From 9192e6c7747fd2d3f6a6c5c07d886a0982b53f11 Mon Sep 17 00:00:00 2001
From: polwex <polwex@sortug.com>
Date: Wed, 21 May 2025 15:28:03 +0700
Subject: good tandem good tandem of ideas and implementation

---
 src/components/Flashcard/Card.tsx | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

(limited to 'src/components/Flashcard/Card.tsx')

diff --git a/src/components/Flashcard/Card.tsx b/src/components/Flashcard/Card.tsx
index 7cada24..9eccdb5 100644
--- a/src/components/Flashcard/Card.tsx
+++ b/src/components/Flashcard/Card.tsx
@@ -1,6 +1,9 @@
 "use client";
 
+import { thaiAnalysis } from "@/actions/lang";
 import { CardResponse } from "@/lib/types/cards";
+import { useTransition } from "react";
+import { Spinner } from "../ui/spinner";
 
 // export default function ({ user }: { user: { name: string; id: number } }) {
 //   const [state, formAction, isPending] = useActionState(postLogout, 0);
@@ -58,6 +61,13 @@ const Flashcard: React.FC<FlashcardProps> = ({
     }
   };
 
+  const [isPending, startTransition] = useTransition();
+  const handleClick = () => {
+    startTransition(async () => {
+      const res = await thaiAnalysis(data.expression.spelling);
+    });
+  };
+
   return (
     <div
       className={`w-full max-w-md h-80 perspective group ${getAnimationClass()}`}
@@ -77,9 +87,13 @@ const Flashcard: React.FC<FlashcardProps> = ({
               </span>
             ))}
           </span>
-          <p className="text-3xl md:text-4xl font-semibold text-slate-800 dark:text-slate-100 text-center">
+          <p
+            onClick={handleClick}
+            className="text-3xl cursor-pointer hover:text-blue-700 md:text-4xl font-semibold text-slate-800 dark:text-slate-100 text-center"
+          >
             {data.expression.spelling}
           </p>
+          {isPending && <Spinner />}
           <div className="w-full h-6">
             {" "}
             {/* Placeholder for spacing, mimics bottom controls */}
-- 
cgit v1.2.3

