Download apps/readest-app/src/app/reader/components/paragraph/ParagraphControl.tsx from echodict/readest: direct link, hf CLI and curl.
- Browser
- Download file 1.51 kB
-
https://huggingface.co/datasets/echodict/readest/resolve/main/apps/readest-app/src/app/reader/components/paragraph/ParagraphControl.tsx
- Command line
-
hf download hf://datasets/echodict/readest/apps/readest-app/src/app/reader/components/paragraph/ParagraphControl.tsx
-
curl -L -o ParagraphControl.tsx https://huggingface.co/datasets/echodict/readest/resolve/main/apps/readest-app/src/app/reader/components/paragraph/ParagraphControl.tsx
1.51 kB
| 'use client'; | |
| import React from 'react'; | |
| import { FoliateView } from '@/types/view'; | |
| import { Insets } from '@/types/misc'; | |
| import { useReaderStore } from '@/store/readerStore'; | |
| import { useParagraphMode } from '../../hooks/useParagraphMode'; | |
| import ParagraphBar from './ParagraphBar'; | |
| import ParagraphOverlay from './ParagraphOverlay'; | |
| const DIM_OPACITY = 0.3; | |
| interface ParagraphControlProps { | |
| bookKey: string; | |
| viewRef: React.RefObject<FoliateView | null>; | |
| gridInsets: Insets; | |
| } | |
| const ParagraphControl: React.FC<ParagraphControlProps> = ({ bookKey, viewRef, gridInsets }) => { | |
| const { getViewSettings } = useReaderStore(); | |
| const viewSettings = getViewSettings(bookKey); | |
| const { | |
| paragraphState, | |
| paragraphConfig, | |
| toggleParagraphMode, | |
| goToNextParagraph, | |
| goToPrevParagraph, | |
| } = useParagraphMode({ bookKey, viewRef }); | |
| if (!paragraphConfig?.enabled) { | |
| return null; | |
| } | |
| return ( | |
| <> | |
| <ParagraphOverlay | |
| bookKey={bookKey} | |
| dimOpacity={DIM_OPACITY} | |
| viewSettings={viewSettings ?? undefined} | |
| onClose={toggleParagraphMode} | |
| /> | |
| <ParagraphBar | |
| bookKey={bookKey} | |
| currentIndex={paragraphState.currentIndex} | |
| totalParagraphs={paragraphState.totalParagraphs} | |
| isLoading={paragraphState.isLoading} | |
| onPrev={goToPrevParagraph} | |
| onNext={goToNextParagraph} | |
| onClose={toggleParagraphMode} | |
| gridInsets={gridInsets} | |
| /> | |
| </> | |
| ); | |
| }; | |
| export default ParagraphControl; | |