analytica-frontend-lib
Version:
Repositório público dos componentes utilizados nas plataformas da Analytica Ensino
64 lines • 2.84 kB
TypeScript
import type { FilterConfig } from '../components/Filter/index';
import type { ActivityModelTableItem, ActivityFilterOption } from '../types/activitiesHistory';
import type { ColumnConfig } from '../TableProvider/index';
import type { ActivityCategory, TypeRoutes } from '../TypeSelector/TypeSelector.types/index';
import { type UserFilterSourceData } from '../utils/filterHelpers';
/**
* Configuration options for the useActivityDraftModelPage hook
*/
export interface UseActivityDraftModelPageOptions {
/** Activity category (ATIVIDADE or PROVA) */
activityCategory: ActivityCategory;
/** Function to fetch data with the given filters */
fetchFn: (params: {
page?: number;
limit?: number;
search?: string;
subjectId?: string;
}) => Promise<void> | void;
/** Function to delete an item by id */
deleteFn: (id: string) => Promise<void> | Promise<boolean>;
/** User data for filter options */
userData: UserFilterSourceData | null;
/** Subject options from API response */
apiSubjectOptions: ActivityFilterOption[];
/** Function to open the send activity modal */
openSendModal: (row: ActivityModelTableItem) => void;
/** URL type segment used in edit/row-click navigation */
editUrlType: 'rascunho' | 'modelo';
/** Label used in error log messages */
errorLogLabel: string;
/** Routes configuration */
routes: TypeRoutes;
}
/**
* Return value of the useActivityDraftModelPage hook
*/
export interface UseActivityDraftModelPageReturn {
isDeleteDialogOpen: boolean;
setIsDeleteDialogOpen: (open: boolean) => void;
itemToDeleteTitle: string;
initialFilterConfigs: FilterConfig[];
tableColumns: ColumnConfig<ActivityModelTableItem>[];
handleSend: (row: ActivityModelTableItem) => void;
handleDelete: (row: ActivityModelTableItem) => void;
handleEdit: (row: ActivityModelTableItem) => void;
handleConfirmDelete: () => Promise<boolean>;
handleParamsChange: (params: {
page?: number;
limit?: number;
search?: string;
subjectId?: string;
}) => void;
handleCreateActivity: () => void;
handleRowClick: (row: ActivityModelTableItem) => void;
}
/**
* Shared hook encapsulating common logic for Activity/Exam Drafts and Models pages.
* Manages delete dialog state, send modal, table columns, filter config,
* and all action/navigation callbacks.
* @param options - Configuration options for the hook
* @returns Shared state and callbacks for the page
*/
export declare const useActivityDraftModelPage: ({ activityCategory, fetchFn, deleteFn, userData, apiSubjectOptions, openSendModal, editUrlType, errorLogLabel, routes, }: UseActivityDraftModelPageOptions) => UseActivityDraftModelPageReturn;
//# sourceMappingURL=useActivityDraftModelPage.d.ts.map