@lssm/example.learning-journey-ui-gamified 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/DayCalendar-Cha869Bi.mjs +178 -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-Bi5V3Ihq.d.mts +33 -0
- package/dist/index-DrzEZfnF.d.mts +44 -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-B-DapxWu.mjs +467 -0
- package/package.json +53 -0
- package/src/GamifiedMiniApp.tsx +94 -0
- package/src/components/DayCalendar.tsx +54 -0
- package/src/components/FlashCard.tsx +101 -0
- package/src/components/MasteryRing.tsx +82 -0
- package/src/components/index.ts +4 -0
- package/src/index.ts +9 -0
- package/src/views/Overview.tsx +165 -0
- package/src/views/Progress.tsx +181 -0
- package/src/views/Steps.tsx +51 -0
- package/src/views/Timeline.tsx +198 -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,101 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { Button } from '@lssm/lib.design-system';
|
|
5
|
+
import { Card, CardContent } from '@lssm/lib.ui-kit-web/ui/card';
|
|
6
|
+
import { cn } from '@lssm/lib.ui-kit-web/ui/utils';
|
|
7
|
+
import type { LearningJourneyStepSpec } from '@lssm/module.learning-journey/track-spec';
|
|
8
|
+
|
|
9
|
+
interface FlashCardProps {
|
|
10
|
+
step: LearningJourneyStepSpec;
|
|
11
|
+
isCompleted: boolean;
|
|
12
|
+
isCurrent: boolean;
|
|
13
|
+
onComplete?: () => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function FlashCard({
|
|
17
|
+
step,
|
|
18
|
+
isCompleted,
|
|
19
|
+
isCurrent,
|
|
20
|
+
onComplete,
|
|
21
|
+
}: FlashCardProps) {
|
|
22
|
+
const [isFlipped, setIsFlipped] = useState(false);
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<Card
|
|
26
|
+
className={cn(
|
|
27
|
+
'relative cursor-pointer overflow-hidden transition-all duration-300',
|
|
28
|
+
isCurrent && 'ring-primary ring-2',
|
|
29
|
+
isCompleted && 'opacity-60'
|
|
30
|
+
)}
|
|
31
|
+
onClick={() => !isCompleted && setIsFlipped(!isFlipped)}
|
|
32
|
+
>
|
|
33
|
+
<CardContent className="p-6">
|
|
34
|
+
{/* Front of card */}
|
|
35
|
+
<div
|
|
36
|
+
className={cn(
|
|
37
|
+
'space-y-4 transition-opacity duration-200',
|
|
38
|
+
isFlipped ? 'opacity-0' : 'opacity-100'
|
|
39
|
+
)}
|
|
40
|
+
>
|
|
41
|
+
<div className="flex items-start justify-between">
|
|
42
|
+
<div className="flex-1">
|
|
43
|
+
<h3 className="text-lg font-semibold">{step.title}</h3>
|
|
44
|
+
{step.description && (
|
|
45
|
+
<p className="text-muted-foreground mt-1 text-sm">
|
|
46
|
+
{step.description}
|
|
47
|
+
</p>
|
|
48
|
+
)}
|
|
49
|
+
</div>
|
|
50
|
+
{step.xpReward && (
|
|
51
|
+
<span className="rounded-full bg-green-500/10 px-2 py-1 text-xs font-semibold text-green-500">
|
|
52
|
+
+{step.xpReward} XP
|
|
53
|
+
</span>
|
|
54
|
+
)}
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
{isCompleted && (
|
|
58
|
+
<div className="flex items-center gap-2 text-green-500">
|
|
59
|
+
<span>✓</span>
|
|
60
|
+
<span className="text-sm font-medium">Completed</span>
|
|
61
|
+
</div>
|
|
62
|
+
)}
|
|
63
|
+
|
|
64
|
+
{isCurrent && !isCompleted && (
|
|
65
|
+
<p className="text-muted-foreground text-xs">
|
|
66
|
+
Tap to reveal action
|
|
67
|
+
</p>
|
|
68
|
+
)}
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
{/* Back of card (action) */}
|
|
72
|
+
{isFlipped && !isCompleted && (
|
|
73
|
+
<div className="absolute inset-0 flex flex-col items-center justify-center gap-4 bg-gradient-to-br from-violet-500/10 to-violet-600/10 p-6">
|
|
74
|
+
<p className="text-center text-sm">
|
|
75
|
+
{step.instructions ?? 'Complete this step to earn XP'}
|
|
76
|
+
</p>
|
|
77
|
+
<div className="flex gap-2">
|
|
78
|
+
<Button
|
|
79
|
+
variant="outline"
|
|
80
|
+
size="sm"
|
|
81
|
+
onClick={() => setIsFlipped(false)}
|
|
82
|
+
>
|
|
83
|
+
Back
|
|
84
|
+
</Button>
|
|
85
|
+
<Button
|
|
86
|
+
size="sm"
|
|
87
|
+
onClick={(e) => {
|
|
88
|
+
e.stopPropagation();
|
|
89
|
+
onComplete?.();
|
|
90
|
+
}}
|
|
91
|
+
>
|
|
92
|
+
Mark Complete
|
|
93
|
+
</Button>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
)}
|
|
97
|
+
</CardContent>
|
|
98
|
+
</Card>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { cn } from '@lssm/lib.ui-kit-web/ui/utils';
|
|
4
|
+
|
|
5
|
+
interface MasteryRingProps {
|
|
6
|
+
label: string;
|
|
7
|
+
percentage: number;
|
|
8
|
+
size?: 'sm' | 'md' | 'lg';
|
|
9
|
+
color?: 'green' | 'blue' | 'violet' | 'orange';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const sizeStyles = {
|
|
13
|
+
sm: { container: 'h-16 w-16', text: 'text-xs', ring: 48, stroke: 4 },
|
|
14
|
+
md: { container: 'h-24 w-24', text: 'text-sm', ring: 72, stroke: 6 },
|
|
15
|
+
lg: { container: 'h-32 w-32', text: 'text-base', ring: 96, stroke: 8 },
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const colorStyles = {
|
|
19
|
+
green: 'stroke-green-500',
|
|
20
|
+
blue: 'stroke-blue-500',
|
|
21
|
+
violet: 'stroke-violet-500',
|
|
22
|
+
orange: 'stroke-orange-500',
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export function MasteryRing({
|
|
26
|
+
label,
|
|
27
|
+
percentage,
|
|
28
|
+
size = 'md',
|
|
29
|
+
color = 'violet',
|
|
30
|
+
}: MasteryRingProps) {
|
|
31
|
+
const styles = sizeStyles[size];
|
|
32
|
+
const radius = (styles.ring - styles.stroke) / 2;
|
|
33
|
+
const circumference = 2 * Math.PI * radius;
|
|
34
|
+
const strokeDashoffset = circumference - (percentage / 100) * circumference;
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div
|
|
38
|
+
className={cn(
|
|
39
|
+
'relative flex flex-col items-center gap-1',
|
|
40
|
+
styles.container
|
|
41
|
+
)}
|
|
42
|
+
>
|
|
43
|
+
<svg
|
|
44
|
+
className="absolute -rotate-90"
|
|
45
|
+
width={styles.ring}
|
|
46
|
+
height={styles.ring}
|
|
47
|
+
viewBox={`0 0 ${styles.ring} ${styles.ring}`}
|
|
48
|
+
>
|
|
49
|
+
{/* Background ring */}
|
|
50
|
+
<circle
|
|
51
|
+
cx={styles.ring / 2}
|
|
52
|
+
cy={styles.ring / 2}
|
|
53
|
+
r={radius}
|
|
54
|
+
fill="none"
|
|
55
|
+
strokeWidth={styles.stroke}
|
|
56
|
+
className="stroke-muted"
|
|
57
|
+
/>
|
|
58
|
+
{/* Progress ring */}
|
|
59
|
+
<circle
|
|
60
|
+
cx={styles.ring / 2}
|
|
61
|
+
cy={styles.ring / 2}
|
|
62
|
+
r={radius}
|
|
63
|
+
fill="none"
|
|
64
|
+
strokeWidth={styles.stroke}
|
|
65
|
+
strokeLinecap="round"
|
|
66
|
+
strokeDasharray={circumference}
|
|
67
|
+
strokeDashoffset={strokeDashoffset}
|
|
68
|
+
className={cn('transition-all duration-500', colorStyles[color])}
|
|
69
|
+
/>
|
|
70
|
+
</svg>
|
|
71
|
+
<div className="flex h-full flex-col items-center justify-center">
|
|
72
|
+
<span className={cn('font-bold', styles.text)}>
|
|
73
|
+
{Math.round(percentage)}%
|
|
74
|
+
</span>
|
|
75
|
+
</div>
|
|
76
|
+
<span className={cn('text-muted-foreground mt-1 truncate', styles.text)}>
|
|
77
|
+
{label}
|
|
78
|
+
</span>
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
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 {
|
|
11
|
+
XpBar,
|
|
12
|
+
StreakCounter,
|
|
13
|
+
BadgeDisplay,
|
|
14
|
+
} from '@lssm/example.learning-journey-ui-shared';
|
|
15
|
+
import type { LearningViewProps } from '@lssm/example.learning-journey-ui-shared';
|
|
16
|
+
|
|
17
|
+
interface GamifiedOverviewProps extends LearningViewProps {
|
|
18
|
+
onStart?: () => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function Overview({ track, progress, onStart }: GamifiedOverviewProps) {
|
|
22
|
+
const totalXp =
|
|
23
|
+
track.totalXp ??
|
|
24
|
+
track.steps.reduce((sum, s) => sum + (s.xpReward ?? 0), 0) +
|
|
25
|
+
(track.completionRewards?.xpBonus ?? 0);
|
|
26
|
+
|
|
27
|
+
const completedSteps = progress.completedStepIds.length;
|
|
28
|
+
const totalSteps = track.steps.length;
|
|
29
|
+
const isComplete = completedSteps === totalSteps;
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<div className="space-y-6">
|
|
33
|
+
{/* Hero Card */}
|
|
34
|
+
<Card className="overflow-hidden bg-gradient-to-br from-violet-500/10 via-purple-500/10 to-fuchsia-500/10">
|
|
35
|
+
<CardContent className="p-6">
|
|
36
|
+
<div className="flex flex-col items-center gap-4 text-center md:flex-row md:text-left">
|
|
37
|
+
<div className="flex h-20 w-20 items-center justify-center rounded-2xl bg-gradient-to-br from-violet-500 to-purple-600 text-4xl shadow-lg">
|
|
38
|
+
{isComplete ? '🏆' : '🎯'}
|
|
39
|
+
</div>
|
|
40
|
+
<div className="flex-1">
|
|
41
|
+
<h1 className="text-2xl font-bold">{track.name}</h1>
|
|
42
|
+
<p className="text-muted-foreground mt-1">{track.description}</p>
|
|
43
|
+
</div>
|
|
44
|
+
<div className="flex items-center gap-3">
|
|
45
|
+
<StreakCounter days={progress.streakDays} size="lg" />
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</CardContent>
|
|
49
|
+
</Card>
|
|
50
|
+
|
|
51
|
+
{/* Stats Grid */}
|
|
52
|
+
<div className="grid gap-4 md:grid-cols-3">
|
|
53
|
+
<Card>
|
|
54
|
+
<CardHeader className="pb-2">
|
|
55
|
+
<CardTitle className="text-muted-foreground text-sm font-medium">
|
|
56
|
+
XP Progress
|
|
57
|
+
</CardTitle>
|
|
58
|
+
</CardHeader>
|
|
59
|
+
<CardContent>
|
|
60
|
+
<div className="text-3xl font-bold text-violet-500">
|
|
61
|
+
{progress.xpEarned.toLocaleString()}
|
|
62
|
+
</div>
|
|
63
|
+
<XpBar
|
|
64
|
+
current={progress.xpEarned}
|
|
65
|
+
max={totalXp}
|
|
66
|
+
showLabel={false}
|
|
67
|
+
size="sm"
|
|
68
|
+
/>
|
|
69
|
+
</CardContent>
|
|
70
|
+
</Card>
|
|
71
|
+
|
|
72
|
+
<Card>
|
|
73
|
+
<CardHeader className="pb-2">
|
|
74
|
+
<CardTitle className="text-muted-foreground text-sm font-medium">
|
|
75
|
+
Steps Completed
|
|
76
|
+
</CardTitle>
|
|
77
|
+
</CardHeader>
|
|
78
|
+
<CardContent>
|
|
79
|
+
<div className="text-3xl font-bold">
|
|
80
|
+
{completedSteps}{' '}
|
|
81
|
+
<span className="text-muted-foreground text-lg">
|
|
82
|
+
/ {totalSteps}
|
|
83
|
+
</span>
|
|
84
|
+
</div>
|
|
85
|
+
<div className="bg-muted mt-2 h-2 w-full overflow-hidden rounded-full">
|
|
86
|
+
<div
|
|
87
|
+
className="h-full bg-green-500 transition-all duration-500"
|
|
88
|
+
style={{ width: `${(completedSteps / totalSteps) * 100}%` }}
|
|
89
|
+
/>
|
|
90
|
+
</div>
|
|
91
|
+
</CardContent>
|
|
92
|
+
</Card>
|
|
93
|
+
|
|
94
|
+
<Card>
|
|
95
|
+
<CardHeader className="pb-2">
|
|
96
|
+
<CardTitle className="text-muted-foreground text-sm font-medium">
|
|
97
|
+
Badges Earned
|
|
98
|
+
</CardTitle>
|
|
99
|
+
</CardHeader>
|
|
100
|
+
<CardContent>
|
|
101
|
+
<BadgeDisplay badges={progress.badges} size="lg" />
|
|
102
|
+
</CardContent>
|
|
103
|
+
</Card>
|
|
104
|
+
</div>
|
|
105
|
+
|
|
106
|
+
{/* Next Step Preview */}
|
|
107
|
+
{!isComplete && (
|
|
108
|
+
<Card>
|
|
109
|
+
<CardHeader>
|
|
110
|
+
<CardTitle className="flex items-center gap-2">
|
|
111
|
+
<span>🎯</span>
|
|
112
|
+
<span>Next Challenge</span>
|
|
113
|
+
</CardTitle>
|
|
114
|
+
</CardHeader>
|
|
115
|
+
<CardContent>
|
|
116
|
+
{(() => {
|
|
117
|
+
const nextStep = track.steps.find(
|
|
118
|
+
(s) => !progress.completedStepIds.includes(s.id)
|
|
119
|
+
);
|
|
120
|
+
if (!nextStep) return null;
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<div className="flex items-center justify-between gap-4">
|
|
124
|
+
<div>
|
|
125
|
+
<h3 className="font-semibold">{nextStep.title}</h3>
|
|
126
|
+
<p className="text-muted-foreground text-sm">
|
|
127
|
+
{nextStep.description}
|
|
128
|
+
</p>
|
|
129
|
+
</div>
|
|
130
|
+
<div className="flex items-center gap-3">
|
|
131
|
+
{nextStep.xpReward && (
|
|
132
|
+
<span className="rounded-full bg-green-500/10 px-3 py-1 text-sm font-semibold text-green-500">
|
|
133
|
+
+{nextStep.xpReward} XP
|
|
134
|
+
</span>
|
|
135
|
+
)}
|
|
136
|
+
<Button onClick={onStart}>Start</Button>
|
|
137
|
+
</div>
|
|
138
|
+
</div>
|
|
139
|
+
);
|
|
140
|
+
})()}
|
|
141
|
+
</CardContent>
|
|
142
|
+
</Card>
|
|
143
|
+
)}
|
|
144
|
+
|
|
145
|
+
{/* Completion Message */}
|
|
146
|
+
{isComplete && (
|
|
147
|
+
<Card className="border-green-500/50 bg-green-500/5">
|
|
148
|
+
<CardContent className="flex items-center gap-4 p-6">
|
|
149
|
+
<div className="text-4xl">🎉</div>
|
|
150
|
+
<div>
|
|
151
|
+
<h3 className="text-lg font-semibold text-green-500">
|
|
152
|
+
Track Complete!
|
|
153
|
+
</h3>
|
|
154
|
+
<p className="text-muted-foreground">
|
|
155
|
+
You've mastered all {totalSteps} challenges and earned{' '}
|
|
156
|
+
{progress.xpEarned} XP.
|
|
157
|
+
</p>
|
|
158
|
+
</div>
|
|
159
|
+
</CardContent>
|
|
160
|
+
</Card>
|
|
161
|
+
)}
|
|
162
|
+
</div>
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
|
|
@@ -0,0 +1,181 @@
|
|
|
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 { XpBar, BadgeDisplay } from '@lssm/example.learning-journey-ui-shared';
|
|
10
|
+
import { MasteryRing } from '../components/MasteryRing';
|
|
11
|
+
import type { LearningViewProps } from '@lssm/example.learning-journey-ui-shared';
|
|
12
|
+
|
|
13
|
+
export function Progress({ track, progress }: LearningViewProps) {
|
|
14
|
+
const totalXp =
|
|
15
|
+
track.totalXp ??
|
|
16
|
+
track.steps.reduce((sum, s) => sum + (s.xpReward ?? 0), 0) +
|
|
17
|
+
(track.completionRewards?.xpBonus ?? 0);
|
|
18
|
+
|
|
19
|
+
const completedSteps = progress.completedStepIds.length;
|
|
20
|
+
const totalSteps = track.steps.length;
|
|
21
|
+
const percentComplete =
|
|
22
|
+
totalSteps > 0 ? (completedSteps / totalSteps) * 100 : 0;
|
|
23
|
+
|
|
24
|
+
// Group steps by metadata surface for mastery rings
|
|
25
|
+
const surfaces = new Map<string, { total: number; completed: number }>();
|
|
26
|
+
track.steps.forEach((step) => {
|
|
27
|
+
const surface = (step.metadata?.surface as string) ?? 'general';
|
|
28
|
+
const current = surfaces.get(surface) ?? { total: 0, completed: 0 };
|
|
29
|
+
surfaces.set(surface, {
|
|
30
|
+
total: current.total + 1,
|
|
31
|
+
completed:
|
|
32
|
+
current.completed +
|
|
33
|
+
(progress.completedStepIds.includes(step.id) ? 1 : 0),
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const surfaceColors: Array<'green' | 'blue' | 'violet' | 'orange'> = [
|
|
38
|
+
'green',
|
|
39
|
+
'blue',
|
|
40
|
+
'violet',
|
|
41
|
+
'orange',
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<div className="space-y-6">
|
|
46
|
+
{/* XP Progress */}
|
|
47
|
+
<Card>
|
|
48
|
+
<CardHeader>
|
|
49
|
+
<CardTitle className="flex items-center gap-2">
|
|
50
|
+
<span>⚡</span>
|
|
51
|
+
<span>Experience Points</span>
|
|
52
|
+
</CardTitle>
|
|
53
|
+
</CardHeader>
|
|
54
|
+
<CardContent className="space-y-4">
|
|
55
|
+
<div className="flex items-baseline gap-2">
|
|
56
|
+
<span className="text-4xl font-bold text-violet-500">
|
|
57
|
+
{progress.xpEarned.toLocaleString()}
|
|
58
|
+
</span>
|
|
59
|
+
<span className="text-muted-foreground">
|
|
60
|
+
/ {totalXp.toLocaleString()} XP
|
|
61
|
+
</span>
|
|
62
|
+
</div>
|
|
63
|
+
<XpBar
|
|
64
|
+
current={progress.xpEarned}
|
|
65
|
+
max={totalXp}
|
|
66
|
+
showLabel={false}
|
|
67
|
+
size="lg"
|
|
68
|
+
/>
|
|
69
|
+
|
|
70
|
+
{track.completionRewards?.xpBonus && percentComplete < 100 && (
|
|
71
|
+
<p className="text-muted-foreground text-sm">
|
|
72
|
+
🎁 Complete all steps for a{' '}
|
|
73
|
+
<span className="font-semibold text-green-500">
|
|
74
|
+
+{track.completionRewards.xpBonus} XP
|
|
75
|
+
</span>{' '}
|
|
76
|
+
bonus!
|
|
77
|
+
</p>
|
|
78
|
+
)}
|
|
79
|
+
</CardContent>
|
|
80
|
+
</Card>
|
|
81
|
+
|
|
82
|
+
{/* Mastery Rings */}
|
|
83
|
+
<Card>
|
|
84
|
+
<CardHeader>
|
|
85
|
+
<CardTitle className="flex items-center gap-2">
|
|
86
|
+
<span>🎯</span>
|
|
87
|
+
<span>Skill Mastery</span>
|
|
88
|
+
</CardTitle>
|
|
89
|
+
</CardHeader>
|
|
90
|
+
<CardContent>
|
|
91
|
+
<div className="flex flex-wrap justify-center gap-6">
|
|
92
|
+
{Array.from(surfaces.entries()).map(([surface, data], index) => (
|
|
93
|
+
<MasteryRing
|
|
94
|
+
key={surface}
|
|
95
|
+
label={surface.charAt(0).toUpperCase() + surface.slice(1)}
|
|
96
|
+
percentage={(data.completed / data.total) * 100}
|
|
97
|
+
color={surfaceColors[index % surfaceColors.length]}
|
|
98
|
+
size="lg"
|
|
99
|
+
/>
|
|
100
|
+
))}
|
|
101
|
+
<MasteryRing
|
|
102
|
+
label="Overall"
|
|
103
|
+
percentage={percentComplete}
|
|
104
|
+
color="violet"
|
|
105
|
+
size="lg"
|
|
106
|
+
/>
|
|
107
|
+
</div>
|
|
108
|
+
</CardContent>
|
|
109
|
+
</Card>
|
|
110
|
+
|
|
111
|
+
{/* Badges */}
|
|
112
|
+
<Card>
|
|
113
|
+
<CardHeader>
|
|
114
|
+
<CardTitle className="flex items-center gap-2">
|
|
115
|
+
<span>🏅</span>
|
|
116
|
+
<span>Badges Earned</span>
|
|
117
|
+
</CardTitle>
|
|
118
|
+
</CardHeader>
|
|
119
|
+
<CardContent>
|
|
120
|
+
<BadgeDisplay badges={progress.badges} size="lg" maxVisible={10} />
|
|
121
|
+
{progress.badges.length === 0 && (
|
|
122
|
+
<p className="text-muted-foreground text-sm">
|
|
123
|
+
Complete the track to earn your first badge!
|
|
124
|
+
</p>
|
|
125
|
+
)}
|
|
126
|
+
</CardContent>
|
|
127
|
+
</Card>
|
|
128
|
+
|
|
129
|
+
{/* Step Breakdown */}
|
|
130
|
+
<Card>
|
|
131
|
+
<CardHeader>
|
|
132
|
+
<CardTitle className="flex items-center gap-2">
|
|
133
|
+
<span>📊</span>
|
|
134
|
+
<span>Step Breakdown</span>
|
|
135
|
+
</CardTitle>
|
|
136
|
+
</CardHeader>
|
|
137
|
+
<CardContent>
|
|
138
|
+
<div className="space-y-2">
|
|
139
|
+
{track.steps.map((step) => {
|
|
140
|
+
const isCompleted = progress.completedStepIds.includes(step.id);
|
|
141
|
+
return (
|
|
142
|
+
<div
|
|
143
|
+
key={step.id}
|
|
144
|
+
className="flex items-center justify-between rounded-lg border p-3"
|
|
145
|
+
>
|
|
146
|
+
<div className="flex items-center gap-3">
|
|
147
|
+
<span
|
|
148
|
+
className={
|
|
149
|
+
isCompleted ? 'text-green-500' : 'text-muted-foreground'
|
|
150
|
+
}
|
|
151
|
+
>
|
|
152
|
+
{isCompleted ? '✓' : '○'}
|
|
153
|
+
</span>
|
|
154
|
+
<span
|
|
155
|
+
className={
|
|
156
|
+
isCompleted
|
|
157
|
+
? 'text-foreground'
|
|
158
|
+
: 'text-muted-foreground'
|
|
159
|
+
}
|
|
160
|
+
>
|
|
161
|
+
{step.title}
|
|
162
|
+
</span>
|
|
163
|
+
</div>
|
|
164
|
+
{step.xpReward && (
|
|
165
|
+
<span
|
|
166
|
+
className={`text-sm font-medium ${isCompleted ? 'text-green-500' : 'text-muted-foreground'}`}
|
|
167
|
+
>
|
|
168
|
+
{isCompleted ? '+' : ''}
|
|
169
|
+
{step.xpReward} XP
|
|
170
|
+
</span>
|
|
171
|
+
)}
|
|
172
|
+
</div>
|
|
173
|
+
);
|
|
174
|
+
})}
|
|
175
|
+
</div>
|
|
176
|
+
</CardContent>
|
|
177
|
+
</Card>
|
|
178
|
+
</div>
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { FlashCard } from '../components/FlashCard';
|
|
4
|
+
import type { LearningViewProps } from '@lssm/example.learning-journey-ui-shared';
|
|
5
|
+
|
|
6
|
+
export function Steps({ track, progress, onStepComplete }: LearningViewProps) {
|
|
7
|
+
const currentStepIndex = track.steps.findIndex(
|
|
8
|
+
(s) => !progress.completedStepIds.includes(s.id)
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<div className="space-y-6">
|
|
13
|
+
{/* Header */}
|
|
14
|
+
<div className="text-center">
|
|
15
|
+
<h2 className="text-xl font-bold">Complete Your Challenges</h2>
|
|
16
|
+
<p className="text-muted-foreground">
|
|
17
|
+
Tap each card to reveal the action, then mark as complete
|
|
18
|
+
</p>
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
{/* Card Stack */}
|
|
22
|
+
<div className="grid gap-4 md:grid-cols-2">
|
|
23
|
+
{track.steps.map((step, index) => {
|
|
24
|
+
const isCompleted = progress.completedStepIds.includes(step.id);
|
|
25
|
+
const isCurrent = index === currentStepIndex;
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<FlashCard
|
|
29
|
+
key={step.id}
|
|
30
|
+
step={step}
|
|
31
|
+
isCompleted={isCompleted}
|
|
32
|
+
isCurrent={isCurrent}
|
|
33
|
+
onComplete={() => onStepComplete?.(step.id)}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
})}
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
{/* Progress Summary */}
|
|
40
|
+
<div className="text-muted-foreground text-center text-sm">
|
|
41
|
+
{progress.completedStepIds.length} of {track.steps.length} completed
|
|
42
|
+
{track.completionRewards?.xpBonus && (
|
|
43
|
+
<span className="ml-2 text-green-500">
|
|
44
|
+
(+{track.completionRewards.xpBonus} XP bonus on completion)
|
|
45
|
+
</span>
|
|
46
|
+
)}
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|