blob: 795e3bfc0227e8cd871da2863e58c6a497b6743c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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
|