@contractspec/example.learning-journey-ui-onboarding 3.7.6 → 3.7.7

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 (56) hide show
  1. package/.turbo/turbo-build.log +3 -3
  2. package/AGENTS.md +50 -24
  3. package/README.md +66 -26
  4. package/dist/OnboardingMiniApp.js +280 -280
  5. package/dist/browser/OnboardingMiniApp.js +280 -280
  6. package/dist/browser/components/CodeSnippet.js +4 -4
  7. package/dist/browser/components/JourneyMap.js +1 -1
  8. package/dist/browser/components/StepChecklist.js +6 -6
  9. package/dist/browser/components/index.js +11 -11
  10. package/dist/browser/index.js +285 -284
  11. package/dist/browser/views/Overview.js +14 -14
  12. package/dist/browser/views/Progress.js +9 -9
  13. package/dist/browser/views/Steps.js +8 -8
  14. package/dist/browser/views/Timeline.js +6 -6
  15. package/dist/browser/views/index.js +276 -276
  16. package/dist/components/CodeSnippet.js +4 -4
  17. package/dist/components/JourneyMap.js +1 -1
  18. package/dist/components/StepChecklist.js +6 -6
  19. package/dist/components/index.d.ts +1 -1
  20. package/dist/components/index.js +11 -11
  21. package/dist/index.d.ts +4 -4
  22. package/dist/index.js +285 -284
  23. package/dist/node/OnboardingMiniApp.js +280 -280
  24. package/dist/node/components/CodeSnippet.js +4 -4
  25. package/dist/node/components/JourneyMap.js +1 -1
  26. package/dist/node/components/StepChecklist.js +6 -6
  27. package/dist/node/components/index.js +11 -11
  28. package/dist/node/index.js +285 -284
  29. package/dist/node/views/Overview.js +14 -14
  30. package/dist/node/views/Progress.js +9 -9
  31. package/dist/node/views/Steps.js +8 -8
  32. package/dist/node/views/Timeline.js +6 -6
  33. package/dist/node/views/index.js +276 -276
  34. package/dist/views/Overview.js +14 -14
  35. package/dist/views/Progress.js +9 -9
  36. package/dist/views/Steps.js +8 -8
  37. package/dist/views/Timeline.js +6 -6
  38. package/dist/views/index.d.ts +1 -1
  39. package/dist/views/index.js +276 -276
  40. package/package.json +10 -10
  41. package/src/OnboardingMiniApp.tsx +70 -70
  42. package/src/components/CodeSnippet.tsx +43 -43
  43. package/src/components/JourneyMap.tsx +70 -70
  44. package/src/components/StepChecklist.tsx +118 -118
  45. package/src/components/index.ts +1 -1
  46. package/src/docs/learning-journey-ui-onboarding.docblock.ts +11 -11
  47. package/src/example.ts +25 -25
  48. package/src/index.ts +5 -6
  49. package/src/learning-journey-ui-onboarding.feature.ts +12 -12
  50. package/src/views/Overview.tsx +182 -182
  51. package/src/views/Progress.tsx +167 -167
  52. package/src/views/Steps.tsx +79 -79
  53. package/src/views/Timeline.tsx +126 -126
  54. package/src/views/index.ts +1 -1
  55. package/tsconfig.json +7 -8
  56. package/tsdown.config.js +7 -13
@@ -1,204 +1,204 @@
1
1
  'use client';
2
2
 
3
+ import type { LearningViewProps } from '@contractspec/example.learning-journey-ui-shared';
4
+ import { XpBar } from '@contractspec/example.learning-journey-ui-shared';
3
5
  import { Button } from '@contractspec/lib.design-system';
4
6
  import {
5
- Card,
6
- CardContent,
7
- CardHeader,
8
- CardTitle,
7
+ Card,
8
+ CardContent,
9
+ CardHeader,
10
+ CardTitle,
9
11
  } from '@contractspec/lib.ui-kit-web/ui/card';
10
12
  import { Progress } from '@contractspec/lib.ui-kit-web/ui/progress';
11
- import { XpBar } from '@contractspec/example.learning-journey-ui-shared';
12
- import type { LearningViewProps } from '@contractspec/example.learning-journey-ui-shared';
13
13
 
14
14
  interface OnboardingOverviewProps extends LearningViewProps {
15
- onStart?: () => void;
15
+ onStart?: () => void;
16
16
  }
17
17
 
18
18
  export function Overview({
19
- track,
20
- progress,
21
- onStart,
19
+ track,
20
+ progress,
21
+ onStart,
22
22
  }: OnboardingOverviewProps) {
23
- const totalSteps = track.steps.length;
24
- const completedSteps = progress.completedStepIds.length;
25
- const percentComplete =
26
- totalSteps > 0 ? (completedSteps / totalSteps) * 100 : 0;
27
- const isComplete = completedSteps === totalSteps;
23
+ const totalSteps = track.steps.length;
24
+ const completedSteps = progress.completedStepIds.length;
25
+ const percentComplete =
26
+ totalSteps > 0 ? (completedSteps / totalSteps) * 100 : 0;
27
+ const isComplete = completedSteps === totalSteps;
28
28
 
29
- // Estimate time remaining (rough: 5 min per step)
30
- const remainingSteps = totalSteps - completedSteps;
31
- const estimatedMinutes = remainingSteps * 5;
29
+ // Estimate time remaining (rough: 5 min per step)
30
+ const remainingSteps = totalSteps - completedSteps;
31
+ const estimatedMinutes = remainingSteps * 5;
32
32
 
33
- const totalXp =
34
- track.totalXp ??
35
- track.steps.reduce((sum, s) => sum + (s.xpReward ?? 0), 0) +
36
- (track.completionRewards?.xpBonus ?? 0);
33
+ const totalXp =
34
+ track.totalXp ??
35
+ track.steps.reduce((sum, s) => sum + (s.xpReward ?? 0), 0) +
36
+ (track.completionRewards?.xpBonus ?? 0);
37
37
 
38
- return (
39
- <div className="space-y-6">
40
- {/* Welcome Banner */}
41
- <Card className="overflow-hidden bg-gradient-to-r from-blue-500/10 via-violet-500/10 to-purple-500/10">
42
- <CardContent className="p-8">
43
- <div className="flex flex-col items-center gap-6 text-center md:flex-row md:text-left">
44
- <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">
45
- {isComplete ? '🎉' : '🚀'}
46
- </div>
47
- <div className="flex-1">
48
- <h1 className="text-2xl font-bold">{track.name}</h1>
49
- <p className="text-muted-foreground mt-1 max-w-2xl">
50
- {track.description}
51
- </p>
52
- {!isComplete && (
53
- <p className="text-muted-foreground mt-3 text-sm">
54
- ⏱️ Estimated time:{' '}
55
- {estimatedMinutes > 0
56
- ? `~${estimatedMinutes} minutes`
57
- : 'Less than a minute'}
58
- </p>
59
- )}
60
- </div>
61
- {!isComplete && (
62
- <Button size="lg" onClick={onStart}>
63
- {completedSteps > 0 ? 'Continue' : 'Get Started'}
64
- </Button>
65
- )}
66
- </div>
67
- </CardContent>
68
- </Card>
38
+ return (
39
+ <div className="space-y-6">
40
+ {/* Welcome Banner */}
41
+ <Card className="overflow-hidden bg-gradient-to-r from-blue-500/10 via-violet-500/10 to-purple-500/10">
42
+ <CardContent className="p-8">
43
+ <div className="flex flex-col items-center gap-6 text-center md:flex-row md:text-left">
44
+ <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">
45
+ {isComplete ? '🎉' : '🚀'}
46
+ </div>
47
+ <div className="flex-1">
48
+ <h1 className="font-bold text-2xl">{track.name}</h1>
49
+ <p className="mt-1 max-w-2xl text-muted-foreground">
50
+ {track.description}
51
+ </p>
52
+ {!isComplete && (
53
+ <p className="mt-3 text-muted-foreground text-sm">
54
+ ⏱️ Estimated time:{' '}
55
+ {estimatedMinutes > 0
56
+ ? `~${estimatedMinutes} minutes`
57
+ : 'Less than a minute'}
58
+ </p>
59
+ )}
60
+ </div>
61
+ {!isComplete && (
62
+ <Button size="lg" onClick={onStart}>
63
+ {completedSteps > 0 ? 'Continue' : 'Get Started'}
64
+ </Button>
65
+ )}
66
+ </div>
67
+ </CardContent>
68
+ </Card>
69
69
 
70
- {/* Progress Overview */}
71
- <div className="grid gap-4 md:grid-cols-3">
72
- <Card>
73
- <CardHeader className="pb-2">
74
- <CardTitle className="text-muted-foreground text-sm font-medium">
75
- Progress
76
- </CardTitle>
77
- </CardHeader>
78
- <CardContent>
79
- <div className="text-3xl font-bold">
80
- {Math.round(percentComplete)}%
81
- </div>
82
- <Progress value={percentComplete} className="mt-2 h-2" />
83
- <p className="text-muted-foreground mt-2 text-sm">
84
- {completedSteps} of {totalSteps} steps completed
85
- </p>
86
- </CardContent>
87
- </Card>
70
+ {/* Progress Overview */}
71
+ <div className="grid gap-4 md:grid-cols-3">
72
+ <Card>
73
+ <CardHeader className="pb-2">
74
+ <CardTitle className="font-medium text-muted-foreground text-sm">
75
+ Progress
76
+ </CardTitle>
77
+ </CardHeader>
78
+ <CardContent>
79
+ <div className="font-bold text-3xl">
80
+ {Math.round(percentComplete)}%
81
+ </div>
82
+ <Progress value={percentComplete} className="mt-2 h-2" />
83
+ <p className="mt-2 text-muted-foreground text-sm">
84
+ {completedSteps} of {totalSteps} steps completed
85
+ </p>
86
+ </CardContent>
87
+ </Card>
88
88
 
89
- <Card>
90
- <CardHeader className="pb-2">
91
- <CardTitle className="text-muted-foreground text-sm font-medium">
92
- XP Earned
93
- </CardTitle>
94
- </CardHeader>
95
- <CardContent>
96
- <div className="text-3xl font-bold text-blue-500">
97
- {progress.xpEarned}
98
- </div>
99
- <XpBar
100
- current={progress.xpEarned}
101
- max={totalXp}
102
- showLabel={false}
103
- size="sm"
104
- />
105
- </CardContent>
106
- </Card>
89
+ <Card>
90
+ <CardHeader className="pb-2">
91
+ <CardTitle className="font-medium text-muted-foreground text-sm">
92
+ XP Earned
93
+ </CardTitle>
94
+ </CardHeader>
95
+ <CardContent>
96
+ <div className="font-bold text-3xl text-blue-500">
97
+ {progress.xpEarned}
98
+ </div>
99
+ <XpBar
100
+ current={progress.xpEarned}
101
+ max={totalXp}
102
+ showLabel={false}
103
+ size="sm"
104
+ />
105
+ </CardContent>
106
+ </Card>
107
107
 
108
- <Card>
109
- <CardHeader className="pb-2">
110
- <CardTitle className="text-muted-foreground text-sm font-medium">
111
- Time Remaining
112
- </CardTitle>
113
- </CardHeader>
114
- <CardContent>
115
- <div className="text-3xl font-bold">
116
- {isComplete ? '✓' : `~${estimatedMinutes}m`}
117
- </div>
118
- <p className="text-muted-foreground mt-2 text-sm">
119
- {isComplete ? 'All done!' : `${remainingSteps} steps to go`}
120
- </p>
121
- </CardContent>
122
- </Card>
123
- </div>
108
+ <Card>
109
+ <CardHeader className="pb-2">
110
+ <CardTitle className="font-medium text-muted-foreground text-sm">
111
+ Time Remaining
112
+ </CardTitle>
113
+ </CardHeader>
114
+ <CardContent>
115
+ <div className="font-bold text-3xl">
116
+ {isComplete ? '✓' : `~${estimatedMinutes}m`}
117
+ </div>
118
+ <p className="mt-2 text-muted-foreground text-sm">
119
+ {isComplete ? 'All done!' : `${remainingSteps} steps to go`}
120
+ </p>
121
+ </CardContent>
122
+ </Card>
123
+ </div>
124
124
 
125
- {/* Step Preview */}
126
- <Card>
127
- <CardHeader>
128
- <CardTitle className="flex items-center gap-2">
129
- <span>📋</span>
130
- <span>Your Journey</span>
131
- </CardTitle>
132
- </CardHeader>
133
- <CardContent>
134
- <div className="space-y-3">
135
- {track.steps.map((step, index) => {
136
- const isStepCompleted = progress.completedStepIds.includes(
137
- step.id
138
- );
139
- const isCurrent =
140
- !isStepCompleted &&
141
- track.steps
142
- .slice(0, index)
143
- .every((s) => progress.completedStepIds.includes(s.id));
125
+ {/* Step Preview */}
126
+ <Card>
127
+ <CardHeader>
128
+ <CardTitle className="flex items-center gap-2">
129
+ <span>📋</span>
130
+ <span>Your Journey</span>
131
+ </CardTitle>
132
+ </CardHeader>
133
+ <CardContent>
134
+ <div className="space-y-3">
135
+ {track.steps.map((step, index) => {
136
+ const isStepCompleted = progress.completedStepIds.includes(
137
+ step.id
138
+ );
139
+ const isCurrent =
140
+ !isStepCompleted &&
141
+ track.steps
142
+ .slice(0, index)
143
+ .every((s) => progress.completedStepIds.includes(s.id));
144
144
 
145
- return (
146
- <div
147
- key={step.id}
148
- className="flex items-center gap-4 rounded-lg border p-3"
149
- >
150
- <div
151
- className={`flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-sm font-semibold ${
152
- isStepCompleted
153
- ? 'bg-green-500 text-white'
154
- : isCurrent
155
- ? 'bg-blue-500 text-white'
156
- : 'bg-muted text-muted-foreground'
157
- }`}
158
- >
159
- {isStepCompleted ? '✓' : index + 1}
160
- </div>
161
- <div className="min-w-0 flex-1">
162
- <p
163
- className={`font-medium ${
164
- isStepCompleted
165
- ? 'text-green-500'
166
- : isCurrent
167
- ? 'text-foreground'
168
- : 'text-muted-foreground'
169
- }`}
170
- >
171
- {step.title}
172
- </p>
173
- </div>
174
- {step.xpReward && (
175
- <span className="text-muted-foreground text-sm">
176
- +{step.xpReward} XP
177
- </span>
178
- )}
179
- </div>
180
- );
181
- })}
182
- </div>
183
- </CardContent>
184
- </Card>
145
+ return (
146
+ <div
147
+ key={step.id}
148
+ className="flex items-center gap-4 rounded-lg border p-3"
149
+ >
150
+ <div
151
+ className={`flex h-8 w-8 shrink-0 items-center justify-center rounded-full font-semibold text-sm ${
152
+ isStepCompleted
153
+ ? 'bg-green-500 text-white'
154
+ : isCurrent
155
+ ? 'bg-blue-500 text-white'
156
+ : 'bg-muted text-muted-foreground'
157
+ }`}
158
+ >
159
+ {isStepCompleted ? '✓' : index + 1}
160
+ </div>
161
+ <div className="min-w-0 flex-1">
162
+ <p
163
+ className={`font-medium ${
164
+ isStepCompleted
165
+ ? 'text-green-500'
166
+ : isCurrent
167
+ ? 'text-foreground'
168
+ : 'text-muted-foreground'
169
+ }`}
170
+ >
171
+ {step.title}
172
+ </p>
173
+ </div>
174
+ {step.xpReward && (
175
+ <span className="text-muted-foreground text-sm">
176
+ +{step.xpReward} XP
177
+ </span>
178
+ )}
179
+ </div>
180
+ );
181
+ })}
182
+ </div>
183
+ </CardContent>
184
+ </Card>
185
185
 
186
- {/* Completion Message */}
187
- {isComplete && (
188
- <Card className="border-green-500/50 bg-green-500/5">
189
- <CardContent className="flex items-center gap-4 p-6">
190
- <div className="text-4xl">🎉</div>
191
- <div>
192
- <h3 className="text-lg font-semibold text-green-500">
193
- Onboarding Complete!
194
- </h3>
195
- <p className="text-muted-foreground">
196
- You've completed all {totalSteps} steps. Welcome aboard!
197
- </p>
198
- </div>
199
- </CardContent>
200
- </Card>
201
- )}
202
- </div>
203
- );
186
+ {/* Completion Message */}
187
+ {isComplete && (
188
+ <Card className="border-green-500/50 bg-green-500/5">
189
+ <CardContent className="flex items-center gap-4 p-6">
190
+ <div className="text-4xl">🎉</div>
191
+ <div>
192
+ <h3 className="font-semibold text-green-500 text-lg">
193
+ Onboarding Complete!
194
+ </h3>
195
+ <p className="text-muted-foreground">
196
+ You've completed all {totalSteps} steps. Welcome aboard!
197
+ </p>
198
+ </div>
199
+ </CardContent>
200
+ </Card>
201
+ )}
202
+ </div>
203
+ );
204
204
  }