From 9192e6c7747fd2d3f6a6c5c07d886a0982b53f11 Mon Sep 17 00:00:00 2001 From: polwex 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 = ({ } }; + const [isPending, startTransition] = useTransition(); + const handleClick = () => { + startTransition(async () => { + const res = await thaiAnalysis(data.expression.spelling); + }); + }; + return (
= ({ ))} -

+

{data.expression.spelling}

+ {isPending && }
{" "} {/* Placeholder for spacing, mimics bottom controls */} -- cgit v1.2.3