fix(types): resolve TypeScript linting errors for build
Fixed all TypeScript errors preventing build: - Added TTSAudiobookChapter type import to HTMLContext - Replaced 'any' types with proper TTSAudiobookChapter type - Removed unused goToChapter from HTMLViewer destructuring - Updated AudiobookExportModal to accept 'html' documentType - Fixed HTMLContext return types to match EPUB/PDF contexts - createFullAudioBook now returns Promise<string> (bookId only) - regenerateChapter now returns Promise<TTSAudiobookChapter> - Prefixed/removed unused parameters in placeholder functions Build now completes successfully with only minor warnings in placeholder code that will be implemented later.
This commit is contained in:
parent
757fa5811b
commit
b13bf96b3b
6 changed files with 22 additions and 15 deletions
|
|
@ -132,7 +132,7 @@ async function processJobInBackground(jobId: string) {
|
|||
job.currentStep = 'Loading document...';
|
||||
jobs.set(jobId, job);
|
||||
|
||||
const { documentId, voice, speed, ttsProvider, ttsModel, ttsInstructions, format } = job.data;
|
||||
const { documentId, voice, speed, ttsProvider, ttsModel, format } = job.data;
|
||||
|
||||
// In a real implementation, this would:
|
||||
// 1. Load the document from IndexedDB or file system
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import {
|
|||
interface AudiobookExportModalProps {
|
||||
isOpen: boolean;
|
||||
setIsOpen: (isOpen: boolean) => void;
|
||||
documentType: 'epub' | 'pdf';
|
||||
documentType: 'epub' | 'pdf' | 'html';
|
||||
documentId: string;
|
||||
onGenerateAudiobook: (
|
||||
onProgress: (progress: number) => void,
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ export function HTMLViewer({ className = '' }: HTMLViewerProps) {
|
|||
totalChapters,
|
||||
goToNextChapter,
|
||||
goToPreviousChapter,
|
||||
goToChapter,
|
||||
} = useHTML();
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import {
|
|||
import { getHtmlDocument } from '@/lib/dexie';
|
||||
import { useTTS } from '@/contexts/TTSContext';
|
||||
import { detectChapters, type Chapter } from '@/lib/chapterDetection';
|
||||
import type { TTSAudiobookChapter } from '@/types/tts';
|
||||
|
||||
interface HTMLContextType {
|
||||
currDocData: string | undefined;
|
||||
|
|
@ -31,16 +32,16 @@ interface HTMLContextType {
|
|||
createFullAudioBook: (
|
||||
onProgress: (progress: number) => void,
|
||||
signal: AbortSignal,
|
||||
onChapterComplete: (chapter: any) => void,
|
||||
onChapterComplete: (chapter: TTSAudiobookChapter) => void,
|
||||
documentId: string,
|
||||
format: 'mp3' | 'm4b'
|
||||
) => Promise<{ bookId: string; format: string }>;
|
||||
) => Promise<string>;
|
||||
regenerateChapter: (
|
||||
chapterIndex: number,
|
||||
bookId: string,
|
||||
format: 'mp3' | 'm4b',
|
||||
signal: AbortSignal
|
||||
) => Promise<void>;
|
||||
) => Promise<TTSAudiobookChapter>;
|
||||
}
|
||||
|
||||
const HTMLContext = createContext<HTMLContextType | undefined>(undefined);
|
||||
|
|
@ -123,10 +124,10 @@ export function HTMLProvider({ children }: { children: ReactNode }) {
|
|||
*/
|
||||
const createFullAudioBook = useCallback(async (
|
||||
onProgress: (progress: number) => void,
|
||||
signal: AbortSignal,
|
||||
onChapterComplete: (chapter: any) => void,
|
||||
_signal: AbortSignal,
|
||||
_onChapterComplete: (chapter: TTSAudiobookChapter) => void,
|
||||
documentId: string,
|
||||
format: 'mp3' | 'm4b'
|
||||
_format: 'mp3' | 'm4b'
|
||||
) => {
|
||||
// Placeholder - will be implemented with job queue system
|
||||
console.log('createFullAudioBook called for HTML document:', documentId);
|
||||
|
|
@ -134,7 +135,7 @@ export function HTMLProvider({ children }: { children: ReactNode }) {
|
|||
|
||||
// TODO: Integrate with background job queue
|
||||
// For now, return a placeholder
|
||||
return { bookId: 'placeholder', format };
|
||||
return 'placeholder';
|
||||
}, []);
|
||||
|
||||
/**
|
||||
|
|
@ -145,10 +146,17 @@ export function HTMLProvider({ children }: { children: ReactNode }) {
|
|||
chapterIndex: number,
|
||||
bookId: string,
|
||||
format: 'mp3' | 'm4b',
|
||||
signal: AbortSignal
|
||||
) => {
|
||||
_signal: AbortSignal
|
||||
): Promise<TTSAudiobookChapter> => {
|
||||
// Placeholder
|
||||
console.log('regenerateChapter called:', chapterIndex, bookId, format);
|
||||
return {
|
||||
index: chapterIndex,
|
||||
title: `Chapter ${chapterIndex + 1}`,
|
||||
status: 'completed',
|
||||
bookId,
|
||||
format,
|
||||
};
|
||||
}, []);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ function splitBySize(text: string, maxChunkSize: number): Chapter[] {
|
|||
let currentChunk = '';
|
||||
let chunkIndex = 0;
|
||||
|
||||
paragraphs.forEach((paragraph, index) => {
|
||||
paragraphs.forEach((paragraph) => {
|
||||
const potentialChunk = currentChunk + (currentChunk ? '\n\n' : '') + paragraph;
|
||||
|
||||
if (potentialChunk.length > maxChunkSize && currentChunk.length > 0) {
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ export async function processAudiobookJob(
|
|||
* Fetch document content from storage
|
||||
* This would integrate with your document storage system
|
||||
*/
|
||||
async function fetchDocumentContent(documentId: string, signal: AbortSignal): Promise<string> {
|
||||
async function fetchDocumentContent(_documentId: string, _signal: AbortSignal): Promise<string> {
|
||||
// In a real implementation, this would:
|
||||
// 1. Query the document from IndexedDB or file system
|
||||
// 2. Extract text content based on document type (PDF, EPUB, HTML)
|
||||
|
|
@ -115,7 +115,7 @@ async function fetchDocumentContent(documentId: string, signal: AbortSignal): Pr
|
|||
* Process text into sentences
|
||||
* Uses the existing NLP sentence splitting logic
|
||||
*/
|
||||
async function processTextToSentences(text: string, signal: AbortSignal): Promise<string[]> {
|
||||
async function processTextToSentences(text: string, _signal: AbortSignal): Promise<string[]> {
|
||||
// This would use the same logic as the TTS context
|
||||
// For now, simple split on sentence boundaries
|
||||
const sentences = text
|
||||
|
|
|
|||
Loading…
Reference in a new issue