/ types / navigation.ts
navigation.ts
 1  // Contains all navigation-related types
 2  
 3  export type NavigationContextType =
 4    | 'browse'
 5    | 'reading'
 6    | 'settings'
 7    | 'search';
 8  
 9  export interface NavigationEntry {
10    path: string;
11    title: string;
12    timestamp: number;
13    context: NavigationContextType;
14    metadata: {
15      mangaId?: string;
16      chapterNumber?: number;
17      searchQuery?: string;
18      scrollPosition?: number;
19      pageTitle?: string;
20      previousPath?: string;
21    };
22  }
23  
24  export interface NavigationContext {
25    id: string;
26    type: NavigationContextType;
27    stack: NavigationEntry[];
28    metadata: {
29      lastAccessed: number;
30      sessionId: string;
31      totalVisits: number;
32      averageTimeSpent: number;
33    };
34  }
35  
36  export interface NavigationHistory {
37    contexts: Record<string, NavigationContext>;
38    globalStack: NavigationEntry[];
39    currentContext: string;
40    settings: NavigationSettings;
41    lastUpdated: number;
42    version: number;
43  }
44  
45  export interface NavigationSettings {
46    maxHistorySize: number;
47    enableGestures: boolean;
48    swipeSensitivity: number;
49    showBreadcrumbs: boolean;
50    enableSmartSuggestions: boolean;
51    contextSeparation: boolean;
52  }
53  
54  export interface NavigationGestureConfig {
55    enabled: boolean;
56    sensitivity: number;
57    edgeThreshold: number;
58    velocityThreshold: number;
59    distanceThreshold: number;
60  }
61  
62  export interface NavigationAnalytics {
63    totalNavigations: number;
64    averageSessionLength: number;
65    mostVisitedPaths: Record<string, number>;
66    navigationPatterns: string[];
67    gestureUsageStats: {
68      swipeBack: number;
69      tapBack: number;
70      breadcrumbUsage: number;
71    };
72  }
73  
74  export interface BreadcrumbItem {
75    path: string;
76    title: string;
77    icon?: string;
78    isClickable: boolean;
79  }
80  
81  export interface NavigationState {
82    canGoBack: boolean;
83    canGoForward: boolean;
84    currentDepth: number;
85    contextHistory: NavigationEntry[];
86    breadcrumbs: BreadcrumbItem[];
87    suggestions: string[];
88  }
89  
90  // Legacy interface for backward compatibility
91  export interface LegacyNavigationHistory {
92    paths: string[];
93    lastUpdated: number;
94  }