diff options
author | polwex <polwex@sortug.com> | 2025-06-03 09:34:29 +0700 |
---|---|---|
committer | polwex <polwex@sortug.com> | 2025-06-03 09:34:29 +0700 |
commit | 2401217a4019938d1c1cc61b6e33ccb233eb6e74 (patch) | |
tree | 06118284965be5cfd6b417dca86d46db5758217b /src/components/prosody/ClientCard.tsx | |
parent | 2b80f7950df34f2a160135d7e20220a9b2ec3352 (diff) |
this is golden thanks claude
Diffstat (limited to 'src/components/prosody/ClientCard.tsx')
-rw-r--r-- | src/components/prosody/ClientCard.tsx | 64 |
1 files changed, 64 insertions, 0 deletions
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<any[]>([]); + function showOnset(e: React.MouseEvent) { + e.stopPropagation(); + console.log(syl); + startTransition(async () => { + const data = await getOnsets(syl.onset); + setData(data); + }); + } + console.log({ isPending }); + return ( + <div> + <div>whole: {syl.ipa}</div> + <div + onClick={showOnset} + className="text-blue-500 hover:text-blue-700 hover:underline" + > + onset: {syl.onset} + </div> + <div + onClick={showOnset} + className="text-blue-500 hover:text-blue-700 hover:underline" + > + nucleus: {syl.nucleus} + </div> + <div + onClick={showOnset} + className="text-blue-500 hover:text-blue-700 hover:underline" + > + coda: {syl.coda} + </div> + <div + onClick={showOnset} + className="text-blue-500 hover:text-blue-700 hover:underline" + > + tone: {syl.tone} + </div> + <div + onClick={showOnset} + className="text-blue-500 hover:text-blue-700 hover:underline" + > + tonename: {syl.tonen} + </div> + {data.length > 0 && ( + <div> + {data.map((d) => ( + <div key={d.id}> + <div>{d.spelling}</div> + </div> + ))} + </div> + )} + </div> + ); +} + +// Component for displaying examples |