-
Notifications
You must be signed in to change notification settings - Fork 585
/
Copy pathroutes.tsx
47 lines (44 loc) · 1.59 KB
/
routes.tsx
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
import {lazy} from 'react'
import {Navigate, RouteObject} from 'react-router-dom'
import {ErrorBoundaryComponentFallback} from '@/components/ui/error-boundary-component-fallback'
import {AppsListing} from '@/features/files/components/listing/apps-listing'
import {DirectoryListing} from '@/features/files/components/listing/directory-listing'
import {RecentsListing} from '@/features/files/components/listing/recents-listing'
import {TrashListing} from '@/features/files/components/listing/trash-listing'
import {BASE_ROUTE_PATH, HOME_PATH} from '@/features/files/constants'
const Files = lazy(() => import('@/features/files'))
export const filesRoutes: RouteObject[] = [
{
path: 'files',
element: <Files />,
ErrorBoundary: ErrorBoundaryComponentFallback,
children: [
// if the user navigates to /files, redirect to /files/<HOME_PATH>
{
index: true,
element: <Navigate to={`${BASE_ROUTE_PATH}${HOME_PATH}`} replace />,
},
// "Recents" and not "Recents/*" because folders aren't tracked in the recents by the server
{
path: 'Recents',
element: <RecentsListing />,
},
{
// "Apps" and not "Apps/*" because we want to allow uploads, new folders, etc. in "Apps/<app-data>/*""
// which would instead be rendered by the DirectoryListing component
path: 'Apps',
element: <AppsListing />,
},
{
// "Trash/*" and not "Trash" because we want to disable new folder, upload, etc.
// in the entire Trash directory and its subdirectories
path: 'Trash/*',
element: <TrashListing />,
},
{
path: '*',
element: <DirectoryListing />,
},
],
},
]