@contractspec/example.learning-journey-ui-onboarding 0.0.0-canary-20260113170453
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build$colon$bundle.log +57 -0
- package/.turbo/turbo-build.log +58 -0
- package/CHANGELOG.md +494 -0
- package/LICENSE +21 -0
- package/README.md +35 -0
- package/dist/OnboardingMiniApp.d.ts +17 -0
- package/dist/OnboardingMiniApp.d.ts.map +1 -0
- package/dist/OnboardingMiniApp.js +63 -0
- package/dist/OnboardingMiniApp.js.map +1 -0
- package/dist/components/CodeSnippet.d.ts +16 -0
- package/dist/components/CodeSnippet.d.ts.map +1 -0
- package/dist/components/CodeSnippet.js +50 -0
- package/dist/components/CodeSnippet.js.map +1 -0
- package/dist/components/JourneyMap.d.ts +17 -0
- package/dist/components/JourneyMap.d.ts.map +1 -0
- package/dist/components/JourneyMap.js +49 -0
- package/dist/components/JourneyMap.js.map +1 -0
- package/dist/components/StepChecklist.d.ts +25 -0
- package/dist/components/StepChecklist.d.ts.map +1 -0
- package/dist/components/StepChecklist.js +80 -0
- package/dist/components/StepChecklist.js.map +1 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +5 -0
- package/dist/docs/index.d.ts +1 -0
- package/dist/docs/index.js +1 -0
- package/dist/docs/learning-journey-ui-onboarding.docblock.d.ts +1 -0
- package/dist/docs/learning-journey-ui-onboarding.docblock.js +20 -0
- package/dist/docs/learning-journey-ui-onboarding.docblock.js.map +1 -0
- package/dist/example.d.ts +7 -0
- package/dist/example.d.ts.map +1 -0
- package/dist/example.js +42 -0
- package/dist/example.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +14 -0
- package/dist/views/Overview.d.ts +15 -0
- package/dist/views/Overview.d.ts.map +1 -0
- package/dist/views/Overview.js +180 -0
- package/dist/views/Overview.js.map +1 -0
- package/dist/views/Progress.d.ts +11 -0
- package/dist/views/Progress.d.ts.map +1 -0
- package/dist/views/Progress.js +161 -0
- package/dist/views/Progress.js.map +1 -0
- package/dist/views/Steps.d.ts +12 -0
- package/dist/views/Steps.d.ts.map +1 -0
- package/dist/views/Steps.js +92 -0
- package/dist/views/Steps.js.map +1 -0
- package/dist/views/Timeline.d.ts +11 -0
- package/dist/views/Timeline.d.ts.map +1 -0
- package/dist/views/Timeline.js +98 -0
- package/dist/views/Timeline.js.map +1 -0
- package/dist/views/index.d.ts +5 -0
- package/dist/views/index.js +6 -0
- package/example.ts +1 -0
- package/package.json +77 -0
- package/src/OnboardingMiniApp.tsx +93 -0
- package/src/components/CodeSnippet.tsx +56 -0
- package/src/components/JourneyMap.tsx +86 -0
- package/src/components/StepChecklist.tsx +136 -0
- package/src/components/index.ts +3 -0
- package/src/docs/index.ts +1 -0
- package/src/docs/learning-journey-ui-onboarding.docblock.ts +18 -0
- package/src/example.ts +31 -0
- package/src/index.ts +10 -0
- package/src/views/Overview.tsx +204 -0
- package/src/views/Progress.tsx +186 -0
- package/src/views/Steps.tsx +92 -0
- package/src/views/Timeline.tsx +141 -0
- package/src/views/index.ts +4 -0
- package/tsconfig.json +10 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/tsdown.config.js +17 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Card, CardContent, CardHeader, CardTitle } from "@contractspec/lib.ui-kit-web/ui/card";
|
|
4
|
+
import { XpBar } from "@contractspec/example.learning-journey-ui-shared";
|
|
5
|
+
import { Button } from "@contractspec/lib.design-system";
|
|
6
|
+
import { Progress } from "@contractspec/lib.ui-kit-web/ui/progress";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/views/Overview.tsx
|
|
10
|
+
function Overview({ track, progress, onStart }) {
|
|
11
|
+
const totalSteps = track.steps.length;
|
|
12
|
+
const completedSteps = progress.completedStepIds.length;
|
|
13
|
+
const percentComplete = totalSteps > 0 ? completedSteps / totalSteps * 100 : 0;
|
|
14
|
+
const isComplete = completedSteps === totalSteps;
|
|
15
|
+
const remainingSteps = totalSteps - completedSteps;
|
|
16
|
+
const estimatedMinutes = remainingSteps * 5;
|
|
17
|
+
const totalXp = track.totalXp ?? track.steps.reduce((sum, s) => sum + (s.xpReward ?? 0), 0) + (track.completionRewards?.xpBonus ?? 0);
|
|
18
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
19
|
+
className: "space-y-6",
|
|
20
|
+
children: [
|
|
21
|
+
/* @__PURE__ */ jsx(Card, {
|
|
22
|
+
className: "overflow-hidden bg-gradient-to-r from-blue-500/10 via-violet-500/10 to-purple-500/10",
|
|
23
|
+
children: /* @__PURE__ */ jsx(CardContent, {
|
|
24
|
+
className: "p-8",
|
|
25
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
26
|
+
className: "flex flex-col items-center gap-6 text-center md:flex-row md:text-left",
|
|
27
|
+
children: [
|
|
28
|
+
/* @__PURE__ */ jsx("div", {
|
|
29
|
+
className: "flex h-20 w-20 items-center justify-center rounded-2xl bg-gradient-to-br from-blue-500 to-violet-600 text-4xl shadow-lg",
|
|
30
|
+
children: isComplete ? "π" : "π"
|
|
31
|
+
}),
|
|
32
|
+
/* @__PURE__ */ jsxs("div", {
|
|
33
|
+
className: "flex-1",
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ jsx("h1", {
|
|
36
|
+
className: "text-2xl font-bold",
|
|
37
|
+
children: track.name
|
|
38
|
+
}),
|
|
39
|
+
/* @__PURE__ */ jsx("p", {
|
|
40
|
+
className: "text-muted-foreground mt-1 max-w-2xl",
|
|
41
|
+
children: track.description
|
|
42
|
+
}),
|
|
43
|
+
!isComplete && /* @__PURE__ */ jsxs("p", {
|
|
44
|
+
className: "text-muted-foreground mt-3 text-sm",
|
|
45
|
+
children: [
|
|
46
|
+
"β±οΈ Estimated time:",
|
|
47
|
+
" ",
|
|
48
|
+
estimatedMinutes > 0 ? `~${estimatedMinutes} minutes` : "Less than a minute"
|
|
49
|
+
]
|
|
50
|
+
})
|
|
51
|
+
]
|
|
52
|
+
}),
|
|
53
|
+
!isComplete && /* @__PURE__ */ jsx(Button, {
|
|
54
|
+
size: "lg",
|
|
55
|
+
onClick: onStart,
|
|
56
|
+
children: completedSteps > 0 ? "Continue" : "Get Started"
|
|
57
|
+
})
|
|
58
|
+
]
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
}),
|
|
62
|
+
/* @__PURE__ */ jsxs("div", {
|
|
63
|
+
className: "grid gap-4 md:grid-cols-3",
|
|
64
|
+
children: [
|
|
65
|
+
/* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsx(CardHeader, {
|
|
66
|
+
className: "pb-2",
|
|
67
|
+
children: /* @__PURE__ */ jsx(CardTitle, {
|
|
68
|
+
className: "text-muted-foreground text-sm font-medium",
|
|
69
|
+
children: "Progress"
|
|
70
|
+
})
|
|
71
|
+
}), /* @__PURE__ */ jsxs(CardContent, { children: [
|
|
72
|
+
/* @__PURE__ */ jsxs("div", {
|
|
73
|
+
className: "text-3xl font-bold",
|
|
74
|
+
children: [Math.round(percentComplete), "%"]
|
|
75
|
+
}),
|
|
76
|
+
/* @__PURE__ */ jsx(Progress, {
|
|
77
|
+
value: percentComplete,
|
|
78
|
+
className: "mt-2 h-2"
|
|
79
|
+
}),
|
|
80
|
+
/* @__PURE__ */ jsxs("p", {
|
|
81
|
+
className: "text-muted-foreground mt-2 text-sm",
|
|
82
|
+
children: [
|
|
83
|
+
completedSteps,
|
|
84
|
+
" of ",
|
|
85
|
+
totalSteps,
|
|
86
|
+
" steps completed"
|
|
87
|
+
]
|
|
88
|
+
})
|
|
89
|
+
] })] }),
|
|
90
|
+
/* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsx(CardHeader, {
|
|
91
|
+
className: "pb-2",
|
|
92
|
+
children: /* @__PURE__ */ jsx(CardTitle, {
|
|
93
|
+
className: "text-muted-foreground text-sm font-medium",
|
|
94
|
+
children: "XP Earned"
|
|
95
|
+
})
|
|
96
|
+
}), /* @__PURE__ */ jsxs(CardContent, { children: [/* @__PURE__ */ jsx("div", {
|
|
97
|
+
className: "text-3xl font-bold text-blue-500",
|
|
98
|
+
children: progress.xpEarned
|
|
99
|
+
}), /* @__PURE__ */ jsx(XpBar, {
|
|
100
|
+
current: progress.xpEarned,
|
|
101
|
+
max: totalXp,
|
|
102
|
+
showLabel: false,
|
|
103
|
+
size: "sm"
|
|
104
|
+
})] })] }),
|
|
105
|
+
/* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsx(CardHeader, {
|
|
106
|
+
className: "pb-2",
|
|
107
|
+
children: /* @__PURE__ */ jsx(CardTitle, {
|
|
108
|
+
className: "text-muted-foreground text-sm font-medium",
|
|
109
|
+
children: "Time Remaining"
|
|
110
|
+
})
|
|
111
|
+
}), /* @__PURE__ */ jsxs(CardContent, { children: [/* @__PURE__ */ jsx("div", {
|
|
112
|
+
className: "text-3xl font-bold",
|
|
113
|
+
children: isComplete ? "β" : `~${estimatedMinutes}m`
|
|
114
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
115
|
+
className: "text-muted-foreground mt-2 text-sm",
|
|
116
|
+
children: isComplete ? "All done!" : `${remainingSteps} steps to go`
|
|
117
|
+
})] })] })
|
|
118
|
+
]
|
|
119
|
+
}),
|
|
120
|
+
/* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsxs(CardTitle, {
|
|
121
|
+
className: "flex items-center gap-2",
|
|
122
|
+
children: [/* @__PURE__ */ jsx("span", { children: "π" }), /* @__PURE__ */ jsx("span", { children: "Your Journey" })]
|
|
123
|
+
}) }), /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx("div", {
|
|
124
|
+
className: "space-y-3",
|
|
125
|
+
children: track.steps.map((step, index) => {
|
|
126
|
+
const isStepCompleted = progress.completedStepIds.includes(step.id);
|
|
127
|
+
const isCurrent = !isStepCompleted && track.steps.slice(0, index).every((s) => progress.completedStepIds.includes(s.id));
|
|
128
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
129
|
+
className: "flex items-center gap-4 rounded-lg border p-3",
|
|
130
|
+
children: [
|
|
131
|
+
/* @__PURE__ */ jsx("div", {
|
|
132
|
+
className: `flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-sm font-semibold ${isStepCompleted ? "bg-green-500 text-white" : isCurrent ? "bg-blue-500 text-white" : "bg-muted text-muted-foreground"}`,
|
|
133
|
+
children: isStepCompleted ? "β" : index + 1
|
|
134
|
+
}),
|
|
135
|
+
/* @__PURE__ */ jsx("div", {
|
|
136
|
+
className: "min-w-0 flex-1",
|
|
137
|
+
children: /* @__PURE__ */ jsx("p", {
|
|
138
|
+
className: `font-medium ${isStepCompleted ? "text-green-500" : isCurrent ? "text-foreground" : "text-muted-foreground"}`,
|
|
139
|
+
children: step.title
|
|
140
|
+
})
|
|
141
|
+
}),
|
|
142
|
+
step.xpReward && /* @__PURE__ */ jsxs("span", {
|
|
143
|
+
className: "text-muted-foreground text-sm",
|
|
144
|
+
children: [
|
|
145
|
+
"+",
|
|
146
|
+
step.xpReward,
|
|
147
|
+
" XP"
|
|
148
|
+
]
|
|
149
|
+
})
|
|
150
|
+
]
|
|
151
|
+
}, step.id);
|
|
152
|
+
})
|
|
153
|
+
}) })] }),
|
|
154
|
+
isComplete && /* @__PURE__ */ jsx(Card, {
|
|
155
|
+
className: "border-green-500/50 bg-green-500/5",
|
|
156
|
+
children: /* @__PURE__ */ jsxs(CardContent, {
|
|
157
|
+
className: "flex items-center gap-4 p-6",
|
|
158
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
159
|
+
className: "text-4xl",
|
|
160
|
+
children: "π"
|
|
161
|
+
}), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
|
|
162
|
+
className: "text-lg font-semibold text-green-500",
|
|
163
|
+
children: "Onboarding Complete!"
|
|
164
|
+
}), /* @__PURE__ */ jsxs("p", {
|
|
165
|
+
className: "text-muted-foreground",
|
|
166
|
+
children: [
|
|
167
|
+
"You've completed all ",
|
|
168
|
+
totalSteps,
|
|
169
|
+
" steps. Welcome aboard!"
|
|
170
|
+
]
|
|
171
|
+
})] })]
|
|
172
|
+
})
|
|
173
|
+
})
|
|
174
|
+
]
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
//#endregion
|
|
179
|
+
export { Overview };
|
|
180
|
+
//# sourceMappingURL=Overview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Overview.js","names":[],"sources":["../../src/views/Overview.tsx"],"sourcesContent":["'use client';\n\nimport { Button } from '@contractspec/lib.design-system';\nimport {\n Card,\n CardContent,\n CardHeader,\n CardTitle,\n} from '@contractspec/lib.ui-kit-web/ui/card';\nimport { Progress } from '@contractspec/lib.ui-kit-web/ui/progress';\nimport { XpBar } from '@contractspec/example.learning-journey-ui-shared';\nimport type { LearningViewProps } from '@contractspec/example.learning-journey-ui-shared';\n\ninterface OnboardingOverviewProps extends LearningViewProps {\n onStart?: () => void;\n}\n\nexport function Overview({\n track,\n progress,\n onStart,\n}: OnboardingOverviewProps) {\n const totalSteps = track.steps.length;\n const completedSteps = progress.completedStepIds.length;\n const percentComplete =\n totalSteps > 0 ? (completedSteps / totalSteps) * 100 : 0;\n const isComplete = completedSteps === totalSteps;\n\n // Estimate time remaining (rough: 5 min per step)\n const remainingSteps = totalSteps - completedSteps;\n const estimatedMinutes = remainingSteps * 5;\n\n const totalXp =\n track.totalXp ??\n track.steps.reduce((sum, s) => sum + (s.xpReward ?? 0), 0) +\n (track.completionRewards?.xpBonus ?? 0);\n\n return (\n <div className=\"space-y-6\">\n {/* Welcome Banner */}\n <Card className=\"overflow-hidden bg-gradient-to-r from-blue-500/10 via-violet-500/10 to-purple-500/10\">\n <CardContent className=\"p-8\">\n <div className=\"flex flex-col items-center gap-6 text-center md:flex-row md:text-left\">\n <div className=\"flex h-20 w-20 items-center justify-center rounded-2xl bg-gradient-to-br from-blue-500 to-violet-600 text-4xl shadow-lg\">\n {isComplete ? 'π' : 'π'}\n </div>\n <div className=\"flex-1\">\n <h1 className=\"text-2xl font-bold\">{track.name}</h1>\n <p className=\"text-muted-foreground mt-1 max-w-2xl\">\n {track.description}\n </p>\n {!isComplete && (\n <p className=\"text-muted-foreground mt-3 text-sm\">\n β±οΈ Estimated time:{' '}\n {estimatedMinutes > 0\n ? `~${estimatedMinutes} minutes`\n : 'Less than a minute'}\n </p>\n )}\n </div>\n {!isComplete && (\n <Button size=\"lg\" onClick={onStart}>\n {completedSteps > 0 ? 'Continue' : 'Get Started'}\n </Button>\n )}\n </div>\n </CardContent>\n </Card>\n\n {/* Progress Overview */}\n <div className=\"grid gap-4 md:grid-cols-3\">\n <Card>\n <CardHeader className=\"pb-2\">\n <CardTitle className=\"text-muted-foreground text-sm font-medium\">\n Progress\n </CardTitle>\n </CardHeader>\n <CardContent>\n <div className=\"text-3xl font-bold\">\n {Math.round(percentComplete)}%\n </div>\n <Progress value={percentComplete} className=\"mt-2 h-2\" />\n <p className=\"text-muted-foreground mt-2 text-sm\">\n {completedSteps} of {totalSteps} steps completed\n </p>\n </CardContent>\n </Card>\n\n <Card>\n <CardHeader className=\"pb-2\">\n <CardTitle className=\"text-muted-foreground text-sm font-medium\">\n XP Earned\n </CardTitle>\n </CardHeader>\n <CardContent>\n <div className=\"text-3xl font-bold text-blue-500\">\n {progress.xpEarned}\n </div>\n <XpBar\n current={progress.xpEarned}\n max={totalXp}\n showLabel={false}\n size=\"sm\"\n />\n </CardContent>\n </Card>\n\n <Card>\n <CardHeader className=\"pb-2\">\n <CardTitle className=\"text-muted-foreground text-sm font-medium\">\n Time Remaining\n </CardTitle>\n </CardHeader>\n <CardContent>\n <div className=\"text-3xl font-bold\">\n {isComplete ? 'β' : `~${estimatedMinutes}m`}\n </div>\n <p className=\"text-muted-foreground mt-2 text-sm\">\n {isComplete ? 'All done!' : `${remainingSteps} steps to go`}\n </p>\n </CardContent>\n </Card>\n </div>\n\n {/* Step Preview */}\n <Card>\n <CardHeader>\n <CardTitle className=\"flex items-center gap-2\">\n <span>π</span>\n <span>Your Journey</span>\n </CardTitle>\n </CardHeader>\n <CardContent>\n <div className=\"space-y-3\">\n {track.steps.map((step, index) => {\n const isStepCompleted = progress.completedStepIds.includes(\n step.id\n );\n const isCurrent =\n !isStepCompleted &&\n track.steps\n .slice(0, index)\n .every((s) => progress.completedStepIds.includes(s.id));\n\n return (\n <div\n key={step.id}\n className=\"flex items-center gap-4 rounded-lg border p-3\"\n >\n <div\n className={`flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-sm font-semibold ${\n isStepCompleted\n ? 'bg-green-500 text-white'\n : isCurrent\n ? 'bg-blue-500 text-white'\n : 'bg-muted text-muted-foreground'\n }`}\n >\n {isStepCompleted ? 'β' : index + 1}\n </div>\n <div className=\"min-w-0 flex-1\">\n <p\n className={`font-medium ${\n isStepCompleted\n ? 'text-green-500'\n : isCurrent\n ? 'text-foreground'\n : 'text-muted-foreground'\n }`}\n >\n {step.title}\n </p>\n </div>\n {step.xpReward && (\n <span className=\"text-muted-foreground text-sm\">\n +{step.xpReward} XP\n </span>\n )}\n </div>\n );\n })}\n </div>\n </CardContent>\n </Card>\n\n {/* Completion Message */}\n {isComplete && (\n <Card className=\"border-green-500/50 bg-green-500/5\">\n <CardContent className=\"flex items-center gap-4 p-6\">\n <div className=\"text-4xl\">π</div>\n <div>\n <h3 className=\"text-lg font-semibold text-green-500\">\n Onboarding Complete!\n </h3>\n <p className=\"text-muted-foreground\">\n You've completed all {totalSteps} steps. Welcome aboard!\n </p>\n </div>\n </CardContent>\n </Card>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAiBA,SAAgB,SAAS,EACvB,OACA,UACA,WAC0B;CAC1B,MAAM,aAAa,MAAM,MAAM;CAC/B,MAAM,iBAAiB,SAAS,iBAAiB;CACjD,MAAM,kBACJ,aAAa,I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oBAAC;MAAW,WAAU;gBACpB,oBAAC;OAAU,WAAU;iBAA4C;QAErD;OACD,EACb,qBAAC,0BACC,oBAAC;MAAI,WAAU;gBACZ,aAAa,MAAM,IAAI,iBAAiB;OACrC,EACN,oBAAC;MAAE,WAAU;gBACV,aAAa,cAAc,GAAG,eAAe;OAC5C,IACQ,IACT;;KACH;GAGN,qBAAC,mBACC,oBAAC,wBACC,qBAAC;IAAU,WAAU;eACnB,oBAAC,oBAAK,OAAS,EACf,oBAAC,oBAAK,iBAAmB;KACf,GACD,EACb,oBAAC,yBACC,oBAAC;IAAI,WAAU;cACZ,MAAM,MAAM,KAAK,MAAM,UAAU;KAChC,MAAM,kBAAkB,SAAS,iBAAiB,SAChD,KAAK,GACN;KACD,MAAM,YACJ,CAAC,mBACD,MAAM,MACH,MAAM,GAAG,MAAM,CACf,OAAO,MAAM,SAAS,iBAAiB,SAAS,EAAE,GAAG,CAAC;AAE3D,YACE,qBAAC;MAEC,WAAU;;OAEV,oBAAC;QACC,WAAW,wFACT,kBACI,4BACA,YACE,2BACA;kBAGP,kBAAkB,MAAM,QAAQ;SAC7B;OACN,oBAAC;QAAI,WAAU;kBACb,oBAAC;SACC,WAAW,eACT,kBACI,mBACA,YACE,oBACA;mBAGP,KAAK;UACJ;SACA;OACL,KAAK,YACJ,qBAAC;QAAK,WAAU;;SAAgC;SAC5C,KAAK;SAAS;;SACX;;QA9BJ,KAAK,GAgCN;MAER;KACE,GACM,IACT;GAGN,cACC,oBAAC;IAAK,WAAU;cACd,qBAAC;KAAY,WAAU;gBACrB,oBAAC;MAAI,WAAU;gBAAW;OAAQ,EAClC,qBAAC,oBACC,oBAAC;MAAG,WAAU;gBAAuC;OAEhD,EACL,qBAAC;MAAE,WAAU;;OAAwB;OACb;OAAW;;OAC/B,IACA;MACM;KACT;;GAEL"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LearningViewProps } from "@contractspec/example.learning-journey-ui-shared";
|
|
2
|
+
import * as react_jsx_runtime6 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/views/Progress.d.ts
|
|
5
|
+
declare function ProgressView({
|
|
6
|
+
track,
|
|
7
|
+
progress
|
|
8
|
+
}: LearningViewProps): react_jsx_runtime6.JSX.Element;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { ProgressView as Progress, ProgressView };
|
|
11
|
+
//# sourceMappingURL=Progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Progress.d.ts","names":[],"sources":["../../src/views/Progress.tsx"],"sourcesContent":[],"mappings":";;;;iBAegB,YAAA;;;GAAkC,oBAAiB,kBAAA,CAAA,GAAA,CAAA"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Card, CardContent, CardHeader, CardTitle } from "@contractspec/lib.ui-kit-web/ui/card";
|
|
4
|
+
import { BadgeDisplay, XpBar } from "@contractspec/example.learning-journey-ui-shared";
|
|
5
|
+
import { Progress } from "@contractspec/lib.ui-kit-web/ui/progress";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/views/Progress.tsx
|
|
9
|
+
function ProgressView({ track, progress }) {
|
|
10
|
+
const totalSteps = track.steps.length;
|
|
11
|
+
const completedSteps = progress.completedStepIds.length;
|
|
12
|
+
const percentComplete = totalSteps > 0 ? completedSteps / totalSteps * 100 : 0;
|
|
13
|
+
const totalXp = track.totalXp ?? track.steps.reduce((sum, s) => sum + (s.xpReward ?? 0), 0) + (track.completionRewards?.xpBonus ?? 0);
|
|
14
|
+
const remainingSteps = totalSteps - completedSteps;
|
|
15
|
+
const estimatedMinutes = remainingSteps * 5;
|
|
16
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
17
|
+
className: "space-y-6",
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsxs(CardTitle, {
|
|
20
|
+
className: "flex items-center gap-2",
|
|
21
|
+
children: [/* @__PURE__ */ jsx("span", { children: "π" }), /* @__PURE__ */ jsx("span", { children: "Your Progress" })]
|
|
22
|
+
}) }), /* @__PURE__ */ jsxs(CardContent, {
|
|
23
|
+
className: "space-y-6",
|
|
24
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
25
|
+
className: "flex items-center justify-center",
|
|
26
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
27
|
+
className: "relative flex h-40 w-40 items-center justify-center",
|
|
28
|
+
children: [/* @__PURE__ */ jsxs("svg", {
|
|
29
|
+
className: "absolute h-full w-full -rotate-90",
|
|
30
|
+
viewBox: "0 0 100 100",
|
|
31
|
+
children: [/* @__PURE__ */ jsx("circle", {
|
|
32
|
+
cx: "50",
|
|
33
|
+
cy: "50",
|
|
34
|
+
r: "45",
|
|
35
|
+
fill: "none",
|
|
36
|
+
strokeWidth: "8",
|
|
37
|
+
className: "stroke-muted"
|
|
38
|
+
}), /* @__PURE__ */ jsx("circle", {
|
|
39
|
+
cx: "50",
|
|
40
|
+
cy: "50",
|
|
41
|
+
r: "45",
|
|
42
|
+
fill: "none",
|
|
43
|
+
strokeWidth: "8",
|
|
44
|
+
strokeLinecap: "round",
|
|
45
|
+
strokeDasharray: `${percentComplete * 2.83} 283`,
|
|
46
|
+
className: "stroke-blue-500 transition-all duration-500"
|
|
47
|
+
})]
|
|
48
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
49
|
+
className: "text-center",
|
|
50
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
51
|
+
className: "text-3xl font-bold",
|
|
52
|
+
children: [Math.round(percentComplete), "%"]
|
|
53
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
54
|
+
className: "text-muted-foreground text-sm",
|
|
55
|
+
children: "Complete"
|
|
56
|
+
})]
|
|
57
|
+
})]
|
|
58
|
+
})
|
|
59
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
60
|
+
className: "grid grid-cols-3 gap-4 text-center",
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
|
|
63
|
+
className: "text-2xl font-bold text-green-500",
|
|
64
|
+
children: completedSteps
|
|
65
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
66
|
+
className: "text-muted-foreground text-sm",
|
|
67
|
+
children: "Completed"
|
|
68
|
+
})] }),
|
|
69
|
+
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
|
|
70
|
+
className: "text-2xl font-bold text-orange-500",
|
|
71
|
+
children: remainingSteps
|
|
72
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
73
|
+
className: "text-muted-foreground text-sm",
|
|
74
|
+
children: "Remaining"
|
|
75
|
+
})] }),
|
|
76
|
+
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
|
|
77
|
+
className: "text-2xl font-bold",
|
|
78
|
+
children: [estimatedMinutes, "m"]
|
|
79
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
80
|
+
className: "text-muted-foreground text-sm",
|
|
81
|
+
children: "Est. Time"
|
|
82
|
+
})] })
|
|
83
|
+
]
|
|
84
|
+
})]
|
|
85
|
+
})] }),
|
|
86
|
+
/* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsxs(CardTitle, {
|
|
87
|
+
className: "flex items-center gap-2",
|
|
88
|
+
children: [/* @__PURE__ */ jsx("span", { children: "β‘" }), /* @__PURE__ */ jsx("span", { children: "Experience Points" })]
|
|
89
|
+
}) }), /* @__PURE__ */ jsxs(CardContent, {
|
|
90
|
+
className: "space-y-4",
|
|
91
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
92
|
+
className: "flex items-baseline gap-2",
|
|
93
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
94
|
+
className: "text-3xl font-bold text-blue-500",
|
|
95
|
+
children: progress.xpEarned
|
|
96
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
97
|
+
className: "text-muted-foreground",
|
|
98
|
+
children: [
|
|
99
|
+
"/ ",
|
|
100
|
+
totalXp,
|
|
101
|
+
" XP"
|
|
102
|
+
]
|
|
103
|
+
})]
|
|
104
|
+
}), /* @__PURE__ */ jsx(XpBar, {
|
|
105
|
+
current: progress.xpEarned,
|
|
106
|
+
max: totalXp,
|
|
107
|
+
showLabel: false,
|
|
108
|
+
size: "lg"
|
|
109
|
+
})]
|
|
110
|
+
})] }),
|
|
111
|
+
/* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsxs(CardTitle, {
|
|
112
|
+
className: "flex items-center gap-2",
|
|
113
|
+
children: [/* @__PURE__ */ jsx("span", { children: "π
" }), /* @__PURE__ */ jsx("span", { children: "Achievements" })]
|
|
114
|
+
}) }), /* @__PURE__ */ jsxs(CardContent, { children: [/* @__PURE__ */ jsx(BadgeDisplay, {
|
|
115
|
+
badges: progress.badges,
|
|
116
|
+
size: "lg"
|
|
117
|
+
}), progress.badges.length === 0 && track.completionRewards?.badgeKey && /* @__PURE__ */ jsxs("p", {
|
|
118
|
+
className: "text-muted-foreground text-sm",
|
|
119
|
+
children: [
|
|
120
|
+
"Complete all steps to earn the \"",
|
|
121
|
+
track.completionRewards.badgeKey,
|
|
122
|
+
"\" badge!"
|
|
123
|
+
]
|
|
124
|
+
})] })] }),
|
|
125
|
+
/* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsxs(CardTitle, {
|
|
126
|
+
className: "flex items-center gap-2",
|
|
127
|
+
children: [/* @__PURE__ */ jsx("span", { children: "π" }), /* @__PURE__ */ jsx("span", { children: "Step Details" })]
|
|
128
|
+
}) }), /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx("div", {
|
|
129
|
+
className: "space-y-3",
|
|
130
|
+
children: track.steps.map((step, index) => {
|
|
131
|
+
const isCompleted = progress.completedStepIds.includes(step.id);
|
|
132
|
+
const stepProgress = isCompleted ? 100 : 0;
|
|
133
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
134
|
+
className: "space-y-1",
|
|
135
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
136
|
+
className: "flex items-center justify-between text-sm",
|
|
137
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
138
|
+
className: isCompleted ? "text-green-500" : "text-foreground",
|
|
139
|
+
children: [
|
|
140
|
+
index + 1,
|
|
141
|
+
". ",
|
|
142
|
+
step.title
|
|
143
|
+
]
|
|
144
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
145
|
+
className: isCompleted ? "text-green-500" : "text-muted-foreground",
|
|
146
|
+
children: isCompleted ? "β" : "Pending"
|
|
147
|
+
})]
|
|
148
|
+
}), /* @__PURE__ */ jsx(Progress, {
|
|
149
|
+
value: stepProgress,
|
|
150
|
+
className: "h-1"
|
|
151
|
+
})]
|
|
152
|
+
}, step.id);
|
|
153
|
+
})
|
|
154
|
+
}) })] })
|
|
155
|
+
]
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
//#endregion
|
|
160
|
+
export { ProgressView as Progress, ProgressView };
|
|
161
|
+
//# sourceMappingURL=Progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Progress.js","names":[],"sources":["../../src/views/Progress.tsx"],"sourcesContent":["'use client';\n\nimport {\n Card,\n CardContent,\n CardHeader,\n CardTitle,\n} from '@contractspec/lib.ui-kit-web/ui/card';\nimport { Progress } from '@contractspec/lib.ui-kit-web/ui/progress';\nimport {\n XpBar,\n BadgeDisplay,\n} from '@contractspec/example.learning-journey-ui-shared';\nimport type { LearningViewProps } from '@contractspec/example.learning-journey-ui-shared';\n\nexport function ProgressView({ track, progress }: LearningViewProps) {\n const totalSteps = track.steps.length;\n const completedSteps = progress.completedStepIds.length;\n const percentComplete =\n totalSteps > 0 ? (completedSteps / totalSteps) * 100 : 0;\n\n const totalXp =\n track.totalXp ??\n track.steps.reduce((sum, s) => sum + (s.xpReward ?? 0), 0) +\n (track.completionRewards?.xpBonus ?? 0);\n\n const remainingSteps = totalSteps - completedSteps;\n const estimatedMinutes = remainingSteps * 5;\n\n return (\n <div className=\"space-y-6\">\n {/* Main Progress */}\n <Card>\n <CardHeader>\n <CardTitle className=\"flex items-center gap-2\">\n <span>π</span>\n <span>Your Progress</span>\n </CardTitle>\n </CardHeader>\n <CardContent className=\"space-y-6\">\n {/* Circular progress indicator */}\n <div className=\"flex items-center justify-center\">\n <div className=\"relative flex h-40 w-40 items-center justify-center\">\n <svg\n className=\"absolute h-full w-full -rotate-90\"\n viewBox=\"0 0 100 100\"\n >\n <circle\n cx=\"50\"\n cy=\"50\"\n r=\"45\"\n fill=\"none\"\n strokeWidth=\"8\"\n className=\"stroke-muted\"\n />\n <circle\n cx=\"50\"\n cy=\"50\"\n r=\"45\"\n fill=\"none\"\n strokeWidth=\"8\"\n strokeLinecap=\"round\"\n strokeDasharray={`${percentComplete * 2.83} 283`}\n className=\"stroke-blue-500 transition-all duration-500\"\n />\n </svg>\n <div className=\"text-center\">\n <div className=\"text-3xl font-bold\">\n {Math.round(percentComplete)}%\n </div>\n <div className=\"text-muted-foreground text-sm\">Complete</div>\n </div>\n </div>\n </div>\n\n {/* Stats row */}\n <div className=\"grid grid-cols-3 gap-4 text-center\">\n <div>\n <div className=\"text-2xl font-bold text-green-500\">\n {completedSteps}\n </div>\n <div className=\"text-muted-foreground text-sm\">Completed</div>\n </div>\n <div>\n <div className=\"text-2xl font-bold text-orange-500\">\n {remainingSteps}\n </div>\n <div className=\"text-muted-foreground text-sm\">Remaining</div>\n </div>\n <div>\n <div className=\"text-2xl font-bold\">{estimatedMinutes}m</div>\n <div className=\"text-muted-foreground text-sm\">Est. Time</div>\n </div>\n </div>\n </CardContent>\n </Card>\n\n {/* XP Progress */}\n <Card>\n <CardHeader>\n <CardTitle className=\"flex items-center gap-2\">\n <span>β‘</span>\n <span>Experience Points</span>\n </CardTitle>\n </CardHeader>\n <CardContent className=\"space-y-4\">\n <div className=\"flex items-baseline gap-2\">\n <span className=\"text-3xl font-bold text-blue-500\">\n {progress.xpEarned}\n </span>\n <span className=\"text-muted-foreground\">/ {totalXp} XP</span>\n </div>\n <XpBar\n current={progress.xpEarned}\n max={totalXp}\n showLabel={false}\n size=\"lg\"\n />\n </CardContent>\n </Card>\n\n {/* Badges */}\n <Card>\n <CardHeader>\n <CardTitle className=\"flex items-center gap-2\">\n <span>π
</span>\n <span>Achievements</span>\n </CardTitle>\n </CardHeader>\n <CardContent>\n <BadgeDisplay badges={progress.badges} size=\"lg\" />\n {progress.badges.length === 0 &&\n track.completionRewards?.badgeKey && (\n <p className=\"text-muted-foreground text-sm\">\n Complete all steps to earn the \"\n {track.completionRewards.badgeKey}\" badge!\n </p>\n )}\n </CardContent>\n </Card>\n\n {/* Step-by-step breakdown */}\n <Card>\n <CardHeader>\n <CardTitle className=\"flex items-center gap-2\">\n <span>π</span>\n <span>Step Details</span>\n </CardTitle>\n </CardHeader>\n <CardContent>\n <div className=\"space-y-3\">\n {track.steps.map((step, index) => {\n const isCompleted = progress.completedStepIds.includes(step.id);\n const stepProgress = isCompleted ? 100 : 0;\n\n return (\n <div key={step.id} className=\"space-y-1\">\n <div className=\"flex items-center justify-between text-sm\">\n <span\n className={\n isCompleted ? 'text-green-500' : 'text-foreground'\n }\n >\n {index + 1}. {step.title}\n </span>\n <span\n className={\n isCompleted ? 'text-green-500' : 'text-muted-foreground'\n }\n >\n {isCompleted ? 'β' : 'Pending'}\n </span>\n </div>\n <Progress value={stepProgress} className=\"h-1\" />\n </div>\n );\n })}\n </div>\n </CardContent>\n </Card>\n </div>\n );\n}\n\n// Re-export with correct name\nexport { ProgressView as Progress };\n"],"mappings":";;;;;;;;AAeA,SAAgB,aAAa,EAAE,OAAO,YAA+B;CACnE,MAAM,aAAa,MAAM,MA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 @@
|
|
|
1
|
+
import { LearningViewProps } from "@contractspec/example.learning-journey-ui-shared";
|
|
2
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/views/Steps.d.ts
|
|
5
|
+
declare function Steps({
|
|
6
|
+
track,
|
|
7
|
+
progress,
|
|
8
|
+
onStepComplete
|
|
9
|
+
}: LearningViewProps): react_jsx_runtime3.JSX.Element;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { Steps };
|
|
12
|
+
//# sourceMappingURL=Steps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Steps.d.ts","names":[],"sources":["../../src/views/Steps.tsx"],"sourcesContent":[],"mappings":";;;;iBAOgB,KAAA;;;;GAA2C,oBAAiB,kBAAA,CAAA,GAAA,CAAA"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { StepChecklist } from "../components/StepChecklist.js";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { Progress } from "@contractspec/lib.ui-kit-web/ui/progress";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/views/Steps.tsx
|
|
9
|
+
function Steps({ track, progress, onStepComplete }) {
|
|
10
|
+
const [expandedStepId, setExpandedStepId] = useState(() => {
|
|
11
|
+
return track.steps.find((s) => !progress.completedStepIds.includes(s.id))?.id ?? null;
|
|
12
|
+
});
|
|
13
|
+
const completedSteps = progress.completedStepIds.length;
|
|
14
|
+
const totalSteps = track.steps.length;
|
|
15
|
+
const percentComplete = totalSteps > 0 ? completedSteps / totalSteps * 100 : 0;
|
|
16
|
+
const currentStepIndex = track.steps.findIndex((s) => !progress.completedStepIds.includes(s.id));
|
|
17
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
18
|
+
className: "space-y-6",
|
|
19
|
+
children: [
|
|
20
|
+
/* @__PURE__ */ jsxs("div", {
|
|
21
|
+
className: "space-y-2",
|
|
22
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
23
|
+
className: "flex items-center justify-between",
|
|
24
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
25
|
+
className: "text-xl font-bold",
|
|
26
|
+
children: "Complete Each Step"
|
|
27
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
28
|
+
className: "text-muted-foreground text-sm",
|
|
29
|
+
children: [
|
|
30
|
+
completedSteps,
|
|
31
|
+
" / ",
|
|
32
|
+
totalSteps,
|
|
33
|
+
" completed"
|
|
34
|
+
]
|
|
35
|
+
})]
|
|
36
|
+
}), /* @__PURE__ */ jsx(Progress, {
|
|
37
|
+
value: percentComplete,
|
|
38
|
+
className: "h-2"
|
|
39
|
+
})]
|
|
40
|
+
}),
|
|
41
|
+
/* @__PURE__ */ jsx("div", {
|
|
42
|
+
className: "space-y-3",
|
|
43
|
+
children: track.steps.map((step, index) => {
|
|
44
|
+
const isCompleted = progress.completedStepIds.includes(step.id);
|
|
45
|
+
const isCurrent = index === currentStepIndex;
|
|
46
|
+
return /* @__PURE__ */ jsx(StepChecklist, {
|
|
47
|
+
step,
|
|
48
|
+
stepNumber: index + 1,
|
|
49
|
+
isCompleted,
|
|
50
|
+
isCurrent,
|
|
51
|
+
isExpanded: expandedStepId === step.id,
|
|
52
|
+
onToggle: () => setExpandedStepId(expandedStepId === step.id ? null : step.id),
|
|
53
|
+
onComplete: () => {
|
|
54
|
+
onStepComplete?.(step.id);
|
|
55
|
+
const nextStep = track.steps[index + 1];
|
|
56
|
+
if (nextStep && !progress.completedStepIds.includes(nextStep.id)) setExpandedStepId(nextStep.id);
|
|
57
|
+
}
|
|
58
|
+
}, step.id);
|
|
59
|
+
})
|
|
60
|
+
}),
|
|
61
|
+
track.completionRewards && percentComplete < 100 && /* @__PURE__ */ jsx("div", {
|
|
62
|
+
className: "rounded-lg border border-blue-500/30 bg-blue-500/5 p-4",
|
|
63
|
+
children: /* @__PURE__ */ jsxs("p", {
|
|
64
|
+
className: "text-sm",
|
|
65
|
+
children: [
|
|
66
|
+
"π Complete all steps to unlock:",
|
|
67
|
+
track.completionRewards.xpBonus && /* @__PURE__ */ jsxs("span", {
|
|
68
|
+
className: "ml-2 font-semibold text-blue-500",
|
|
69
|
+
children: [
|
|
70
|
+
"+",
|
|
71
|
+
track.completionRewards.xpBonus,
|
|
72
|
+
" XP bonus"
|
|
73
|
+
]
|
|
74
|
+
}),
|
|
75
|
+
track.completionRewards.badgeKey && /* @__PURE__ */ jsxs("span", {
|
|
76
|
+
className: "ml-2 font-semibold text-amber-500",
|
|
77
|
+
children: [
|
|
78
|
+
"+ \"",
|
|
79
|
+
track.completionRewards.badgeKey,
|
|
80
|
+
"\" badge"
|
|
81
|
+
]
|
|
82
|
+
})
|
|
83
|
+
]
|
|
84
|
+
})
|
|
85
|
+
})
|
|
86
|
+
]
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
//#endregion
|
|
91
|
+
export { Steps };
|
|
92
|
+
//# sourceMappingURL=Steps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Steps.js","names":[],"sources":["../../src/views/Steps.tsx"],"sourcesContent":["'use client';\n\nimport { useState } from 'react';\nimport { Progress } from '@contractspec/lib.ui-kit-web/ui/progress';\nimport { StepChecklist } from '../components/StepChecklist';\nimport type { LearningViewProps } from '@contractspec/example.learning-journey-ui-shared';\n\nexport function Steps({ track, progress, onStepComplete }: LearningViewProps) {\n const [expandedStepId, setExpandedStepId] = useState<string | null>(() => {\n // Auto-expand first incomplete step\n const firstIncomplete = track.steps.find(\n (s) => !progress.completedStepIds.includes(s.id)\n );\n return firstIncomplete?.id ?? null;\n });\n\n const completedSteps = progress.completedStepIds.length;\n const totalSteps = track.steps.length;\n const percentComplete =\n totalSteps > 0 ? (completedSteps / totalSteps) * 100 : 0;\n\n const currentStepIndex = track.steps.findIndex(\n (s) => !progress.completedStepIds.includes(s.id)\n );\n\n return (\n <div className=\"space-y-6\">\n {/* Progress Header */}\n <div className=\"space-y-2\">\n <div className=\"flex items-center justify-between\">\n <h2 className=\"text-xl font-bold\">Complete Each Step</h2>\n <span className=\"text-muted-foreground text-sm\">\n {completedSteps} / {totalSteps} completed\n </span>\n </div>\n <Progress value={percentComplete} className=\"h-2\" />\n </div>\n\n {/* Steps List */}\n <div className=\"space-y-3\">\n {track.steps.map((step, index) => {\n const isCompleted = progress.completedStepIds.includes(step.id);\n const isCurrent = index === currentStepIndex;\n\n return (\n <StepChecklist\n key={step.id}\n step={step}\n stepNumber={index + 1}\n isCompleted={isCompleted}\n isCurrent={isCurrent}\n isExpanded={expandedStepId === step.id}\n onToggle={() =>\n setExpandedStepId(expandedStepId === step.id ? null : step.id)\n }\n onComplete={() => {\n onStepComplete?.(step.id);\n // Auto-expand next step\n const nextStep = track.steps[index + 1];\n if (\n nextStep &&\n !progress.completedStepIds.includes(nextStep.id)\n ) {\n setExpandedStepId(nextStep.id);\n }\n }}\n />\n );\n })}\n </div>\n\n {/* Completion rewards hint */}\n {track.completionRewards && percentComplete < 100 && (\n <div className=\"rounded-lg border border-blue-500/30 bg-blue-500/5 p-4\">\n <p className=\"text-sm\">\n π Complete all steps to unlock:\n {track.completionRewards.xpBonus && (\n <span className=\"ml-2 font-semibold text-blue-500\">\n +{track.completionRewards.xpBonus} XP bonus\n </span>\n )}\n {track.completionRewards.badgeKey && (\n <span className=\"ml-2 font-semibold text-amber-500\">\n + \"{track.completionRewards.badgeKey}\" badge\n </span>\n )}\n </p>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAOA,SAAgB,MAAM,EAAE,OAAO,UAAU,kBAAqC;CAC5E,MAAM,CAAC,gBAAgB,qBAAqB,eAA8B;AAKxE,SAHwB,MAAM,MAAM,MACjC,MAAM,CAAC,SAAS,iBAAiB,SAAS,EAAE,GAAG,CACjD,EACuB,MAAM;GAC9B;CAEF,MAAM,iBAAiB,SAAS,iBAAiB;CACjD,MAAM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ared";
|
|
2
|
+
import * as react_jsx_runtime5 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/views/Timeline.d.ts
|
|
5
|
+
declare function Timeline({
|
|
6
|
+
track,
|
|
7
|
+
progress
|
|
8
|
+
}: LearningViewProps): react_jsx_runtime5.JSX.Element;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { Timeline };
|
|
11
|
+
//# sourceMappingURL=Timeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Timeline.d.ts","names":[],"sources":["../../src/views/Timeline.tsx"],"sourcesContent":[],"mappings":";;;;iBAWgB,QAAA;;;GAA8B,oBAAiB,kBAAA,CAAA,GAAA,CAAA"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { JourneyMap } from "../components/JourneyMap.js";
|
|
4
|
+
import { Card, CardContent, CardHeader, CardTitle } from "@contractspec/lib.ui-kit-web/ui/card";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/views/Timeline.tsx
|
|
8
|
+
function Timeline({ track, progress }) {
|
|
9
|
+
const currentStepId = track.steps.find((s) => !progress.completedStepIds.includes(s.id))?.id ?? null;
|
|
10
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
11
|
+
className: "space-y-6",
|
|
12
|
+
children: [
|
|
13
|
+
/* @__PURE__ */ jsxs("div", {
|
|
14
|
+
className: "text-center",
|
|
15
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
16
|
+
className: "text-xl font-bold",
|
|
17
|
+
children: "Your Learning Journey"
|
|
18
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
19
|
+
className: "text-muted-foreground",
|
|
20
|
+
children: "Follow the path through each surface and feature"
|
|
21
|
+
})]
|
|
22
|
+
}),
|
|
23
|
+
/* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsxs(CardTitle, {
|
|
24
|
+
className: "flex items-center gap-2",
|
|
25
|
+
children: [/* @__PURE__ */ jsx("span", { children: "πΊοΈ" }), /* @__PURE__ */ jsx("span", { children: "Journey Map" })]
|
|
26
|
+
}) }), /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx(JourneyMap, {
|
|
27
|
+
steps: track.steps,
|
|
28
|
+
completedStepIds: progress.completedStepIds,
|
|
29
|
+
currentStepId
|
|
30
|
+
}) })] }),
|
|
31
|
+
/* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsxs(CardTitle, {
|
|
32
|
+
className: "flex items-center gap-2",
|
|
33
|
+
children: [/* @__PURE__ */ jsx("span", { children: "π" }), /* @__PURE__ */ jsx("span", { children: "Step by Step" })]
|
|
34
|
+
}) }), /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsxs("div", {
|
|
35
|
+
className: "relative",
|
|
36
|
+
children: [/* @__PURE__ */ jsx("div", { className: "bg-border absolute top-0 left-4 h-full w-0.5" }), /* @__PURE__ */ jsx("div", {
|
|
37
|
+
className: "space-y-6",
|
|
38
|
+
children: track.steps.map((step, index) => {
|
|
39
|
+
const isCompleted = progress.completedStepIds.includes(step.id);
|
|
40
|
+
const isCurrent = step.id === currentStepId;
|
|
41
|
+
const surface = step.metadata?.surface ?? "general";
|
|
42
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
43
|
+
className: "relative flex gap-4 pl-2",
|
|
44
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
45
|
+
className: `relative z-10 flex h-8 w-8 shrink-0 items-center justify-center rounded-full border-2 transition-all ${isCompleted ? "border-green-500 bg-green-500 text-white" : isCurrent ? "border-blue-500 bg-blue-500 text-white ring-4 ring-blue-500/20" : "border-border bg-background text-muted-foreground"}`,
|
|
46
|
+
children: isCompleted ? "β" : index + 1
|
|
47
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
48
|
+
className: "flex-1 pb-2",
|
|
49
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
50
|
+
className: "rounded-lg border p-4",
|
|
51
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
52
|
+
className: "flex items-start justify-between gap-2",
|
|
53
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
|
|
54
|
+
className: "flex items-center gap-2",
|
|
55
|
+
children: [/* @__PURE__ */ jsx("h4", {
|
|
56
|
+
className: `font-semibold ${isCompleted ? "text-green-500" : isCurrent ? "text-blue-500" : "text-foreground"}`,
|
|
57
|
+
children: step.title
|
|
58
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
59
|
+
className: "bg-muted text-muted-foreground rounded px-2 py-0.5 text-xs",
|
|
60
|
+
children: surface
|
|
61
|
+
})]
|
|
62
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
63
|
+
className: "text-muted-foreground mt-1 text-sm",
|
|
64
|
+
children: step.description
|
|
65
|
+
})] }), step.xpReward && /* @__PURE__ */ jsxs("span", {
|
|
66
|
+
className: `shrink-0 rounded-full px-2 py-1 text-xs font-semibold ${isCompleted ? "bg-green-500/10 text-green-500" : "bg-muted text-muted-foreground"}`,
|
|
67
|
+
children: [
|
|
68
|
+
"+",
|
|
69
|
+
step.xpReward,
|
|
70
|
+
" XP"
|
|
71
|
+
]
|
|
72
|
+
})]
|
|
73
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
74
|
+
className: "mt-3 text-xs",
|
|
75
|
+
children: isCompleted ? /* @__PURE__ */ jsx("span", {
|
|
76
|
+
className: "text-green-500",
|
|
77
|
+
children: "β Completed"
|
|
78
|
+
}) : isCurrent ? /* @__PURE__ */ jsx("span", {
|
|
79
|
+
className: "text-blue-500",
|
|
80
|
+
children: "β In Progress"
|
|
81
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
82
|
+
className: "text-muted-foreground",
|
|
83
|
+
children: "β Not Started"
|
|
84
|
+
})
|
|
85
|
+
})]
|
|
86
|
+
})
|
|
87
|
+
})]
|
|
88
|
+
}, step.id);
|
|
89
|
+
})
|
|
90
|
+
})]
|
|
91
|
+
}) })] })
|
|
92
|
+
]
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
97
|
+
export { Timeline };
|
|
98
|
+
//# sourceMappingURL=Timeline.js.map
|