@contractspec/example.learning-journey-ui-coaching 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.
Files changed (48) hide show
  1. package/.turbo/turbo-build.log +49 -49
  2. package/CHANGELOG.md +34 -0
  3. package/dist/CoachingMiniApp.js +1 -1059
  4. package/dist/browser/CoachingMiniApp.js +1 -1059
  5. package/dist/browser/components/EngagementMeter.js +1 -143
  6. package/dist/browser/components/TipCard.js +1 -89
  7. package/dist/browser/components/TipFeed.js +1 -90
  8. package/dist/browser/components/index.js +1 -320
  9. package/dist/browser/docs/index.js +2 -16
  10. package/dist/browser/docs/learning-journey-ui-coaching.docblock.js +2 -16
  11. package/dist/browser/example.js +1 -32
  12. package/dist/browser/index.js +2 -1129
  13. package/dist/browser/learning-journey-ui-coaching.feature.js +1 -18
  14. package/dist/browser/views/Overview.js +1 -303
  15. package/dist/browser/views/Progress.js +1 -344
  16. package/dist/browser/views/Steps.js +1 -159
  17. package/dist/browser/views/Timeline.js +1 -266
  18. package/dist/browser/views/index.js +1 -980
  19. package/dist/components/EngagementMeter.js +1 -143
  20. package/dist/components/TipCard.js +1 -89
  21. package/dist/components/TipFeed.js +1 -90
  22. package/dist/components/index.js +1 -320
  23. package/dist/docs/index.js +2 -16
  24. package/dist/docs/learning-journey-ui-coaching.docblock.js +2 -16
  25. package/dist/example.js +1 -32
  26. package/dist/index.js +2 -1129
  27. package/dist/learning-journey-ui-coaching.feature.js +1 -18
  28. package/dist/node/CoachingMiniApp.js +1 -1059
  29. package/dist/node/components/EngagementMeter.js +1 -143
  30. package/dist/node/components/TipCard.js +1 -89
  31. package/dist/node/components/TipFeed.js +1 -90
  32. package/dist/node/components/index.js +1 -320
  33. package/dist/node/docs/index.js +2 -16
  34. package/dist/node/docs/learning-journey-ui-coaching.docblock.js +2 -16
  35. package/dist/node/example.js +1 -32
  36. package/dist/node/index.js +2 -1129
  37. package/dist/node/learning-journey-ui-coaching.feature.js +1 -18
  38. package/dist/node/views/Overview.js +1 -303
  39. package/dist/node/views/Progress.js +1 -344
  40. package/dist/node/views/Steps.js +1 -159
  41. package/dist/node/views/Timeline.js +1 -266
  42. package/dist/node/views/index.js +1 -980
  43. package/dist/views/Overview.js +1 -303
  44. package/dist/views/Progress.js +1 -344
  45. package/dist/views/Steps.js +1 -159
  46. package/dist/views/Timeline.js +1 -266
  47. package/dist/views/index.js +1 -980
  48. package/package.json +12 -12
@@ -1,304 +1,2 @@
1
1
  // @bun
2
- // src/components/TipCard.tsx
3
- import { Button } from "@contractspec/lib.design-system";
4
- import { Card, CardContent } from "@contractspec/lib.ui-kit-web/ui/card";
5
- import { cn } from "@contractspec/lib.ui-kit-web/ui/utils";
6
- import { jsxDEV } from "react/jsx-dev-runtime";
7
- "use client";
8
- var TIP_ICONS = {
9
- cash_buffer_too_high: "\uD83D\uDCB0",
10
- no_savings_goal: "\uD83C\uDFAF",
11
- irregular_savings: "\uD83D\uDCC5",
12
- noise_late_evening: "\uD83D\uDD07",
13
- guest_frequency_high: "\uD83D\uDC65",
14
- shared_space_conflicts: "\uD83C\uDFE0",
15
- default: "\uD83D\uDCA1"
16
- };
17
- function TipCard({
18
- step,
19
- isCompleted,
20
- isCurrent,
21
- onComplete,
22
- onDismiss
23
- }) {
24
- const tipId = step.metadata?.tipId ?? "default";
25
- const icon = TIP_ICONS[tipId] ?? TIP_ICONS.default;
26
- return /* @__PURE__ */ jsxDEV(Card, {
27
- className: cn("transition-all", isCompleted && "opacity-60", isCurrent && "ring-2 ring-amber-500"),
28
- children: /* @__PURE__ */ jsxDEV(CardContent, {
29
- className: "p-4",
30
- children: /* @__PURE__ */ jsxDEV("div", {
31
- className: "flex gap-4",
32
- children: [
33
- /* @__PURE__ */ jsxDEV("div", {
34
- className: cn("flex h-12 w-12 shrink-0 items-center justify-center rounded-xl text-2xl", isCompleted ? "bg-green-500/10" : isCurrent ? "bg-amber-500/10" : "bg-muted"),
35
- children: isCompleted ? "\u2713" : icon
36
- }, undefined, false, undefined, this),
37
- /* @__PURE__ */ jsxDEV("div", {
38
- className: "min-w-0 flex-1",
39
- children: [
40
- /* @__PURE__ */ jsxDEV("div", {
41
- className: "flex items-start justify-between gap-2",
42
- children: [
43
- /* @__PURE__ */ jsxDEV("h4", {
44
- className: "font-semibold",
45
- children: step.title
46
- }, undefined, false, undefined, this),
47
- step.xpReward && /* @__PURE__ */ jsxDEV("span", {
48
- className: cn("shrink-0 rounded-full px-2 py-0.5 font-semibold text-xs", isCompleted ? "bg-green-500/10 text-green-500" : "bg-amber-500/10 text-amber-500"),
49
- children: [
50
- "+",
51
- step.xpReward,
52
- " XP"
53
- ]
54
- }, undefined, true, undefined, this)
55
- ]
56
- }, undefined, true, undefined, this),
57
- /* @__PURE__ */ jsxDEV("p", {
58
- className: "mt-1 text-muted-foreground text-sm",
59
- children: step.description
60
- }, undefined, false, undefined, this),
61
- !isCompleted && /* @__PURE__ */ jsxDEV("div", {
62
- className: "mt-3 flex flex-wrap gap-2",
63
- children: [
64
- /* @__PURE__ */ jsxDEV(Button, {
65
- size: "sm",
66
- onClick: onComplete,
67
- children: "Take Action"
68
- }, undefined, false, undefined, this),
69
- /* @__PURE__ */ jsxDEV(Button, {
70
- variant: "outline",
71
- size: "sm",
72
- onClick: onDismiss,
73
- children: "Dismiss"
74
- }, undefined, false, undefined, this)
75
- ]
76
- }, undefined, true, undefined, this),
77
- isCompleted && /* @__PURE__ */ jsxDEV("p", {
78
- className: "mt-2 text-green-500 text-sm",
79
- children: "\u2713 Tip acknowledged"
80
- }, undefined, false, undefined, this)
81
- ]
82
- }, undefined, true, undefined, this)
83
- ]
84
- }, undefined, true, undefined, this)
85
- }, undefined, false, undefined, this)
86
- }, undefined, false, undefined, this);
87
- }
88
-
89
- // src/views/Overview.tsx
90
- import {
91
- StreakCounter,
92
- XpBar
93
- } from "@contractspec/example.learning-journey-ui-shared";
94
- import { Button as Button2 } from "@contractspec/lib.design-system";
95
- import {
96
- Card as Card2,
97
- CardContent as CardContent2,
98
- CardHeader,
99
- CardTitle
100
- } from "@contractspec/lib.ui-kit-web/ui/card";
101
- import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
102
- "use client";
103
- function Overview({
104
- track,
105
- progress,
106
- onStepComplete,
107
- onStart
108
- }) {
109
- const totalXp = track.totalXp ?? track.steps.reduce((sum, s) => sum + (s.xpReward ?? 0), 0);
110
- const completedSteps = progress.completedStepIds.length;
111
- const totalSteps = track.steps.length;
112
- const pendingSteps = totalSteps - completedSteps;
113
- const activeTips = track.steps.filter((s) => !progress.completedStepIds.includes(s.id)).slice(0, 3);
114
- return /* @__PURE__ */ jsxDEV2("div", {
115
- className: "space-y-6",
116
- children: [
117
- /* @__PURE__ */ jsxDEV2(Card2, {
118
- className: "overflow-hidden bg-gradient-to-br from-amber-500/10 via-orange-500/10 to-red-500/10",
119
- children: /* @__PURE__ */ jsxDEV2(CardContent2, {
120
- className: "p-6",
121
- children: /* @__PURE__ */ jsxDEV2("div", {
122
- className: "flex flex-col items-center gap-4 text-center md:flex-row md:text-left",
123
- children: [
124
- /* @__PURE__ */ jsxDEV2("div", {
125
- className: "flex h-16 w-16 items-center justify-center rounded-2xl bg-gradient-to-br from-amber-500 to-orange-600 text-3xl shadow-lg",
126
- children: "\uD83D\uDCA1"
127
- }, undefined, false, undefined, this),
128
- /* @__PURE__ */ jsxDEV2("div", {
129
- className: "flex-1",
130
- children: [
131
- /* @__PURE__ */ jsxDEV2("h1", {
132
- className: "font-bold text-2xl",
133
- children: track.name
134
- }, undefined, false, undefined, this),
135
- /* @__PURE__ */ jsxDEV2("p", {
136
- className: "mt-1 text-muted-foreground",
137
- children: track.description
138
- }, undefined, false, undefined, this)
139
- ]
140
- }, undefined, true, undefined, this),
141
- /* @__PURE__ */ jsxDEV2("div", {
142
- className: "flex items-center gap-4",
143
- children: /* @__PURE__ */ jsxDEV2(StreakCounter, {
144
- days: progress.streakDays,
145
- size: "lg"
146
- }, undefined, false, undefined, this)
147
- }, undefined, false, undefined, this)
148
- ]
149
- }, undefined, true, undefined, this)
150
- }, undefined, false, undefined, this)
151
- }, undefined, false, undefined, this),
152
- /* @__PURE__ */ jsxDEV2("div", {
153
- className: "grid gap-4 md:grid-cols-3",
154
- children: [
155
- /* @__PURE__ */ jsxDEV2(Card2, {
156
- children: [
157
- /* @__PURE__ */ jsxDEV2(CardHeader, {
158
- className: "pb-2",
159
- children: /* @__PURE__ */ jsxDEV2(CardTitle, {
160
- className: "font-medium text-muted-foreground text-sm",
161
- children: "Active Tips"
162
- }, undefined, false, undefined, this)
163
- }, undefined, false, undefined, this),
164
- /* @__PURE__ */ jsxDEV2(CardContent2, {
165
- children: [
166
- /* @__PURE__ */ jsxDEV2("div", {
167
- className: "font-bold text-3xl text-amber-500",
168
- children: pendingSteps
169
- }, undefined, false, undefined, this),
170
- /* @__PURE__ */ jsxDEV2("p", {
171
- className: "text-muted-foreground text-sm",
172
- children: "tips for you today"
173
- }, undefined, false, undefined, this)
174
- ]
175
- }, undefined, true, undefined, this)
176
- ]
177
- }, undefined, true, undefined, this),
178
- /* @__PURE__ */ jsxDEV2(Card2, {
179
- children: [
180
- /* @__PURE__ */ jsxDEV2(CardHeader, {
181
- className: "pb-2",
182
- children: /* @__PURE__ */ jsxDEV2(CardTitle, {
183
- className: "font-medium text-muted-foreground text-sm",
184
- children: "Tips Actioned"
185
- }, undefined, false, undefined, this)
186
- }, undefined, false, undefined, this),
187
- /* @__PURE__ */ jsxDEV2(CardContent2, {
188
- children: [
189
- /* @__PURE__ */ jsxDEV2("div", {
190
- className: "font-bold text-3xl text-green-500",
191
- children: completedSteps
192
- }, undefined, false, undefined, this),
193
- /* @__PURE__ */ jsxDEV2("p", {
194
- className: "text-muted-foreground text-sm",
195
- children: [
196
- "out of ",
197
- totalSteps,
198
- " total"
199
- ]
200
- }, undefined, true, undefined, this)
201
- ]
202
- }, undefined, true, undefined, this)
203
- ]
204
- }, undefined, true, undefined, this),
205
- /* @__PURE__ */ jsxDEV2(Card2, {
206
- children: [
207
- /* @__PURE__ */ jsxDEV2(CardHeader, {
208
- className: "pb-2",
209
- children: /* @__PURE__ */ jsxDEV2(CardTitle, {
210
- className: "font-medium text-muted-foreground text-sm",
211
- children: "XP Earned"
212
- }, undefined, false, undefined, this)
213
- }, undefined, false, undefined, this),
214
- /* @__PURE__ */ jsxDEV2(CardContent2, {
215
- children: [
216
- /* @__PURE__ */ jsxDEV2("div", {
217
- className: "font-bold text-3xl text-orange-500",
218
- children: progress.xpEarned
219
- }, undefined, false, undefined, this),
220
- /* @__PURE__ */ jsxDEV2(XpBar, {
221
- current: progress.xpEarned,
222
- max: totalXp,
223
- showLabel: false,
224
- size: "sm"
225
- }, undefined, false, undefined, this)
226
- ]
227
- }, undefined, true, undefined, this)
228
- ]
229
- }, undefined, true, undefined, this)
230
- ]
231
- }, undefined, true, undefined, this),
232
- activeTips.length > 0 && /* @__PURE__ */ jsxDEV2(Card2, {
233
- children: [
234
- /* @__PURE__ */ jsxDEV2(CardHeader, {
235
- className: "flex flex-row items-center justify-between",
236
- children: [
237
- /* @__PURE__ */ jsxDEV2(CardTitle, {
238
- className: "flex items-center gap-2",
239
- children: [
240
- /* @__PURE__ */ jsxDEV2("span", {
241
- children: "\uD83D\uDCA1"
242
- }, undefined, false, undefined, this),
243
- /* @__PURE__ */ jsxDEV2("span", {
244
- children: "Tips for You"
245
- }, undefined, false, undefined, this)
246
- ]
247
- }, undefined, true, undefined, this),
248
- activeTips.length < pendingSteps && /* @__PURE__ */ jsxDEV2(Button2, {
249
- variant: "outline",
250
- size: "sm",
251
- onClick: onStart,
252
- children: [
253
- "View All (",
254
- pendingSteps,
255
- ")"
256
- ]
257
- }, undefined, true, undefined, this)
258
- ]
259
- }, undefined, true, undefined, this),
260
- /* @__PURE__ */ jsxDEV2(CardContent2, {
261
- className: "space-y-3",
262
- children: activeTips.map((step) => /* @__PURE__ */ jsxDEV2(TipCard, {
263
- step,
264
- isCompleted: false,
265
- isCurrent: step.id === activeTips[0]?.id,
266
- onComplete: () => onStepComplete?.(step.id)
267
- }, step.id, false, undefined, this))
268
- }, undefined, false, undefined, this)
269
- ]
270
- }, undefined, true, undefined, this),
271
- pendingSteps === 0 && /* @__PURE__ */ jsxDEV2(Card2, {
272
- className: "border-green-500/50 bg-green-500/5",
273
- children: /* @__PURE__ */ jsxDEV2(CardContent2, {
274
- className: "flex items-center gap-4 p-6",
275
- children: [
276
- /* @__PURE__ */ jsxDEV2("div", {
277
- className: "text-4xl",
278
- children: "\uD83C\uDF89"
279
- }, undefined, false, undefined, this),
280
- /* @__PURE__ */ jsxDEV2("div", {
281
- children: [
282
- /* @__PURE__ */ jsxDEV2("h3", {
283
- className: "font-semibold text-green-500 text-lg",
284
- children: "All Tips Actioned!"
285
- }, undefined, false, undefined, this),
286
- /* @__PURE__ */ jsxDEV2("p", {
287
- className: "text-muted-foreground",
288
- children: [
289
- "Great job! You've addressed all ",
290
- totalSteps,
291
- " coaching tips."
292
- ]
293
- }, undefined, true, undefined, this)
294
- ]
295
- }, undefined, true, undefined, this)
296
- ]
297
- }, undefined, true, undefined, this)
298
- }, undefined, false, undefined, this)
299
- ]
300
- }, undefined, true, undefined, this);
301
- }
302
- export {
303
- Overview
304
- };
2
+ import{Button as Z}from"@contractspec/lib.design-system";import{Card as N,CardContent as O}from"@contractspec/lib.ui-kit-web/ui/card";import{cn as Y}from"@contractspec/lib.ui-kit-web/ui/utils";import{jsx as A,jsxs as J}from"react/jsx-runtime";var $={cash_buffer_too_high:"\uD83D\uDCB0",no_savings_goal:"\uD83C\uDFAF",irregular_savings:"\uD83D\uDCC5",noise_late_evening:"\uD83D\uDD07",guest_frequency_high:"\uD83D\uDC65",shared_space_conflicts:"\uD83C\uDFE0",default:"\uD83D\uDCA1"};function w({step:q,isCompleted:y,isCurrent:K,onComplete:V,onDismiss:W}){let L=q.metadata?.tipId??"default",G=$[L]??$.default;return A(N,{className:Y("transition-all",y&&"opacity-60",K&&"ring-2 ring-amber-500"),children:A(O,{className:"p-4",children:J("div",{className:"flex gap-4",children:[A("div",{className:Y("flex h-12 w-12 shrink-0 items-center justify-center rounded-xl text-2xl",y?"bg-green-500/10":K?"bg-amber-500/10":"bg-muted"),children:y?"\u2713":G}),J("div",{className:"min-w-0 flex-1",children:[J("div",{className:"flex items-start justify-between gap-2",children:[A("h4",{className:"font-semibold",children:q.title}),q.xpReward&&J("span",{className:Y("shrink-0 rounded-full px-2 py-0.5 font-semibold text-xs",y?"bg-green-500/10 text-green-500":"bg-amber-500/10 text-amber-500"),children:["+",q.xpReward," XP"]})]}),A("p",{className:"mt-1 text-muted-foreground text-sm",children:q.description}),!y&&J("div",{className:"mt-3 flex flex-wrap gap-2",children:[A(Z,{size:"sm",onClick:V,children:"Take Action"}),A(Z,{variant:"outline",size:"sm",onClick:W,children:"Dismiss"})]}),y&&A("p",{className:"mt-2 text-green-500 text-sm",children:"\u2713 Tip acknowledged"})]})]})})})}import{StreakCounter as P,XpBar as X}from"@contractspec/example.learning-journey-ui-shared";import{Button as _}from"@contractspec/lib.design-system";import{Card as E,CardContent as F,CardHeader as R,CardTitle as U}from"@contractspec/lib.ui-kit-web/ui/card";import{jsx as f,jsxs as h}from"react/jsx-runtime";function u({track:q,progress:y,onStepComplete:K,onStart:V}){let W=q.totalXp??q.steps.reduce((z,D)=>z+(D.xpReward??0),0),L=y.completedStepIds.length,G=q.steps.length,M=G-L,Q=q.steps.filter((z)=>!y.completedStepIds.includes(z.id)).slice(0,3);return h("div",{className:"space-y-6",children:[f(E,{className:"overflow-hidden bg-gradient-to-br from-amber-500/10 via-orange-500/10 to-red-500/10",children:f(F,{className:"p-6",children:h("div",{className:"flex flex-col items-center gap-4 text-center md:flex-row md:text-left",children:[f("div",{className:"flex h-16 w-16 items-center justify-center rounded-2xl bg-gradient-to-br from-amber-500 to-orange-600 text-3xl shadow-lg",children:"\uD83D\uDCA1"}),h("div",{className:"flex-1",children:[f("h1",{className:"font-bold text-2xl",children:q.name}),f("p",{className:"mt-1 text-muted-foreground",children:q.description})]}),f("div",{className:"flex items-center gap-4",children:f(P,{days:y.streakDays,size:"lg"})})]})})}),h("div",{className:"grid gap-4 md:grid-cols-3",children:[h(E,{children:[f(R,{className:"pb-2",children:f(U,{className:"font-medium text-muted-foreground text-sm",children:"Active Tips"})}),h(F,{children:[f("div",{className:"font-bold text-3xl text-amber-500",children:M}),f("p",{className:"text-muted-foreground text-sm",children:"tips for you today"})]})]}),h(E,{children:[f(R,{className:"pb-2",children:f(U,{className:"font-medium text-muted-foreground text-sm",children:"Tips Actioned"})}),h(F,{children:[f("div",{className:"font-bold text-3xl text-green-500",children:L}),h("p",{className:"text-muted-foreground text-sm",children:["out of ",G," total"]})]})]}),h(E,{children:[f(R,{className:"pb-2",children:f(U,{className:"font-medium text-muted-foreground text-sm",children:"XP Earned"})}),h(F,{children:[f("div",{className:"font-bold text-3xl text-orange-500",children:y.xpEarned}),f(X,{current:y.xpEarned,max:W,showLabel:!1,size:"sm"})]})]})]}),Q.length>0&&h(E,{children:[h(R,{className:"flex flex-row items-center justify-between",children:[h(U,{className:"flex items-center gap-2",children:[f("span",{children:"\uD83D\uDCA1"}),f("span",{children:"Tips for You"})]}),Q.length<M&&h(_,{variant:"outline",size:"sm",onClick:V,children:["View All (",M,")"]})]}),f(F,{className:"space-y-3",children:Q.map((z)=>f(w,{step:z,isCompleted:!1,isCurrent:z.id===Q[0]?.id,onComplete:()=>K?.(z.id)},z.id))})]}),M===0&&f(E,{className:"border-green-500/50 bg-green-500/5",children:h(F,{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:"All Tips Actioned!"}),h("p",{className:"text-muted-foreground",children:["Great job! You've addressed all ",G," coaching tips."]})]})]})})]})}export{u as Overview};
@@ -1,345 +1,2 @@
1
1
  // @bun
2
- // src/components/EngagementMeter.tsx
3
- import { jsxDEV } from "react/jsx-dev-runtime";
4
- "use client";
5
- function EngagementMeter({
6
- acknowledged,
7
- actioned,
8
- pending,
9
- streak = 0
10
- }) {
11
- const total = acknowledged + actioned + pending;
12
- const actionedPercent = total > 0 ? actioned / total * 100 : 0;
13
- const acknowledgedPercent = total > 0 ? acknowledged / total * 100 : 0;
14
- return /* @__PURE__ */ jsxDEV("div", {
15
- className: "space-y-4",
16
- children: [
17
- /* @__PURE__ */ jsxDEV("div", {
18
- className: "flex items-center justify-center",
19
- children: /* @__PURE__ */ jsxDEV("div", {
20
- className: "relative h-32 w-32",
21
- children: [
22
- /* @__PURE__ */ jsxDEV("svg", {
23
- className: "h-full w-full -rotate-90",
24
- viewBox: "0 0 100 100",
25
- children: [
26
- /* @__PURE__ */ jsxDEV("circle", {
27
- cx: "50",
28
- cy: "50",
29
- r: "40",
30
- fill: "none",
31
- strokeWidth: "12",
32
- className: "stroke-muted"
33
- }, undefined, false, undefined, this),
34
- /* @__PURE__ */ jsxDEV("circle", {
35
- cx: "50",
36
- cy: "50",
37
- r: "40",
38
- fill: "none",
39
- strokeWidth: "12",
40
- strokeLinecap: "round",
41
- strokeDasharray: `${actionedPercent * 2.51} 251`,
42
- className: "stroke-green-500 transition-all duration-500"
43
- }, undefined, false, undefined, this),
44
- /* @__PURE__ */ jsxDEV("circle", {
45
- cx: "50",
46
- cy: "50",
47
- r: "40",
48
- fill: "none",
49
- strokeWidth: "12",
50
- strokeLinecap: "round",
51
- strokeDasharray: `${acknowledgedPercent * 2.51} 251`,
52
- strokeDashoffset: `${-actionedPercent * 2.51}`,
53
- className: "stroke-amber-500 transition-all duration-500"
54
- }, undefined, false, undefined, this)
55
- ]
56
- }, undefined, true, undefined, this),
57
- /* @__PURE__ */ jsxDEV("div", {
58
- className: "absolute inset-0 flex flex-col items-center justify-center",
59
- children: [
60
- /* @__PURE__ */ jsxDEV("span", {
61
- className: "font-bold text-2xl",
62
- children: total
63
- }, undefined, false, undefined, this),
64
- /* @__PURE__ */ jsxDEV("span", {
65
- className: "text-muted-foreground text-xs",
66
- children: "tips"
67
- }, undefined, false, undefined, this)
68
- ]
69
- }, undefined, true, undefined, this)
70
- ]
71
- }, undefined, true, undefined, this)
72
- }, undefined, false, undefined, this),
73
- /* @__PURE__ */ jsxDEV("div", {
74
- className: "flex justify-center gap-4 text-sm",
75
- children: [
76
- /* @__PURE__ */ jsxDEV("div", {
77
- className: "flex items-center gap-1.5",
78
- children: [
79
- /* @__PURE__ */ jsxDEV("div", {
80
- className: "h-3 w-3 rounded-full bg-green-500"
81
- }, undefined, false, undefined, this),
82
- /* @__PURE__ */ jsxDEV("span", {
83
- children: [
84
- "Actioned (",
85
- actioned,
86
- ")"
87
- ]
88
- }, undefined, true, undefined, this)
89
- ]
90
- }, undefined, true, undefined, this),
91
- /* @__PURE__ */ jsxDEV("div", {
92
- className: "flex items-center gap-1.5",
93
- children: [
94
- /* @__PURE__ */ jsxDEV("div", {
95
- className: "h-3 w-3 rounded-full bg-amber-500"
96
- }, undefined, false, undefined, this),
97
- /* @__PURE__ */ jsxDEV("span", {
98
- children: [
99
- "Acknowledged (",
100
- acknowledged,
101
- ")"
102
- ]
103
- }, undefined, true, undefined, this)
104
- ]
105
- }, undefined, true, undefined, this),
106
- /* @__PURE__ */ jsxDEV("div", {
107
- className: "flex items-center gap-1.5",
108
- children: [
109
- /* @__PURE__ */ jsxDEV("div", {
110
- className: "h-3 w-3 rounded-full bg-muted"
111
- }, undefined, false, undefined, this),
112
- /* @__PURE__ */ jsxDEV("span", {
113
- children: [
114
- "Pending (",
115
- pending,
116
- ")"
117
- ]
118
- }, undefined, true, undefined, this)
119
- ]
120
- }, undefined, true, undefined, this)
121
- ]
122
- }, undefined, true, undefined, this),
123
- streak > 0 && /* @__PURE__ */ jsxDEV("div", {
124
- className: "flex items-center justify-center gap-2 rounded-lg bg-orange-500/10 px-4 py-2",
125
- children: [
126
- /* @__PURE__ */ jsxDEV("span", {
127
- className: "text-xl",
128
- children: "\uD83D\uDD25"
129
- }, undefined, false, undefined, this),
130
- /* @__PURE__ */ jsxDEV("span", {
131
- className: "font-semibold text-orange-500",
132
- children: [
133
- streak,
134
- " day engagement streak!"
135
- ]
136
- }, undefined, true, undefined, this)
137
- ]
138
- }, undefined, true, undefined, this)
139
- ]
140
- }, undefined, true, undefined, this);
141
- }
142
-
143
- // src/views/Progress.tsx
144
- import {
145
- BadgeDisplay,
146
- StreakCounter,
147
- XpBar
148
- } from "@contractspec/example.learning-journey-ui-shared";
149
- import {
150
- Card,
151
- CardContent,
152
- CardHeader,
153
- CardTitle
154
- } from "@contractspec/lib.ui-kit-web/ui/card";
155
- import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
156
- "use client";
157
- function ProgressView({ track, progress }) {
158
- const totalXp = track.totalXp ?? track.steps.reduce((sum, s) => sum + (s.xpReward ?? 0), 0);
159
- const completedSteps = progress.completedStepIds.length;
160
- const totalSteps = track.steps.length;
161
- const pendingSteps = totalSteps - completedSteps;
162
- const actioned = Math.floor(completedSteps * 0.7);
163
- const acknowledged = completedSteps - actioned;
164
- return /* @__PURE__ */ jsxDEV2("div", {
165
- className: "space-y-6",
166
- children: [
167
- /* @__PURE__ */ jsxDEV2(Card, {
168
- children: [
169
- /* @__PURE__ */ jsxDEV2(CardHeader, {
170
- children: /* @__PURE__ */ jsxDEV2(CardTitle, {
171
- className: "flex items-center gap-2",
172
- children: [
173
- /* @__PURE__ */ jsxDEV2("span", {
174
- children: "\uD83D\uDCCA"
175
- }, undefined, false, undefined, this),
176
- /* @__PURE__ */ jsxDEV2("span", {
177
- children: "Engagement Overview"
178
- }, undefined, false, undefined, this)
179
- ]
180
- }, undefined, true, undefined, this)
181
- }, undefined, false, undefined, this),
182
- /* @__PURE__ */ jsxDEV2(CardContent, {
183
- children: /* @__PURE__ */ jsxDEV2(EngagementMeter, {
184
- actioned,
185
- acknowledged,
186
- pending: pendingSteps,
187
- streak: progress.streakDays
188
- }, undefined, false, undefined, this)
189
- }, undefined, false, undefined, this)
190
- ]
191
- }, undefined, true, undefined, this),
192
- /* @__PURE__ */ jsxDEV2("div", {
193
- className: "grid gap-4 md:grid-cols-2",
194
- children: [
195
- /* @__PURE__ */ jsxDEV2(Card, {
196
- children: [
197
- /* @__PURE__ */ jsxDEV2(CardHeader, {
198
- className: "pb-2",
199
- children: /* @__PURE__ */ jsxDEV2(CardTitle, {
200
- className: "font-medium text-muted-foreground text-sm",
201
- children: "XP Earned"
202
- }, undefined, false, undefined, this)
203
- }, undefined, false, undefined, this),
204
- /* @__PURE__ */ jsxDEV2(CardContent, {
205
- className: "space-y-3",
206
- children: [
207
- /* @__PURE__ */ jsxDEV2("div", {
208
- className: "flex items-baseline gap-2",
209
- children: [
210
- /* @__PURE__ */ jsxDEV2("span", {
211
- className: "font-bold text-3xl text-orange-500",
212
- children: progress.xpEarned
213
- }, undefined, false, undefined, this),
214
- /* @__PURE__ */ jsxDEV2("span", {
215
- className: "text-muted-foreground",
216
- children: [
217
- "/ ",
218
- totalXp,
219
- " XP"
220
- ]
221
- }, undefined, true, undefined, this)
222
- ]
223
- }, undefined, true, undefined, this),
224
- /* @__PURE__ */ jsxDEV2(XpBar, {
225
- current: progress.xpEarned,
226
- max: totalXp,
227
- showLabel: false,
228
- size: "lg"
229
- }, undefined, false, undefined, this)
230
- ]
231
- }, undefined, true, undefined, this)
232
- ]
233
- }, undefined, true, undefined, this),
234
- /* @__PURE__ */ jsxDEV2(Card, {
235
- children: [
236
- /* @__PURE__ */ jsxDEV2(CardHeader, {
237
- className: "pb-2",
238
- children: /* @__PURE__ */ jsxDEV2(CardTitle, {
239
- className: "font-medium text-muted-foreground text-sm",
240
- children: "Engagement Streak"
241
- }, undefined, false, undefined, this)
242
- }, undefined, false, undefined, this),
243
- /* @__PURE__ */ jsxDEV2(CardContent, {
244
- children: /* @__PURE__ */ jsxDEV2("div", {
245
- className: "flex items-center gap-4",
246
- children: [
247
- /* @__PURE__ */ jsxDEV2(StreakCounter, {
248
- days: progress.streakDays,
249
- size: "lg"
250
- }, undefined, false, undefined, this),
251
- /* @__PURE__ */ jsxDEV2("div", {
252
- className: "text-muted-foreground text-sm",
253
- children: progress.streakDays > 0 ? "Keep going!" : "Start your streak today!"
254
- }, undefined, false, undefined, this)
255
- ]
256
- }, undefined, true, undefined, this)
257
- }, undefined, false, undefined, this)
258
- ]
259
- }, undefined, true, undefined, this)
260
- ]
261
- }, undefined, true, undefined, this),
262
- /* @__PURE__ */ jsxDEV2(Card, {
263
- children: [
264
- /* @__PURE__ */ jsxDEV2(CardHeader, {
265
- children: /* @__PURE__ */ jsxDEV2(CardTitle, {
266
- className: "flex items-center gap-2",
267
- children: [
268
- /* @__PURE__ */ jsxDEV2("span", {
269
- children: "\uD83C\uDFC5"
270
- }, undefined, false, undefined, this),
271
- /* @__PURE__ */ jsxDEV2("span", {
272
- children: "Achievements"
273
- }, undefined, false, undefined, this)
274
- ]
275
- }, undefined, true, undefined, this)
276
- }, undefined, false, undefined, this),
277
- /* @__PURE__ */ jsxDEV2(CardContent, {
278
- children: [
279
- /* @__PURE__ */ jsxDEV2(BadgeDisplay, {
280
- badges: progress.badges,
281
- size: "lg",
282
- maxVisible: 10
283
- }, undefined, false, undefined, this),
284
- progress.badges.length === 0 && /* @__PURE__ */ jsxDEV2("p", {
285
- className: "text-muted-foreground text-sm",
286
- children: "Action tips to unlock achievements!"
287
- }, undefined, false, undefined, this)
288
- ]
289
- }, undefined, true, undefined, this)
290
- ]
291
- }, undefined, true, undefined, this),
292
- /* @__PURE__ */ jsxDEV2(Card, {
293
- children: [
294
- /* @__PURE__ */ jsxDEV2(CardHeader, {
295
- children: /* @__PURE__ */ jsxDEV2(CardTitle, {
296
- className: "flex items-center gap-2",
297
- children: [
298
- /* @__PURE__ */ jsxDEV2("span", {
299
- children: "\uD83D\uDCA1"
300
- }, undefined, false, undefined, this),
301
- /* @__PURE__ */ jsxDEV2("span", {
302
- children: "Tip Status"
303
- }, undefined, false, undefined, this)
304
- ]
305
- }, undefined, true, undefined, this)
306
- }, undefined, false, undefined, this),
307
- /* @__PURE__ */ jsxDEV2(CardContent, {
308
- children: /* @__PURE__ */ jsxDEV2("div", {
309
- className: "space-y-3",
310
- children: track.steps.map((step) => {
311
- const isCompleted = progress.completedStepIds.includes(step.id);
312
- return /* @__PURE__ */ jsxDEV2("div", {
313
- className: "flex items-center justify-between rounded-lg border p-3",
314
- children: [
315
- /* @__PURE__ */ jsxDEV2("div", {
316
- className: "flex items-center gap-3",
317
- children: [
318
- /* @__PURE__ */ jsxDEV2("span", {
319
- className: isCompleted ? "text-green-500" : "text-amber-500",
320
- children: isCompleted ? "\u2713" : "\u25CB"
321
- }, undefined, false, undefined, this),
322
- /* @__PURE__ */ jsxDEV2("span", {
323
- className: isCompleted ? "text-muted-foreground" : "text-foreground",
324
- children: step.title
325
- }, undefined, false, undefined, this)
326
- ]
327
- }, undefined, true, undefined, this),
328
- /* @__PURE__ */ jsxDEV2("span", {
329
- className: `text-sm ${isCompleted ? "text-green-500" : "text-muted-foreground"}`,
330
- children: isCompleted ? "Actioned" : "Pending"
331
- }, undefined, false, undefined, this)
332
- ]
333
- }, step.id, true, undefined, this);
334
- })
335
- }, undefined, false, undefined, this)
336
- }, undefined, false, undefined, this)
337
- ]
338
- }, undefined, true, undefined, this)
339
- ]
340
- }, undefined, true, undefined, this);
341
- }
342
- export {
343
- ProgressView,
344
- ProgressView as Progress
345
- };
2
+ import{jsx as F,jsxs as z}from"react/jsx-runtime";function _({acknowledged:G,actioned:v,pending:N,streak:J=0}){let K=G+v+N,Y=K>0?v/K*100:0,Z=K>0?G/K*100:0;return z("div",{className:"space-y-4",children:[F("div",{className:"flex items-center justify-center",children:z("div",{className:"relative h-32 w-32",children:[z("svg",{className:"h-full w-full -rotate-90",viewBox:"0 0 100 100",children:[F("circle",{cx:"50",cy:"50",r:"40",fill:"none",strokeWidth:"12",className:"stroke-muted"}),F("circle",{cx:"50",cy:"50",r:"40",fill:"none",strokeWidth:"12",strokeLinecap:"round",strokeDasharray:`${Y*2.51} 251`,className:"stroke-green-500 transition-all duration-500"}),F("circle",{cx:"50",cy:"50",r:"40",fill:"none",strokeWidth:"12",strokeLinecap:"round",strokeDasharray:`${Z*2.51} 251`,strokeDashoffset:`${-Y*2.51}`,className:"stroke-amber-500 transition-all duration-500"})]}),z("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[F("span",{className:"font-bold text-2xl",children:K}),F("span",{className:"text-muted-foreground text-xs",children:"tips"})]})]})}),z("div",{className:"flex justify-center gap-4 text-sm",children:[z("div",{className:"flex items-center gap-1.5",children:[F("div",{className:"h-3 w-3 rounded-full bg-green-500"}),z("span",{children:["Actioned (",v,")"]})]}),z("div",{className:"flex items-center gap-1.5",children:[F("div",{className:"h-3 w-3 rounded-full bg-amber-500"}),z("span",{children:["Acknowledged (",G,")"]})]}),z("div",{className:"flex items-center gap-1.5",children:[F("div",{className:"h-3 w-3 rounded-full bg-muted"}),z("span",{children:["Pending (",N,")"]})]})]}),J>0&&z("div",{className:"flex items-center justify-center gap-2 rounded-lg bg-orange-500/10 px-4 py-2",children:[F("span",{className:"text-xl",children:"\uD83D\uDD25"}),z("span",{className:"font-semibold text-orange-500",children:[J," day engagement streak!"]})]})]})}import{BadgeDisplay as A,StreakCounter as D,XpBar as L}from"@contractspec/example.learning-journey-ui-shared";import{Card as Q,CardContent as R,CardHeader as U,CardTitle as W}from"@contractspec/lib.ui-kit-web/ui/card";import{jsx as h,jsxs as q}from"react/jsx-runtime";function M({track:G,progress:v}){let N=G.totalXp??G.steps.reduce((O,I)=>O+(I.xpReward??0),0),J=v.completedStepIds.length,Y=G.steps.length-J,Z=Math.floor(J*0.7),$=J-Z;return q("div",{className:"space-y-6",children:[q(Q,{children:[h(U,{children:q(W,{className:"flex items-center gap-2",children:[h("span",{children:"\uD83D\uDCCA"}),h("span",{children:"Engagement Overview"})]})}),h(R,{children:h(_,{actioned:Z,acknowledged:$,pending:Y,streak:v.streakDays})})]}),q("div",{className:"grid gap-4 md:grid-cols-2",children:[q(Q,{children:[h(U,{className:"pb-2",children:h(W,{className:"font-medium text-muted-foreground text-sm",children:"XP Earned"})}),q(R,{className:"space-y-3",children:[q("div",{className:"flex items-baseline gap-2",children:[h("span",{className:"font-bold text-3xl text-orange-500",children:v.xpEarned}),q("span",{className:"text-muted-foreground",children:["/ ",N," XP"]})]}),h(L,{current:v.xpEarned,max:N,showLabel:!1,size:"lg"})]})]}),q(Q,{children:[h(U,{className:"pb-2",children:h(W,{className:"font-medium text-muted-foreground text-sm",children:"Engagement Streak"})}),h(R,{children:q("div",{className:"flex items-center gap-4",children:[h(D,{days:v.streakDays,size:"lg"}),h("div",{className:"text-muted-foreground text-sm",children:v.streakDays>0?"Keep going!":"Start your streak today!"})]})})]})]}),q(Q,{children:[h(U,{children:q(W,{className:"flex items-center gap-2",children:[h("span",{children:"\uD83C\uDFC5"}),h("span",{children:"Achievements"})]})}),q(R,{children:[h(A,{badges:v.badges,size:"lg",maxVisible:10}),v.badges.length===0&&h("p",{className:"text-muted-foreground text-sm",children:"Action tips to unlock achievements!"})]})]}),q(Q,{children:[h(U,{children:q(W,{className:"flex items-center gap-2",children:[h("span",{children:"\uD83D\uDCA1"}),h("span",{children:"Tip Status"})]})}),h(R,{children:h("div",{className:"space-y-3",children:G.steps.map((O)=>{let I=v.completedStepIds.includes(O.id);return q("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[q("div",{className:"flex items-center gap-3",children:[h("span",{className:I?"text-green-500":"text-amber-500",children:I?"\u2713":"\u25CB"}),h("span",{className:I?"text-muted-foreground":"text-foreground",children:O.title})]}),h("span",{className:`text-sm ${I?"text-green-500":"text-muted-foreground"}`,children:I?"Actioned":"Pending"})]},O.id)})})})]})]})}export{M as ProgressView,M as Progress};