-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEditionRoutes.tsx
More file actions
51 lines (46 loc) · 1.89 KB
/
EditionRoutes.tsx
File metadata and controls
51 lines (46 loc) · 1.89 KB
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
import { Navigate, Route } from "react-router-dom";
import EditionView from "@/pages/EditionView/EditionView";
import { SetDetails } from "@/pages/SetDetails";
// Tab components
import { ArtistsTab } from "@/pages/EditionView/tabs/ArtistsTab/ArtistsTab";
import { MapTab } from "@/pages/EditionView/tabs/MapTab";
import { InfoTab } from "@/pages/EditionView/tabs/InfoTab";
import { SocialTab } from "@/pages/EditionView/tabs/SocialTab";
import { ScheduleTabTimeline } from "@/pages/EditionView/tabs/ScheduleTab/TimelineTab";
import { ScheduleTabList } from "@/pages/EditionView/tabs/ScheduleTab/list/ListTab";
import { ScheduleTab } from "@/pages/EditionView/tabs/ScheduleTab";
interface EditionRoutesProps {
basePath: string;
WrapperComponent?: React.ComponentType<{ component: React.ComponentType }>;
}
export function createEditionRoutes({
basePath,
WrapperComponent,
}: EditionRoutesProps) {
const EditionComponent = WrapperComponent
? () => <WrapperComponent component={EditionView} />
: EditionView;
const SetDetailsComponent = WrapperComponent
? () => <WrapperComponent component={SetDetails} />
: SetDetails;
return [
<Route key="main" path={basePath} element={<EditionComponent />}>
{/* Nested tab routes */}
<Route index element={<Navigate to="sets" replace />} />
<Route path="sets" element={<ArtistsTab />} />
<Route path="map" element={<MapTab />} />
<Route path="info" element={<InfoTab />} />
<Route path="social" element={<SocialTab />} />
<Route path="schedule" element={<ScheduleTab />}>
<Route index element={<Navigate to="timeline" replace />} />
<Route path="timeline" element={<ScheduleTabTimeline />} />
<Route path="list" element={<ScheduleTabList />} />
</Route>
</Route>,
<Route
key="sets"
path={`${basePath}/sets/:setSlug`}
element={<SetDetailsComponent />}
/>,
];
}