analytica-frontend-lib
Version:
Repositório público dos componentes utilizados nas plataformas da Analytica Ensino
96 lines • 5.78 kB
TypeScript
import { SubjectEnum } from '../../enums/SubjectEnum';
import type { FilterConfig } from '../Filter/index';
import { type RecommendedClassTableItem, type RecommendedClassHistoryFilters, type RecommendedClassHistoryApiResponse, type RecommendedClassUserFilterData, type RecommendedClassModelFilters, type RecommendedClassModelsApiResponse, type RecommendedClassModelTableItem, type RecommendedClassData, type UpdateRecommendedClassData } from '../../types/recommendedLessons';
/**
* Enum for page tabs - exported for external routing control
*/
export declare enum RecommendedClassPageTab {
HISTORY = "history",
DRAFTS = "drafts",
MODELS = "models"
}
/**
* Props for the RecommendedLessonsHistory component
*/
export interface RecommendedLessonsHistoryProps {
/** Function to fetch recommendedClass history from API. Must return RecommendedClassHistoryApiResponse. */
fetchRecommendedClassHistory: (filters?: RecommendedClassHistoryFilters) => Promise<RecommendedClassHistoryApiResponse>;
/** Callback when create lesson button is clicked */
onCreateLesson: () => void;
/** Callback when a row is clicked */
onRowClick: (row: RecommendedClassTableItem) => void;
/** Delete a recommended class (history item). Enables the row delete action. */
deleteRecommendedClass?: (id: string) => Promise<void>;
/** Update a recommended class title/dates. Enables the row edit action (with fetchRecommendedClassById). */
updateRecommendedClass?: (id: string, data: UpdateRecommendedClassData) => Promise<void>;
/** Load a single recommended class to pre-fill the edit modal. */
fetchRecommendedClassById?: (id: string) => Promise<RecommendedClassData>;
/** Image for empty state */
emptyStateImage?: string;
/** Image for no search results */
noSearchImage?: string;
/** Function to map subject name to SubjectEnum */
mapSubjectNameToEnum?: (subjectName: string) => SubjectEnum | null;
/** User data for populating filter options */
userFilterData?: RecommendedClassUserFilterData;
/** Page title */
title?: string;
/** Create button text */
createButtonText?: string;
/** Search placeholder */
searchPlaceholder?: string;
/** Function to fetch recommendedClass models from API (optional - for Models tab) */
fetchRecommendedClassModels?: (filters?: RecommendedClassModelFilters) => Promise<RecommendedClassModelsApiResponse>;
/** Function to delete a recommendedClass model (optional - for Models tab) */
deleteRecommendedClassModel?: (id: string) => Promise<void>;
/** Callback when create model button is clicked (optional - for Models tab) */
onCreateModel?: () => void;
/** Callback when send lesson button is clicked on a model (optional - for Models tab) */
onSendLesson?: (model: RecommendedClassModelTableItem) => void;
/** Callback when edit model button is clicked (optional - for Models tab) */
onEditModel?: (model: RecommendedClassModelTableItem) => void;
/**
* Map of subject IDs to names for models display.
* IMPORTANT: This Map should be memoized with useMemo in the parent component
* to avoid unnecessary re-fetches.
*/
subjectsMap?: Map<string, string>;
/** Function to fetch recommendedClass drafts from API (optional - for Drafts tab) */
fetchRecommendedClassDrafts?: (filters?: RecommendedClassModelFilters) => Promise<RecommendedClassModelsApiResponse>;
/** Function to delete a recommendedClass draft (optional - for Drafts tab) */
deleteRecommendedClassDraft?: (id: string) => Promise<void>;
/** Callback when send draft button is clicked (optional - for Drafts tab) */
onSendDraft?: (draft: RecommendedClassModelTableItem) => void;
/** Callback when edit draft button is clicked (optional - for Drafts tab) */
onEditDraft?: (draft: RecommendedClassModelTableItem) => void;
/**
* Default tab to display. When provided with onTabChange, enables controlled mode
* for URL routing.
*/
defaultTab?: RecommendedClassPageTab;
/**
* Callback when tab changes. When provided, enables controlled mode for URL routing.
* Use this to navigate to different routes when tabs change.
*/
onTabChange?: (tab: RecommendedClassPageTab) => void;
/**
* Extra filter categories to inject (e.g., creatorType for gestors).
* Merged with default filters when provided.
*/
extraFilterCategories?: FilterConfig[];
/**
* Id of the current user. When provided, the edit/delete actions are shown
* only for rows the current user created (i.e. rows whose `creatorId`
* matches this id). When undefined, the actions behave as before and are
* shown for every row (subject to the delete/edit capabilities), keeping
* other consumers of this shared component unaffected.
*/
currentUserId?: string;
}
/**
* RecommendedLessonsHistory component
* Displays recommendedClass/recommended lessons history with tabs, filters, and table
*/
export declare const RecommendedLessonsHistory: ({ fetchRecommendedClassHistory, onCreateLesson, onRowClick, deleteRecommendedClass, updateRecommendedClass, fetchRecommendedClassById, emptyStateImage, noSearchImage, mapSubjectNameToEnum, userFilterData, title, createButtonText, searchPlaceholder, fetchRecommendedClassModels, deleteRecommendedClassModel, onCreateModel, onSendLesson, onEditModel, subjectsMap, fetchRecommendedClassDrafts, deleteRecommendedClassDraft, onSendDraft, onEditDraft, defaultTab, onTabChange, extraFilterCategories, currentUserId, }: RecommendedLessonsHistoryProps) => import("react/jsx-runtime").JSX.Element;
export default RecommendedLessonsHistory;
//# sourceMappingURL=RecommendedLessonsHistory.d.ts.map