import React, { useCallback, useEffect, useState } from "react"; import spinner from "../assets/icons/spinner.svg"; import likeIcon from "../assets/icons/heart.svg"; import commentsIcon from "../assets/icons/quote.svg"; import shareIcon from "../assets/icons/share.svg"; import fontIcon from "../assets/icons/font.svg"; import bookmarkIcon from "../assets/icons/bookmark.svg"; import type { AnalyzeRes, ColorTheme, Meaning } from "@/logic/types"; import { P, Span, useSpeechSynthesis } from "@/hooks/useLang.tsx"; import type { FullWordData, Syllable, Tone } from "@sortug/langlib"; import { cycleNext } from "@sortug/lib"; import FontChanger from "../fonts/FontChanger.tsx"; import { assignColors } from "../Colors.tsx"; import { IconBadgeFilled, IconSpeakerphone } from "@tabler/icons-react"; function Phonetic({ data, lang, theme, }: { data: FullWordData; lang: string; theme: ColorTheme; }) { async function load() { // const wiki = await fetchWiki(data.word); // console.log(wiki, "wiki res"); // if ("ok" in wiki) setM(wiki.ok.meanings); // else setError(wiki.error); // setLoading(false); } useEffect(() => { load(); }, []); const [loading, setLoading] = useState(false); const { voices, speaking, speak, stop } = useSpeechSynthesis(); function playAudio() { setLoading(true); console.log({ voices, speaking }); console.log("word", data); speak(data.spelling); setLoading(false); } console.log({ data }); async function saveW() {} return (
{data.phonetic.ipa}
{loading ? (