All files / src/features/dashboard/components/shared dashboard-types.tsx

100% Statements 3/3
100% Branches 0/0
100% Functions 1/1
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51      5x   23x                   5x                                                                      
import type { MenuItemConfig } from '@/components/action-menu';
 
// Create default action items as a function to allow dynamic handlers
export const createDefaultActionItems = (
  onDelete?: () => void
): MenuItemConfig[] => [
  { label: 'View' },
  {
    label: 'Delete',
    variant: 'destructive',
    onClick: onDelete,
  },
];
 
// Backward compatibility - keep the original export for components that don't need delete functionality
export const DEFAULT_ACTION_ITEMS: MenuItemConfig[] = [
  { label: 'View' },
  { label: 'Delete', variant: 'destructive' },
];
 
// Type for managing hidden cards
export interface HiddenCardsState {
  summaryCards: Set<number>;
  conversionCard: boolean;
  statisticCard: boolean;
  transactionCard: boolean;
  walletCard: boolean;
}
 
// Common interface for components with async data loading
export interface AsyncDataState<T> {
  data: T;
  loading: boolean;
  error: string | null;
  refetch: () => void | Promise<void>;
}
 
// Common props for dashboard components
export interface DashboardComponentProps {
  actionItems?: MenuItemConfig[];
  className?: string;
}
 
// Hook return type pattern used across dashboard hooks
export interface DashboardHookReturn<T> {
  data: T;
  loading: boolean;
  error: string | null;
  refetch: () => Promise<void>;
}