-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy path_tutorial.tsx
More file actions
40 lines (37 loc) · 1.15 KB
/
Copy path_tutorial.tsx
File metadata and controls
40 lines (37 loc) · 1.15 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
import { createFileRoute, Outlet } from "@tanstack/react-router";
import z from "zod";
import { HomeIntro } from "@/components/HomeIntro";
import { highlightParamSchema } from "@/components/tutorial";
import { TutorialWindow } from "@/components/tutorial/TutorialWindow";
import { getShowIntro } from "@/utils/getShowIntro";
import { getTutorialDataHandlers } from "@/utils/getTutorialDataHandlers";
export const Route = createFileRoute("/_tutorial")({
validateSearch: z
.object({
temp_db_missing: z.string().optional(),
article: z.string().optional(),
})
.extend(highlightParamSchema.shape),
loader: async () => {
const { tutorialData } = await getTutorialDataHandlers();
const { showIntroState } = getShowIntro();
return {
tutorialData,
showIntroState,
};
},
component: RouteComponent,
});
function RouteComponent() {
const { tutorialData, showIntroState } = Route.useLoaderData();
return (
<>
<Outlet />
<HomeIntro
activeStep={tutorialData.tutorialStep}
showIntro={showIntroState === "visible"}
/>
<TutorialWindow tutorialData={tutorialData} />
</>
);
}