From 2401217a4019938d1c1cc61b6e33ccb233eb6e74 Mon Sep 17 00:00:00 2001 From: polwex Date: Tue, 3 Jun 2025 09:34:29 +0700 Subject: this is golden thanks claude --- src/components/prosody/ClientCard.tsx | 64 +++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 src/components/prosody/ClientCard.tsx (limited to 'src/components/prosody/ClientCard.tsx') diff --git a/src/components/prosody/ClientCard.tsx b/src/components/prosody/ClientCard.tsx new file mode 100644 index 0000000..795e3bf --- /dev/null +++ b/src/components/prosody/ClientCard.tsx @@ -0,0 +1,64 @@ +"use client"; +import { getOnsets } from "@/actions/prosody"; +import type { ProsodySyllable, ProsodyWord } from "@/lib/types/cards"; +import { useTransition, useState } from "react"; + +export async function SyllableBreakdown({ syl }: { syl: ProsodySyllable }) { + const [isPending, startTransition] = useTransition(); + const [data, setData] = useState([]); + function showOnset(e: React.MouseEvent) { + e.stopPropagation(); + console.log(syl); + startTransition(async () => { + const data = await getOnsets(syl.onset); + setData(data); + }); + } + console.log({ isPending }); + return ( +
+
whole: {syl.ipa}
+
+ onset: {syl.onset} +
+
+ nucleus: {syl.nucleus} +
+
+ coda: {syl.coda} +
+
+ tone: {syl.tone} +
+
+ tonename: {syl.tonen} +
+ {data.length > 0 && ( +
+ {data.map((d) => ( +
+
{d.spelling}
+
+ ))} +
+ )} +
+ ); +} + +// Component for displaying examples -- cgit v1.2.3