Skip to content
Source
Sign inSign up
fuko/trytanstackdb.com
Open History to see the last commit

tutorial.ts

66 lines1.7 KB

1import CollectionsIntro from "@/data/tutorial/collections-intro.mdx";
2import HowDoCollectionsWork from "@/data/tutorial/how-do-collections-work.mdx";
3import OptimisticActions from "@/data/tutorial/optimistic-actions.mdx";
4import OptimisticUpdates from "@/data/tutorial/optimistic-updates.mdx";
5import WhatIsNext from "@/data/tutorial/what-is-next.mdx";
6​
7export type Step = {
8 title: string;
9 // text: string;
10 file: React.ComponentType;
11 nextStepName?: string;
12};
13​
14// export const steps: Step[] = [
15// "What are collections?",
16// "Optimistic updates",
17// "Data lifecycle",
18// ].map((title) => ({
19// title,
20// text: `Text for ${title}`,
21// file: CollectionsIntro,
22// }));
23//
24const tutorialArticlesWithoutNextSteps: Step[] = [
25 {
26 title: "What are collections?",
27 file: CollectionsIntro,
28 },
29 {
30 title: "Optimistic updates",
31 file: OptimisticUpdates,
32 },
33 {
34 title: "How do collections work?",
35 file: HowDoCollectionsWork,
36 },
37 {
38 title: "What is next?",
39 file: WhatIsNext,
40 },
41];
42​
43export const tutorialArticles: Step[] = tutorialArticlesWithoutNextSteps.map(
44 (step, index) => ({
45 ...step,
46 nextStepName: tutorialArticlesWithoutNextSteps[index + 1]?.title,
47 }),
48);
49​
50const deepDiveArticlesWithoutNextSteps: Step[] = [
51 {
52 title: "Optimistic Actions",
53 file: OptimisticActions,
54 },
55];
56​
57// export const deepDiveArticles: Step[] = deepDiveArticlesWithoutNextSteps.map(
58// (step, index) => ({
59// ...step,
60// nextStepName: deepDiveArticlesWithoutNextSteps[index + 1]?.title,
61// }),
62// );
63​
64export const deepDiveArticles: Step[] = deepDiveArticlesWithoutNextSteps;
65​
66export const steps = [...tutorialArticles, ...deepDiveArticles];