summaryrefslogtreecommitdiff
path: root/src/pages/study/thai.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/pages/study/thai.tsx')
-rw-r--r--src/pages/study/thai.tsx53
1 files changed, 53 insertions, 0 deletions
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: <CardFront data={data} />,
+ back: <CardBack data={data} />,
+ };
+ });
+
+ return (
+ <div className="container mx-auto py-8">
+ <Deck
+ data={{ lesson: { name: "hey", description: "hoy" } }}
+ cards={cardComponents}
+ />
+ </div>
+ );
+}
+
+const getData = async () => {
+ const res = pdb.fetchFrequent("th");
+ return res;
+};
+
+export const getConfig = async () => {
+ return {
+ render: "dynamic",
+ } as const;
+};