@lssm/example.learning-journey-ui-coaching 0.0.0-canary-20251212210835
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +22 -0
- package/CHANGELOG.md +13 -0
- package/README.md +30 -0
- package/dist/TipFeed-_1oKR35X.mjs +234 -0
- package/dist/components/index.d.mts +2 -0
- package/dist/components/index.mjs +4 -0
- package/dist/components-kh0CpIG2.mjs +1 -0
- package/dist/index-BjhNDTSh.d.mts +34 -0
- package/dist/index-DJtCFWjr.d.mts +47 -0
- package/dist/index.d.mts +18 -0
- package/dist/index.mjs +59 -0
- package/dist/views/index.d.mts +2 -0
- package/dist/views/index.mjs +4 -0
- package/dist/views-BTGcWRSz.mjs +421 -0
- package/package.json +53 -0
- package/src/CoachingMiniApp.tsx +94 -0
- package/src/components/EngagementMeter.tsx +96 -0
- package/src/components/TipCard.tsx +102 -0
- package/src/components/TipFeed.tsx +102 -0
- package/src/components/index.ts +4 -0
- package/src/index.ts +9 -0
- package/src/views/Overview.tsx +155 -0
- package/src/views/Progress.tsx +165 -0
- package/src/views/Steps.tsx +64 -0
- package/src/views/Timeline.tsx +115 -0
- package/src/views/index.ts +5 -0
- package/tsconfig.json +10 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/tsdown.config.js +13 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Button } from '@lssm/lib.design-system';
|
|
4
|
+
import { Card, CardContent } from '@lssm/lib.ui-kit-web/ui/card';
|
|
5
|
+
import { cn } from '@lssm/lib.ui-kit-web/ui/utils';
|
|
6
|
+
import type { LearningJourneyStepSpec } from '@lssm/module.learning-journey/track-spec';
|
|
7
|
+
|
|
8
|
+
interface TipCardProps {
|
|
9
|
+
step: LearningJourneyStepSpec;
|
|
10
|
+
isCompleted: boolean;
|
|
11
|
+
isCurrent: boolean;
|
|
12
|
+
onComplete?: () => void;
|
|
13
|
+
onDismiss?: () => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const TIP_ICONS: Record<string, string> = {
|
|
17
|
+
cash_buffer_too_high: '💰',
|
|
18
|
+
no_savings_goal: '🎯',
|
|
19
|
+
irregular_savings: '📅',
|
|
20
|
+
noise_late_evening: '🔇',
|
|
21
|
+
guest_frequency_high: '👥',
|
|
22
|
+
shared_space_conflicts: '🏠',
|
|
23
|
+
default: '💡',
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export function TipCard({
|
|
27
|
+
step,
|
|
28
|
+
isCompleted,
|
|
29
|
+
isCurrent,
|
|
30
|
+
onComplete,
|
|
31
|
+
onDismiss,
|
|
32
|
+
}: TipCardProps) {
|
|
33
|
+
const tipId = (step.metadata?.tipId as string) ?? 'default';
|
|
34
|
+
const icon = TIP_ICONS[tipId] ?? TIP_ICONS.default;
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<Card
|
|
38
|
+
className={cn(
|
|
39
|
+
'transition-all',
|
|
40
|
+
isCompleted && 'opacity-60',
|
|
41
|
+
isCurrent && 'ring-2 ring-amber-500'
|
|
42
|
+
)}
|
|
43
|
+
>
|
|
44
|
+
<CardContent className="p-4">
|
|
45
|
+
<div className="flex gap-4">
|
|
46
|
+
{/* Icon */}
|
|
47
|
+
<div
|
|
48
|
+
className={cn(
|
|
49
|
+
'flex h-12 w-12 shrink-0 items-center justify-center rounded-xl text-2xl',
|
|
50
|
+
isCompleted
|
|
51
|
+
? 'bg-green-500/10'
|
|
52
|
+
: isCurrent
|
|
53
|
+
? 'bg-amber-500/10'
|
|
54
|
+
: 'bg-muted'
|
|
55
|
+
)}
|
|
56
|
+
>
|
|
57
|
+
{isCompleted ? '✓' : icon}
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
{/* Content */}
|
|
61
|
+
<div className="min-w-0 flex-1">
|
|
62
|
+
<div className="flex items-start justify-between gap-2">
|
|
63
|
+
<h4 className="font-semibold">{step.title}</h4>
|
|
64
|
+
{step.xpReward && (
|
|
65
|
+
<span
|
|
66
|
+
className={cn(
|
|
67
|
+
'shrink-0 rounded-full px-2 py-0.5 text-xs font-semibold',
|
|
68
|
+
isCompleted
|
|
69
|
+
? 'bg-green-500/10 text-green-500'
|
|
70
|
+
: 'bg-amber-500/10 text-amber-500'
|
|
71
|
+
)}
|
|
72
|
+
>
|
|
73
|
+
+{step.xpReward} XP
|
|
74
|
+
</span>
|
|
75
|
+
)}
|
|
76
|
+
</div>
|
|
77
|
+
<p className="text-muted-foreground mt-1 text-sm">
|
|
78
|
+
{step.description}
|
|
79
|
+
</p>
|
|
80
|
+
|
|
81
|
+
{/* Actions */}
|
|
82
|
+
{!isCompleted && (
|
|
83
|
+
<div className="mt-3 flex flex-wrap gap-2">
|
|
84
|
+
<Button size="sm" onClick={onComplete}>
|
|
85
|
+
Take Action
|
|
86
|
+
</Button>
|
|
87
|
+
<Button variant="outline" size="sm" onClick={onDismiss}>
|
|
88
|
+
Dismiss
|
|
89
|
+
</Button>
|
|
90
|
+
</div>
|
|
91
|
+
)}
|
|
92
|
+
|
|
93
|
+
{isCompleted && (
|
|
94
|
+
<p className="mt-2 text-sm text-green-500">✓ Tip acknowledged</p>
|
|
95
|
+
)}
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
</CardContent>
|
|
99
|
+
</Card>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { cn } from '@lssm/lib.ui-kit-web/ui/utils';
|
|
4
|
+
import type { LearningJourneyStepSpec } from '@lssm/module.learning-journey/track-spec';
|
|
5
|
+
|
|
6
|
+
interface TipFeedItem {
|
|
7
|
+
step: LearningJourneyStepSpec;
|
|
8
|
+
isCompleted: boolean;
|
|
9
|
+
completedAt?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface TipFeedProps {
|
|
13
|
+
items: TipFeedItem[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const TIP_ICONS: Record<string, string> = {
|
|
17
|
+
cash_buffer_too_high: '💰',
|
|
18
|
+
no_savings_goal: '🎯',
|
|
19
|
+
irregular_savings: '📅',
|
|
20
|
+
noise_late_evening: '🔇',
|
|
21
|
+
guest_frequency_high: '👥',
|
|
22
|
+
shared_space_conflicts: '🏠',
|
|
23
|
+
default: '💡',
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export function TipFeed({ items }: TipFeedProps) {
|
|
27
|
+
if (items.length === 0) {
|
|
28
|
+
return (
|
|
29
|
+
<div className="text-muted-foreground py-8 text-center">
|
|
30
|
+
No tips yet. Start engaging with coaching tips!
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<div className="relative">
|
|
37
|
+
{/* Timeline line */}
|
|
38
|
+
<div className="bg-border absolute top-0 left-4 h-full w-0.5" />
|
|
39
|
+
|
|
40
|
+
{/* Feed items */}
|
|
41
|
+
<div className="space-y-4">
|
|
42
|
+
{items.map((item, index) => {
|
|
43
|
+
const tipId = (item.step.metadata?.tipId as string) ?? 'default';
|
|
44
|
+
const icon = TIP_ICONS[tipId] ?? TIP_ICONS.default;
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<div key={item.step.id} className="relative flex gap-4 pl-2">
|
|
48
|
+
{/* Node */}
|
|
49
|
+
<div
|
|
50
|
+
className={cn(
|
|
51
|
+
'relative z-10 flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-sm',
|
|
52
|
+
item.isCompleted
|
|
53
|
+
? 'bg-green-500 text-white'
|
|
54
|
+
: 'bg-muted text-muted-foreground'
|
|
55
|
+
)}
|
|
56
|
+
>
|
|
57
|
+
{item.isCompleted ? '✓' : icon}
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
{/* Content */}
|
|
61
|
+
<div className="bg-card flex-1 rounded-lg border p-3">
|
|
62
|
+
<div className="flex items-start justify-between gap-2">
|
|
63
|
+
<div>
|
|
64
|
+
<p className="font-medium">{item.step.title}</p>
|
|
65
|
+
<p className="text-muted-foreground mt-0.5 text-sm">
|
|
66
|
+
{item.step.description}
|
|
67
|
+
</p>
|
|
68
|
+
</div>
|
|
69
|
+
{item.step.xpReward && (
|
|
70
|
+
<span
|
|
71
|
+
className={cn(
|
|
72
|
+
'shrink-0 text-xs font-medium',
|
|
73
|
+
item.isCompleted
|
|
74
|
+
? 'text-green-500'
|
|
75
|
+
: 'text-muted-foreground'
|
|
76
|
+
)}
|
|
77
|
+
>
|
|
78
|
+
+{item.step.xpReward} XP
|
|
79
|
+
</span>
|
|
80
|
+
)}
|
|
81
|
+
</div>
|
|
82
|
+
|
|
83
|
+
{/* Timestamp */}
|
|
84
|
+
<div className="text-muted-foreground mt-2 flex items-center gap-2 text-xs">
|
|
85
|
+
{item.isCompleted ? (
|
|
86
|
+
<span className="text-green-500">
|
|
87
|
+
✓ Completed
|
|
88
|
+
{item.completedAt && ` • ${item.completedAt}`}
|
|
89
|
+
</span>
|
|
90
|
+
) : (
|
|
91
|
+
<span>Pending action</span>
|
|
92
|
+
)}
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
);
|
|
97
|
+
})}
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Button } from '@lssm/lib.design-system';
|
|
4
|
+
import {
|
|
5
|
+
Card,
|
|
6
|
+
CardContent,
|
|
7
|
+
CardHeader,
|
|
8
|
+
CardTitle,
|
|
9
|
+
} from '@lssm/lib.ui-kit-web/ui/card';
|
|
10
|
+
import { XpBar, StreakCounter } from '@lssm/example.learning-journey-ui-shared';
|
|
11
|
+
import { TipCard } from '../components/TipCard';
|
|
12
|
+
import type { LearningViewProps } from '@lssm/example.learning-journey-ui-shared';
|
|
13
|
+
|
|
14
|
+
interface CoachingOverviewProps extends LearningViewProps {
|
|
15
|
+
onStart?: () => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function Overview({
|
|
19
|
+
track,
|
|
20
|
+
progress,
|
|
21
|
+
onStepComplete,
|
|
22
|
+
onStart,
|
|
23
|
+
}: CoachingOverviewProps) {
|
|
24
|
+
const totalXp =
|
|
25
|
+
track.totalXp ?? track.steps.reduce((sum, s) => sum + (s.xpReward ?? 0), 0);
|
|
26
|
+
|
|
27
|
+
const completedSteps = progress.completedStepIds.length;
|
|
28
|
+
const totalSteps = track.steps.length;
|
|
29
|
+
const pendingSteps = totalSteps - completedSteps;
|
|
30
|
+
|
|
31
|
+
// Get active tips (incomplete ones)
|
|
32
|
+
const activeTips = track.steps
|
|
33
|
+
.filter((s) => !progress.completedStepIds.includes(s.id))
|
|
34
|
+
.slice(0, 3);
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div className="space-y-6">
|
|
38
|
+
{/* Header Card */}
|
|
39
|
+
<Card className="overflow-hidden bg-gradient-to-br from-amber-500/10 via-orange-500/10 to-red-500/10">
|
|
40
|
+
<CardContent className="p-6">
|
|
41
|
+
<div className="flex flex-col items-center gap-4 text-center md:flex-row md:text-left">
|
|
42
|
+
<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">
|
|
43
|
+
💡
|
|
44
|
+
</div>
|
|
45
|
+
<div className="flex-1">
|
|
46
|
+
<h1 className="text-2xl font-bold">{track.name}</h1>
|
|
47
|
+
<p className="text-muted-foreground mt-1">{track.description}</p>
|
|
48
|
+
</div>
|
|
49
|
+
<div className="flex items-center gap-4">
|
|
50
|
+
<StreakCounter days={progress.streakDays} size="lg" />
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</CardContent>
|
|
54
|
+
</Card>
|
|
55
|
+
|
|
56
|
+
{/* Quick Stats */}
|
|
57
|
+
<div className="grid gap-4 md:grid-cols-3">
|
|
58
|
+
<Card>
|
|
59
|
+
<CardHeader className="pb-2">
|
|
60
|
+
<CardTitle className="text-muted-foreground text-sm font-medium">
|
|
61
|
+
Active Tips
|
|
62
|
+
</CardTitle>
|
|
63
|
+
</CardHeader>
|
|
64
|
+
<CardContent>
|
|
65
|
+
<div className="text-3xl font-bold text-amber-500">
|
|
66
|
+
{pendingSteps}
|
|
67
|
+
</div>
|
|
68
|
+
<p className="text-muted-foreground text-sm">tips for you today</p>
|
|
69
|
+
</CardContent>
|
|
70
|
+
</Card>
|
|
71
|
+
|
|
72
|
+
<Card>
|
|
73
|
+
<CardHeader className="pb-2">
|
|
74
|
+
<CardTitle className="text-muted-foreground text-sm font-medium">
|
|
75
|
+
Tips Actioned
|
|
76
|
+
</CardTitle>
|
|
77
|
+
</CardHeader>
|
|
78
|
+
<CardContent>
|
|
79
|
+
<div className="text-3xl font-bold text-green-500">
|
|
80
|
+
{completedSteps}
|
|
81
|
+
</div>
|
|
82
|
+
<p className="text-muted-foreground text-sm">
|
|
83
|
+
out of {totalSteps} total
|
|
84
|
+
</p>
|
|
85
|
+
</CardContent>
|
|
86
|
+
</Card>
|
|
87
|
+
|
|
88
|
+
<Card>
|
|
89
|
+
<CardHeader className="pb-2">
|
|
90
|
+
<CardTitle className="text-muted-foreground text-sm font-medium">
|
|
91
|
+
XP Earned
|
|
92
|
+
</CardTitle>
|
|
93
|
+
</CardHeader>
|
|
94
|
+
<CardContent>
|
|
95
|
+
<div className="text-3xl font-bold text-orange-500">
|
|
96
|
+
{progress.xpEarned}
|
|
97
|
+
</div>
|
|
98
|
+
<XpBar
|
|
99
|
+
current={progress.xpEarned}
|
|
100
|
+
max={totalXp}
|
|
101
|
+
showLabel={false}
|
|
102
|
+
size="sm"
|
|
103
|
+
/>
|
|
104
|
+
</CardContent>
|
|
105
|
+
</Card>
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
{/* Active Tips Preview */}
|
|
109
|
+
{activeTips.length > 0 && (
|
|
110
|
+
<Card>
|
|
111
|
+
<CardHeader className="flex flex-row items-center justify-between">
|
|
112
|
+
<CardTitle className="flex items-center gap-2">
|
|
113
|
+
<span>💡</span>
|
|
114
|
+
<span>Tips for You</span>
|
|
115
|
+
</CardTitle>
|
|
116
|
+
{activeTips.length < pendingSteps && (
|
|
117
|
+
<Button variant="outline" size="sm" onClick={onStart}>
|
|
118
|
+
View All ({pendingSteps})
|
|
119
|
+
</Button>
|
|
120
|
+
)}
|
|
121
|
+
</CardHeader>
|
|
122
|
+
<CardContent className="space-y-3">
|
|
123
|
+
{activeTips.map((step) => (
|
|
124
|
+
<TipCard
|
|
125
|
+
key={step.id}
|
|
126
|
+
step={step}
|
|
127
|
+
isCompleted={false}
|
|
128
|
+
isCurrent={step.id === activeTips[0]?.id}
|
|
129
|
+
onComplete={() => onStepComplete?.(step.id)}
|
|
130
|
+
/>
|
|
131
|
+
))}
|
|
132
|
+
</CardContent>
|
|
133
|
+
</Card>
|
|
134
|
+
)}
|
|
135
|
+
|
|
136
|
+
{/* All Complete */}
|
|
137
|
+
{pendingSteps === 0 && (
|
|
138
|
+
<Card className="border-green-500/50 bg-green-500/5">
|
|
139
|
+
<CardContent className="flex items-center gap-4 p-6">
|
|
140
|
+
<div className="text-4xl">🎉</div>
|
|
141
|
+
<div>
|
|
142
|
+
<h3 className="text-lg font-semibold text-green-500">
|
|
143
|
+
All Tips Actioned!
|
|
144
|
+
</h3>
|
|
145
|
+
<p className="text-muted-foreground">
|
|
146
|
+
Great job! You've addressed all {totalSteps} coaching tips.
|
|
147
|
+
</p>
|
|
148
|
+
</div>
|
|
149
|
+
</CardContent>
|
|
150
|
+
</Card>
|
|
151
|
+
)}
|
|
152
|
+
</div>
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Card,
|
|
5
|
+
CardContent,
|
|
6
|
+
CardHeader,
|
|
7
|
+
CardTitle,
|
|
8
|
+
} from '@lssm/lib.ui-kit-web/ui/card';
|
|
9
|
+
import {
|
|
10
|
+
XpBar,
|
|
11
|
+
BadgeDisplay,
|
|
12
|
+
StreakCounter,
|
|
13
|
+
} from '@lssm/example.learning-journey-ui-shared';
|
|
14
|
+
import { EngagementMeter } from '../components/EngagementMeter';
|
|
15
|
+
import type { LearningViewProps } from '@lssm/example.learning-journey-ui-shared';
|
|
16
|
+
|
|
17
|
+
export function ProgressView({ track, progress }: LearningViewProps) {
|
|
18
|
+
const totalXp =
|
|
19
|
+
track.totalXp ?? track.steps.reduce((sum, s) => sum + (s.xpReward ?? 0), 0);
|
|
20
|
+
|
|
21
|
+
const completedSteps = progress.completedStepIds.length;
|
|
22
|
+
const totalSteps = track.steps.length;
|
|
23
|
+
const pendingSteps = totalSteps - completedSteps;
|
|
24
|
+
|
|
25
|
+
// For demo: split completed into "actioned" and "acknowledged"
|
|
26
|
+
// In real app, this would come from progress data
|
|
27
|
+
const actioned = Math.floor(completedSteps * 0.7);
|
|
28
|
+
const acknowledged = completedSteps - actioned;
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<div className="space-y-6">
|
|
32
|
+
{/* Engagement Overview */}
|
|
33
|
+
<Card>
|
|
34
|
+
<CardHeader>
|
|
35
|
+
<CardTitle className="flex items-center gap-2">
|
|
36
|
+
<span>📊</span>
|
|
37
|
+
<span>Engagement Overview</span>
|
|
38
|
+
</CardTitle>
|
|
39
|
+
</CardHeader>
|
|
40
|
+
<CardContent>
|
|
41
|
+
<EngagementMeter
|
|
42
|
+
actioned={actioned}
|
|
43
|
+
acknowledged={acknowledged}
|
|
44
|
+
pending={pendingSteps}
|
|
45
|
+
streak={progress.streakDays}
|
|
46
|
+
/>
|
|
47
|
+
</CardContent>
|
|
48
|
+
</Card>
|
|
49
|
+
|
|
50
|
+
{/* Stats Grid */}
|
|
51
|
+
<div className="grid gap-4 md:grid-cols-2">
|
|
52
|
+
<Card>
|
|
53
|
+
<CardHeader className="pb-2">
|
|
54
|
+
<CardTitle className="text-muted-foreground text-sm font-medium">
|
|
55
|
+
XP Earned
|
|
56
|
+
</CardTitle>
|
|
57
|
+
</CardHeader>
|
|
58
|
+
<CardContent className="space-y-3">
|
|
59
|
+
<div className="flex items-baseline gap-2">
|
|
60
|
+
<span className="text-3xl font-bold text-orange-500">
|
|
61
|
+
{progress.xpEarned}
|
|
62
|
+
</span>
|
|
63
|
+
<span className="text-muted-foreground">/ {totalXp} XP</span>
|
|
64
|
+
</div>
|
|
65
|
+
<XpBar
|
|
66
|
+
current={progress.xpEarned}
|
|
67
|
+
max={totalXp}
|
|
68
|
+
showLabel={false}
|
|
69
|
+
size="lg"
|
|
70
|
+
/>
|
|
71
|
+
</CardContent>
|
|
72
|
+
</Card>
|
|
73
|
+
|
|
74
|
+
<Card>
|
|
75
|
+
<CardHeader className="pb-2">
|
|
76
|
+
<CardTitle className="text-muted-foreground text-sm font-medium">
|
|
77
|
+
Engagement Streak
|
|
78
|
+
</CardTitle>
|
|
79
|
+
</CardHeader>
|
|
80
|
+
<CardContent>
|
|
81
|
+
<div className="flex items-center gap-4">
|
|
82
|
+
<StreakCounter days={progress.streakDays} size="lg" />
|
|
83
|
+
<div className="text-muted-foreground text-sm">
|
|
84
|
+
{progress.streakDays > 0
|
|
85
|
+
? 'Keep going!'
|
|
86
|
+
: 'Start your streak today!'}
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
</CardContent>
|
|
90
|
+
</Card>
|
|
91
|
+
</div>
|
|
92
|
+
|
|
93
|
+
{/* Achievements */}
|
|
94
|
+
<Card>
|
|
95
|
+
<CardHeader>
|
|
96
|
+
<CardTitle className="flex items-center gap-2">
|
|
97
|
+
<span>🏅</span>
|
|
98
|
+
<span>Achievements</span>
|
|
99
|
+
</CardTitle>
|
|
100
|
+
</CardHeader>
|
|
101
|
+
<CardContent>
|
|
102
|
+
<BadgeDisplay badges={progress.badges} size="lg" maxVisible={10} />
|
|
103
|
+
{progress.badges.length === 0 && (
|
|
104
|
+
<p className="text-muted-foreground text-sm">
|
|
105
|
+
Action tips to unlock achievements!
|
|
106
|
+
</p>
|
|
107
|
+
)}
|
|
108
|
+
</CardContent>
|
|
109
|
+
</Card>
|
|
110
|
+
|
|
111
|
+
{/* Tip Breakdown */}
|
|
112
|
+
<Card>
|
|
113
|
+
<CardHeader>
|
|
114
|
+
<CardTitle className="flex items-center gap-2">
|
|
115
|
+
<span>💡</span>
|
|
116
|
+
<span>Tip Status</span>
|
|
117
|
+
</CardTitle>
|
|
118
|
+
</CardHeader>
|
|
119
|
+
<CardContent>
|
|
120
|
+
<div className="space-y-3">
|
|
121
|
+
{track.steps.map((step) => {
|
|
122
|
+
const isCompleted = progress.completedStepIds.includes(step.id);
|
|
123
|
+
|
|
124
|
+
return (
|
|
125
|
+
<div
|
|
126
|
+
key={step.id}
|
|
127
|
+
className="flex items-center justify-between rounded-lg border p-3"
|
|
128
|
+
>
|
|
129
|
+
<div className="flex items-center gap-3">
|
|
130
|
+
<span
|
|
131
|
+
className={
|
|
132
|
+
isCompleted ? 'text-green-500' : 'text-amber-500'
|
|
133
|
+
}
|
|
134
|
+
>
|
|
135
|
+
{isCompleted ? '✓' : '○'}
|
|
136
|
+
</span>
|
|
137
|
+
<span
|
|
138
|
+
className={
|
|
139
|
+
isCompleted
|
|
140
|
+
? 'text-muted-foreground'
|
|
141
|
+
: 'text-foreground'
|
|
142
|
+
}
|
|
143
|
+
>
|
|
144
|
+
{step.title}
|
|
145
|
+
</span>
|
|
146
|
+
</div>
|
|
147
|
+
<span
|
|
148
|
+
className={`text-sm ${
|
|
149
|
+
isCompleted ? 'text-green-500' : 'text-muted-foreground'
|
|
150
|
+
}`}
|
|
151
|
+
>
|
|
152
|
+
{isCompleted ? 'Actioned' : 'Pending'}
|
|
153
|
+
</span>
|
|
154
|
+
</div>
|
|
155
|
+
);
|
|
156
|
+
})}
|
|
157
|
+
</div>
|
|
158
|
+
</CardContent>
|
|
159
|
+
</Card>
|
|
160
|
+
</div>
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export { ProgressView as Progress };
|
|
165
|
+
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { TipCard } from '../components/TipCard';
|
|
4
|
+
import type { LearningViewProps } from '@lssm/example.learning-journey-ui-shared';
|
|
5
|
+
|
|
6
|
+
export function Steps({ track, progress, onStepComplete }: LearningViewProps) {
|
|
7
|
+
const completedSteps = progress.completedStepIds.length;
|
|
8
|
+
const totalSteps = track.steps.length;
|
|
9
|
+
|
|
10
|
+
// Sort: pending first, then completed
|
|
11
|
+
const sortedSteps = [...track.steps].sort((a, b) => {
|
|
12
|
+
const aCompleted = progress.completedStepIds.includes(a.id);
|
|
13
|
+
const bCompleted = progress.completedStepIds.includes(b.id);
|
|
14
|
+
if (aCompleted === bCompleted) return 0;
|
|
15
|
+
return aCompleted ? 1 : -1;
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const currentStepId = track.steps.find(
|
|
19
|
+
(s) => !progress.completedStepIds.includes(s.id)
|
|
20
|
+
)?.id;
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div className="space-y-6">
|
|
24
|
+
{/* Header */}
|
|
25
|
+
<div className="text-center">
|
|
26
|
+
<h2 className="text-xl font-bold">Coaching Tips</h2>
|
|
27
|
+
<p className="text-muted-foreground">
|
|
28
|
+
Review and take action on personalized tips
|
|
29
|
+
</p>
|
|
30
|
+
<p className="text-muted-foreground mt-2 text-sm">
|
|
31
|
+
{completedSteps} of {totalSteps} tips actioned
|
|
32
|
+
</p>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
{/* Tips Stack */}
|
|
36
|
+
<div className="space-y-3">
|
|
37
|
+
{sortedSteps.map((step) => {
|
|
38
|
+
const isCompleted = progress.completedStepIds.includes(step.id);
|
|
39
|
+
const isCurrent = step.id === currentStepId;
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<TipCard
|
|
43
|
+
key={step.id}
|
|
44
|
+
step={step}
|
|
45
|
+
isCompleted={isCompleted}
|
|
46
|
+
isCurrent={isCurrent}
|
|
47
|
+
onComplete={() => onStepComplete?.(step.id)}
|
|
48
|
+
onDismiss={() => onStepComplete?.(step.id)} // Dismiss also completes
|
|
49
|
+
/>
|
|
50
|
+
);
|
|
51
|
+
})}
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
{/* All done */}
|
|
55
|
+
{completedSteps === totalSteps && (
|
|
56
|
+
<div className="text-muted-foreground text-center">
|
|
57
|
+
<span className="text-2xl">✨</span>
|
|
58
|
+
<p className="mt-2">All tips have been addressed!</p>
|
|
59
|
+
</div>
|
|
60
|
+
)}
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|