Build fixes
This commit is contained in:
parent
43d34fb2f7
commit
9374d3efbe
2 changed files with 82 additions and 82 deletions
|
|
@ -4,7 +4,7 @@ import dynamic from 'next/dynamic';
|
|||
import { usePDF } from '@/contexts/PDFContext';
|
||||
import { useParams } from 'next/navigation';
|
||||
import Link from 'next/link';
|
||||
import { use, useCallback, useEffect, useState } from 'react';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { PDFSkeleton } from '@/components/PDFSkeleton';
|
||||
import { useTTS } from '@/contexts/TTSContext';
|
||||
|
||||
|
|
|
|||
|
|
@ -148,10 +148,10 @@ export function PDFProvider({ children }: { children: ReactNode }) {
|
|||
}
|
||||
}, []);
|
||||
|
||||
function onDocumentLoadSuccess({ numPages }: { numPages: number }): void {
|
||||
const onDocumentLoadSuccess = useCallback(({ numPages }: { numPages: number }) => {
|
||||
console.log('Document loaded:', numPages);
|
||||
setCurrDocPages(numPages);
|
||||
}
|
||||
}, []);
|
||||
|
||||
// Extract text from a PDF file
|
||||
const extractTextFromPDF = useCallback(async (pdfURL: string, currDocPage: number): Promise<string> => {
|
||||
|
|
@ -267,18 +267,18 @@ export function PDFProvider({ children }: { children: ReactNode }) {
|
|||
console.error('Failed to get document URL:', error);
|
||||
setError('Failed to retrieve the document. Please try again.');
|
||||
}
|
||||
}, [getDocument, loadCurrDocText]);
|
||||
}, [getDocument]);
|
||||
|
||||
const clearCurrDoc = useCallback(() => {
|
||||
setCurrDocName(undefined);
|
||||
setCurrDocURL(undefined);
|
||||
setCurrDocText(undefined);
|
||||
setCurrDocPages(undefined);
|
||||
|
||||
// Clear TTS text
|
||||
setCurrDocPages(undefined); // Goes to TTS context
|
||||
setTTSText('');
|
||||
|
||||
}, []);
|
||||
}, [setCurrDocPages, setTTSText]);
|
||||
|
||||
// Clear all highlights in the PDF viewer
|
||||
const clearHighlights = useCallback(() => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue