From a3f24ea79b14394b24c4b60a010651eb29eeb872 Mon Sep 17 00:00:00 2001
From: polwex
Date: Thu, 29 May 2025 12:10:22 +0700
Subject: glorious new db
---
src/components/Flashcard/ServerCard.tsx | 43 ++++++++++++++++++++++++---------
1 file changed, 31 insertions(+), 12 deletions(-)
(limited to 'src/components/Flashcard/ServerCard.tsx')
diff --git a/src/components/Flashcard/ServerCard.tsx b/src/components/Flashcard/ServerCard.tsx
index d377dce..df37ba8 100644
--- a/src/components/Flashcard/ServerCard.tsx
+++ b/src/components/Flashcard/ServerCard.tsx
@@ -23,13 +23,21 @@ import {
WordData,
} from "@/zoom/logic/types";
import { CardResponse } from "@/lib/types/cards";
-import { thaiData } from "@/pages/api/nlp";
+import { thaiData } from "@/lib/calls/nlp";
import { getRandomHexColor } from "@/lib/utils";
import { BookmarkIconito } from "./BookmarkButton";
+import SyllableSpan from "./SyllableSpan";
+import SyllableCard from "./Syllable";
-export async function CardFront({ data }: { data: CardResponse }) {
+export async function CardFront({
+ data,
+ needFetch = true,
+}: {
+ data: CardResponse;
+ needFetch?: boolean;
+}) {
// const extraData = data.expression.lang
- const extraData = await thaiData(data.expression.spelling);
+ const extraData = needFetch ? await thaiData(data.expression.spelling) : [];
// console.log({ extraData });
return (
@@ -42,15 +50,26 @@ export async function CardFront({ data }: { data: CardResponse }) {
}
>
- {extraData[0]?.syllables.map((syl, i) => (
-
- {syl}
-
- ))}
+ {needFetch ? (
+ extraData[0]?.syllables.map((syl, i) => (
+ //
+ // {syl}
+ //
+
+ ))
+ ) : (
+
+ {data.expression.spelling}
+
+ )}
--
cgit v1.2.3