File size: 964 Bytes
f5d25f5 836dd88 f5d25f5 f43196f 836dd88 f5d25f5 f43196f 836dd88 f5d25f5 836dd88 f5d25f5 836dd88 f5d25f5 836dd88 f43196f 836dd88 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
'use client'
import { TitleBar } from "@/components/title-bar/TitleBar";
import { useTextStore } from "./TextStore";
import { SentimentList } from "./SentimentList";
import { Fallback } from "@/components/fallback/Fallback";
import Link from "next/link";
import { classify } from "@/util/classify";
import { useQuery } from "@tanstack/react-query";
export function SentimentWidget() {
const { text } = useTextStore();
const { isPending, data: out } = useQuery({
queryKey: ['text', text],
queryFn: () =>
classify(text),
})
return (
<section className="w-full max-w-2xl h-full flex flex-col">
<TitleBar label="Sentiment">
<Link
href="https://github.com/samyosm/analyzo#how"
className="border-dotted hover:underline"
title="This widget uses an AI"
>
How?
</Link>
</TitleBar>
{isPending ? <Fallback /> : <SentimentList out={out} />}
</section>
)
}
|