@contractspec/example.learning-journey-ui-gamified 1.56.1 → 1.58.0
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 +59 -58
- package/.turbo/turbo-prebuild.log +1 -0
- package/CHANGELOG.md +40 -0
- package/dist/GamifiedMiniApp.d.ts +4 -14
- package/dist/GamifiedMiniApp.d.ts.map +1 -1
- package/dist/GamifiedMiniApp.js +995 -59
- package/dist/browser/GamifiedMiniApp.js +998 -0
- package/dist/browser/components/DayCalendar.js +42 -0
- package/dist/browser/components/FlashCard.js +102 -0
- package/dist/browser/components/MasteryRing.js +75 -0
- package/dist/browser/components/index.js +217 -0
- package/dist/browser/docs/index.js +22 -0
- package/dist/browser/docs/learning-journey-ui-gamified.docblock.js +22 -0
- package/dist/browser/example.js +32 -0
- package/dist/browser/index.js +1057 -0
- package/dist/browser/views/Overview.js +236 -0
- package/dist/browser/views/Progress.js +294 -0
- package/dist/browser/views/Steps.js +157 -0
- package/dist/browser/views/Timeline.js +235 -0
- package/dist/browser/views/index.js +919 -0
- package/dist/components/DayCalendar.d.ts +5 -13
- package/dist/components/DayCalendar.d.ts.map +1 -1
- package/dist/components/DayCalendar.js +41 -31
- package/dist/components/FlashCard.d.ts +7 -16
- package/dist/components/FlashCard.d.ts.map +1 -1
- package/dist/components/FlashCard.js +99 -76
- package/dist/components/MasteryRing.d.ts +6 -15
- package/dist/components/MasteryRing.d.ts.map +1 -1
- package/dist/components/MasteryRing.js +72 -78
- package/dist/components/index.d.ts +4 -4
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +217 -4
- package/dist/docs/index.d.ts +2 -1
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +23 -1
- package/dist/docs/learning-journey-ui-gamified.docblock.d.ts +2 -1
- package/dist/docs/learning-journey-ui-gamified.docblock.d.ts.map +1 -0
- package/dist/docs/learning-journey-ui-gamified.docblock.js +21 -18
- package/dist/example.d.ts +2 -6
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +30 -39
- package/dist/index.d.ts +6 -12
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1058 -14
- package/dist/node/GamifiedMiniApp.js +998 -0
- package/dist/node/components/DayCalendar.js +42 -0
- package/dist/node/components/FlashCard.js +102 -0
- package/dist/node/components/MasteryRing.js +75 -0
- package/dist/node/components/index.js +217 -0
- package/dist/node/docs/index.js +22 -0
- package/dist/node/docs/learning-journey-ui-gamified.docblock.js +22 -0
- package/dist/node/example.js +32 -0
- package/dist/node/index.js +1057 -0
- package/dist/node/views/Overview.js +236 -0
- package/dist/node/views/Progress.js +294 -0
- package/dist/node/views/Steps.js +157 -0
- package/dist/node/views/Timeline.js +235 -0
- package/dist/node/views/index.js +919 -0
- package/dist/views/Overview.d.ts +4 -12
- package/dist/views/Overview.d.ts.map +1 -1
- package/dist/views/Overview.js +234 -158
- package/dist/views/Progress.d.ts +2 -10
- package/dist/views/Progress.d.ts.map +1 -1
- package/dist/views/Progress.js +292 -140
- package/dist/views/Steps.d.ts +2 -11
- package/dist/views/Steps.d.ts.map +1 -1
- package/dist/views/Steps.js +155 -53
- package/dist/views/Timeline.d.ts +2 -10
- package/dist/views/Timeline.d.ts.map +1 -1
- package/dist/views/Timeline.js +233 -130
- package/dist/views/index.d.ts +5 -5
- package/dist/views/index.d.ts.map +1 -0
- package/dist/views/index.js +919 -5
- package/package.json +155 -39
- package/tsdown.config.js +1 -2
- package/.turbo/turbo-build$colon$bundle.log +0 -57
- package/dist/GamifiedMiniApp.js.map +0 -1
- package/dist/components/DayCalendar.js.map +0 -1
- package/dist/components/FlashCard.js.map +0 -1
- package/dist/components/MasteryRing.js.map +0 -1
- package/dist/docs/learning-journey-ui-gamified.docblock.js.map +0 -1
- package/dist/example.js.map +0 -1
- package/dist/views/Overview.js.map +0 -1
- package/dist/views/Progress.js.map +0 -1
- package/dist/views/Steps.js.map +0 -1
- package/dist/views/Timeline.js.map +0 -1
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// src/components/DayCalendar.tsx
|
|
2
|
+
import { cn } from "@contractspec/lib.ui-kit-web/ui/utils";
|
|
3
|
+
import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
|
|
4
|
+
"use client";
|
|
5
|
+
function DayCalendar({
|
|
6
|
+
totalDays,
|
|
7
|
+
currentDay,
|
|
8
|
+
completedDays
|
|
9
|
+
}) {
|
|
10
|
+
const days = Array.from({ length: totalDays }, (_, i) => i + 1);
|
|
11
|
+
return /* @__PURE__ */ jsxDEV("div", {
|
|
12
|
+
className: "grid grid-cols-7 gap-2",
|
|
13
|
+
children: days.map((day) => {
|
|
14
|
+
const isCompleted = completedDays.includes(day);
|
|
15
|
+
const isCurrent = day === currentDay;
|
|
16
|
+
const isLocked = day > currentDay;
|
|
17
|
+
return /* @__PURE__ */ jsxDEV("div", {
|
|
18
|
+
className: cn("flex h-12 w-12 flex-col items-center justify-center rounded-lg border text-sm font-medium transition-all", isCompleted && "border-green-500 bg-green-500/10 text-green-500", isCurrent && !isCompleted && "border-violet-500 bg-violet-500/10 text-violet-500 ring-2 ring-violet-500/50", isLocked && "border-muted bg-muted/50 text-muted-foreground", !isCompleted && !isCurrent && !isLocked && "border-border bg-card"),
|
|
19
|
+
children: isCompleted ? /* @__PURE__ */ jsxDEV("span", {
|
|
20
|
+
className: "text-lg",
|
|
21
|
+
children: "✓"
|
|
22
|
+
}, undefined, false, undefined, this) : isLocked ? /* @__PURE__ */ jsxDEV("span", {
|
|
23
|
+
className: "text-lg",
|
|
24
|
+
children: "\uD83D\uDD12"
|
|
25
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV(Fragment, {
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
28
|
+
className: "text-muted-foreground text-xs",
|
|
29
|
+
children: "Day"
|
|
30
|
+
}, undefined, false, undefined, this),
|
|
31
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
32
|
+
children: day
|
|
33
|
+
}, undefined, false, undefined, this)
|
|
34
|
+
]
|
|
35
|
+
}, undefined, true, undefined, this)
|
|
36
|
+
}, day, false, undefined, this);
|
|
37
|
+
})
|
|
38
|
+
}, undefined, false, undefined, this);
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
DayCalendar
|
|
42
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// src/components/FlashCard.tsx
|
|
2
|
+
import { useState } from "react";
|
|
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
|
+
function FlashCard({
|
|
9
|
+
step,
|
|
10
|
+
isCompleted,
|
|
11
|
+
isCurrent,
|
|
12
|
+
onComplete
|
|
13
|
+
}) {
|
|
14
|
+
const [isFlipped, setIsFlipped] = useState(false);
|
|
15
|
+
return /* @__PURE__ */ jsxDEV(Card, {
|
|
16
|
+
className: cn("relative cursor-pointer overflow-hidden transition-all duration-300", isCurrent && "ring-primary ring-2", isCompleted && "opacity-60"),
|
|
17
|
+
onClick: () => !isCompleted && setIsFlipped(!isFlipped),
|
|
18
|
+
children: /* @__PURE__ */ jsxDEV(CardContent, {
|
|
19
|
+
className: "p-6",
|
|
20
|
+
children: [
|
|
21
|
+
/* @__PURE__ */ jsxDEV("div", {
|
|
22
|
+
className: cn("space-y-4 transition-opacity duration-200", isFlipped ? "opacity-0" : "opacity-100"),
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ jsxDEV("div", {
|
|
25
|
+
className: "flex items-start justify-between",
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ jsxDEV("div", {
|
|
28
|
+
className: "flex-1",
|
|
29
|
+
children: [
|
|
30
|
+
/* @__PURE__ */ jsxDEV("h3", {
|
|
31
|
+
className: "text-lg font-semibold",
|
|
32
|
+
children: step.title
|
|
33
|
+
}, undefined, false, undefined, this),
|
|
34
|
+
step.description && /* @__PURE__ */ jsxDEV("p", {
|
|
35
|
+
className: "text-muted-foreground mt-1 text-sm",
|
|
36
|
+
children: step.description
|
|
37
|
+
}, undefined, false, undefined, this)
|
|
38
|
+
]
|
|
39
|
+
}, undefined, true, undefined, this),
|
|
40
|
+
step.xpReward && /* @__PURE__ */ jsxDEV("span", {
|
|
41
|
+
className: "rounded-full bg-green-500/10 px-2 py-1 text-xs font-semibold text-green-500",
|
|
42
|
+
children: [
|
|
43
|
+
"+",
|
|
44
|
+
step.xpReward,
|
|
45
|
+
" XP"
|
|
46
|
+
]
|
|
47
|
+
}, undefined, true, undefined, this)
|
|
48
|
+
]
|
|
49
|
+
}, undefined, true, undefined, this),
|
|
50
|
+
isCompleted && /* @__PURE__ */ jsxDEV("div", {
|
|
51
|
+
className: "flex items-center gap-2 text-green-500",
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
54
|
+
children: "✓"
|
|
55
|
+
}, undefined, false, undefined, this),
|
|
56
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
57
|
+
className: "text-sm font-medium",
|
|
58
|
+
children: "Completed"
|
|
59
|
+
}, undefined, false, undefined, this)
|
|
60
|
+
]
|
|
61
|
+
}, undefined, true, undefined, this),
|
|
62
|
+
isCurrent && !isCompleted && /* @__PURE__ */ jsxDEV("p", {
|
|
63
|
+
className: "text-muted-foreground text-xs",
|
|
64
|
+
children: "Tap to reveal action"
|
|
65
|
+
}, undefined, false, undefined, this)
|
|
66
|
+
]
|
|
67
|
+
}, undefined, true, undefined, this),
|
|
68
|
+
isFlipped && !isCompleted && /* @__PURE__ */ jsxDEV("div", {
|
|
69
|
+
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",
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ jsxDEV("p", {
|
|
72
|
+
className: "text-center text-sm",
|
|
73
|
+
children: step.instructions ?? "Complete this step to earn XP"
|
|
74
|
+
}, undefined, false, undefined, this),
|
|
75
|
+
/* @__PURE__ */ jsxDEV("div", {
|
|
76
|
+
className: "flex gap-2",
|
|
77
|
+
children: [
|
|
78
|
+
/* @__PURE__ */ jsxDEV(Button, {
|
|
79
|
+
variant: "outline",
|
|
80
|
+
size: "sm",
|
|
81
|
+
onClick: () => setIsFlipped(false),
|
|
82
|
+
children: "Back"
|
|
83
|
+
}, undefined, false, undefined, this),
|
|
84
|
+
/* @__PURE__ */ jsxDEV(Button, {
|
|
85
|
+
size: "sm",
|
|
86
|
+
onClick: (e) => {
|
|
87
|
+
e.stopPropagation();
|
|
88
|
+
onComplete?.();
|
|
89
|
+
},
|
|
90
|
+
children: "Mark Complete"
|
|
91
|
+
}, undefined, false, undefined, this)
|
|
92
|
+
]
|
|
93
|
+
}, undefined, true, undefined, this)
|
|
94
|
+
]
|
|
95
|
+
}, undefined, true, undefined, this)
|
|
96
|
+
]
|
|
97
|
+
}, undefined, true, undefined, this)
|
|
98
|
+
}, undefined, false, undefined, this);
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
FlashCard
|
|
102
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// src/components/MasteryRing.tsx
|
|
2
|
+
import { cn } from "@contractspec/lib.ui-kit-web/ui/utils";
|
|
3
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
4
|
+
"use client";
|
|
5
|
+
var sizeStyles = {
|
|
6
|
+
sm: { container: "h-16 w-16", text: "text-xs", ring: 48, stroke: 4 },
|
|
7
|
+
md: { container: "h-24 w-24", text: "text-sm", ring: 72, stroke: 6 },
|
|
8
|
+
lg: { container: "h-32 w-32", text: "text-base", ring: 96, stroke: 8 }
|
|
9
|
+
};
|
|
10
|
+
var colorStyles = {
|
|
11
|
+
green: "stroke-green-500",
|
|
12
|
+
blue: "stroke-blue-500",
|
|
13
|
+
violet: "stroke-violet-500",
|
|
14
|
+
orange: "stroke-orange-500"
|
|
15
|
+
};
|
|
16
|
+
function MasteryRing({
|
|
17
|
+
label,
|
|
18
|
+
percentage,
|
|
19
|
+
size = "md",
|
|
20
|
+
color = "violet"
|
|
21
|
+
}) {
|
|
22
|
+
const styles = sizeStyles[size];
|
|
23
|
+
const radius = (styles.ring - styles.stroke) / 2;
|
|
24
|
+
const circumference = 2 * Math.PI * radius;
|
|
25
|
+
const strokeDashoffset = circumference - percentage / 100 * circumference;
|
|
26
|
+
return /* @__PURE__ */ jsxDEV("div", {
|
|
27
|
+
className: cn("relative flex flex-col items-center gap-1", styles.container),
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ jsxDEV("svg", {
|
|
30
|
+
className: "absolute -rotate-90",
|
|
31
|
+
width: styles.ring,
|
|
32
|
+
height: styles.ring,
|
|
33
|
+
viewBox: `0 0 ${styles.ring} ${styles.ring}`,
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ jsxDEV("circle", {
|
|
36
|
+
cx: styles.ring / 2,
|
|
37
|
+
cy: styles.ring / 2,
|
|
38
|
+
r: radius,
|
|
39
|
+
fill: "none",
|
|
40
|
+
strokeWidth: styles.stroke,
|
|
41
|
+
className: "stroke-muted"
|
|
42
|
+
}, undefined, false, undefined, this),
|
|
43
|
+
/* @__PURE__ */ jsxDEV("circle", {
|
|
44
|
+
cx: styles.ring / 2,
|
|
45
|
+
cy: styles.ring / 2,
|
|
46
|
+
r: radius,
|
|
47
|
+
fill: "none",
|
|
48
|
+
strokeWidth: styles.stroke,
|
|
49
|
+
strokeLinecap: "round",
|
|
50
|
+
strokeDasharray: circumference,
|
|
51
|
+
strokeDashoffset,
|
|
52
|
+
className: cn("transition-all duration-500", colorStyles[color])
|
|
53
|
+
}, undefined, false, undefined, this)
|
|
54
|
+
]
|
|
55
|
+
}, undefined, true, undefined, this),
|
|
56
|
+
/* @__PURE__ */ jsxDEV("div", {
|
|
57
|
+
className: "flex h-full flex-col items-center justify-center",
|
|
58
|
+
children: /* @__PURE__ */ jsxDEV("span", {
|
|
59
|
+
className: cn("font-bold", styles.text),
|
|
60
|
+
children: [
|
|
61
|
+
Math.round(percentage),
|
|
62
|
+
"%"
|
|
63
|
+
]
|
|
64
|
+
}, undefined, true, undefined, this)
|
|
65
|
+
}, undefined, false, undefined, this),
|
|
66
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
67
|
+
className: cn("text-muted-foreground mt-1 truncate", styles.text),
|
|
68
|
+
children: label
|
|
69
|
+
}, undefined, false, undefined, this)
|
|
70
|
+
]
|
|
71
|
+
}, undefined, true, undefined, this);
|
|
72
|
+
}
|
|
73
|
+
export {
|
|
74
|
+
MasteryRing
|
|
75
|
+
};
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
// src/components/FlashCard.tsx
|
|
2
|
+
import { useState } from "react";
|
|
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
|
+
function FlashCard({
|
|
9
|
+
step,
|
|
10
|
+
isCompleted,
|
|
11
|
+
isCurrent,
|
|
12
|
+
onComplete
|
|
13
|
+
}) {
|
|
14
|
+
const [isFlipped, setIsFlipped] = useState(false);
|
|
15
|
+
return /* @__PURE__ */ jsxDEV(Card, {
|
|
16
|
+
className: cn("relative cursor-pointer overflow-hidden transition-all duration-300", isCurrent && "ring-primary ring-2", isCompleted && "opacity-60"),
|
|
17
|
+
onClick: () => !isCompleted && setIsFlipped(!isFlipped),
|
|
18
|
+
children: /* @__PURE__ */ jsxDEV(CardContent, {
|
|
19
|
+
className: "p-6",
|
|
20
|
+
children: [
|
|
21
|
+
/* @__PURE__ */ jsxDEV("div", {
|
|
22
|
+
className: cn("space-y-4 transition-opacity duration-200", isFlipped ? "opacity-0" : "opacity-100"),
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ jsxDEV("div", {
|
|
25
|
+
className: "flex items-start justify-between",
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ jsxDEV("div", {
|
|
28
|
+
className: "flex-1",
|
|
29
|
+
children: [
|
|
30
|
+
/* @__PURE__ */ jsxDEV("h3", {
|
|
31
|
+
className: "text-lg font-semibold",
|
|
32
|
+
children: step.title
|
|
33
|
+
}, undefined, false, undefined, this),
|
|
34
|
+
step.description && /* @__PURE__ */ jsxDEV("p", {
|
|
35
|
+
className: "text-muted-foreground mt-1 text-sm",
|
|
36
|
+
children: step.description
|
|
37
|
+
}, undefined, false, undefined, this)
|
|
38
|
+
]
|
|
39
|
+
}, undefined, true, undefined, this),
|
|
40
|
+
step.xpReward && /* @__PURE__ */ jsxDEV("span", {
|
|
41
|
+
className: "rounded-full bg-green-500/10 px-2 py-1 text-xs font-semibold text-green-500",
|
|
42
|
+
children: [
|
|
43
|
+
"+",
|
|
44
|
+
step.xpReward,
|
|
45
|
+
" XP"
|
|
46
|
+
]
|
|
47
|
+
}, undefined, true, undefined, this)
|
|
48
|
+
]
|
|
49
|
+
}, undefined, true, undefined, this),
|
|
50
|
+
isCompleted && /* @__PURE__ */ jsxDEV("div", {
|
|
51
|
+
className: "flex items-center gap-2 text-green-500",
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
54
|
+
children: "✓"
|
|
55
|
+
}, undefined, false, undefined, this),
|
|
56
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
57
|
+
className: "text-sm font-medium",
|
|
58
|
+
children: "Completed"
|
|
59
|
+
}, undefined, false, undefined, this)
|
|
60
|
+
]
|
|
61
|
+
}, undefined, true, undefined, this),
|
|
62
|
+
isCurrent && !isCompleted && /* @__PURE__ */ jsxDEV("p", {
|
|
63
|
+
className: "text-muted-foreground text-xs",
|
|
64
|
+
children: "Tap to reveal action"
|
|
65
|
+
}, undefined, false, undefined, this)
|
|
66
|
+
]
|
|
67
|
+
}, undefined, true, undefined, this),
|
|
68
|
+
isFlipped && !isCompleted && /* @__PURE__ */ jsxDEV("div", {
|
|
69
|
+
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",
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ jsxDEV("p", {
|
|
72
|
+
className: "text-center text-sm",
|
|
73
|
+
children: step.instructions ?? "Complete this step to earn XP"
|
|
74
|
+
}, undefined, false, undefined, this),
|
|
75
|
+
/* @__PURE__ */ jsxDEV("div", {
|
|
76
|
+
className: "flex gap-2",
|
|
77
|
+
children: [
|
|
78
|
+
/* @__PURE__ */ jsxDEV(Button, {
|
|
79
|
+
variant: "outline",
|
|
80
|
+
size: "sm",
|
|
81
|
+
onClick: () => setIsFlipped(false),
|
|
82
|
+
children: "Back"
|
|
83
|
+
}, undefined, false, undefined, this),
|
|
84
|
+
/* @__PURE__ */ jsxDEV(Button, {
|
|
85
|
+
size: "sm",
|
|
86
|
+
onClick: (e) => {
|
|
87
|
+
e.stopPropagation();
|
|
88
|
+
onComplete?.();
|
|
89
|
+
},
|
|
90
|
+
children: "Mark Complete"
|
|
91
|
+
}, undefined, false, undefined, this)
|
|
92
|
+
]
|
|
93
|
+
}, undefined, true, undefined, this)
|
|
94
|
+
]
|
|
95
|
+
}, undefined, true, undefined, this)
|
|
96
|
+
]
|
|
97
|
+
}, undefined, true, undefined, this)
|
|
98
|
+
}, undefined, false, undefined, this);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// src/components/MasteryRing.tsx
|
|
102
|
+
import { cn as cn2 } from "@contractspec/lib.ui-kit-web/ui/utils";
|
|
103
|
+
import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
|
|
104
|
+
"use client";
|
|
105
|
+
var sizeStyles = {
|
|
106
|
+
sm: { container: "h-16 w-16", text: "text-xs", ring: 48, stroke: 4 },
|
|
107
|
+
md: { container: "h-24 w-24", text: "text-sm", ring: 72, stroke: 6 },
|
|
108
|
+
lg: { container: "h-32 w-32", text: "text-base", ring: 96, stroke: 8 }
|
|
109
|
+
};
|
|
110
|
+
var colorStyles = {
|
|
111
|
+
green: "stroke-green-500",
|
|
112
|
+
blue: "stroke-blue-500",
|
|
113
|
+
violet: "stroke-violet-500",
|
|
114
|
+
orange: "stroke-orange-500"
|
|
115
|
+
};
|
|
116
|
+
function MasteryRing({
|
|
117
|
+
label,
|
|
118
|
+
percentage,
|
|
119
|
+
size = "md",
|
|
120
|
+
color = "violet"
|
|
121
|
+
}) {
|
|
122
|
+
const styles = sizeStyles[size];
|
|
123
|
+
const radius = (styles.ring - styles.stroke) / 2;
|
|
124
|
+
const circumference = 2 * Math.PI * radius;
|
|
125
|
+
const strokeDashoffset = circumference - percentage / 100 * circumference;
|
|
126
|
+
return /* @__PURE__ */ jsxDEV2("div", {
|
|
127
|
+
className: cn2("relative flex flex-col items-center gap-1", styles.container),
|
|
128
|
+
children: [
|
|
129
|
+
/* @__PURE__ */ jsxDEV2("svg", {
|
|
130
|
+
className: "absolute -rotate-90",
|
|
131
|
+
width: styles.ring,
|
|
132
|
+
height: styles.ring,
|
|
133
|
+
viewBox: `0 0 ${styles.ring} ${styles.ring}`,
|
|
134
|
+
children: [
|
|
135
|
+
/* @__PURE__ */ jsxDEV2("circle", {
|
|
136
|
+
cx: styles.ring / 2,
|
|
137
|
+
cy: styles.ring / 2,
|
|
138
|
+
r: radius,
|
|
139
|
+
fill: "none",
|
|
140
|
+
strokeWidth: styles.stroke,
|
|
141
|
+
className: "stroke-muted"
|
|
142
|
+
}, undefined, false, undefined, this),
|
|
143
|
+
/* @__PURE__ */ jsxDEV2("circle", {
|
|
144
|
+
cx: styles.ring / 2,
|
|
145
|
+
cy: styles.ring / 2,
|
|
146
|
+
r: radius,
|
|
147
|
+
fill: "none",
|
|
148
|
+
strokeWidth: styles.stroke,
|
|
149
|
+
strokeLinecap: "round",
|
|
150
|
+
strokeDasharray: circumference,
|
|
151
|
+
strokeDashoffset,
|
|
152
|
+
className: cn2("transition-all duration-500", colorStyles[color])
|
|
153
|
+
}, undefined, false, undefined, this)
|
|
154
|
+
]
|
|
155
|
+
}, undefined, true, undefined, this),
|
|
156
|
+
/* @__PURE__ */ jsxDEV2("div", {
|
|
157
|
+
className: "flex h-full flex-col items-center justify-center",
|
|
158
|
+
children: /* @__PURE__ */ jsxDEV2("span", {
|
|
159
|
+
className: cn2("font-bold", styles.text),
|
|
160
|
+
children: [
|
|
161
|
+
Math.round(percentage),
|
|
162
|
+
"%"
|
|
163
|
+
]
|
|
164
|
+
}, undefined, true, undefined, this)
|
|
165
|
+
}, undefined, false, undefined, this),
|
|
166
|
+
/* @__PURE__ */ jsxDEV2("span", {
|
|
167
|
+
className: cn2("text-muted-foreground mt-1 truncate", styles.text),
|
|
168
|
+
children: label
|
|
169
|
+
}, undefined, false, undefined, this)
|
|
170
|
+
]
|
|
171
|
+
}, undefined, true, undefined, this);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// src/components/DayCalendar.tsx
|
|
175
|
+
import { cn as cn3 } from "@contractspec/lib.ui-kit-web/ui/utils";
|
|
176
|
+
import { jsxDEV as jsxDEV3, Fragment } from "react/jsx-dev-runtime";
|
|
177
|
+
"use client";
|
|
178
|
+
function DayCalendar({
|
|
179
|
+
totalDays,
|
|
180
|
+
currentDay,
|
|
181
|
+
completedDays
|
|
182
|
+
}) {
|
|
183
|
+
const days = Array.from({ length: totalDays }, (_, i) => i + 1);
|
|
184
|
+
return /* @__PURE__ */ jsxDEV3("div", {
|
|
185
|
+
className: "grid grid-cols-7 gap-2",
|
|
186
|
+
children: days.map((day) => {
|
|
187
|
+
const isCompleted = completedDays.includes(day);
|
|
188
|
+
const isCurrent = day === currentDay;
|
|
189
|
+
const isLocked = day > currentDay;
|
|
190
|
+
return /* @__PURE__ */ jsxDEV3("div", {
|
|
191
|
+
className: cn3("flex h-12 w-12 flex-col items-center justify-center rounded-lg border text-sm font-medium transition-all", isCompleted && "border-green-500 bg-green-500/10 text-green-500", isCurrent && !isCompleted && "border-violet-500 bg-violet-500/10 text-violet-500 ring-2 ring-violet-500/50", isLocked && "border-muted bg-muted/50 text-muted-foreground", !isCompleted && !isCurrent && !isLocked && "border-border bg-card"),
|
|
192
|
+
children: isCompleted ? /* @__PURE__ */ jsxDEV3("span", {
|
|
193
|
+
className: "text-lg",
|
|
194
|
+
children: "✓"
|
|
195
|
+
}, undefined, false, undefined, this) : isLocked ? /* @__PURE__ */ jsxDEV3("span", {
|
|
196
|
+
className: "text-lg",
|
|
197
|
+
children: "\uD83D\uDD12"
|
|
198
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV3(Fragment, {
|
|
199
|
+
children: [
|
|
200
|
+
/* @__PURE__ */ jsxDEV3("span", {
|
|
201
|
+
className: "text-muted-foreground text-xs",
|
|
202
|
+
children: "Day"
|
|
203
|
+
}, undefined, false, undefined, this),
|
|
204
|
+
/* @__PURE__ */ jsxDEV3("span", {
|
|
205
|
+
children: day
|
|
206
|
+
}, undefined, false, undefined, this)
|
|
207
|
+
]
|
|
208
|
+
}, undefined, true, undefined, this)
|
|
209
|
+
}, day, false, undefined, this);
|
|
210
|
+
})
|
|
211
|
+
}, undefined, false, undefined, this);
|
|
212
|
+
}
|
|
213
|
+
export {
|
|
214
|
+
MasteryRing,
|
|
215
|
+
FlashCard,
|
|
216
|
+
DayCalendar
|
|
217
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/docs/learning-journey-ui-gamified.docblock.ts
|
|
2
|
+
import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
|
|
3
|
+
var blocks = [
|
|
4
|
+
{
|
|
5
|
+
id: "docs.examples.learning-journey-ui-gamified",
|
|
6
|
+
title: "Learning Journey UI — Gamified",
|
|
7
|
+
summary: "UI mini-app components for gamified learning: flashcards, mastery, streak/calendar.",
|
|
8
|
+
kind: "reference",
|
|
9
|
+
visibility: "public",
|
|
10
|
+
route: "/docs/examples/learning-journey-ui-gamified",
|
|
11
|
+
tags: ["learning", "ui", "gamified"],
|
|
12
|
+
body: `## Includes
|
|
13
|
+
- Gamified mini-app shell
|
|
14
|
+
- Views: overview, steps, progress, timeline
|
|
15
|
+
- Components: flash card, mastery ring, day calendar
|
|
16
|
+
|
|
17
|
+
## Notes
|
|
18
|
+
- Compose with design system components.
|
|
19
|
+
- Respect prefers-reduced-motion; keep tap targets large.`
|
|
20
|
+
}
|
|
21
|
+
];
|
|
22
|
+
registerDocBlocks(blocks);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/docs/learning-journey-ui-gamified.docblock.ts
|
|
2
|
+
import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
|
|
3
|
+
var blocks = [
|
|
4
|
+
{
|
|
5
|
+
id: "docs.examples.learning-journey-ui-gamified",
|
|
6
|
+
title: "Learning Journey UI — Gamified",
|
|
7
|
+
summary: "UI mini-app components for gamified learning: flashcards, mastery, streak/calendar.",
|
|
8
|
+
kind: "reference",
|
|
9
|
+
visibility: "public",
|
|
10
|
+
route: "/docs/examples/learning-journey-ui-gamified",
|
|
11
|
+
tags: ["learning", "ui", "gamified"],
|
|
12
|
+
body: `## Includes
|
|
13
|
+
- Gamified mini-app shell
|
|
14
|
+
- Views: overview, steps, progress, timeline
|
|
15
|
+
- Components: flash card, mastery ring, day calendar
|
|
16
|
+
|
|
17
|
+
## Notes
|
|
18
|
+
- Compose with design system components.
|
|
19
|
+
- Respect prefers-reduced-motion; keep tap targets large.`
|
|
20
|
+
}
|
|
21
|
+
];
|
|
22
|
+
registerDocBlocks(blocks);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// src/example.ts
|
|
2
|
+
import { defineExample } from "@contractspec/lib.contracts";
|
|
3
|
+
var example = defineExample({
|
|
4
|
+
meta: {
|
|
5
|
+
key: "learning-journey-ui-gamified",
|
|
6
|
+
version: "1.0.0",
|
|
7
|
+
title: "Learning Journey UI — Gamified",
|
|
8
|
+
description: "UI mini-app for gamified learning: flashcards, mastery ring, calendar.",
|
|
9
|
+
kind: "ui",
|
|
10
|
+
visibility: "public",
|
|
11
|
+
stability: "experimental",
|
|
12
|
+
owners: ["@platform.core"],
|
|
13
|
+
tags: ["learning", "ui", "gamified"]
|
|
14
|
+
},
|
|
15
|
+
docs: {
|
|
16
|
+
rootDocId: "docs.examples.learning-journey-ui-gamified"
|
|
17
|
+
},
|
|
18
|
+
entrypoints: {
|
|
19
|
+
packageName: "@contractspec/example.learning-journey-ui-gamified",
|
|
20
|
+
docs: "./docs"
|
|
21
|
+
},
|
|
22
|
+
surfaces: {
|
|
23
|
+
templates: true,
|
|
24
|
+
sandbox: { enabled: true, modes: ["playground", "markdown"] },
|
|
25
|
+
studio: { enabled: true, installable: true },
|
|
26
|
+
mcp: { enabled: true }
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
var example_default = example;
|
|
30
|
+
export {
|
|
31
|
+
example_default as default
|
|
32
|
+
};
|