@contractspec/example.learning-journey-ui-onboarding 3.7.16 → 3.7.18
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.log +48 -48
- package/CHANGELOG.md +36 -0
- package/dist/OnboardingMiniApp.js +1 -994
- package/dist/browser/OnboardingMiniApp.js +1 -994
- package/dist/browser/components/CodeSnippet.js +1 -65
- package/dist/browser/components/JourneyMap.js +1 -59
- package/dist/browser/components/StepChecklist.js +1 -97
- package/dist/browser/components/index.js +1 -219
- package/dist/browser/docs/index.js +2 -16
- package/dist/browser/docs/learning-journey-ui-onboarding.docblock.js +2 -16
- package/dist/browser/example.js +1 -32
- package/dist/browser/index.js +2 -1127
- package/dist/browser/learning-journey-ui-onboarding.feature.js +1 -18
- package/dist/browser/views/Overview.js +1 -240
- package/dist/browser/views/Progress.js +1 -275
- package/dist/browser/views/Steps.js +1 -192
- package/dist/browser/views/Timeline.js +1 -213
- package/dist/browser/views/index.js +1 -915
- package/dist/components/CodeSnippet.js +1 -65
- package/dist/components/JourneyMap.js +1 -59
- package/dist/components/StepChecklist.js +1 -97
- package/dist/components/index.js +1 -219
- package/dist/docs/index.js +2 -16
- package/dist/docs/learning-journey-ui-onboarding.docblock.js +2 -16
- package/dist/example.js +1 -32
- package/dist/index.js +2 -1127
- package/dist/learning-journey-ui-onboarding.feature.js +1 -18
- package/dist/node/OnboardingMiniApp.js +1 -994
- package/dist/node/components/CodeSnippet.js +1 -65
- package/dist/node/components/JourneyMap.js +1 -59
- package/dist/node/components/StepChecklist.js +1 -97
- package/dist/node/components/index.js +1 -219
- package/dist/node/docs/index.js +2 -16
- package/dist/node/docs/learning-journey-ui-onboarding.docblock.js +2 -16
- package/dist/node/example.js +1 -32
- package/dist/node/index.js +2 -1127
- package/dist/node/learning-journey-ui-onboarding.feature.js +1 -18
- package/dist/node/views/Overview.js +1 -240
- package/dist/node/views/Progress.js +1 -275
- package/dist/node/views/Steps.js +1 -192
- package/dist/node/views/Timeline.js +1 -213
- package/dist/node/views/index.js +1 -915
- package/dist/views/Overview.js +1 -240
- package/dist/views/Progress.js +1 -275
- package/dist/views/Steps.js +1 -192
- package/dist/views/Timeline.js +1 -213
- package/dist/views/index.js +1 -915
- package/package.json +13 -13
|
@@ -1,18 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { defineFeature } from "@contractspec/lib.contracts-spec";
|
|
3
|
-
var LearningJourneyUiOnboardingFeature = defineFeature({
|
|
4
|
-
meta: {
|
|
5
|
-
key: "learning-journey-ui-onboarding",
|
|
6
|
-
version: "1.0.0",
|
|
7
|
-
title: "Learning Journey UI: Onboarding",
|
|
8
|
-
description: "Developer onboarding UI with checklists, journey maps, and step-by-step progress",
|
|
9
|
-
domain: "learning-journey",
|
|
10
|
-
owners: ["@examples"],
|
|
11
|
-
tags: ["learning", "ui", "onboarding", "checklists"],
|
|
12
|
-
stability: "experimental"
|
|
13
|
-
},
|
|
14
|
-
docs: ["docs.examples.learning-journey-ui-onboarding"]
|
|
15
|
-
});
|
|
16
|
-
export {
|
|
17
|
-
LearningJourneyUiOnboardingFeature
|
|
18
|
-
};
|
|
1
|
+
import{defineFeature as g}from"@contractspec/lib.contracts-spec";var j=g({meta:{key:"learning-journey-ui-onboarding",version:"1.0.0",title:"Learning Journey UI: Onboarding",description:"Developer onboarding UI with checklists, journey maps, and step-by-step progress",domain:"learning-journey",owners:["@examples"],tags:["learning","ui","onboarding","checklists"],stability:"experimental"},docs:["docs.examples.learning-journey-ui-onboarding"]});export{j as LearningJourneyUiOnboardingFeature};
|
|
@@ -1,240 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { XpBar } from "@contractspec/example.learning-journey-ui-shared";
|
|
3
|
-
import { Button } from "@contractspec/lib.design-system";
|
|
4
|
-
import {
|
|
5
|
-
Card,
|
|
6
|
-
CardContent,
|
|
7
|
-
CardHeader,
|
|
8
|
-
CardTitle
|
|
9
|
-
} from "@contractspec/lib.ui-kit-web/ui/card";
|
|
10
|
-
import { Progress } from "@contractspec/lib.ui-kit-web/ui/progress";
|
|
11
|
-
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
12
|
-
"use client";
|
|
13
|
-
function Overview({
|
|
14
|
-
track,
|
|
15
|
-
progress,
|
|
16
|
-
onStart
|
|
17
|
-
}) {
|
|
18
|
-
const totalSteps = track.steps.length;
|
|
19
|
-
const completedSteps = progress.completedStepIds.length;
|
|
20
|
-
const percentComplete = totalSteps > 0 ? completedSteps / totalSteps * 100 : 0;
|
|
21
|
-
const isComplete = completedSteps === totalSteps;
|
|
22
|
-
const remainingSteps = totalSteps - completedSteps;
|
|
23
|
-
const estimatedMinutes = remainingSteps * 5;
|
|
24
|
-
const totalXp = track.totalXp ?? track.steps.reduce((sum, s) => sum + (s.xpReward ?? 0), 0) + (track.completionRewards?.xpBonus ?? 0);
|
|
25
|
-
return /* @__PURE__ */ jsxDEV("div", {
|
|
26
|
-
className: "space-y-6",
|
|
27
|
-
children: [
|
|
28
|
-
/* @__PURE__ */ jsxDEV(Card, {
|
|
29
|
-
className: "overflow-hidden bg-gradient-to-r from-blue-500/10 via-violet-500/10 to-purple-500/10",
|
|
30
|
-
children: /* @__PURE__ */ jsxDEV(CardContent, {
|
|
31
|
-
className: "p-8",
|
|
32
|
-
children: /* @__PURE__ */ jsxDEV("div", {
|
|
33
|
-
className: "flex flex-col items-center gap-6 text-center md:flex-row md:text-left",
|
|
34
|
-
children: [
|
|
35
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
36
|
-
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",
|
|
37
|
-
children: isComplete ? "\uD83C\uDF89" : "\uD83D\uDE80"
|
|
38
|
-
}, undefined, false, undefined, this),
|
|
39
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
40
|
-
className: "flex-1",
|
|
41
|
-
children: [
|
|
42
|
-
/* @__PURE__ */ jsxDEV("h1", {
|
|
43
|
-
className: "font-bold text-2xl",
|
|
44
|
-
children: track.name
|
|
45
|
-
}, undefined, false, undefined, this),
|
|
46
|
-
/* @__PURE__ */ jsxDEV("p", {
|
|
47
|
-
className: "mt-1 max-w-2xl text-muted-foreground",
|
|
48
|
-
children: track.description
|
|
49
|
-
}, undefined, false, undefined, this),
|
|
50
|
-
!isComplete && /* @__PURE__ */ jsxDEV("p", {
|
|
51
|
-
className: "mt-3 text-muted-foreground text-sm",
|
|
52
|
-
children: [
|
|
53
|
-
"⏱️ Estimated time:",
|
|
54
|
-
" ",
|
|
55
|
-
estimatedMinutes > 0 ? `~${estimatedMinutes} minutes` : "Less than a minute"
|
|
56
|
-
]
|
|
57
|
-
}, undefined, true, undefined, this)
|
|
58
|
-
]
|
|
59
|
-
}, undefined, true, undefined, this),
|
|
60
|
-
!isComplete && /* @__PURE__ */ jsxDEV(Button, {
|
|
61
|
-
size: "lg",
|
|
62
|
-
onClick: onStart,
|
|
63
|
-
children: completedSteps > 0 ? "Continue" : "Get Started"
|
|
64
|
-
}, undefined, false, undefined, this)
|
|
65
|
-
]
|
|
66
|
-
}, undefined, true, undefined, this)
|
|
67
|
-
}, undefined, false, undefined, this)
|
|
68
|
-
}, undefined, false, undefined, this),
|
|
69
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
70
|
-
className: "grid gap-4 md:grid-cols-3",
|
|
71
|
-
children: [
|
|
72
|
-
/* @__PURE__ */ jsxDEV(Card, {
|
|
73
|
-
children: [
|
|
74
|
-
/* @__PURE__ */ jsxDEV(CardHeader, {
|
|
75
|
-
className: "pb-2",
|
|
76
|
-
children: /* @__PURE__ */ jsxDEV(CardTitle, {
|
|
77
|
-
className: "font-medium text-muted-foreground text-sm",
|
|
78
|
-
children: "Progress"
|
|
79
|
-
}, undefined, false, undefined, this)
|
|
80
|
-
}, undefined, false, undefined, this),
|
|
81
|
-
/* @__PURE__ */ jsxDEV(CardContent, {
|
|
82
|
-
children: [
|
|
83
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
84
|
-
className: "font-bold text-3xl",
|
|
85
|
-
children: [
|
|
86
|
-
Math.round(percentComplete),
|
|
87
|
-
"%"
|
|
88
|
-
]
|
|
89
|
-
}, undefined, true, undefined, this),
|
|
90
|
-
/* @__PURE__ */ jsxDEV(Progress, {
|
|
91
|
-
value: percentComplete,
|
|
92
|
-
className: "mt-2 h-2"
|
|
93
|
-
}, undefined, false, undefined, this),
|
|
94
|
-
/* @__PURE__ */ jsxDEV("p", {
|
|
95
|
-
className: "mt-2 text-muted-foreground text-sm",
|
|
96
|
-
children: [
|
|
97
|
-
completedSteps,
|
|
98
|
-
" of ",
|
|
99
|
-
totalSteps,
|
|
100
|
-
" steps completed"
|
|
101
|
-
]
|
|
102
|
-
}, undefined, true, undefined, this)
|
|
103
|
-
]
|
|
104
|
-
}, undefined, true, undefined, this)
|
|
105
|
-
]
|
|
106
|
-
}, undefined, true, undefined, this),
|
|
107
|
-
/* @__PURE__ */ jsxDEV(Card, {
|
|
108
|
-
children: [
|
|
109
|
-
/* @__PURE__ */ jsxDEV(CardHeader, {
|
|
110
|
-
className: "pb-2",
|
|
111
|
-
children: /* @__PURE__ */ jsxDEV(CardTitle, {
|
|
112
|
-
className: "font-medium text-muted-foreground text-sm",
|
|
113
|
-
children: "XP Earned"
|
|
114
|
-
}, undefined, false, undefined, this)
|
|
115
|
-
}, undefined, false, undefined, this),
|
|
116
|
-
/* @__PURE__ */ jsxDEV(CardContent, {
|
|
117
|
-
children: [
|
|
118
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
119
|
-
className: "font-bold text-3xl text-blue-500",
|
|
120
|
-
children: progress.xpEarned
|
|
121
|
-
}, undefined, false, undefined, this),
|
|
122
|
-
/* @__PURE__ */ jsxDEV(XpBar, {
|
|
123
|
-
current: progress.xpEarned,
|
|
124
|
-
max: totalXp,
|
|
125
|
-
showLabel: false,
|
|
126
|
-
size: "sm"
|
|
127
|
-
}, undefined, false, undefined, this)
|
|
128
|
-
]
|
|
129
|
-
}, undefined, true, undefined, this)
|
|
130
|
-
]
|
|
131
|
-
}, undefined, true, undefined, this),
|
|
132
|
-
/* @__PURE__ */ jsxDEV(Card, {
|
|
133
|
-
children: [
|
|
134
|
-
/* @__PURE__ */ jsxDEV(CardHeader, {
|
|
135
|
-
className: "pb-2",
|
|
136
|
-
children: /* @__PURE__ */ jsxDEV(CardTitle, {
|
|
137
|
-
className: "font-medium text-muted-foreground text-sm",
|
|
138
|
-
children: "Time Remaining"
|
|
139
|
-
}, undefined, false, undefined, this)
|
|
140
|
-
}, undefined, false, undefined, this),
|
|
141
|
-
/* @__PURE__ */ jsxDEV(CardContent, {
|
|
142
|
-
children: [
|
|
143
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
144
|
-
className: "font-bold text-3xl",
|
|
145
|
-
children: isComplete ? "✓" : `~${estimatedMinutes}m`
|
|
146
|
-
}, undefined, false, undefined, this),
|
|
147
|
-
/* @__PURE__ */ jsxDEV("p", {
|
|
148
|
-
className: "mt-2 text-muted-foreground text-sm",
|
|
149
|
-
children: isComplete ? "All done!" : `${remainingSteps} steps to go`
|
|
150
|
-
}, undefined, false, undefined, this)
|
|
151
|
-
]
|
|
152
|
-
}, undefined, true, undefined, this)
|
|
153
|
-
]
|
|
154
|
-
}, undefined, true, undefined, this)
|
|
155
|
-
]
|
|
156
|
-
}, undefined, true, undefined, this),
|
|
157
|
-
/* @__PURE__ */ jsxDEV(Card, {
|
|
158
|
-
children: [
|
|
159
|
-
/* @__PURE__ */ jsxDEV(CardHeader, {
|
|
160
|
-
children: /* @__PURE__ */ jsxDEV(CardTitle, {
|
|
161
|
-
className: "flex items-center gap-2",
|
|
162
|
-
children: [
|
|
163
|
-
/* @__PURE__ */ jsxDEV("span", {
|
|
164
|
-
children: "\uD83D\uDCCB"
|
|
165
|
-
}, undefined, false, undefined, this),
|
|
166
|
-
/* @__PURE__ */ jsxDEV("span", {
|
|
167
|
-
children: "Your Journey"
|
|
168
|
-
}, undefined, false, undefined, this)
|
|
169
|
-
]
|
|
170
|
-
}, undefined, true, undefined, this)
|
|
171
|
-
}, undefined, false, undefined, this),
|
|
172
|
-
/* @__PURE__ */ jsxDEV(CardContent, {
|
|
173
|
-
children: /* @__PURE__ */ jsxDEV("div", {
|
|
174
|
-
className: "space-y-3",
|
|
175
|
-
children: track.steps.map((step, index) => {
|
|
176
|
-
const isStepCompleted = progress.completedStepIds.includes(step.id);
|
|
177
|
-
const isCurrent = !isStepCompleted && track.steps.slice(0, index).every((s) => progress.completedStepIds.includes(s.id));
|
|
178
|
-
return /* @__PURE__ */ jsxDEV("div", {
|
|
179
|
-
className: "flex items-center gap-4 rounded-lg border p-3",
|
|
180
|
-
children: [
|
|
181
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
182
|
-
className: `flex h-8 w-8 shrink-0 items-center justify-center rounded-full font-semibold text-sm ${isStepCompleted ? "bg-green-500 text-white" : isCurrent ? "bg-blue-500 text-white" : "bg-muted text-muted-foreground"}`,
|
|
183
|
-
children: isStepCompleted ? "✓" : index + 1
|
|
184
|
-
}, undefined, false, undefined, this),
|
|
185
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
186
|
-
className: "min-w-0 flex-1",
|
|
187
|
-
children: /* @__PURE__ */ jsxDEV("p", {
|
|
188
|
-
className: `font-medium ${isStepCompleted ? "text-green-500" : isCurrent ? "text-foreground" : "text-muted-foreground"}`,
|
|
189
|
-
children: step.title
|
|
190
|
-
}, undefined, false, undefined, this)
|
|
191
|
-
}, undefined, false, undefined, this),
|
|
192
|
-
step.xpReward && /* @__PURE__ */ jsxDEV("span", {
|
|
193
|
-
className: "text-muted-foreground text-sm",
|
|
194
|
-
children: [
|
|
195
|
-
"+",
|
|
196
|
-
step.xpReward,
|
|
197
|
-
" XP"
|
|
198
|
-
]
|
|
199
|
-
}, undefined, true, undefined, this)
|
|
200
|
-
]
|
|
201
|
-
}, step.id, true, undefined, this);
|
|
202
|
-
})
|
|
203
|
-
}, undefined, false, undefined, this)
|
|
204
|
-
}, undefined, false, undefined, this)
|
|
205
|
-
]
|
|
206
|
-
}, undefined, true, undefined, this),
|
|
207
|
-
isComplete && /* @__PURE__ */ jsxDEV(Card, {
|
|
208
|
-
className: "border-green-500/50 bg-green-500/5",
|
|
209
|
-
children: /* @__PURE__ */ jsxDEV(CardContent, {
|
|
210
|
-
className: "flex items-center gap-4 p-6",
|
|
211
|
-
children: [
|
|
212
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
213
|
-
className: "text-4xl",
|
|
214
|
-
children: "\uD83C\uDF89"
|
|
215
|
-
}, undefined, false, undefined, this),
|
|
216
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
217
|
-
children: [
|
|
218
|
-
/* @__PURE__ */ jsxDEV("h3", {
|
|
219
|
-
className: "font-semibold text-green-500 text-lg",
|
|
220
|
-
children: "Onboarding Complete!"
|
|
221
|
-
}, undefined, false, undefined, this),
|
|
222
|
-
/* @__PURE__ */ jsxDEV("p", {
|
|
223
|
-
className: "text-muted-foreground",
|
|
224
|
-
children: [
|
|
225
|
-
"You've completed all ",
|
|
226
|
-
totalSteps,
|
|
227
|
-
" steps. Welcome aboard!"
|
|
228
|
-
]
|
|
229
|
-
}, undefined, true, undefined, this)
|
|
230
|
-
]
|
|
231
|
-
}, undefined, true, undefined, this)
|
|
232
|
-
]
|
|
233
|
-
}, undefined, true, undefined, this)
|
|
234
|
-
}, undefined, false, undefined, this)
|
|
235
|
-
]
|
|
236
|
-
}, undefined, true, undefined, this);
|
|
237
|
-
}
|
|
238
|
-
export {
|
|
239
|
-
Overview
|
|
240
|
-
};
|
|
1
|
+
import{XpBar as W}from"@contractspec/example.learning-journey-ui-shared";import{Button as Y}from"@contractspec/lib.design-system";import{Card as A,CardContent as D,CardHeader as J,CardTitle as K}from"@contractspec/lib.ui-kit-web/ui/card";import{Progress as Z}from"@contractspec/lib.ui-kit-web/ui/progress";import{jsx as f,jsxs as h}from"react/jsx-runtime";function b({track:q,progress:E,onStart:R}){let y=q.steps.length,F=E.completedStepIds.length,N=y>0?F/y*100:0,z=F===y,O=y-F,L=O*5,U=q.totalXp??q.steps.reduce((v,G)=>v+(G.xpReward??0),0)+(q.completionRewards?.xpBonus??0);return h("div",{className:"space-y-6",children:[f(A,{className:"overflow-hidden bg-gradient-to-r from-blue-500/10 via-violet-500/10 to-purple-500/10",children:f(D,{className:"p-8",children:h("div",{className:"flex flex-col items-center gap-6 text-center md:flex-row md:text-left",children:[f("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",children:z?"\uD83C\uDF89":"\uD83D\uDE80"}),h("div",{className:"flex-1",children:[f("h1",{className:"font-bold text-2xl",children:q.name}),f("p",{className:"mt-1 max-w-2xl text-muted-foreground",children:q.description}),!z&&h("p",{className:"mt-3 text-muted-foreground text-sm",children:["⏱️ Estimated time:"," ",L>0?`~${L} minutes`:"Less than a minute"]})]}),!z&&f(Y,{size:"lg",onClick:R,children:F>0?"Continue":"Get Started"})]})})}),h("div",{className:"grid gap-4 md:grid-cols-3",children:[h(A,{children:[f(J,{className:"pb-2",children:f(K,{className:"font-medium text-muted-foreground text-sm",children:"Progress"})}),h(D,{children:[h("div",{className:"font-bold text-3xl",children:[Math.round(N),"%"]}),f(Z,{value:N,className:"mt-2 h-2"}),h("p",{className:"mt-2 text-muted-foreground text-sm",children:[F," of ",y," steps completed"]})]})]}),h(A,{children:[f(J,{className:"pb-2",children:f(K,{className:"font-medium text-muted-foreground text-sm",children:"XP Earned"})}),h(D,{children:[f("div",{className:"font-bold text-3xl text-blue-500",children:E.xpEarned}),f(W,{current:E.xpEarned,max:U,showLabel:!1,size:"sm"})]})]}),h(A,{children:[f(J,{className:"pb-2",children:f(K,{className:"font-medium text-muted-foreground text-sm",children:"Time Remaining"})}),h(D,{children:[f("div",{className:"font-bold text-3xl",children:z?"✓":`~${L}m`}),f("p",{className:"mt-2 text-muted-foreground text-sm",children:z?"All done!":`${O} steps to go`})]})]})]}),h(A,{children:[f(J,{children:h(K,{className:"flex items-center gap-2",children:[f("span",{children:"\uD83D\uDCCB"}),f("span",{children:"Your Journey"})]})}),f(D,{children:f("div",{className:"space-y-3",children:q.steps.map((v,G)=>{let I=E.completedStepIds.includes(v.id),Q=!I&&q.steps.slice(0,G).every((V)=>E.completedStepIds.includes(V.id));return h("div",{className:"flex items-center gap-4 rounded-lg border p-3",children:[f("div",{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-full font-semibold text-sm ${I?"bg-green-500 text-white":Q?"bg-blue-500 text-white":"bg-muted text-muted-foreground"}`,children:I?"✓":G+1}),f("div",{className:"min-w-0 flex-1",children:f("p",{className:`font-medium ${I?"text-green-500":Q?"text-foreground":"text-muted-foreground"}`,children:v.title})}),v.xpReward&&h("span",{className:"text-muted-foreground text-sm",children:["+",v.xpReward," XP"]})]},v.id)})})})]}),z&&f(A,{className:"border-green-500/50 bg-green-500/5",children:h(D,{className:"flex items-center gap-4 p-6",children:[f("div",{className:"text-4xl",children:"\uD83C\uDF89"}),h("div",{children:[f("h3",{className:"font-semibold text-green-500 text-lg",children:"Onboarding Complete!"}),h("p",{className:"text-muted-foreground",children:["You've completed all ",y," steps. Welcome aboard!"]})]})]})})]})}export{b as Overview};
|
|
@@ -1,275 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
BadgeDisplay,
|
|
4
|
-
XpBar
|
|
5
|
-
} from "@contractspec/example.learning-journey-ui-shared";
|
|
6
|
-
import {
|
|
7
|
-
Card,
|
|
8
|
-
CardContent,
|
|
9
|
-
CardHeader,
|
|
10
|
-
CardTitle
|
|
11
|
-
} from "@contractspec/lib.ui-kit-web/ui/card";
|
|
12
|
-
import { Progress } from "@contractspec/lib.ui-kit-web/ui/progress";
|
|
13
|
-
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
14
|
-
"use client";
|
|
15
|
-
function ProgressView({ track, progress }) {
|
|
16
|
-
const totalSteps = track.steps.length;
|
|
17
|
-
const completedSteps = progress.completedStepIds.length;
|
|
18
|
-
const percentComplete = totalSteps > 0 ? completedSteps / totalSteps * 100 : 0;
|
|
19
|
-
const totalXp = track.totalXp ?? track.steps.reduce((sum, s) => sum + (s.xpReward ?? 0), 0) + (track.completionRewards?.xpBonus ?? 0);
|
|
20
|
-
const remainingSteps = totalSteps - completedSteps;
|
|
21
|
-
const estimatedMinutes = remainingSteps * 5;
|
|
22
|
-
return /* @__PURE__ */ jsxDEV("div", {
|
|
23
|
-
className: "space-y-6",
|
|
24
|
-
children: [
|
|
25
|
-
/* @__PURE__ */ jsxDEV(Card, {
|
|
26
|
-
children: [
|
|
27
|
-
/* @__PURE__ */ jsxDEV(CardHeader, {
|
|
28
|
-
children: /* @__PURE__ */ jsxDEV(CardTitle, {
|
|
29
|
-
className: "flex items-center gap-2",
|
|
30
|
-
children: [
|
|
31
|
-
/* @__PURE__ */ jsxDEV("span", {
|
|
32
|
-
children: "\uD83D\uDCC8"
|
|
33
|
-
}, undefined, false, undefined, this),
|
|
34
|
-
/* @__PURE__ */ jsxDEV("span", {
|
|
35
|
-
children: "Your Progress"
|
|
36
|
-
}, undefined, false, undefined, this)
|
|
37
|
-
]
|
|
38
|
-
}, undefined, true, undefined, this)
|
|
39
|
-
}, undefined, false, undefined, this),
|
|
40
|
-
/* @__PURE__ */ jsxDEV(CardContent, {
|
|
41
|
-
className: "space-y-6",
|
|
42
|
-
children: [
|
|
43
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
44
|
-
className: "flex items-center justify-center",
|
|
45
|
-
children: /* @__PURE__ */ jsxDEV("div", {
|
|
46
|
-
className: "relative flex h-40 w-40 items-center justify-center",
|
|
47
|
-
children: [
|
|
48
|
-
/* @__PURE__ */ jsxDEV("svg", {
|
|
49
|
-
className: "absolute h-full w-full -rotate-90",
|
|
50
|
-
viewBox: "0 0 100 100",
|
|
51
|
-
children: [
|
|
52
|
-
/* @__PURE__ */ jsxDEV("circle", {
|
|
53
|
-
cx: "50",
|
|
54
|
-
cy: "50",
|
|
55
|
-
r: "45",
|
|
56
|
-
fill: "none",
|
|
57
|
-
strokeWidth: "8",
|
|
58
|
-
className: "stroke-muted"
|
|
59
|
-
}, undefined, false, undefined, this),
|
|
60
|
-
/* @__PURE__ */ jsxDEV("circle", {
|
|
61
|
-
cx: "50",
|
|
62
|
-
cy: "50",
|
|
63
|
-
r: "45",
|
|
64
|
-
fill: "none",
|
|
65
|
-
strokeWidth: "8",
|
|
66
|
-
strokeLinecap: "round",
|
|
67
|
-
strokeDasharray: `${percentComplete * 2.83} 283`,
|
|
68
|
-
className: "stroke-blue-500 transition-all duration-500"
|
|
69
|
-
}, undefined, false, undefined, this)
|
|
70
|
-
]
|
|
71
|
-
}, undefined, true, undefined, this),
|
|
72
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
73
|
-
className: "text-center",
|
|
74
|
-
children: [
|
|
75
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
76
|
-
className: "font-bold text-3xl",
|
|
77
|
-
children: [
|
|
78
|
-
Math.round(percentComplete),
|
|
79
|
-
"%"
|
|
80
|
-
]
|
|
81
|
-
}, undefined, true, undefined, this),
|
|
82
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
83
|
-
className: "text-muted-foreground text-sm",
|
|
84
|
-
children: "Complete"
|
|
85
|
-
}, undefined, false, undefined, this)
|
|
86
|
-
]
|
|
87
|
-
}, undefined, true, undefined, this)
|
|
88
|
-
]
|
|
89
|
-
}, undefined, true, undefined, this)
|
|
90
|
-
}, undefined, false, undefined, this),
|
|
91
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
92
|
-
className: "grid grid-cols-3 gap-4 text-center",
|
|
93
|
-
children: [
|
|
94
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
95
|
-
children: [
|
|
96
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
97
|
-
className: "font-bold text-2xl text-green-500",
|
|
98
|
-
children: completedSteps
|
|
99
|
-
}, undefined, false, undefined, this),
|
|
100
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
101
|
-
className: "text-muted-foreground text-sm",
|
|
102
|
-
children: "Completed"
|
|
103
|
-
}, undefined, false, undefined, this)
|
|
104
|
-
]
|
|
105
|
-
}, undefined, true, undefined, this),
|
|
106
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
107
|
-
children: [
|
|
108
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
109
|
-
className: "font-bold text-2xl text-orange-500",
|
|
110
|
-
children: remainingSteps
|
|
111
|
-
}, undefined, false, undefined, this),
|
|
112
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
113
|
-
className: "text-muted-foreground text-sm",
|
|
114
|
-
children: "Remaining"
|
|
115
|
-
}, undefined, false, undefined, this)
|
|
116
|
-
]
|
|
117
|
-
}, undefined, true, undefined, this),
|
|
118
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
119
|
-
children: [
|
|
120
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
121
|
-
className: "font-bold text-2xl",
|
|
122
|
-
children: [
|
|
123
|
-
estimatedMinutes,
|
|
124
|
-
"m"
|
|
125
|
-
]
|
|
126
|
-
}, undefined, true, undefined, this),
|
|
127
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
128
|
-
className: "text-muted-foreground text-sm",
|
|
129
|
-
children: "Est. Time"
|
|
130
|
-
}, undefined, false, undefined, this)
|
|
131
|
-
]
|
|
132
|
-
}, undefined, true, undefined, this)
|
|
133
|
-
]
|
|
134
|
-
}, undefined, true, undefined, this)
|
|
135
|
-
]
|
|
136
|
-
}, undefined, true, undefined, this)
|
|
137
|
-
]
|
|
138
|
-
}, undefined, true, undefined, this),
|
|
139
|
-
/* @__PURE__ */ jsxDEV(Card, {
|
|
140
|
-
children: [
|
|
141
|
-
/* @__PURE__ */ jsxDEV(CardHeader, {
|
|
142
|
-
children: /* @__PURE__ */ jsxDEV(CardTitle, {
|
|
143
|
-
className: "flex items-center gap-2",
|
|
144
|
-
children: [
|
|
145
|
-
/* @__PURE__ */ jsxDEV("span", {
|
|
146
|
-
children: "⚡"
|
|
147
|
-
}, undefined, false, undefined, this),
|
|
148
|
-
/* @__PURE__ */ jsxDEV("span", {
|
|
149
|
-
children: "Experience Points"
|
|
150
|
-
}, undefined, false, undefined, this)
|
|
151
|
-
]
|
|
152
|
-
}, undefined, true, undefined, this)
|
|
153
|
-
}, undefined, false, undefined, this),
|
|
154
|
-
/* @__PURE__ */ jsxDEV(CardContent, {
|
|
155
|
-
className: "space-y-4",
|
|
156
|
-
children: [
|
|
157
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
158
|
-
className: "flex items-baseline gap-2",
|
|
159
|
-
children: [
|
|
160
|
-
/* @__PURE__ */ jsxDEV("span", {
|
|
161
|
-
className: "font-bold text-3xl text-blue-500",
|
|
162
|
-
children: progress.xpEarned
|
|
163
|
-
}, undefined, false, undefined, this),
|
|
164
|
-
/* @__PURE__ */ jsxDEV("span", {
|
|
165
|
-
className: "text-muted-foreground",
|
|
166
|
-
children: [
|
|
167
|
-
"/ ",
|
|
168
|
-
totalXp,
|
|
169
|
-
" XP"
|
|
170
|
-
]
|
|
171
|
-
}, undefined, true, undefined, this)
|
|
172
|
-
]
|
|
173
|
-
}, undefined, true, undefined, this),
|
|
174
|
-
/* @__PURE__ */ jsxDEV(XpBar, {
|
|
175
|
-
current: progress.xpEarned,
|
|
176
|
-
max: totalXp,
|
|
177
|
-
showLabel: false,
|
|
178
|
-
size: "lg"
|
|
179
|
-
}, undefined, false, undefined, this)
|
|
180
|
-
]
|
|
181
|
-
}, undefined, true, undefined, this)
|
|
182
|
-
]
|
|
183
|
-
}, undefined, true, undefined, this),
|
|
184
|
-
/* @__PURE__ */ jsxDEV(Card, {
|
|
185
|
-
children: [
|
|
186
|
-
/* @__PURE__ */ jsxDEV(CardHeader, {
|
|
187
|
-
children: /* @__PURE__ */ jsxDEV(CardTitle, {
|
|
188
|
-
className: "flex items-center gap-2",
|
|
189
|
-
children: [
|
|
190
|
-
/* @__PURE__ */ jsxDEV("span", {
|
|
191
|
-
children: "\uD83C\uDFC5"
|
|
192
|
-
}, undefined, false, undefined, this),
|
|
193
|
-
/* @__PURE__ */ jsxDEV("span", {
|
|
194
|
-
children: "Achievements"
|
|
195
|
-
}, undefined, false, undefined, this)
|
|
196
|
-
]
|
|
197
|
-
}, undefined, true, undefined, this)
|
|
198
|
-
}, undefined, false, undefined, this),
|
|
199
|
-
/* @__PURE__ */ jsxDEV(CardContent, {
|
|
200
|
-
children: [
|
|
201
|
-
/* @__PURE__ */ jsxDEV(BadgeDisplay, {
|
|
202
|
-
badges: progress.badges,
|
|
203
|
-
size: "lg"
|
|
204
|
-
}, undefined, false, undefined, this),
|
|
205
|
-
progress.badges.length === 0 && track.completionRewards?.badgeKey && /* @__PURE__ */ jsxDEV("p", {
|
|
206
|
-
className: "text-muted-foreground text-sm",
|
|
207
|
-
children: [
|
|
208
|
-
'Complete all steps to earn the "',
|
|
209
|
-
track.completionRewards.badgeKey,
|
|
210
|
-
'" badge!'
|
|
211
|
-
]
|
|
212
|
-
}, undefined, true, undefined, this)
|
|
213
|
-
]
|
|
214
|
-
}, undefined, true, undefined, this)
|
|
215
|
-
]
|
|
216
|
-
}, undefined, true, undefined, this),
|
|
217
|
-
/* @__PURE__ */ jsxDEV(Card, {
|
|
218
|
-
children: [
|
|
219
|
-
/* @__PURE__ */ jsxDEV(CardHeader, {
|
|
220
|
-
children: /* @__PURE__ */ jsxDEV(CardTitle, {
|
|
221
|
-
className: "flex items-center gap-2",
|
|
222
|
-
children: [
|
|
223
|
-
/* @__PURE__ */ jsxDEV("span", {
|
|
224
|
-
children: "\uD83D\uDCCB"
|
|
225
|
-
}, undefined, false, undefined, this),
|
|
226
|
-
/* @__PURE__ */ jsxDEV("span", {
|
|
227
|
-
children: "Step Details"
|
|
228
|
-
}, undefined, false, undefined, this)
|
|
229
|
-
]
|
|
230
|
-
}, undefined, true, undefined, this)
|
|
231
|
-
}, undefined, false, undefined, this),
|
|
232
|
-
/* @__PURE__ */ jsxDEV(CardContent, {
|
|
233
|
-
children: /* @__PURE__ */ jsxDEV("div", {
|
|
234
|
-
className: "space-y-3",
|
|
235
|
-
children: track.steps.map((step, index) => {
|
|
236
|
-
const isCompleted = progress.completedStepIds.includes(step.id);
|
|
237
|
-
const stepProgress = isCompleted ? 100 : 0;
|
|
238
|
-
return /* @__PURE__ */ jsxDEV("div", {
|
|
239
|
-
className: "space-y-1",
|
|
240
|
-
children: [
|
|
241
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
242
|
-
className: "flex items-center justify-between text-sm",
|
|
243
|
-
children: [
|
|
244
|
-
/* @__PURE__ */ jsxDEV("span", {
|
|
245
|
-
className: isCompleted ? "text-green-500" : "text-foreground",
|
|
246
|
-
children: [
|
|
247
|
-
index + 1,
|
|
248
|
-
". ",
|
|
249
|
-
step.title
|
|
250
|
-
]
|
|
251
|
-
}, undefined, true, undefined, this),
|
|
252
|
-
/* @__PURE__ */ jsxDEV("span", {
|
|
253
|
-
className: isCompleted ? "text-green-500" : "text-muted-foreground",
|
|
254
|
-
children: isCompleted ? "✓" : "Pending"
|
|
255
|
-
}, undefined, false, undefined, this)
|
|
256
|
-
]
|
|
257
|
-
}, undefined, true, undefined, this),
|
|
258
|
-
/* @__PURE__ */ jsxDEV(Progress, {
|
|
259
|
-
value: stepProgress,
|
|
260
|
-
className: "h-1"
|
|
261
|
-
}, undefined, false, undefined, this)
|
|
262
|
-
]
|
|
263
|
-
}, step.id, true, undefined, this);
|
|
264
|
-
})
|
|
265
|
-
}, undefined, false, undefined, this)
|
|
266
|
-
}, undefined, false, undefined, this)
|
|
267
|
-
]
|
|
268
|
-
}, undefined, true, undefined, this)
|
|
269
|
-
]
|
|
270
|
-
}, undefined, true, undefined, this);
|
|
271
|
-
}
|
|
272
|
-
export {
|
|
273
|
-
ProgressView,
|
|
274
|
-
ProgressView as Progress
|
|
275
|
-
};
|
|
1
|
+
import{BadgeDisplay as W,XpBar as Y}from"@contractspec/example.learning-journey-ui-shared";import{Card as E,CardContent as F,CardHeader as G,CardTitle as I}from"@contractspec/lib.ui-kit-web/ui/card";import{Progress as Z}from"@contractspec/lib.ui-kit-web/ui/progress";import{jsx as f,jsxs as h}from"react/jsx-runtime";function D({track:q,progress:v}){let J=q.steps.length,K=v.completedStepIds.length,N=J>0?K/J*100:0,O=q.totalXp??q.steps.reduce((z,L)=>z+(L.xpReward??0),0)+(q.completionRewards?.xpBonus??0),Q=J-K,R=Q*5;return h("div",{className:"space-y-6",children:[h(E,{children:[f(G,{children:h(I,{className:"flex items-center gap-2",children:[f("span",{children:"\uD83D\uDCC8"}),f("span",{children:"Your Progress"})]})}),h(F,{className:"space-y-6",children:[f("div",{className:"flex items-center justify-center",children:h("div",{className:"relative flex h-40 w-40 items-center justify-center",children:[h("svg",{className:"absolute h-full w-full -rotate-90",viewBox:"0 0 100 100",children:[f("circle",{cx:"50",cy:"50",r:"45",fill:"none",strokeWidth:"8",className:"stroke-muted"}),f("circle",{cx:"50",cy:"50",r:"45",fill:"none",strokeWidth:"8",strokeLinecap:"round",strokeDasharray:`${N*2.83} 283`,className:"stroke-blue-500 transition-all duration-500"})]}),h("div",{className:"text-center",children:[h("div",{className:"font-bold text-3xl",children:[Math.round(N),"%"]}),f("div",{className:"text-muted-foreground text-sm",children:"Complete"})]})]})}),h("div",{className:"grid grid-cols-3 gap-4 text-center",children:[h("div",{children:[f("div",{className:"font-bold text-2xl text-green-500",children:K}),f("div",{className:"text-muted-foreground text-sm",children:"Completed"})]}),h("div",{children:[f("div",{className:"font-bold text-2xl text-orange-500",children:Q}),f("div",{className:"text-muted-foreground text-sm",children:"Remaining"})]}),h("div",{children:[h("div",{className:"font-bold text-2xl",children:[R,"m"]}),f("div",{className:"text-muted-foreground text-sm",children:"Est. Time"})]})]})]})]}),h(E,{children:[f(G,{children:h(I,{className:"flex items-center gap-2",children:[f("span",{children:"⚡"}),f("span",{children:"Experience Points"})]})}),h(F,{className:"space-y-4",children:[h("div",{className:"flex items-baseline gap-2",children:[f("span",{className:"font-bold text-3xl text-blue-500",children:v.xpEarned}),h("span",{className:"text-muted-foreground",children:["/ ",O," XP"]})]}),f(Y,{current:v.xpEarned,max:O,showLabel:!1,size:"lg"})]})]}),h(E,{children:[f(G,{children:h(I,{className:"flex items-center gap-2",children:[f("span",{children:"\uD83C\uDFC5"}),f("span",{children:"Achievements"})]})}),h(F,{children:[f(W,{badges:v.badges,size:"lg"}),v.badges.length===0&&q.completionRewards?.badgeKey&&h("p",{className:"text-muted-foreground text-sm",children:['Complete all steps to earn the "',q.completionRewards.badgeKey,'" badge!']})]})]}),h(E,{children:[f(G,{children:h(I,{className:"flex items-center gap-2",children:[f("span",{children:"\uD83D\uDCCB"}),f("span",{children:"Step Details"})]})}),f(F,{children:f("div",{className:"space-y-3",children:q.steps.map((z,L)=>{let A=v.completedStepIds.includes(z.id),U=A?100:0;return h("div",{className:"space-y-1",children:[h("div",{className:"flex items-center justify-between text-sm",children:[h("span",{className:A?"text-green-500":"text-foreground",children:[L+1,". ",z.title]}),f("span",{className:A?"text-green-500":"text-muted-foreground",children:A?"✓":"Pending"})]}),f(Z,{value:U,className:"h-1"})]},z.id)})})})]})]})}export{D as ProgressView,D as Progress};
|