analytica-frontend-lib
Version:
Repositório público dos componentes utilizados nas plataformas da Analytica Ensino
63 lines • 2.32 kB
TypeScript
import { RefObject } from 'react';
import type { BaseApiClient } from '../../../types/api';
import type { Lesson, LessonsPagination } from '../../../types/lessons';
import type { WhiteboardImage } from '../../../Whiteboard/index';
export interface LessonFilters {
subjectId?: string[];
topicIds?: string[];
subtopicIds?: string[];
contentIds?: string[];
selectedIds?: string[];
}
interface UseLessonBankConfig {
apiClient: BaseApiClient;
filters?: LessonFilters;
addedLessonIds?: string[];
onAddLesson?: (lesson: Lesson) => void;
isFromTrailRoute?: boolean;
lessonId?: string;
getInitialTimestamp?: (lessonId: string) => number;
onVideoTimeUpdate?: (lessonId: string, time: number) => void;
onVideoComplete?: (lessonId: string) => void;
onPodcastEnded?: (lessonId: string) => void | Promise<void>;
}
interface UseLessonBankReturn {
lessons: Lesson[];
pagination: LessonsPagination | null;
loading: boolean;
loadingMore: boolean;
error: string | null;
selectedLesson: Lesson | null;
isWatchModalOpen: boolean;
filteredLessons: Lesson[];
totalLessons: number;
observerTarget: RefObject<HTMLDivElement | null>;
firstBoardImageRef: RefObject<HTMLDivElement | null>;
lastBoardImageRef: RefObject<HTMLDivElement | null>;
handleWatch: (lesson: Lesson) => void;
handleAddToLesson: (lesson: Lesson) => void;
handleAddToLessonFromModal: () => void;
handleCloseModal: () => void;
getVideoData: (lesson: Lesson | null) => {
src: string;
poster?: string;
subtitles?: string;
};
getPodcastData: (lesson: Lesson | null) => {
src: string;
title: string;
};
getBoardImages: (lesson: Lesson | null) => WhiteboardImage[];
getBoardImageRef: (index: number, total: number) => RefObject<HTMLDivElement | null> | null;
getInitialTimestampValue: (id: string) => number;
handleVideoTimeUpdate: (seconds: number) => void;
handleVideoCompleteCallback: () => void;
handlePodcastEnded: () => Promise<void>;
uniqueLesson: () => string;
}
/**
* Hook for managing lesson bank state and operations
*/
export declare const useLessonBank: (config: UseLessonBankConfig) => UseLessonBankReturn;
export {};
//# sourceMappingURL=useLessonBank.d.ts.map