30 lines
1.2 KiB
TypeScript
30 lines
1.2 KiB
TypeScript
/** همهی صفحههای اپ و پارامترهایشان. */
|
|
export type Route =
|
|
| { name: 'home' }
|
|
| { name: 'lessons' }
|
|
| { name: 'ask'; lessonId?: number; questionId?: string; prompt?: string }
|
|
| { name: 'subscription' }
|
|
| { name: 'profile' }
|
|
| { name: 'unit'; unitId: string }
|
|
| { name: 'lesson'; lessonId: number; nodeId?: string }
|
|
/** بدونِ lessonId یعنی آزمونِ کلِ جزیره (nodeId لازم است). */
|
|
| { name: 'quiz'; lessonId?: number; nodeId?: string }
|
|
| { name: 'notifications' }
|
|
| { name: 'leaderboard' }
|
|
| { name: 'characters' }
|
|
| { name: 'streak' }
|
|
| { name: 'support' }
|
|
/** «گزارشِ والدین»: والد پیشرفتِ هفته را در حسابِ خودِ دانشآموز میبیند. */
|
|
| { name: 'report' }
|
|
/** پرداختها و فاکتورهای خودِ کاربر. */
|
|
| { name: 'invoices' }
|
|
| { name: 'invite' };
|
|
|
|
export type TabName = 'home' | 'lessons' | 'ask' | 'subscription' | 'profile';
|
|
|
|
export const TABS: TabName[] = ['home', 'lessons', 'ask', 'subscription', 'profile'];
|
|
|
|
export function isTab(name: Route['name']): name is TabName {
|
|
return (TABS as string[]).includes(name);
|
|
}
|