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/pages/study/thai.tsx | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/pages/study/thai.tsx (limited to 'src/pages/study') diff --git a/src/pages/study/thai.tsx b/src/pages/study/thai.tsx new file mode 100644 index 0000000..272aecb --- /dev/null +++ b/src/pages/study/thai.tsx @@ -0,0 +1,53 @@ +import { getContextData } from "waku/middleware/context"; +import { getState } from "@/lib/db"; +import { startStudySession } from "@/actions/srs"; +import StudySession from "@/components/Flashcard/StudySession"; +import { Button } from "@/components/ui/button"; +import { Card } from "@/components/ui/card"; +import LessonSelector from "@/components/srs/LessonSelector"; +import type { PageProps } from "waku/router"; +import pdb from "@/lib/db/prosodydb"; +import Deck from "@/components/Flashcard/Deck3"; +import { CardFront, CardBack } from "@/components/Flashcard/ServerCard2"; + +// This is a server component that gets the initial data +export default async function StudyPage(props: PageProps<"/study/[slug]">) { + const lessonId = props.slug; + const ctx = getContextData() as any; + const userId = ctx?.user?.id; + const data = await getData(); + console.log({ data }); + const cardComponents = data.map((card) => { + const syls = JSON.parse(card.syllables); + const syllables = syls.map((s: any) => { + const long = s.long === 1 ? true : s.long === 0 ? false : null; + return { ...s, long }; + }); + const data = { ...card, syllables }; + return { + id: card.id, + front: , + back: , + }; + }); + + return ( +
+ +
+ ); +} + +const getData = async () => { + const res = pdb.fetchFrequent("th"); + return res; +}; + +export const getConfig = async () => { + return { + render: "dynamic", + } as const; +}; -- cgit v1.2.3