@contractspec/example.learning-journey-ui-coaching 3.7.17 → 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 +48 -48
  2. package/CHANGELOG.md +17 -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 +11 -11
@@ -1,981 +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
-
303
- // src/components/EngagementMeter.tsx
304
- import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
305
- "use client";
306
- function EngagementMeter({
307
- acknowledged,
308
- actioned,
309
- pending,
310
- streak = 0
311
- }) {
312
- const total = acknowledged + actioned + pending;
313
- const actionedPercent = total > 0 ? actioned / total * 100 : 0;
314
- const acknowledgedPercent = total > 0 ? acknowledged / total * 100 : 0;
315
- return /* @__PURE__ */ jsxDEV3("div", {
316
- className: "space-y-4",
317
- children: [
318
- /* @__PURE__ */ jsxDEV3("div", {
319
- className: "flex items-center justify-center",
320
- children: /* @__PURE__ */ jsxDEV3("div", {
321
- className: "relative h-32 w-32",
322
- children: [
323
- /* @__PURE__ */ jsxDEV3("svg", {
324
- className: "h-full w-full -rotate-90",
325
- viewBox: "0 0 100 100",
326
- children: [
327
- /* @__PURE__ */ jsxDEV3("circle", {
328
- cx: "50",
329
- cy: "50",
330
- r: "40",
331
- fill: "none",
332
- strokeWidth: "12",
333
- className: "stroke-muted"
334
- }, undefined, false, undefined, this),
335
- /* @__PURE__ */ jsxDEV3("circle", {
336
- cx: "50",
337
- cy: "50",
338
- r: "40",
339
- fill: "none",
340
- strokeWidth: "12",
341
- strokeLinecap: "round",
342
- strokeDasharray: `${actionedPercent * 2.51} 251`,
343
- className: "stroke-green-500 transition-all duration-500"
344
- }, undefined, false, undefined, this),
345
- /* @__PURE__ */ jsxDEV3("circle", {
346
- cx: "50",
347
- cy: "50",
348
- r: "40",
349
- fill: "none",
350
- strokeWidth: "12",
351
- strokeLinecap: "round",
352
- strokeDasharray: `${acknowledgedPercent * 2.51} 251`,
353
- strokeDashoffset: `${-actionedPercent * 2.51}`,
354
- className: "stroke-amber-500 transition-all duration-500"
355
- }, undefined, false, undefined, this)
356
- ]
357
- }, undefined, true, undefined, this),
358
- /* @__PURE__ */ jsxDEV3("div", {
359
- className: "absolute inset-0 flex flex-col items-center justify-center",
360
- children: [
361
- /* @__PURE__ */ jsxDEV3("span", {
362
- className: "font-bold text-2xl",
363
- children: total
364
- }, undefined, false, undefined, this),
365
- /* @__PURE__ */ jsxDEV3("span", {
366
- className: "text-muted-foreground text-xs",
367
- children: "tips"
368
- }, undefined, false, undefined, this)
369
- ]
370
- }, undefined, true, undefined, this)
371
- ]
372
- }, undefined, true, undefined, this)
373
- }, undefined, false, undefined, this),
374
- /* @__PURE__ */ jsxDEV3("div", {
375
- className: "flex justify-center gap-4 text-sm",
376
- children: [
377
- /* @__PURE__ */ jsxDEV3("div", {
378
- className: "flex items-center gap-1.5",
379
- children: [
380
- /* @__PURE__ */ jsxDEV3("div", {
381
- className: "h-3 w-3 rounded-full bg-green-500"
382
- }, undefined, false, undefined, this),
383
- /* @__PURE__ */ jsxDEV3("span", {
384
- children: [
385
- "Actioned (",
386
- actioned,
387
- ")"
388
- ]
389
- }, undefined, true, undefined, this)
390
- ]
391
- }, undefined, true, undefined, this),
392
- /* @__PURE__ */ jsxDEV3("div", {
393
- className: "flex items-center gap-1.5",
394
- children: [
395
- /* @__PURE__ */ jsxDEV3("div", {
396
- className: "h-3 w-3 rounded-full bg-amber-500"
397
- }, undefined, false, undefined, this),
398
- /* @__PURE__ */ jsxDEV3("span", {
399
- children: [
400
- "Acknowledged (",
401
- acknowledged,
402
- ")"
403
- ]
404
- }, undefined, true, undefined, this)
405
- ]
406
- }, undefined, true, undefined, this),
407
- /* @__PURE__ */ jsxDEV3("div", {
408
- className: "flex items-center gap-1.5",
409
- children: [
410
- /* @__PURE__ */ jsxDEV3("div", {
411
- className: "h-3 w-3 rounded-full bg-muted"
412
- }, undefined, false, undefined, this),
413
- /* @__PURE__ */ jsxDEV3("span", {
414
- children: [
415
- "Pending (",
416
- pending,
417
- ")"
418
- ]
419
- }, undefined, true, undefined, this)
420
- ]
421
- }, undefined, true, undefined, this)
422
- ]
423
- }, undefined, true, undefined, this),
424
- streak > 0 && /* @__PURE__ */ jsxDEV3("div", {
425
- className: "flex items-center justify-center gap-2 rounded-lg bg-orange-500/10 px-4 py-2",
426
- children: [
427
- /* @__PURE__ */ jsxDEV3("span", {
428
- className: "text-xl",
429
- children: "\uD83D\uDD25"
430
- }, undefined, false, undefined, this),
431
- /* @__PURE__ */ jsxDEV3("span", {
432
- className: "font-semibold text-orange-500",
433
- children: [
434
- streak,
435
- " day engagement streak!"
436
- ]
437
- }, undefined, true, undefined, this)
438
- ]
439
- }, undefined, true, undefined, this)
440
- ]
441
- }, undefined, true, undefined, this);
442
- }
443
-
444
- // src/views/Progress.tsx
445
- import {
446
- BadgeDisplay,
447
- StreakCounter as StreakCounter2,
448
- XpBar as XpBar2
449
- } from "@contractspec/example.learning-journey-ui-shared";
450
- import {
451
- Card as Card3,
452
- CardContent as CardContent3,
453
- CardHeader as CardHeader2,
454
- CardTitle as CardTitle2
455
- } from "@contractspec/lib.ui-kit-web/ui/card";
456
- import { jsxDEV as jsxDEV4 } from "react/jsx-dev-runtime";
457
- "use client";
458
- function ProgressView({ track, progress }) {
459
- const totalXp = track.totalXp ?? track.steps.reduce((sum, s) => sum + (s.xpReward ?? 0), 0);
460
- const completedSteps = progress.completedStepIds.length;
461
- const totalSteps = track.steps.length;
462
- const pendingSteps = totalSteps - completedSteps;
463
- const actioned = Math.floor(completedSteps * 0.7);
464
- const acknowledged = completedSteps - actioned;
465
- return /* @__PURE__ */ jsxDEV4("div", {
466
- className: "space-y-6",
467
- children: [
468
- /* @__PURE__ */ jsxDEV4(Card3, {
469
- children: [
470
- /* @__PURE__ */ jsxDEV4(CardHeader2, {
471
- children: /* @__PURE__ */ jsxDEV4(CardTitle2, {
472
- className: "flex items-center gap-2",
473
- children: [
474
- /* @__PURE__ */ jsxDEV4("span", {
475
- children: "\uD83D\uDCCA"
476
- }, undefined, false, undefined, this),
477
- /* @__PURE__ */ jsxDEV4("span", {
478
- children: "Engagement Overview"
479
- }, undefined, false, undefined, this)
480
- ]
481
- }, undefined, true, undefined, this)
482
- }, undefined, false, undefined, this),
483
- /* @__PURE__ */ jsxDEV4(CardContent3, {
484
- children: /* @__PURE__ */ jsxDEV4(EngagementMeter, {
485
- actioned,
486
- acknowledged,
487
- pending: pendingSteps,
488
- streak: progress.streakDays
489
- }, undefined, false, undefined, this)
490
- }, undefined, false, undefined, this)
491
- ]
492
- }, undefined, true, undefined, this),
493
- /* @__PURE__ */ jsxDEV4("div", {
494
- className: "grid gap-4 md:grid-cols-2",
495
- children: [
496
- /* @__PURE__ */ jsxDEV4(Card3, {
497
- children: [
498
- /* @__PURE__ */ jsxDEV4(CardHeader2, {
499
- className: "pb-2",
500
- children: /* @__PURE__ */ jsxDEV4(CardTitle2, {
501
- className: "font-medium text-muted-foreground text-sm",
502
- children: "XP Earned"
503
- }, undefined, false, undefined, this)
504
- }, undefined, false, undefined, this),
505
- /* @__PURE__ */ jsxDEV4(CardContent3, {
506
- className: "space-y-3",
507
- children: [
508
- /* @__PURE__ */ jsxDEV4("div", {
509
- className: "flex items-baseline gap-2",
510
- children: [
511
- /* @__PURE__ */ jsxDEV4("span", {
512
- className: "font-bold text-3xl text-orange-500",
513
- children: progress.xpEarned
514
- }, undefined, false, undefined, this),
515
- /* @__PURE__ */ jsxDEV4("span", {
516
- className: "text-muted-foreground",
517
- children: [
518
- "/ ",
519
- totalXp,
520
- " XP"
521
- ]
522
- }, undefined, true, undefined, this)
523
- ]
524
- }, undefined, true, undefined, this),
525
- /* @__PURE__ */ jsxDEV4(XpBar2, {
526
- current: progress.xpEarned,
527
- max: totalXp,
528
- showLabel: false,
529
- size: "lg"
530
- }, undefined, false, undefined, this)
531
- ]
532
- }, undefined, true, undefined, this)
533
- ]
534
- }, undefined, true, undefined, this),
535
- /* @__PURE__ */ jsxDEV4(Card3, {
536
- children: [
537
- /* @__PURE__ */ jsxDEV4(CardHeader2, {
538
- className: "pb-2",
539
- children: /* @__PURE__ */ jsxDEV4(CardTitle2, {
540
- className: "font-medium text-muted-foreground text-sm",
541
- children: "Engagement Streak"
542
- }, undefined, false, undefined, this)
543
- }, undefined, false, undefined, this),
544
- /* @__PURE__ */ jsxDEV4(CardContent3, {
545
- children: /* @__PURE__ */ jsxDEV4("div", {
546
- className: "flex items-center gap-4",
547
- children: [
548
- /* @__PURE__ */ jsxDEV4(StreakCounter2, {
549
- days: progress.streakDays,
550
- size: "lg"
551
- }, undefined, false, undefined, this),
552
- /* @__PURE__ */ jsxDEV4("div", {
553
- className: "text-muted-foreground text-sm",
554
- children: progress.streakDays > 0 ? "Keep going!" : "Start your streak today!"
555
- }, undefined, false, undefined, this)
556
- ]
557
- }, undefined, true, undefined, this)
558
- }, undefined, false, undefined, this)
559
- ]
560
- }, undefined, true, undefined, this)
561
- ]
562
- }, undefined, true, undefined, this),
563
- /* @__PURE__ */ jsxDEV4(Card3, {
564
- children: [
565
- /* @__PURE__ */ jsxDEV4(CardHeader2, {
566
- children: /* @__PURE__ */ jsxDEV4(CardTitle2, {
567
- className: "flex items-center gap-2",
568
- children: [
569
- /* @__PURE__ */ jsxDEV4("span", {
570
- children: "\uD83C\uDFC5"
571
- }, undefined, false, undefined, this),
572
- /* @__PURE__ */ jsxDEV4("span", {
573
- children: "Achievements"
574
- }, undefined, false, undefined, this)
575
- ]
576
- }, undefined, true, undefined, this)
577
- }, undefined, false, undefined, this),
578
- /* @__PURE__ */ jsxDEV4(CardContent3, {
579
- children: [
580
- /* @__PURE__ */ jsxDEV4(BadgeDisplay, {
581
- badges: progress.badges,
582
- size: "lg",
583
- maxVisible: 10
584
- }, undefined, false, undefined, this),
585
- progress.badges.length === 0 && /* @__PURE__ */ jsxDEV4("p", {
586
- className: "text-muted-foreground text-sm",
587
- children: "Action tips to unlock achievements!"
588
- }, undefined, false, undefined, this)
589
- ]
590
- }, undefined, true, undefined, this)
591
- ]
592
- }, undefined, true, undefined, this),
593
- /* @__PURE__ */ jsxDEV4(Card3, {
594
- children: [
595
- /* @__PURE__ */ jsxDEV4(CardHeader2, {
596
- children: /* @__PURE__ */ jsxDEV4(CardTitle2, {
597
- className: "flex items-center gap-2",
598
- children: [
599
- /* @__PURE__ */ jsxDEV4("span", {
600
- children: "\uD83D\uDCA1"
601
- }, undefined, false, undefined, this),
602
- /* @__PURE__ */ jsxDEV4("span", {
603
- children: "Tip Status"
604
- }, undefined, false, undefined, this)
605
- ]
606
- }, undefined, true, undefined, this)
607
- }, undefined, false, undefined, this),
608
- /* @__PURE__ */ jsxDEV4(CardContent3, {
609
- children: /* @__PURE__ */ jsxDEV4("div", {
610
- className: "space-y-3",
611
- children: track.steps.map((step) => {
612
- const isCompleted = progress.completedStepIds.includes(step.id);
613
- return /* @__PURE__ */ jsxDEV4("div", {
614
- className: "flex items-center justify-between rounded-lg border p-3",
615
- children: [
616
- /* @__PURE__ */ jsxDEV4("div", {
617
- className: "flex items-center gap-3",
618
- children: [
619
- /* @__PURE__ */ jsxDEV4("span", {
620
- className: isCompleted ? "text-green-500" : "text-amber-500",
621
- children: isCompleted ? "\u2713" : "\u25CB"
622
- }, undefined, false, undefined, this),
623
- /* @__PURE__ */ jsxDEV4("span", {
624
- className: isCompleted ? "text-muted-foreground" : "text-foreground",
625
- children: step.title
626
- }, undefined, false, undefined, this)
627
- ]
628
- }, undefined, true, undefined, this),
629
- /* @__PURE__ */ jsxDEV4("span", {
630
- className: `text-sm ${isCompleted ? "text-green-500" : "text-muted-foreground"}`,
631
- children: isCompleted ? "Actioned" : "Pending"
632
- }, undefined, false, undefined, this)
633
- ]
634
- }, step.id, true, undefined, this);
635
- })
636
- }, undefined, false, undefined, this)
637
- }, undefined, false, undefined, this)
638
- ]
639
- }, undefined, true, undefined, this)
640
- ]
641
- }, undefined, true, undefined, this);
642
- }
643
- // src/views/Steps.tsx
644
- import { jsxDEV as jsxDEV5 } from "react/jsx-dev-runtime";
645
- "use client";
646
- function Steps({ track, progress, onStepComplete }) {
647
- const completedSteps = progress.completedStepIds.length;
648
- const totalSteps = track.steps.length;
649
- const sortedSteps = [...track.steps].sort((a, b) => {
650
- const aCompleted = progress.completedStepIds.includes(a.id);
651
- const bCompleted = progress.completedStepIds.includes(b.id);
652
- if (aCompleted === bCompleted)
653
- return 0;
654
- return aCompleted ? 1 : -1;
655
- });
656
- const currentStepId = track.steps.find((s) => !progress.completedStepIds.includes(s.id))?.id;
657
- return /* @__PURE__ */ jsxDEV5("div", {
658
- className: "space-y-6",
659
- children: [
660
- /* @__PURE__ */ jsxDEV5("div", {
661
- className: "text-center",
662
- children: [
663
- /* @__PURE__ */ jsxDEV5("h2", {
664
- className: "font-bold text-xl",
665
- children: "Coaching Tips"
666
- }, undefined, false, undefined, this),
667
- /* @__PURE__ */ jsxDEV5("p", {
668
- className: "text-muted-foreground",
669
- children: "Review and take action on personalized tips"
670
- }, undefined, false, undefined, this),
671
- /* @__PURE__ */ jsxDEV5("p", {
672
- className: "mt-2 text-muted-foreground text-sm",
673
- children: [
674
- completedSteps,
675
- " of ",
676
- totalSteps,
677
- " tips actioned"
678
- ]
679
- }, undefined, true, undefined, this)
680
- ]
681
- }, undefined, true, undefined, this),
682
- /* @__PURE__ */ jsxDEV5("div", {
683
- className: "space-y-3",
684
- children: sortedSteps.map((step) => {
685
- const isCompleted = progress.completedStepIds.includes(step.id);
686
- const isCurrent = step.id === currentStepId;
687
- return /* @__PURE__ */ jsxDEV5(TipCard, {
688
- step,
689
- isCompleted,
690
- isCurrent,
691
- onComplete: () => onStepComplete?.(step.id),
692
- onDismiss: () => onStepComplete?.(step.id)
693
- }, step.id, false, undefined, this);
694
- })
695
- }, undefined, false, undefined, this),
696
- completedSteps === totalSteps && /* @__PURE__ */ jsxDEV5("div", {
697
- className: "text-center text-muted-foreground",
698
- children: [
699
- /* @__PURE__ */ jsxDEV5("span", {
700
- className: "text-2xl",
701
- children: "\u2728"
702
- }, undefined, false, undefined, this),
703
- /* @__PURE__ */ jsxDEV5("p", {
704
- className: "mt-2",
705
- children: "All tips have been addressed!"
706
- }, undefined, false, undefined, this)
707
- ]
708
- }, undefined, true, undefined, this)
709
- ]
710
- }, undefined, true, undefined, this);
711
- }
712
-
713
- // src/components/TipFeed.tsx
714
- import { cn as cn2 } from "@contractspec/lib.ui-kit-web/ui/utils";
715
- import { jsxDEV as jsxDEV6 } from "react/jsx-dev-runtime";
716
- "use client";
717
- var TIP_ICONS2 = {
718
- cash_buffer_too_high: "\uD83D\uDCB0",
719
- no_savings_goal: "\uD83C\uDFAF",
720
- irregular_savings: "\uD83D\uDCC5",
721
- noise_late_evening: "\uD83D\uDD07",
722
- guest_frequency_high: "\uD83D\uDC65",
723
- shared_space_conflicts: "\uD83C\uDFE0",
724
- default: "\uD83D\uDCA1"
725
- };
726
- function TipFeed({ items }) {
727
- if (items.length === 0) {
728
- return /* @__PURE__ */ jsxDEV6("div", {
729
- className: "py-8 text-center text-muted-foreground",
730
- children: "No tips yet. Start engaging with coaching tips!"
731
- }, undefined, false, undefined, this);
732
- }
733
- return /* @__PURE__ */ jsxDEV6("div", {
734
- className: "relative",
735
- children: [
736
- /* @__PURE__ */ jsxDEV6("div", {
737
- className: "absolute top-0 left-4 h-full w-0.5 bg-border"
738
- }, undefined, false, undefined, this),
739
- /* @__PURE__ */ jsxDEV6("div", {
740
- className: "space-y-4",
741
- children: items.map((item) => {
742
- const tipId = item.step.metadata?.tipId ?? "default";
743
- const icon = TIP_ICONS2[tipId] ?? TIP_ICONS2.default;
744
- return /* @__PURE__ */ jsxDEV6("div", {
745
- className: "relative flex gap-4 pl-2",
746
- children: [
747
- /* @__PURE__ */ jsxDEV6("div", {
748
- className: cn2("relative z-10 flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-sm", item.isCompleted ? "bg-green-500 text-white" : "bg-muted text-muted-foreground"),
749
- children: item.isCompleted ? "\u2713" : icon
750
- }, undefined, false, undefined, this),
751
- /* @__PURE__ */ jsxDEV6("div", {
752
- className: "flex-1 rounded-lg border bg-card p-3",
753
- children: [
754
- /* @__PURE__ */ jsxDEV6("div", {
755
- className: "flex items-start justify-between gap-2",
756
- children: [
757
- /* @__PURE__ */ jsxDEV6("div", {
758
- children: [
759
- /* @__PURE__ */ jsxDEV6("p", {
760
- className: "font-medium",
761
- children: item.step.title
762
- }, undefined, false, undefined, this),
763
- /* @__PURE__ */ jsxDEV6("p", {
764
- className: "mt-0.5 text-muted-foreground text-sm",
765
- children: item.step.description
766
- }, undefined, false, undefined, this)
767
- ]
768
- }, undefined, true, undefined, this),
769
- item.step.xpReward && /* @__PURE__ */ jsxDEV6("span", {
770
- className: cn2("shrink-0 font-medium text-xs", item.isCompleted ? "text-green-500" : "text-muted-foreground"),
771
- children: [
772
- "+",
773
- item.step.xpReward,
774
- " XP"
775
- ]
776
- }, undefined, true, undefined, this)
777
- ]
778
- }, undefined, true, undefined, this),
779
- /* @__PURE__ */ jsxDEV6("div", {
780
- className: "mt-2 flex items-center gap-2 text-muted-foreground text-xs",
781
- children: item.isCompleted ? /* @__PURE__ */ jsxDEV6("span", {
782
- className: "text-green-500",
783
- children: [
784
- "\u2713 Completed",
785
- item.completedAt && ` \u2022 ${item.completedAt}`
786
- ]
787
- }, undefined, true, undefined, this) : /* @__PURE__ */ jsxDEV6("span", {
788
- children: "Pending action"
789
- }, undefined, false, undefined, this)
790
- }, undefined, false, undefined, this)
791
- ]
792
- }, undefined, true, undefined, this)
793
- ]
794
- }, item.step.id, true, undefined, this);
795
- })
796
- }, undefined, false, undefined, this)
797
- ]
798
- }, undefined, true, undefined, this);
799
- }
800
-
801
- // src/views/Timeline.tsx
802
- import {
803
- Card as Card4,
804
- CardContent as CardContent4,
805
- CardHeader as CardHeader3,
806
- CardTitle as CardTitle3
807
- } from "@contractspec/lib.ui-kit-web/ui/card";
808
- import { jsxDEV as jsxDEV7 } from "react/jsx-dev-runtime";
809
- "use client";
810
- function Timeline({ track, progress }) {
811
- const feedItems = track.steps.map((step) => ({
812
- step,
813
- isCompleted: progress.completedStepIds.includes(step.id),
814
- completedAt: progress.completedStepIds.includes(step.id) ? "Recently" : undefined
815
- })).sort((a, b) => {
816
- if (a.isCompleted && !b.isCompleted)
817
- return -1;
818
- if (!a.isCompleted && b.isCompleted)
819
- return 1;
820
- return 0;
821
- });
822
- const completedCount = feedItems.filter((f) => f.isCompleted).length;
823
- const pendingCount = feedItems.length - completedCount;
824
- return /* @__PURE__ */ jsxDEV7("div", {
825
- className: "space-y-6",
826
- children: [
827
- /* @__PURE__ */ jsxDEV7("div", {
828
- className: "text-center",
829
- children: [
830
- /* @__PURE__ */ jsxDEV7("h2", {
831
- className: "font-bold text-xl",
832
- children: "Activity Timeline"
833
- }, undefined, false, undefined, this),
834
- /* @__PURE__ */ jsxDEV7("p", {
835
- className: "text-muted-foreground",
836
- children: "Your coaching journey and tip history"
837
- }, undefined, false, undefined, this)
838
- ]
839
- }, undefined, true, undefined, this),
840
- /* @__PURE__ */ jsxDEV7("div", {
841
- className: "grid grid-cols-2 gap-4",
842
- children: [
843
- /* @__PURE__ */ jsxDEV7(Card4, {
844
- children: /* @__PURE__ */ jsxDEV7(CardContent4, {
845
- className: "p-4 text-center",
846
- children: [
847
- /* @__PURE__ */ jsxDEV7("div", {
848
- className: "font-bold text-2xl text-green-500",
849
- children: completedCount
850
- }, undefined, false, undefined, this),
851
- /* @__PURE__ */ jsxDEV7("div", {
852
- className: "text-muted-foreground text-sm",
853
- children: "Tips Actioned"
854
- }, undefined, false, undefined, this)
855
- ]
856
- }, undefined, true, undefined, this)
857
- }, undefined, false, undefined, this),
858
- /* @__PURE__ */ jsxDEV7(Card4, {
859
- children: /* @__PURE__ */ jsxDEV7(CardContent4, {
860
- className: "p-4 text-center",
861
- children: [
862
- /* @__PURE__ */ jsxDEV7("div", {
863
- className: "font-bold text-2xl text-amber-500",
864
- children: pendingCount
865
- }, undefined, false, undefined, this),
866
- /* @__PURE__ */ jsxDEV7("div", {
867
- className: "text-muted-foreground text-sm",
868
- children: "Tips Pending"
869
- }, undefined, false, undefined, this)
870
- ]
871
- }, undefined, true, undefined, this)
872
- }, undefined, false, undefined, this)
873
- ]
874
- }, undefined, true, undefined, this),
875
- /* @__PURE__ */ jsxDEV7(Card4, {
876
- children: [
877
- /* @__PURE__ */ jsxDEV7(CardHeader3, {
878
- children: /* @__PURE__ */ jsxDEV7(CardTitle3, {
879
- className: "flex items-center gap-2",
880
- children: [
881
- /* @__PURE__ */ jsxDEV7("span", {
882
- children: "\uD83D\uDCDD"
883
- }, undefined, false, undefined, this),
884
- /* @__PURE__ */ jsxDEV7("span", {
885
- children: "Coaching Feed"
886
- }, undefined, false, undefined, this)
887
- ]
888
- }, undefined, true, undefined, this)
889
- }, undefined, false, undefined, this),
890
- /* @__PURE__ */ jsxDEV7(CardContent4, {
891
- children: /* @__PURE__ */ jsxDEV7(TipFeed, {
892
- items: feedItems
893
- }, undefined, false, undefined, this)
894
- }, undefined, false, undefined, this)
895
- ]
896
- }, undefined, true, undefined, this),
897
- /* @__PURE__ */ jsxDEV7(Card4, {
898
- children: [
899
- /* @__PURE__ */ jsxDEV7(CardHeader3, {
900
- children: /* @__PURE__ */ jsxDEV7(CardTitle3, {
901
- className: "flex items-center gap-2",
902
- children: [
903
- /* @__PURE__ */ jsxDEV7("span", {
904
- children: "\uD83D\uDCC8"
905
- }, undefined, false, undefined, this),
906
- /* @__PURE__ */ jsxDEV7("span", {
907
- children: "Journey Stats"
908
- }, undefined, false, undefined, this)
909
- ]
910
- }, undefined, true, undefined, this)
911
- }, undefined, false, undefined, this),
912
- /* @__PURE__ */ jsxDEV7(CardContent4, {
913
- children: /* @__PURE__ */ jsxDEV7("div", {
914
- className: "space-y-4",
915
- children: [
916
- /* @__PURE__ */ jsxDEV7("div", {
917
- className: "flex items-center justify-between",
918
- children: [
919
- /* @__PURE__ */ jsxDEV7("span", {
920
- className: "text-muted-foreground",
921
- children: "Total Tips"
922
- }, undefined, false, undefined, this),
923
- /* @__PURE__ */ jsxDEV7("span", {
924
- className: "font-semibold",
925
- children: track.steps.length
926
- }, undefined, false, undefined, this)
927
- ]
928
- }, undefined, true, undefined, this),
929
- /* @__PURE__ */ jsxDEV7("div", {
930
- className: "flex items-center justify-between",
931
- children: [
932
- /* @__PURE__ */ jsxDEV7("span", {
933
- className: "text-muted-foreground",
934
- children: "Completed"
935
- }, undefined, false, undefined, this),
936
- /* @__PURE__ */ jsxDEV7("span", {
937
- className: "font-semibold text-green-500",
938
- children: completedCount
939
- }, undefined, false, undefined, this)
940
- ]
941
- }, undefined, true, undefined, this),
942
- /* @__PURE__ */ jsxDEV7("div", {
943
- className: "flex items-center justify-between",
944
- children: [
945
- /* @__PURE__ */ jsxDEV7("span", {
946
- className: "text-muted-foreground",
947
- children: "XP Earned"
948
- }, undefined, false, undefined, this),
949
- /* @__PURE__ */ jsxDEV7("span", {
950
- className: "font-semibold text-orange-500",
951
- children: progress.xpEarned
952
- }, undefined, false, undefined, this)
953
- ]
954
- }, undefined, true, undefined, this),
955
- /* @__PURE__ */ jsxDEV7("div", {
956
- className: "flex items-center justify-between",
957
- children: [
958
- /* @__PURE__ */ jsxDEV7("span", {
959
- className: "text-muted-foreground",
960
- children: "Current Streak"
961
- }, undefined, false, undefined, this),
962
- /* @__PURE__ */ jsxDEV7("span", {
963
- className: "font-semibold",
964
- children: progress.streakDays > 0 ? `\uD83D\uDD25 ${progress.streakDays} days` : "Start today!"
965
- }, undefined, false, undefined, this)
966
- ]
967
- }, undefined, true, undefined, this)
968
- ]
969
- }, undefined, true, undefined, this)
970
- }, undefined, false, undefined, this)
971
- ]
972
- }, undefined, true, undefined, this)
973
- ]
974
- }, undefined, true, undefined, this);
975
- }
976
- export {
977
- Timeline,
978
- Steps,
979
- ProgressView as Progress,
980
- Overview
981
- };
2
+ import{Button as g}from"@contractspec/lib.design-system";import{Card as o,CardContent as a}from"@contractspec/lib.ui-kit-web/ui/card";import{cn as k}from"@contractspec/lib.ui-kit-web/ui/utils";import{jsx as E,jsxs as N}from"react/jsx-runtime";var l={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 H({step:z,isCompleted:q,isCurrent:U,onComplete:W,onDismiss:h}){let R=z.metadata?.tipId??"default",L=l[R]??l.default;return E(o,{className:k("transition-all",q&&"opacity-60",U&&"ring-2 ring-amber-500"),children:E(a,{className:"p-4",children:N("div",{className:"flex gap-4",children:[E("div",{className:k("flex h-12 w-12 shrink-0 items-center justify-center rounded-xl text-2xl",q?"bg-green-500/10":U?"bg-amber-500/10":"bg-muted"),children:q?"\u2713":L}),N("div",{className:"min-w-0 flex-1",children:[N("div",{className:"flex items-start justify-between gap-2",children:[E("h4",{className:"font-semibold",children:z.title}),z.xpReward&&N("span",{className:k("shrink-0 rounded-full px-2 py-0.5 font-semibold text-xs",q?"bg-green-500/10 text-green-500":"bg-amber-500/10 text-amber-500"),children:["+",z.xpReward," XP"]})]}),E("p",{className:"mt-1 text-muted-foreground text-sm",children:z.description}),!q&&N("div",{className:"mt-3 flex flex-wrap gap-2",children:[E(g,{size:"sm",onClick:W,children:"Take Action"}),E(g,{variant:"outline",size:"sm",onClick:h,children:"Dismiss"})]}),q&&E("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 j}from"@contractspec/lib.design-system";import{Card as D,CardContent as O,CardHeader as w,CardTitle as I}from"@contractspec/lib.ui-kit-web/ui/card";import{jsx as J,jsxs as Y}from"react/jsx-runtime";function r({track:z,progress:q,onStepComplete:U,onStart:W}){let h=z.totalXp??z.steps.reduce((Q,u)=>Q+(u.xpReward??0),0),R=q.completedStepIds.length,L=z.steps.length,Z=L-R,V=z.steps.filter((Q)=>!q.completedStepIds.includes(Q.id)).slice(0,3);return Y("div",{className:"space-y-6",children:[J(D,{className:"overflow-hidden bg-gradient-to-br from-amber-500/10 via-orange-500/10 to-red-500/10",children:J(O,{className:"p-6",children:Y("div",{className:"flex flex-col items-center gap-4 text-center md:flex-row md:text-left",children:[J("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"}),Y("div",{className:"flex-1",children:[J("h1",{className:"font-bold text-2xl",children:z.name}),J("p",{className:"mt-1 text-muted-foreground",children:z.description})]}),J("div",{className:"flex items-center gap-4",children:J(p,{days:q.streakDays,size:"lg"})})]})})}),Y("div",{className:"grid gap-4 md:grid-cols-3",children:[Y(D,{children:[J(w,{className:"pb-2",children:J(I,{className:"font-medium text-muted-foreground text-sm",children:"Active Tips"})}),Y(O,{children:[J("div",{className:"font-bold text-3xl text-amber-500",children:Z}),J("p",{className:"text-muted-foreground text-sm",children:"tips for you today"})]})]}),Y(D,{children:[J(w,{className:"pb-2",children:J(I,{className:"font-medium text-muted-foreground text-sm",children:"Tips Actioned"})}),Y(O,{children:[J("div",{className:"font-bold text-3xl text-green-500",children:R}),Y("p",{className:"text-muted-foreground text-sm",children:["out of ",L," total"]})]})]}),Y(D,{children:[J(w,{className:"pb-2",children:J(I,{className:"font-medium text-muted-foreground text-sm",children:"XP Earned"})}),Y(O,{children:[J("div",{className:"font-bold text-3xl text-orange-500",children:q.xpEarned}),J(x,{current:q.xpEarned,max:h,showLabel:!1,size:"sm"})]})]})]}),V.length>0&&Y(D,{children:[Y(w,{className:"flex flex-row items-center justify-between",children:[Y(I,{className:"flex items-center gap-2",children:[J("span",{children:"\uD83D\uDCA1"}),J("span",{children:"Tips for You"})]}),V.length<Z&&Y(j,{variant:"outline",size:"sm",onClick:W,children:["View All (",Z,")"]})]}),J(O,{className:"space-y-3",children:V.map((Q)=>J(H,{step:Q,isCompleted:!1,isCurrent:Q.id===V[0]?.id,onComplete:()=>U?.(Q.id)},Q.id))})]}),Z===0&&J(D,{className:"border-green-500/50 bg-green-500/5",children:Y(O,{className:"flex items-center gap-4 p-6",children:[J("div",{className:"text-4xl",children:"\uD83C\uDF89"}),Y("div",{children:[J("h3",{className:"font-semibold text-green-500 text-lg",children:"All Tips Actioned!"}),Y("p",{className:"text-muted-foreground",children:["Great job! You've addressed all ",L," coaching tips."]})]})]})})]})}import{jsx as A,jsxs as y}from"react/jsx-runtime";function m({acknowledged:z,actioned:q,pending:U,streak:W=0}){let h=z+q+U,R=h>0?q/h*100:0,L=h>0?z/h*100:0;return y("div",{className:"space-y-4",children:[A("div",{className:"flex items-center justify-center",children:y("div",{className:"relative h-32 w-32",children:[y("svg",{className:"h-full w-full -rotate-90",viewBox:"0 0 100 100",children:[A("circle",{cx:"50",cy:"50",r:"40",fill:"none",strokeWidth:"12",className:"stroke-muted"}),A("circle",{cx:"50",cy:"50",r:"40",fill:"none",strokeWidth:"12",strokeLinecap:"round",strokeDasharray:`${R*2.51} 251`,className:"stroke-green-500 transition-all duration-500"}),A("circle",{cx:"50",cy:"50",r:"40",fill:"none",strokeWidth:"12",strokeLinecap:"round",strokeDasharray:`${L*2.51} 251`,strokeDashoffset:`${-R*2.51}`,className:"stroke-amber-500 transition-all duration-500"})]}),y("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[A("span",{className:"font-bold text-2xl",children:h}),A("span",{className:"text-muted-foreground text-xs",children:"tips"})]})]})}),y("div",{className:"flex justify-center gap-4 text-sm",children:[y("div",{className:"flex items-center gap-1.5",children:[A("div",{className:"h-3 w-3 rounded-full bg-green-500"}),y("span",{children:["Actioned (",q,")"]})]}),y("div",{className:"flex items-center gap-1.5",children:[A("div",{className:"h-3 w-3 rounded-full bg-amber-500"}),y("span",{children:["Acknowledged (",z,")"]})]}),y("div",{className:"flex items-center gap-1.5",children:[A("div",{className:"h-3 w-3 rounded-full bg-muted"}),y("span",{children:["Pending (",U,")"]})]})]}),W>0&&y("div",{className:"flex items-center justify-center gap-2 rounded-lg bg-orange-500/10 px-4 py-2",children:[A("span",{className:"text-xl",children:"\uD83D\uDD25"}),y("span",{className:"font-semibold text-orange-500",children:[W," day engagement streak!"]})]})]})}import{BadgeDisplay as t,StreakCounter as e,XpBar as s}from"@contractspec/example.learning-journey-ui-shared";import{Card as _,CardContent as X,CardHeader as B,CardTitle as P}from"@contractspec/lib.ui-kit-web/ui/card";import{jsx as G,jsxs as $}from"react/jsx-runtime";function qq({track:z,progress:q}){let U=z.totalXp??z.steps.reduce((V,Q)=>V+(Q.xpReward??0),0),W=q.completedStepIds.length,R=z.steps.length-W,L=Math.floor(W*0.7),Z=W-L;return $("div",{className:"space-y-6",children:[$(_,{children:[G(B,{children:$(P,{className:"flex items-center gap-2",children:[G("span",{children:"\uD83D\uDCCA"}),G("span",{children:"Engagement Overview"})]})}),G(X,{children:G(m,{actioned:L,acknowledged:Z,pending:R,streak:q.streakDays})})]}),$("div",{className:"grid gap-4 md:grid-cols-2",children:[$(_,{children:[G(B,{className:"pb-2",children:G(P,{className:"font-medium text-muted-foreground text-sm",children:"XP Earned"})}),$(X,{className:"space-y-3",children:[$("div",{className:"flex items-baseline gap-2",children:[G("span",{className:"font-bold text-3xl text-orange-500",children:q.xpEarned}),$("span",{className:"text-muted-foreground",children:["/ ",U," XP"]})]}),G(s,{current:q.xpEarned,max:U,showLabel:!1,size:"lg"})]})]}),$(_,{children:[G(B,{className:"pb-2",children:G(P,{className:"font-medium text-muted-foreground text-sm",children:"Engagement Streak"})}),G(X,{children:$("div",{className:"flex items-center gap-4",children:[G(e,{days:q.streakDays,size:"lg"}),G("div",{className:"text-muted-foreground text-sm",children:q.streakDays>0?"Keep going!":"Start your streak today!"})]})})]})]}),$(_,{children:[G(B,{children:$(P,{className:"flex items-center gap-2",children:[G("span",{children:"\uD83C\uDFC5"}),G("span",{children:"Achievements"})]})}),$(X,{children:[G(t,{badges:q.badges,size:"lg",maxVisible:10}),q.badges.length===0&&G("p",{className:"text-muted-foreground text-sm",children:"Action tips to unlock achievements!"})]})]}),$(_,{children:[G(B,{children:$(P,{className:"flex items-center gap-2",children:[G("span",{children:"\uD83D\uDCA1"}),G("span",{children:"Tip Status"})]})}),G(X,{children:G("div",{className:"space-y-3",children:z.steps.map((V)=>{let Q=q.completedStepIds.includes(V.id);return $("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[$("div",{className:"flex items-center gap-3",children:[G("span",{className:Q?"text-green-500":"text-amber-500",children:Q?"\u2713":"\u25CB"}),G("span",{className:Q?"text-muted-foreground":"text-foreground",children:V.title})]}),G("span",{className:`text-sm ${Q?"text-green-500":"text-muted-foreground"}`,children:Q?"Actioned":"Pending"})]},V.id)})})})]})]})}import{jsx as f,jsxs as b}from"react/jsx-runtime";function zq({track:z,progress:q,onStepComplete:U}){let W=q.completedStepIds.length,h=z.steps.length,R=[...z.steps].sort((Z,V)=>{let Q=q.completedStepIds.includes(Z.id),u=q.completedStepIds.includes(V.id);if(Q===u)return 0;return Q?1:-1}),L=z.steps.find((Z)=>!q.completedStepIds.includes(Z.id))?.id;return b("div",{className:"space-y-6",children:[b("div",{className:"text-center",children:[f("h2",{className:"font-bold text-xl",children:"Coaching Tips"}),f("p",{className:"text-muted-foreground",children:"Review and take action on personalized tips"}),b("p",{className:"mt-2 text-muted-foreground text-sm",children:[W," of ",h," tips actioned"]})]}),f("div",{className:"space-y-3",children:R.map((Z)=>{let V=q.completedStepIds.includes(Z.id),Q=Z.id===L;return f(H,{step:Z,isCompleted:V,isCurrent:Q,onComplete:()=>U?.(Z.id),onDismiss:()=>U?.(Z.id)},Z.id)})}),W===h&&b("div",{className:"text-center text-muted-foreground",children:[f("span",{className:"text-2xl",children:"\u2728"}),f("p",{className:"mt-2",children:"All tips have been addressed!"})]})]})}import{cn as c}from"@contractspec/lib.ui-kit-web/ui/utils";import{jsx as F,jsxs as M}from"react/jsx-runtime";var C={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 i({items:z}){if(z.length===0)return F("div",{className:"py-8 text-center text-muted-foreground",children:"No tips yet. Start engaging with coaching tips!"});return M("div",{className:"relative",children:[F("div",{className:"absolute top-0 left-4 h-full w-0.5 bg-border"}),F("div",{className:"space-y-4",children:z.map((q)=>{let U=q.step.metadata?.tipId??"default",W=C[U]??C.default;return M("div",{className:"relative flex gap-4 pl-2",children:[F("div",{className:c("relative z-10 flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-sm",q.isCompleted?"bg-green-500 text-white":"bg-muted text-muted-foreground"),children:q.isCompleted?"\u2713":W}),M("div",{className:"flex-1 rounded-lg border bg-card p-3",children:[M("div",{className:"flex items-start justify-between gap-2",children:[M("div",{children:[F("p",{className:"font-medium",children:q.step.title}),F("p",{className:"mt-0.5 text-muted-foreground text-sm",children:q.step.description})]}),q.step.xpReward&&M("span",{className:c("shrink-0 font-medium text-xs",q.isCompleted?"text-green-500":"text-muted-foreground"),children:["+",q.step.xpReward," XP"]})]}),F("div",{className:"mt-2 flex items-center gap-2 text-muted-foreground text-xs",children:q.isCompleted?M("span",{className:"text-green-500",children:["\u2713 Completed",q.completedAt&&` \u2022 ${q.completedAt}`]}):F("span",{children:"Pending action"})})]})]},q.step.id)})})]})}import{Card as T,CardContent as S,CardHeader as n,CardTitle as d}from"@contractspec/lib.ui-kit-web/ui/card";import{jsx as K,jsxs as v}from"react/jsx-runtime";function Gq({track:z,progress:q}){let U=z.steps.map((R)=>({step:R,isCompleted:q.completedStepIds.includes(R.id),completedAt:q.completedStepIds.includes(R.id)?"Recently":void 0})).sort((R,L)=>{if(R.isCompleted&&!L.isCompleted)return-1;if(!R.isCompleted&&L.isCompleted)return 1;return 0}),W=U.filter((R)=>R.isCompleted).length,h=U.length-W;return v("div",{className:"space-y-6",children:[v("div",{className:"text-center",children:[K("h2",{className:"font-bold text-xl",children:"Activity Timeline"}),K("p",{className:"text-muted-foreground",children:"Your coaching journey and tip history"})]}),v("div",{className:"grid grid-cols-2 gap-4",children:[K(T,{children:v(S,{className:"p-4 text-center",children:[K("div",{className:"font-bold text-2xl text-green-500",children:W}),K("div",{className:"text-muted-foreground text-sm",children:"Tips Actioned"})]})}),K(T,{children:v(S,{className:"p-4 text-center",children:[K("div",{className:"font-bold text-2xl text-amber-500",children:h}),K("div",{className:"text-muted-foreground text-sm",children:"Tips Pending"})]})})]}),v(T,{children:[K(n,{children:v(d,{className:"flex items-center gap-2",children:[K("span",{children:"\uD83D\uDCDD"}),K("span",{children:"Coaching Feed"})]})}),K(S,{children:K(i,{items:U})})]}),v(T,{children:[K(n,{children:v(d,{className:"flex items-center gap-2",children:[K("span",{children:"\uD83D\uDCC8"}),K("span",{children:"Journey Stats"})]})}),K(S,{children:v("div",{className:"space-y-4",children:[v("div",{className:"flex items-center justify-between",children:[K("span",{className:"text-muted-foreground",children:"Total Tips"}),K("span",{className:"font-semibold",children:z.steps.length})]}),v("div",{className:"flex items-center justify-between",children:[K("span",{className:"text-muted-foreground",children:"Completed"}),K("span",{className:"font-semibold text-green-500",children:W})]}),v("div",{className:"flex items-center justify-between",children:[K("span",{className:"text-muted-foreground",children:"XP Earned"}),K("span",{className:"font-semibold text-orange-500",children:q.xpEarned})]}),v("div",{className:"flex items-center justify-between",children:[K("span",{className:"text-muted-foreground",children:"Current Streak"}),K("span",{className:"font-semibold",children:q.streakDays>0?`\uD83D\uDD25 ${q.streakDays} days`:"Start today!"})]})]})})]})]})}export{Gq as Timeline,zq as Steps,qq as Progress,r as Overview};