import type { MindNode } from "@mind-map/shared";
export function HoverCard({
node,
x,
y,
}: {
node: MindNode;
x: number;
y: number;
}) {
const tags = (node.tags ?? []).slice(0, 4);
const note = (node.note ?? "").trim();
const links = node.links?.length ?? 0;
return (
{node.text}
{note ?
{note.slice(0, 120)}
: null}
{tags.length ? (
{tags.map((t) => (
{t}
))}
) : null}
{links ? `${links} 链接` : null}
{node.dueAt != null
? `${links ? " · " : ""}截止 ${new Date(node.dueAt).toLocaleDateString()}`
: null}
{node.stylePreset !== "default" ? `${links || node.dueAt ? " · " : ""}${node.stylePreset}` : null}
);
}