From e839a5f61f0faa21ca8b4bd5767f7575d5e576ee Mon Sep 17 00:00:00 2001 From: polwex Date: Wed, 21 May 2025 14:00:28 +0700 Subject: the card flip animation is legit --- src/pages/lesson/[slug].tsx | 66 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 src/pages/lesson/[slug].tsx (limited to 'src/pages/lesson') diff --git a/src/pages/lesson/[slug].tsx b/src/pages/lesson/[slug].tsx new file mode 100644 index 0000000..6632838 --- /dev/null +++ b/src/pages/lesson/[slug].tsx @@ -0,0 +1,66 @@ +import { getHonoContext } from "waku/unstable_hono"; +import { Button } from "@/components/ui/button"; +import { Link } from "waku"; + +import { getContext, getContextData } from "waku/middleware/context"; +import * as WServer from "waku/server"; +import type { PageProps } from "waku/router"; +import db from "@/lib/db"; +import { useCookies } from "@/lib/server/cookiebridge"; +import Deck from "@/components/Flashcard/Deck"; + +const flags: Record = { + th: "🇹🇭", + en: "🇬🇧", + zh: "🇨🇳", + ja: "🇯🇵", + es: "🇪🇸", + fr: "🇫🇷", +}; + +export default async function HomePage(props: PageProps<"/lesson/[slug]">) { + const hctx: any = getHonoContext(); + console.log({ hctx }); + const ctx = getContext(); + console.log(ctx.req.headers, "heders"); + hctx.set("lol", "lmao"); + const cokis = useCookies(); + const coki = cokis.getCookie("sorlang"); + console.log({ coki }); + console.log({ props }); + // const { user } = getContextData() as any; + // console.log({ user }); + const user = { id: 2 }; + const data = await getData(Number(props.slug), user.id); + if ("error" in data) return

Error

; + // console.log({ data }); + + return ( + <> +
+

Thai!

+ +
+ + ); +} + +const getData = async (lesson: number, userId: number) => { + const lessons = db.fetchLesson(userId, lesson); + + return lessons; +}; + +export const getConfig = async () => { + return { + render: "dynamic", + } as const; +}; + +async function LanguageItem({ lang }: { lang: string }) { + return ( +
+
{flags[lang] || ""}
+
+ ); +} -- cgit v1.2.3