From cb1b56f5a0eddbf77446f415f2beda57c8305f85 Mon Sep 17 00:00:00 2001 From: polwex Date: Sun, 23 Nov 2025 01:12:53 +0700 Subject: wut --- packages/prosody-ui/src/zoom/Paragraph.tsx | 60 ++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 packages/prosody-ui/src/zoom/Paragraph.tsx (limited to 'packages/prosody-ui/src/zoom/Paragraph.tsx') diff --git a/packages/prosody-ui/src/zoom/Paragraph.tsx b/packages/prosody-ui/src/zoom/Paragraph.tsx new file mode 100644 index 0000000..c26f806 --- /dev/null +++ b/packages/prosody-ui/src/zoom/Paragraph.tsx @@ -0,0 +1,60 @@ +import React, { memo, useCallback, useEffect, useState } from "react"; +import { motion } from "motion/react"; +import type { ViewProps, LoadingStatus } from "./logic/types"; +import { NLP } from "sortug-ai"; +import Sentence from "./Sentence"; +import { paragraphVariants, createHoverEffect } from "./animations"; +import { useZoom } from "./hooks/useZoom"; + +function Paragraph({ rawText, context, idx, doc }: ViewProps) { + const { viewState, handleElementClick } = useZoom(); + const { level, pIndex } = viewState; + const selected = pIndex === idx; + const isFocused = level === "paragraph" && selected; + + // State for sentences + const [loading, setLoading] = useState("pending"); + + return ( + <> + handleElementClick(e, idx)} + whileHover={ + level === "text" + ? createHoverEffect(level, "text", "255, 255, 200") + : {} + } + > + {loading === "loading" &&
} + {level === "text" || !selected || doc.segs.length === 0 ? ( +

{rawText}

+ ) : ( +
+ {doc.segs.map((sentence, sentIdx) => ( + s.text), + }} + doc={doc} + /> + ))} +
+ )} + + + ); +} + +export default memo(Paragraph); -- cgit v1.2.3