1import {isMobile} from './platform' 2 3const chatTab = 'tabs.chatTab' 4const cryptoTab = 'tabs.cryptoTab' 5const devicesTab = 'tabs.devicesTab' 6const folderTab = 'tabs.folderTab' 7const loginTab = 'tabs.loginTab' 8const peopleTab = 'tabs.peopleTab' 9const searchTab = 'tabs.searchTab' 10const settingsTab = 'tabs.settingsTab' 11const teamsTab = 'tabs.teamsTab' 12const gitTab = 'tabs.gitTab' 13const fsTab = 'tabs.fsTab' 14const walletsTab = 'tabs.walletsTab' 15 16export type Tab = 17 | typeof chatTab 18 | typeof cryptoTab 19 | typeof devicesTab 20 | typeof folderTab 21 | typeof loginTab 22 | typeof peopleTab 23 | typeof settingsTab 24 | typeof searchTab 25 | typeof teamsTab 26 | typeof gitTab 27 | typeof fsTab 28 | typeof walletsTab 29 30export type AppTab = 31 | typeof peopleTab 32 | typeof chatTab 33 | typeof cryptoTab 34 | typeof fsTab 35 | typeof teamsTab 36 | typeof walletsTab 37 | typeof gitTab 38 | typeof devicesTab 39 | typeof settingsTab 40 41// Canonical ordering for desktop tabs, used visually and for hotkeys 42const desktopTabOrder: Array<AppTab> = [ 43 peopleTab, 44 chatTab, 45 fsTab, 46 cryptoTab, 47 teamsTab, 48 walletsTab, 49 gitTab, 50 devicesTab, 51 settingsTab, 52] 53 54function isValidInitialTab(tab: Tab | null) { 55 return isValidInitialTabString(tab) 56} 57 58function isValidInitialTabString(tab: string | null) { 59 // Keep this in left-to-right (for mobile) or top-to-bottom (for 60 // desktop) order in the app. 61 if (isMobile) { 62 return ([peopleTab, chatTab, teamsTab, settingsTab, fsTab] as Tab[]).includes(tab as Tab) 63 } else { 64 return [peopleTab, chatTab, folderTab, teamsTab, gitTab, devicesTab, settingsTab].includes(tab as Tab) 65 } 66} 67 68export { 69 chatTab, 70 cryptoTab, 71 desktopTabOrder, 72 devicesTab, 73 folderTab, 74 fsTab, 75 gitTab, 76 isValidInitialTab, 77 isValidInitialTabString, 78 loginTab, 79 peopleTab, 80 searchTab, 81 settingsTab, 82 teamsTab, 83 walletsTab, 84} 85