import Link from "next/link";
import type { LexicalEntry } from "@/lib/types";
import { entriesBySynset, senseById, synsetById } from "@/lib/lexicon";
import { REL_LABEL } from "@/lib/format";
import { WordLink } from "@/components/WordLink";
import { IdChip, LangBadge, PosBadge } from "./ui";
/**
* Dictionary entry card (SRS §8.1.2). When `showIds` is false (Visitor
* tier) internal IDs and ILI codes are hidden and relations are shown
* by target word form only.
*/
export function EntryCard({
entry,
showIds,
compact = false,
detailPage = false,
}: {
entry: LexicalEntry;
showIds: boolean;
compact?: boolean;
/** True on `/word/[id]` — hides the redundant self-link control. */
detailPage?: boolean;
}) {
const firstSynset = entry.senses[0]
? synsetById.get(entry.senses[0].synset)
: undefined;
const previewDefinition = firstSynset?.definition?.text;
const cardClassName =
"rounded-2xl border border-slate-200 bg-white p-5 shadow-sm transition hover:shadow-md";
const header = (
{entry.lemma}
) : (
No definition recorded for this concept yet.
)} {synonyms.length > 0 ? (
Synonyms:{" "}
{synonyms.slice(0, 8).map((s, i) => (
{i > 0 ? ", " : ""}
Sense relations
Synset relations
{previewDefinition}
) : (No definition recorded — open for full entry.
)}