@contractspec/example.learning-journey-ui-onboarding 1.44.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$colon$bundle.log +57 -0
- package/.turbo/turbo-build.log +58 -0
- package/CHANGELOG.md +278 -0
- package/LICENSE +21 -0
- package/README.md +35 -0
- package/dist/OnboardingMiniApp.d.ts +17 -0
- package/dist/OnboardingMiniApp.d.ts.map +1 -0
- package/dist/OnboardingMiniApp.js +63 -0
- package/dist/OnboardingMiniApp.js.map +1 -0
- package/dist/components/CodeSnippet.d.ts +16 -0
- package/dist/components/CodeSnippet.d.ts.map +1 -0
- package/dist/components/CodeSnippet.js +50 -0
- package/dist/components/CodeSnippet.js.map +1 -0
- package/dist/components/JourneyMap.d.ts +17 -0
- package/dist/components/JourneyMap.d.ts.map +1 -0
- package/dist/components/JourneyMap.js +49 -0
- package/dist/components/JourneyMap.js.map +1 -0
- package/dist/components/StepChecklist.d.ts +25 -0
- package/dist/components/StepChecklist.d.ts.map +1 -0
- package/dist/components/StepChecklist.js +80 -0
- package/dist/components/StepChecklist.js.map +1 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +5 -0
- package/dist/docs/index.d.ts +1 -0
- package/dist/docs/index.js +1 -0
- package/dist/docs/learning-journey-ui-onboarding.docblock.d.ts +1 -0
- package/dist/docs/learning-journey-ui-onboarding.docblock.js +20 -0
- package/dist/docs/learning-journey-ui-onboarding.docblock.js.map +1 -0
- package/dist/example.d.ts +33 -0
- package/dist/example.d.ts.map +1 -0
- package/dist/example.js +35 -0
- package/dist/example.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +14 -0
- package/dist/views/Overview.d.ts +15 -0
- package/dist/views/Overview.d.ts.map +1 -0
- package/dist/views/Overview.js +180 -0
- package/dist/views/Overview.js.map +1 -0
- package/dist/views/Progress.d.ts +11 -0
- package/dist/views/Progress.d.ts.map +1 -0
- package/dist/views/Progress.js +161 -0
- package/dist/views/Progress.js.map +1 -0
- package/dist/views/Steps.d.ts +12 -0
- package/dist/views/Steps.d.ts.map +1 -0
- package/dist/views/Steps.js +92 -0
- package/dist/views/Steps.js.map +1 -0
- package/dist/views/Timeline.d.ts +11 -0
- package/dist/views/Timeline.d.ts.map +1 -0
- package/dist/views/Timeline.js +98 -0
- package/dist/views/Timeline.js.map +1 -0
- package/dist/views/index.d.ts +5 -0
- package/dist/views/index.js +6 -0
- package/example.ts +1 -0
- package/package.json +80 -0
- package/src/OnboardingMiniApp.tsx +93 -0
- package/src/components/CodeSnippet.tsx +56 -0
- package/src/components/JourneyMap.tsx +86 -0
- package/src/components/StepChecklist.tsx +136 -0
- package/src/components/index.ts +3 -0
- package/src/docs/index.ts +1 -0
- package/src/docs/learning-journey-ui-onboarding.docblock.ts +18 -0
- package/src/example.ts +24 -0
- package/src/index.ts +10 -0
- package/src/views/Overview.tsx +204 -0
- package/src/views/Progress.tsx +186 -0
- package/src/views/Steps.tsx +92 -0
- package/src/views/Timeline.tsx +141 -0
- package/src/views/index.ts +4 -0
- package/tsconfig.json +10 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/tsdown.config.js +17 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { cn } from "@contractspec/lib.ui-kit-web/ui/utils";
|
|
5
|
+
|
|
6
|
+
//#region src/components/JourneyMap.tsx
|
|
7
|
+
const SURFACE_ICONS = {
|
|
8
|
+
templates: "📋",
|
|
9
|
+
"spec-editor": "✏️",
|
|
10
|
+
regenerator: "🔄",
|
|
11
|
+
playground: "🎮",
|
|
12
|
+
evolution: "🤖",
|
|
13
|
+
dashboard: "📊",
|
|
14
|
+
settings: "⚙️",
|
|
15
|
+
default: "📍"
|
|
16
|
+
};
|
|
17
|
+
function JourneyMap({ steps, completedStepIds, currentStepId }) {
|
|
18
|
+
return /* @__PURE__ */ jsx("div", {
|
|
19
|
+
className: "relative overflow-x-auto pb-4",
|
|
20
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
21
|
+
className: "flex min-w-max items-center gap-2",
|
|
22
|
+
children: steps.map((step, index) => {
|
|
23
|
+
const isCompleted = completedStepIds.includes(step.id);
|
|
24
|
+
const isCurrent = step.id === currentStepId;
|
|
25
|
+
const icon = SURFACE_ICONS[step.metadata?.surface ?? "default"] ?? SURFACE_ICONS.default;
|
|
26
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
27
|
+
className: "flex items-center",
|
|
28
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
29
|
+
className: "flex flex-col items-center gap-2",
|
|
30
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
31
|
+
className: cn("flex h-14 w-14 items-center justify-center rounded-2xl border-2 text-2xl transition-all", isCompleted && "border-green-500 bg-green-500/10", isCurrent && !isCompleted && "border-violet-500 bg-violet-500/10 ring-4 ring-violet-500/20", !isCompleted && !isCurrent && "border-muted bg-muted/50"),
|
|
32
|
+
children: isCompleted ? "✓" : icon
|
|
33
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
34
|
+
className: "text-center",
|
|
35
|
+
children: /* @__PURE__ */ jsx("p", {
|
|
36
|
+
className: cn("max-w-[100px] truncate text-xs font-medium", isCompleted && "text-green-500", isCurrent && !isCompleted && "text-violet-500", !isCompleted && !isCurrent && "text-muted-foreground"),
|
|
37
|
+
children: step.title
|
|
38
|
+
})
|
|
39
|
+
})]
|
|
40
|
+
}), index < steps.length - 1 && /* @__PURE__ */ jsx("div", { className: cn("mx-2 h-1 w-8 rounded-full transition-colors", completedStepIds.includes(steps[index + 1]?.id ?? "") ? "bg-green-500" : isCompleted ? "bg-green-500/50" : "bg-muted") })]
|
|
41
|
+
}, step.id);
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
export { JourneyMap };
|
|
49
|
+
//# sourceMappingURL=JourneyMap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JourneyMap.js","names":["SURFACE_ICONS: Record<string, string>"],"sources":["../../src/components/JourneyMap.tsx"],"sourcesContent":["'use client';\n\nimport { cn } from '@contractspec/lib.ui-kit-web/ui/utils';\nimport type { LearningJourneyStepSpec } from '@contractspec/module.learning-journey/track-spec';\n\ninterface JourneyMapProps {\n steps: LearningJourneyStepSpec[];\n completedStepIds: string[];\n currentStepId?: string | null;\n}\n\nconst SURFACE_ICONS: Record<string, string> = {\n templates: '📋',\n 'spec-editor': '✏️',\n regenerator: '🔄',\n playground: '🎮',\n evolution: '🤖',\n dashboard: '📊',\n settings: '⚙️',\n default: '📍',\n};\n\nexport function JourneyMap({\n steps,\n completedStepIds,\n currentStepId,\n}: JourneyMapProps) {\n return (\n <div className=\"relative overflow-x-auto pb-4\">\n <div className=\"flex min-w-max items-center gap-2\">\n {steps.map((step, index) => {\n const isCompleted = completedStepIds.includes(step.id);\n const isCurrent = step.id === currentStepId;\n const surface = (step.metadata?.surface as string) ?? 'default';\n const icon = SURFACE_ICONS[surface] ?? SURFACE_ICONS.default;\n\n return (\n <div key={step.id} className=\"flex items-center\">\n {/* Node */}\n <div className=\"flex flex-col items-center gap-2\">\n <div\n className={cn(\n 'flex h-14 w-14 items-center justify-center rounded-2xl border-2 text-2xl transition-all',\n isCompleted && 'border-green-500 bg-green-500/10',\n isCurrent &&\n !isCompleted &&\n 'border-violet-500 bg-violet-500/10 ring-4 ring-violet-500/20',\n !isCompleted && !isCurrent && 'border-muted bg-muted/50'\n )}\n >\n {isCompleted ? '✓' : icon}\n </div>\n <div className=\"text-center\">\n <p\n className={cn(\n 'max-w-[100px] truncate text-xs font-medium',\n isCompleted && 'text-green-500',\n isCurrent && !isCompleted && 'text-violet-500',\n !isCompleted && !isCurrent && 'text-muted-foreground'\n )}\n >\n {step.title}\n </p>\n </div>\n </div>\n\n {/* Connector */}\n {index < steps.length - 1 && (\n <div\n className={cn(\n 'mx-2 h-1 w-8 rounded-full transition-colors',\n completedStepIds.includes(steps[index + 1]?.id ?? '')\n ? 'bg-green-500'\n : isCompleted\n ? 'bg-green-500/50'\n : 'bg-muted'\n )}\n />\n )}\n </div>\n );\n })}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;AAWA,MAAMA,gBAAwC;CAC5C,WAAW;CACX,eAAe;CACf,aAAa;CACb,YAAY;CACZ,WAAW;CACX,WAAW;CACX,UAAU;CACV,SAAS;CACV;AAED,SAAgB,WAAW,EACzB,OACA,kBACA,iBACkB;AAClB,QACE,oBAAC;EAAI,WAAU;YACb,oBAAC;GAAI,WAAU;aACZ,MAAM,KAAK,MAAM,UAAU;IAC1B,MAAM,cAAc,iBAAiB,SAAS,KAAK,GAAG;IACtD,MAAM,YAAY,KAAK,OAAO;IAE9B,MAAM,OAAO,cADI,KAAK,UAAU,WAAsB,cACf,cAAc;AAErD,WACE,qBAAC;KAAkB,WAAU;gBAE3B,qBAAC;MAAI,WAAU;iBACb,oBAAC;OACC,WAAW,GACT,2FACA,eAAe,oCACf,aACE,CAAC,eACD,gEACF,CAAC,eAAe,CAAC,aAAa,2BAC/B;iBAEA,cAAc,MAAM;QACjB,EACN,oBAAC;OAAI,WAAU;iBACb,oBAAC;QACC,WAAW,GACT,8CACA,eAAe,kBACf,aAAa,CAAC,eAAe,mBAC7B,CAAC,eAAe,CAAC,aAAa,wBAC/B;kBAEA,KAAK;SACJ;QACA;OACF,EAGL,QAAQ,MAAM,SAAS,KACtB,oBAAC,SACC,WAAW,GACT,+CACA,iBAAiB,SAAS,MAAM,QAAQ,IAAI,MAAM,GAAG,GACjD,iBACA,cACE,oBACA,WACP,GACD;OAxCI,KAAK,GA0CT;KAER;IACE;GACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as react_jsx_runtime2 from "react/jsx-runtime";
|
|
2
|
+
import { LearningJourneyStepSpec } from "@contractspec/module.learning-journey/track-spec";
|
|
3
|
+
|
|
4
|
+
//#region src/components/StepChecklist.d.ts
|
|
5
|
+
interface StepChecklistProps {
|
|
6
|
+
step: LearningJourneyStepSpec;
|
|
7
|
+
stepNumber: number;
|
|
8
|
+
isCompleted: boolean;
|
|
9
|
+
isCurrent: boolean;
|
|
10
|
+
isExpanded: boolean;
|
|
11
|
+
onToggle: () => void;
|
|
12
|
+
onComplete?: () => void;
|
|
13
|
+
}
|
|
14
|
+
declare function StepChecklist({
|
|
15
|
+
step,
|
|
16
|
+
stepNumber,
|
|
17
|
+
isCompleted,
|
|
18
|
+
isCurrent,
|
|
19
|
+
isExpanded,
|
|
20
|
+
onToggle,
|
|
21
|
+
onComplete
|
|
22
|
+
}: StepChecklistProps): react_jsx_runtime2.JSX.Element;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { StepChecklist };
|
|
25
|
+
//# sourceMappingURL=StepChecklist.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StepChecklist.d.ts","names":[],"sources":["../../src/components/StepChecklist.tsx"],"sourcesContent":[],"mappings":";;;;UAMU,kBAAA;QACF;;EADE,WAAA,EAAA,OAAA;EAUM,SAAA,EAAA,OAAa;EAC3B,UAAA,EAAA,OAAA;EACA,QAAA,EAAA,GAAA,GAAA,IAAA;EACA,UAAA,CAAA,EAAA,GAAA,GAAA,IAAA;;AAEA,iBALc,aAAA,CAKd;EAAA,IAAA;EAAA,UAAA;EAAA,WAAA;EAAA,SAAA;EAAA,UAAA;EAAA,QAAA;EAAA;AAAA,CAAA,EAGC,kBAHD,CAAA,EAGmB,kBAAA,CAAA,GAAA,CAAA,OAHnB"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Button } from "@contractspec/lib.design-system";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { cn } from "@contractspec/lib.ui-kit-core";
|
|
6
|
+
|
|
7
|
+
//#region src/components/StepChecklist.tsx
|
|
8
|
+
function StepChecklist({ step, stepNumber, isCompleted, isCurrent, isExpanded, onToggle, onComplete }) {
|
|
9
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
10
|
+
className: cn("rounded-xl border transition-all", isCompleted && "border-green-500/50 bg-green-500/5", isCurrent && !isCompleted && "border-violet-500 bg-violet-500/5", !isCompleted && !isCurrent && "border-border"),
|
|
11
|
+
children: [/* @__PURE__ */ jsxs("button", {
|
|
12
|
+
type: "button",
|
|
13
|
+
className: "flex w-full items-center gap-4 p-4 text-left",
|
|
14
|
+
onClick: onToggle,
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ jsx("div", {
|
|
17
|
+
className: cn("flex h-8 w-8 shrink-0 items-center justify-center rounded-full border-2 text-sm font-semibold transition-colors", isCompleted && "border-green-500 bg-green-500 text-white", isCurrent && !isCompleted && "border-violet-500 text-violet-500", !isCompleted && !isCurrent && "border-muted-foreground text-muted-foreground"),
|
|
18
|
+
children: isCompleted ? "✓" : stepNumber
|
|
19
|
+
}),
|
|
20
|
+
/* @__PURE__ */ jsxs("div", {
|
|
21
|
+
className: "min-w-0 flex-1",
|
|
22
|
+
children: [/* @__PURE__ */ jsx("h4", {
|
|
23
|
+
className: cn("font-semibold", isCompleted && "text-green-500", isCurrent && !isCompleted && "text-foreground", !isCompleted && !isCurrent && "text-muted-foreground"),
|
|
24
|
+
children: step.title
|
|
25
|
+
}), !isExpanded && step.description && /* @__PURE__ */ jsx("p", {
|
|
26
|
+
className: "text-muted-foreground truncate text-sm",
|
|
27
|
+
children: step.description
|
|
28
|
+
})]
|
|
29
|
+
}),
|
|
30
|
+
step.xpReward && /* @__PURE__ */ jsxs("span", {
|
|
31
|
+
className: cn("shrink-0 rounded-full px-2 py-1 text-xs font-semibold", isCompleted ? "bg-green-500/10 text-green-500" : "bg-muted text-muted-foreground"),
|
|
32
|
+
children: [
|
|
33
|
+
"+",
|
|
34
|
+
step.xpReward,
|
|
35
|
+
" XP"
|
|
36
|
+
]
|
|
37
|
+
}),
|
|
38
|
+
/* @__PURE__ */ jsx("span", {
|
|
39
|
+
className: cn("shrink-0 transition-transform", isExpanded && "rotate-180"),
|
|
40
|
+
children: "▼"
|
|
41
|
+
})
|
|
42
|
+
]
|
|
43
|
+
}), isExpanded && /* @__PURE__ */ jsxs("div", {
|
|
44
|
+
className: "border-t px-4 py-4",
|
|
45
|
+
children: [
|
|
46
|
+
step.description && /* @__PURE__ */ jsx("p", {
|
|
47
|
+
className: "text-muted-foreground mb-4",
|
|
48
|
+
children: step.description
|
|
49
|
+
}),
|
|
50
|
+
step.instructions && /* @__PURE__ */ jsxs("div", {
|
|
51
|
+
className: "bg-muted mb-4 rounded-lg p-4",
|
|
52
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
53
|
+
className: "mb-2 text-sm font-medium",
|
|
54
|
+
children: "Instructions:"
|
|
55
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
56
|
+
className: "text-muted-foreground text-sm",
|
|
57
|
+
children: step.instructions
|
|
58
|
+
})]
|
|
59
|
+
}),
|
|
60
|
+
/* @__PURE__ */ jsxs("div", {
|
|
61
|
+
className: "flex flex-wrap gap-2",
|
|
62
|
+
children: [step.actionUrl && /* @__PURE__ */ jsx(Button, {
|
|
63
|
+
variant: "outline",
|
|
64
|
+
size: "sm",
|
|
65
|
+
onClick: () => window.open(step.actionUrl, "_blank"),
|
|
66
|
+
children: step.actionLabel ?? "Try it"
|
|
67
|
+
}), !isCompleted && /* @__PURE__ */ jsx(Button, {
|
|
68
|
+
size: "sm",
|
|
69
|
+
onClick: onComplete,
|
|
70
|
+
children: "Mark as Complete"
|
|
71
|
+
})]
|
|
72
|
+
})
|
|
73
|
+
]
|
|
74
|
+
})]
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
//#endregion
|
|
79
|
+
export { StepChecklist };
|
|
80
|
+
//# sourceMappingURL=StepChecklist.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StepChecklist.js","names":[],"sources":["../../src/components/StepChecklist.tsx"],"sourcesContent":["'use client';\n\nimport { Button } from '@contractspec/lib.design-system';\nimport { cn } from '@contractspec/lib.ui-kit-core';\nimport type { LearningJourneyStepSpec } from '@contractspec/module.learning-journey/track-spec';\n\ninterface StepChecklistProps {\n step: LearningJourneyStepSpec;\n stepNumber: number;\n isCompleted: boolean;\n isCurrent: boolean;\n isExpanded: boolean;\n onToggle: () => void;\n onComplete?: () => void;\n}\n\nexport function StepChecklist({\n step,\n stepNumber,\n isCompleted,\n isCurrent,\n isExpanded,\n onToggle,\n onComplete,\n}: StepChecklistProps) {\n return (\n <div\n className={cn(\n 'rounded-xl border transition-all',\n isCompleted && 'border-green-500/50 bg-green-500/5',\n isCurrent && !isCompleted && 'border-violet-500 bg-violet-500/5',\n !isCompleted && !isCurrent && 'border-border'\n )}\n >\n {/* Header */}\n <button\n type=\"button\"\n className=\"flex w-full items-center gap-4 p-4 text-left\"\n onClick={onToggle}\n >\n {/* Checkbox/Number */}\n <div\n className={cn(\n 'flex h-8 w-8 shrink-0 items-center justify-center rounded-full border-2 text-sm font-semibold transition-colors',\n isCompleted && 'border-green-500 bg-green-500 text-white',\n isCurrent && !isCompleted && 'border-violet-500 text-violet-500',\n !isCompleted &&\n !isCurrent &&\n 'border-muted-foreground text-muted-foreground'\n )}\n >\n {isCompleted ? '✓' : stepNumber}\n </div>\n\n {/* Title & Description */}\n <div className=\"min-w-0 flex-1\">\n <h4\n className={cn(\n 'font-semibold',\n isCompleted && 'text-green-500',\n isCurrent && !isCompleted && 'text-foreground',\n !isCompleted && !isCurrent && 'text-muted-foreground'\n )}\n >\n {step.title}\n </h4>\n {!isExpanded && step.description && (\n <p className=\"text-muted-foreground truncate text-sm\">\n {step.description}\n </p>\n )}\n </div>\n\n {/* XP Badge */}\n {step.xpReward && (\n <span\n className={cn(\n 'shrink-0 rounded-full px-2 py-1 text-xs font-semibold',\n isCompleted\n ? 'bg-green-500/10 text-green-500'\n : 'bg-muted text-muted-foreground'\n )}\n >\n +{step.xpReward} XP\n </span>\n )}\n\n {/* Expand indicator */}\n <span\n className={cn(\n 'shrink-0 transition-transform',\n isExpanded && 'rotate-180'\n )}\n >\n ▼\n </span>\n </button>\n\n {/* Expanded Content */}\n {isExpanded && (\n <div className=\"border-t px-4 py-4\">\n {step.description && (\n <p className=\"text-muted-foreground mb-4\">{step.description}</p>\n )}\n\n {step.instructions && (\n <div className=\"bg-muted mb-4 rounded-lg p-4\">\n <p className=\"mb-2 text-sm font-medium\">Instructions:</p>\n <p className=\"text-muted-foreground text-sm\">\n {step.instructions}\n </p>\n </div>\n )}\n\n {/* Action buttons */}\n <div className=\"flex flex-wrap gap-2\">\n {step.actionUrl && (\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() => window.open(step.actionUrl, '_blank')}\n >\n {step.actionLabel ?? 'Try it'}\n </Button>\n )}\n {!isCompleted && (\n <Button size=\"sm\" onClick={onComplete}>\n Mark as Complete\n </Button>\n )}\n </div>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAgBA,SAAgB,cAAc,EAC5B,MACA,YACA,aACA,WACA,YACA,UACA,cACqB;AACrB,QACE,qBAAC;EACC,WAAW,GACT,oCACA,eAAe,sCACf,aAAa,CAAC,eAAe,qCAC7B,CAAC,eAAe,CAAC,aAAa,gBAC/B;aAGD,qBAAC;GACC,MAAK;GACL,WAAU;GACV,SAAS;;IAGT,oBAAC;KACC,WAAW,GACT,mHACA,eAAe,4CACf,aAAa,CAAC,eAAe,qCAC7B,CAAC,eACC,CAAC,aACD,gDACH;eAEA,cAAc,MAAM;MACjB;IAGN,qBAAC;KAAI,WAAU;gBACb,oBAAC;MACC,WAAW,GACT,iBACA,eAAe,kBACf,aAAa,CAAC,eAAe,mBAC7B,CAAC,eAAe,CAAC,aAAa,wBAC/B;gBAEA,KAAK;OACH,EACJ,CAAC,cAAc,KAAK,eACnB,oBAAC;MAAE,WAAU;gBACV,KAAK;OACJ;MAEF;IAGL,KAAK,YACJ,qBAAC;KACC,WAAW,GACT,yDACA,cACI,mCACA,iCACL;;MACF;MACG,KAAK;MAAS;;MACX;IAIT,oBAAC;KACC,WAAW,GACT,iCACA,cAAc,aACf;eACF;MAEM;;IACA,EAGR,cACC,qBAAC;GAAI,WAAU;;IACZ,KAAK,eACJ,oBAAC;KAAE,WAAU;eAA8B,KAAK;MAAgB;IAGjE,KAAK,gBACJ,qBAAC;KAAI,WAAU;gBACb,oBAAC;MAAE,WAAU;gBAA2B;OAAiB,EACzD,oBAAC;MAAE,WAAU;gBACV,KAAK;OACJ;MACA;IAIR,qBAAC;KAAI,WAAU;gBACZ,KAAK,aACJ,oBAAC;MACC,SAAQ;MACR,MAAK;MACL,eAAe,OAAO,KAAK,KAAK,WAAW,SAAS;gBAEnD,KAAK,eAAe;OACd,EAEV,CAAC,eACA,oBAAC;MAAO,MAAK;MAAK,SAAS;gBAAY;OAE9B;MAEP;;IACF;GAEJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./learning-journey-ui-onboarding.docblock.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
|
|
2
|
+
|
|
3
|
+
//#region src/docs/learning-journey-ui-onboarding.docblock.ts
|
|
4
|
+
registerDocBlocks([{
|
|
5
|
+
id: "docs.examples.learning-journey-ui-onboarding",
|
|
6
|
+
title: "Learning Journey UI — Onboarding",
|
|
7
|
+
summary: "UI mini-app components for onboarding: checklists, snippets, and journey mapping.",
|
|
8
|
+
kind: "reference",
|
|
9
|
+
visibility: "public",
|
|
10
|
+
route: "/docs/examples/learning-journey-ui-onboarding",
|
|
11
|
+
tags: [
|
|
12
|
+
"learning",
|
|
13
|
+
"ui",
|
|
14
|
+
"onboarding"
|
|
15
|
+
],
|
|
16
|
+
body: `## Includes\n- Onboarding mini-app shell\n- Views: overview, steps, progress, timeline\n- Components: step checklist, code snippet, journey map\n\n## Notes\n- Compose with design system components.\n- Ensure accessible labels and keyboard navigation.`
|
|
17
|
+
}]);
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
//# sourceMappingURL=learning-journey-ui-onboarding.docblock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"learning-journey-ui-onboarding.docblock.js","names":[],"sources":["../../src/docs/learning-journey-ui-onboarding.docblock.ts"],"sourcesContent":["import type { DocBlock } from '@contractspec/lib.contracts/docs';\nimport { registerDocBlocks } from '@contractspec/lib.contracts/docs';\n\nconst blocks: DocBlock[] = [\n {\n id: 'docs.examples.learning-journey-ui-onboarding',\n title: 'Learning Journey UI — Onboarding',\n summary:\n 'UI mini-app components for onboarding: checklists, snippets, and journey mapping.',\n kind: 'reference',\n visibility: 'public',\n route: '/docs/examples/learning-journey-ui-onboarding',\n tags: ['learning', 'ui', 'onboarding'],\n body: `## Includes\\n- Onboarding mini-app shell\\n- Views: overview, steps, progress, timeline\\n- Components: step checklist, code snippet, journey map\\n\\n## Notes\\n- Compose with design system components.\\n- Ensure accessible labels and keyboard navigation.`,\n },\n];\n\nregisterDocBlocks(blocks);\n"],"mappings":";;;AAiBA,kBAd2B,CACzB;CACE,IAAI;CACJ,OAAO;CACP,SACE;CACF,MAAM;CACN,YAAY;CACZ,OAAO;CACP,MAAM;EAAC;EAAY;EAAM;EAAa;CACtC,MAAM;CACP,CACF,CAEwB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region src/example.d.ts
|
|
2
|
+
declare const example: {
|
|
3
|
+
readonly id: "learning-journey-ui-onboarding";
|
|
4
|
+
readonly title: "Learning Journey UI — Onboarding";
|
|
5
|
+
readonly summary: "UI mini-app for onboarding patterns: checklists, code snippets, journey map.";
|
|
6
|
+
readonly tags: readonly ["learning", "ui", "onboarding"];
|
|
7
|
+
readonly kind: "ui";
|
|
8
|
+
readonly visibility: "public";
|
|
9
|
+
readonly docs: {
|
|
10
|
+
readonly rootDocId: "docs.examples.learning-journey-ui-onboarding";
|
|
11
|
+
};
|
|
12
|
+
readonly entrypoints: {
|
|
13
|
+
readonly packageName: "@contractspec/example.learning-journey-ui-onboarding";
|
|
14
|
+
readonly docs: "./docs";
|
|
15
|
+
};
|
|
16
|
+
readonly surfaces: {
|
|
17
|
+
readonly templates: true;
|
|
18
|
+
readonly sandbox: {
|
|
19
|
+
readonly enabled: true;
|
|
20
|
+
readonly modes: readonly ["playground", "markdown"];
|
|
21
|
+
};
|
|
22
|
+
readonly studio: {
|
|
23
|
+
readonly enabled: true;
|
|
24
|
+
readonly installable: true;
|
|
25
|
+
};
|
|
26
|
+
readonly mcp: {
|
|
27
|
+
readonly enabled: true;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
//#endregion
|
|
32
|
+
export { example as default };
|
|
33
|
+
//# sourceMappingURL=example.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example.d.ts","names":[],"sources":["../src/example.ts"],"sourcesContent":[],"mappings":";cAAM;EAAA,SAAA,EAqBI,EAAA,gCAAA"}
|
package/dist/example.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//#region src/example.ts
|
|
2
|
+
const example = {
|
|
3
|
+
id: "learning-journey-ui-onboarding",
|
|
4
|
+
title: "Learning Journey UI — Onboarding",
|
|
5
|
+
summary: "UI mini-app for onboarding patterns: checklists, code snippets, journey map.",
|
|
6
|
+
tags: [
|
|
7
|
+
"learning",
|
|
8
|
+
"ui",
|
|
9
|
+
"onboarding"
|
|
10
|
+
],
|
|
11
|
+
kind: "ui",
|
|
12
|
+
visibility: "public",
|
|
13
|
+
docs: { rootDocId: "docs.examples.learning-journey-ui-onboarding" },
|
|
14
|
+
entrypoints: {
|
|
15
|
+
packageName: "@contractspec/example.learning-journey-ui-onboarding",
|
|
16
|
+
docs: "./docs"
|
|
17
|
+
},
|
|
18
|
+
surfaces: {
|
|
19
|
+
templates: true,
|
|
20
|
+
sandbox: {
|
|
21
|
+
enabled: true,
|
|
22
|
+
modes: ["playground", "markdown"]
|
|
23
|
+
},
|
|
24
|
+
studio: {
|
|
25
|
+
enabled: true,
|
|
26
|
+
installable: true
|
|
27
|
+
},
|
|
28
|
+
mcp: { enabled: true }
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
var example_default = example;
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
export { example_default as default };
|
|
35
|
+
//# sourceMappingURL=example.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example.js","names":[],"sources":["../src/example.ts"],"sourcesContent":["const example = {\n id: 'learning-journey-ui-onboarding',\n title: 'Learning Journey UI — Onboarding',\n summary:\n 'UI mini-app for onboarding patterns: checklists, code snippets, journey map.',\n tags: ['learning', 'ui', 'onboarding'],\n kind: 'ui',\n visibility: 'public',\n docs: {\n rootDocId: 'docs.examples.learning-journey-ui-onboarding',\n },\n entrypoints: {\n packageName: '@contractspec/example.learning-journey-ui-onboarding',\n docs: './docs',\n },\n surfaces: {\n templates: true,\n sandbox: { enabled: true, modes: ['playground', 'markdown'] },\n studio: { enabled: true, installable: true },\n mcp: { enabled: true },\n },\n} as const;\n\nexport default example;\n"],"mappings":";AAAA,MAAM,UAAU;CACd,IAAI;CACJ,OAAO;CACP,SACE;CACF,MAAM;EAAC;EAAY;EAAM;EAAa;CACtC,MAAM;CACN,YAAY;CACZ,MAAM,EACJ,WAAW,gDACZ;CACD,aAAa;EACX,aAAa;EACb,MAAM;EACP;CACD,UAAU;EACR,WAAW;EACX,SAAS;GAAE,SAAS;GAAM,OAAO,CAAC,cAAc,WAAW;GAAE;EAC7D,QAAQ;GAAE,SAAS;GAAM,aAAa;GAAM;EAC5C,KAAK,EAAE,SAAS,MAAM;EACvB;CACF;AAED,sBAAe"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { OnboardingMiniApp } from "./OnboardingMiniApp.js";
|
|
2
|
+
import { CodeSnippet } from "./components/CodeSnippet.js";
|
|
3
|
+
import { JourneyMap } from "./components/JourneyMap.js";
|
|
4
|
+
import { StepChecklist } from "./components/StepChecklist.js";
|
|
5
|
+
import "./components/index.js";
|
|
6
|
+
import example from "./example.js";
|
|
7
|
+
import { Overview } from "./views/Overview.js";
|
|
8
|
+
import { Steps } from "./views/Steps.js";
|
|
9
|
+
import { Progress as ProgressView } from "./views/Progress.js";
|
|
10
|
+
import { Timeline } from "./views/Timeline.js";
|
|
11
|
+
import "./views/index.js";
|
|
12
|
+
export { CodeSnippet, JourneyMap, OnboardingMiniApp, Overview, ProgressView as Progress, StepChecklist, Steps, Timeline, example };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Overview } from "./views/Overview.js";
|
|
2
|
+
import { StepChecklist } from "./components/StepChecklist.js";
|
|
3
|
+
import { Steps } from "./views/Steps.js";
|
|
4
|
+
import { Progress as ProgressView } from "./views/Progress.js";
|
|
5
|
+
import { JourneyMap } from "./components/JourneyMap.js";
|
|
6
|
+
import { Timeline } from "./views/Timeline.js";
|
|
7
|
+
import { OnboardingMiniApp } from "./OnboardingMiniApp.js";
|
|
8
|
+
import example_default from "./example.js";
|
|
9
|
+
import "./views/index.js";
|
|
10
|
+
import { CodeSnippet } from "./components/CodeSnippet.js";
|
|
11
|
+
import "./components/index.js";
|
|
12
|
+
import "./docs/index.js";
|
|
13
|
+
|
|
14
|
+
export { CodeSnippet, JourneyMap, OnboardingMiniApp, Overview, ProgressView as Progress, StepChecklist, Steps, Timeline, example_default as example };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LearningViewProps } from "@contractspec/example.learning-journey-ui-shared";
|
|
2
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/views/Overview.d.ts
|
|
5
|
+
interface OnboardingOverviewProps extends LearningViewProps {
|
|
6
|
+
onStart?: () => void;
|
|
7
|
+
}
|
|
8
|
+
declare function Overview({
|
|
9
|
+
track,
|
|
10
|
+
progress,
|
|
11
|
+
onStart
|
|
12
|
+
}: OnboardingOverviewProps): react_jsx_runtime3.JSX.Element;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Overview };
|
|
15
|
+
//# sourceMappingURL=Overview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Overview.d.ts","names":[],"sources":["../../src/views/Overview.tsx"],"sourcesContent":[],"mappings":";;;;UAaU,uBAAA,SAAgC;;;AAAhC,iBAIM,QAAA,CAJkB;EAAA,KAAA;EAAQ,QAAA;EAAA;AAAiB,CAAA,EAQxD,uBARwD,CAAA,EAQjC,kBAAA,CAAA,GAAA,CAAA,OARiC"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Card, CardContent, CardHeader, CardTitle } from "@contractspec/lib.ui-kit-web/ui/card";
|
|
4
|
+
import { XpBar } from "@contractspec/example.learning-journey-ui-shared";
|
|
5
|
+
import { Button } from "@contractspec/lib.design-system";
|
|
6
|
+
import { Progress } from "@contractspec/lib.ui-kit-web/ui/progress";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/views/Overview.tsx
|
|
10
|
+
function Overview({ track, progress, onStart }) {
|
|
11
|
+
const totalSteps = track.steps.length;
|
|
12
|
+
const completedSteps = progress.completedStepIds.length;
|
|
13
|
+
const percentComplete = totalSteps > 0 ? completedSteps / totalSteps * 100 : 0;
|
|
14
|
+
const isComplete = completedSteps === totalSteps;
|
|
15
|
+
const remainingSteps = totalSteps - completedSteps;
|
|
16
|
+
const estimatedMinutes = remainingSteps * 5;
|
|
17
|
+
const totalXp = track.totalXp ?? track.steps.reduce((sum, s) => sum + (s.xpReward ?? 0), 0) + (track.completionRewards?.xpBonus ?? 0);
|
|
18
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
19
|
+
className: "space-y-6",
|
|
20
|
+
children: [
|
|
21
|
+
/* @__PURE__ */ jsx(Card, {
|
|
22
|
+
className: "overflow-hidden bg-gradient-to-r from-blue-500/10 via-violet-500/10 to-purple-500/10",
|
|
23
|
+
children: /* @__PURE__ */ jsx(CardContent, {
|
|
24
|
+
className: "p-8",
|
|
25
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
26
|
+
className: "flex flex-col items-center gap-6 text-center md:flex-row md:text-left",
|
|
27
|
+
children: [
|
|
28
|
+
/* @__PURE__ */ jsx("div", {
|
|
29
|
+
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",
|
|
30
|
+
children: isComplete ? "🎉" : "🚀"
|
|
31
|
+
}),
|
|
32
|
+
/* @__PURE__ */ jsxs("div", {
|
|
33
|
+
className: "flex-1",
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ jsx("h1", {
|
|
36
|
+
className: "text-2xl font-bold",
|
|
37
|
+
children: track.name
|
|
38
|
+
}),
|
|
39
|
+
/* @__PURE__ */ jsx("p", {
|
|
40
|
+
className: "text-muted-foreground mt-1 max-w-2xl",
|
|
41
|
+
children: track.description
|
|
42
|
+
}),
|
|
43
|
+
!isComplete && /* @__PURE__ */ jsxs("p", {
|
|
44
|
+
className: "text-muted-foreground mt-3 text-sm",
|
|
45
|
+
children: [
|
|
46
|
+
"⏱️ Estimated time:",
|
|
47
|
+
" ",
|
|
48
|
+
estimatedMinutes > 0 ? `~${estimatedMinutes} minutes` : "Less than a minute"
|
|
49
|
+
]
|
|
50
|
+
})
|
|
51
|
+
]
|
|
52
|
+
}),
|
|
53
|
+
!isComplete && /* @__PURE__ */ jsx(Button, {
|
|
54
|
+
size: "lg",
|
|
55
|
+
onClick: onStart,
|
|
56
|
+
children: completedSteps > 0 ? "Continue" : "Get Started"
|
|
57
|
+
})
|
|
58
|
+
]
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
}),
|
|
62
|
+
/* @__PURE__ */ jsxs("div", {
|
|
63
|
+
className: "grid gap-4 md:grid-cols-3",
|
|
64
|
+
children: [
|
|
65
|
+
/* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsx(CardHeader, {
|
|
66
|
+
className: "pb-2",
|
|
67
|
+
children: /* @__PURE__ */ jsx(CardTitle, {
|
|
68
|
+
className: "text-muted-foreground text-sm font-medium",
|
|
69
|
+
children: "Progress"
|
|
70
|
+
})
|
|
71
|
+
}), /* @__PURE__ */ jsxs(CardContent, { children: [
|
|
72
|
+
/* @__PURE__ */ jsxs("div", {
|
|
73
|
+
className: "text-3xl font-bold",
|
|
74
|
+
children: [Math.round(percentComplete), "%"]
|
|
75
|
+
}),
|
|
76
|
+
/* @__PURE__ */ jsx(Progress, {
|
|
77
|
+
value: percentComplete,
|
|
78
|
+
className: "mt-2 h-2"
|
|
79
|
+
}),
|
|
80
|
+
/* @__PURE__ */ jsxs("p", {
|
|
81
|
+
className: "text-muted-foreground mt-2 text-sm",
|
|
82
|
+
children: [
|
|
83
|
+
completedSteps,
|
|
84
|
+
" of ",
|
|
85
|
+
totalSteps,
|
|
86
|
+
" steps completed"
|
|
87
|
+
]
|
|
88
|
+
})
|
|
89
|
+
] })] }),
|
|
90
|
+
/* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsx(CardHeader, {
|
|
91
|
+
className: "pb-2",
|
|
92
|
+
children: /* @__PURE__ */ jsx(CardTitle, {
|
|
93
|
+
className: "text-muted-foreground text-sm font-medium",
|
|
94
|
+
children: "XP Earned"
|
|
95
|
+
})
|
|
96
|
+
}), /* @__PURE__ */ jsxs(CardContent, { children: [/* @__PURE__ */ jsx("div", {
|
|
97
|
+
className: "text-3xl font-bold text-blue-500",
|
|
98
|
+
children: progress.xpEarned
|
|
99
|
+
}), /* @__PURE__ */ jsx(XpBar, {
|
|
100
|
+
current: progress.xpEarned,
|
|
101
|
+
max: totalXp,
|
|
102
|
+
showLabel: false,
|
|
103
|
+
size: "sm"
|
|
104
|
+
})] })] }),
|
|
105
|
+
/* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsx(CardHeader, {
|
|
106
|
+
className: "pb-2",
|
|
107
|
+
children: /* @__PURE__ */ jsx(CardTitle, {
|
|
108
|
+
className: "text-muted-foreground text-sm font-medium",
|
|
109
|
+
children: "Time Remaining"
|
|
110
|
+
})
|
|
111
|
+
}), /* @__PURE__ */ jsxs(CardContent, { children: [/* @__PURE__ */ jsx("div", {
|
|
112
|
+
className: "text-3xl font-bold",
|
|
113
|
+
children: isComplete ? "✓" : `~${estimatedMinutes}m`
|
|
114
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
115
|
+
className: "text-muted-foreground mt-2 text-sm",
|
|
116
|
+
children: isComplete ? "All done!" : `${remainingSteps} steps to go`
|
|
117
|
+
})] })] })
|
|
118
|
+
]
|
|
119
|
+
}),
|
|
120
|
+
/* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsxs(CardTitle, {
|
|
121
|
+
className: "flex items-center gap-2",
|
|
122
|
+
children: [/* @__PURE__ */ jsx("span", { children: "📋" }), /* @__PURE__ */ jsx("span", { children: "Your Journey" })]
|
|
123
|
+
}) }), /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx("div", {
|
|
124
|
+
className: "space-y-3",
|
|
125
|
+
children: track.steps.map((step, index) => {
|
|
126
|
+
const isStepCompleted = progress.completedStepIds.includes(step.id);
|
|
127
|
+
const isCurrent = !isStepCompleted && track.steps.slice(0, index).every((s) => progress.completedStepIds.includes(s.id));
|
|
128
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
129
|
+
className: "flex items-center gap-4 rounded-lg border p-3",
|
|
130
|
+
children: [
|
|
131
|
+
/* @__PURE__ */ jsx("div", {
|
|
132
|
+
className: `flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-sm font-semibold ${isStepCompleted ? "bg-green-500 text-white" : isCurrent ? "bg-blue-500 text-white" : "bg-muted text-muted-foreground"}`,
|
|
133
|
+
children: isStepCompleted ? "✓" : index + 1
|
|
134
|
+
}),
|
|
135
|
+
/* @__PURE__ */ jsx("div", {
|
|
136
|
+
className: "min-w-0 flex-1",
|
|
137
|
+
children: /* @__PURE__ */ jsx("p", {
|
|
138
|
+
className: `font-medium ${isStepCompleted ? "text-green-500" : isCurrent ? "text-foreground" : "text-muted-foreground"}`,
|
|
139
|
+
children: step.title
|
|
140
|
+
})
|
|
141
|
+
}),
|
|
142
|
+
step.xpReward && /* @__PURE__ */ jsxs("span", {
|
|
143
|
+
className: "text-muted-foreground text-sm",
|
|
144
|
+
children: [
|
|
145
|
+
"+",
|
|
146
|
+
step.xpReward,
|
|
147
|
+
" XP"
|
|
148
|
+
]
|
|
149
|
+
})
|
|
150
|
+
]
|
|
151
|
+
}, step.id);
|
|
152
|
+
})
|
|
153
|
+
}) })] }),
|
|
154
|
+
isComplete && /* @__PURE__ */ jsx(Card, {
|
|
155
|
+
className: "border-green-500/50 bg-green-500/5",
|
|
156
|
+
children: /* @__PURE__ */ jsxs(CardContent, {
|
|
157
|
+
className: "flex items-center gap-4 p-6",
|
|
158
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
159
|
+
className: "text-4xl",
|
|
160
|
+
children: "🎉"
|
|
161
|
+
}), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
|
|
162
|
+
className: "text-lg font-semibold text-green-500",
|
|
163
|
+
children: "Onboarding Complete!"
|
|
164
|
+
}), /* @__PURE__ */ jsxs("p", {
|
|
165
|
+
className: "text-muted-foreground",
|
|
166
|
+
children: [
|
|
167
|
+
"You've completed all ",
|
|
168
|
+
totalSteps,
|
|
169
|
+
" steps. Welcome aboard!"
|
|
170
|
+
]
|
|
171
|
+
})] })]
|
|
172
|
+
})
|
|
173
|
+
})
|
|
174
|
+
]
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
//#endregion
|
|
179
|
+
export { Overview };
|
|
180
|
+
//# sourceMappingURL=Overview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Overview.js","names":[],"sources":["../../src/views/Overview.tsx"],"sourcesContent":["'use client';\n\nimport { Button } from '@contractspec/lib.design-system';\nimport {\n Card,\n CardContent,\n CardHeader,\n CardTitle,\n} from '@contractspec/lib.ui-kit-web/ui/card';\nimport { Progress } from '@contractspec/lib.ui-kit-web/ui/progress';\nimport { XpBar } from '@contractspec/example.learning-journey-ui-shared';\nimport type { LearningViewProps } from '@contractspec/example.learning-journey-ui-shared';\n\ninterface OnboardingOverviewProps extends LearningViewProps {\n onStart?: () => void;\n}\n\nexport function Overview({\n track,\n progress,\n onStart,\n}: OnboardingOverviewProps) {\n const totalSteps = track.steps.length;\n const completedSteps = progress.completedStepIds.length;\n const percentComplete =\n totalSteps > 0 ? (completedSteps / totalSteps) * 100 : 0;\n const isComplete = completedSteps === totalSteps;\n\n // Estimate time remaining (rough: 5 min per step)\n const remainingSteps = totalSteps - completedSteps;\n const estimatedMinutes = remainingSteps * 5;\n\n const totalXp =\n track.totalXp ??\n track.steps.reduce((sum, s) => sum + (s.xpReward ?? 0), 0) +\n (track.completionRewards?.xpBonus ?? 0);\n\n return (\n <div className=\"space-y-6\">\n {/* Welcome Banner */}\n <Card className=\"overflow-hidden bg-gradient-to-r from-blue-500/10 via-violet-500/10 to-purple-500/10\">\n <CardContent className=\"p-8\">\n <div className=\"flex flex-col items-center gap-6 text-center md:flex-row md:text-left\">\n <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\">\n {isComplete ? '🎉' : '🚀'}\n </div>\n <div className=\"flex-1\">\n <h1 className=\"text-2xl font-bold\">{track.name}</h1>\n <p className=\"text-muted-foreground mt-1 max-w-2xl\">\n {track.description}\n </p>\n {!isComplete && (\n <p className=\"text-muted-foreground mt-3 text-sm\">\n ⏱️ Estimated time:{' '}\n {estimatedMinutes > 0\n ? `~${estimatedMinutes} minutes`\n : 'Less than a minute'}\n </p>\n )}\n </div>\n {!isComplete && (\n <Button size=\"lg\" onClick={onStart}>\n {completedSteps > 0 ? 'Continue' : 'Get Started'}\n </Button>\n )}\n </div>\n </CardContent>\n </Card>\n\n {/* Progress Overview */}\n <div className=\"grid gap-4 md:grid-cols-3\">\n <Card>\n <CardHeader className=\"pb-2\">\n <CardTitle className=\"text-muted-foreground text-sm font-medium\">\n Progress\n </CardTitle>\n </CardHeader>\n <CardContent>\n <div className=\"text-3xl font-bold\">\n {Math.round(percentComplete)}%\n </div>\n <Progress value={percentComplete} className=\"mt-2 h-2\" />\n <p className=\"text-muted-foreground mt-2 text-sm\">\n {completedSteps} of {totalSteps} steps completed\n </p>\n </CardContent>\n </Card>\n\n <Card>\n <CardHeader className=\"pb-2\">\n <CardTitle className=\"text-muted-foreground text-sm font-medium\">\n XP Earned\n </CardTitle>\n </CardHeader>\n <CardContent>\n <div className=\"text-3xl font-bold text-blue-500\">\n {progress.xpEarned}\n </div>\n <XpBar\n current={progress.xpEarned}\n max={totalXp}\n showLabel={false}\n size=\"sm\"\n />\n </CardContent>\n </Card>\n\n <Card>\n <CardHeader className=\"pb-2\">\n <CardTitle className=\"text-muted-foreground text-sm font-medium\">\n Time Remaining\n </CardTitle>\n </CardHeader>\n <CardContent>\n <div className=\"text-3xl font-bold\">\n {isComplete ? '✓' : `~${estimatedMinutes}m`}\n </div>\n <p className=\"text-muted-foreground mt-2 text-sm\">\n {isComplete ? 'All done!' : `${remainingSteps} steps to go`}\n </p>\n </CardContent>\n </Card>\n </div>\n\n {/* Step Preview */}\n <Card>\n <CardHeader>\n <CardTitle className=\"flex items-center gap-2\">\n <span>📋</span>\n <span>Your Journey</span>\n </CardTitle>\n </CardHeader>\n <CardContent>\n <div className=\"space-y-3\">\n {track.steps.map((step, index) => {\n const isStepCompleted = progress.completedStepIds.includes(\n step.id\n );\n const isCurrent =\n !isStepCompleted &&\n track.steps\n .slice(0, index)\n .every((s) => progress.completedStepIds.includes(s.id));\n\n return (\n <div\n key={step.id}\n className=\"flex items-center gap-4 rounded-lg border p-3\"\n >\n <div\n className={`flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-sm font-semibold ${\n isStepCompleted\n ? 'bg-green-500 text-white'\n : isCurrent\n ? 'bg-blue-500 text-white'\n : 'bg-muted text-muted-foreground'\n }`}\n >\n {isStepCompleted ? '✓' : index + 1}\n </div>\n <div className=\"min-w-0 flex-1\">\n <p\n className={`font-medium ${\n isStepCompleted\n ? 'text-green-500'\n : isCurrent\n ? 'text-foreground'\n : 'text-muted-foreground'\n }`}\n >\n {step.title}\n </p>\n </div>\n {step.xpReward && (\n <span className=\"text-muted-foreground text-sm\">\n +{step.xpReward} XP\n </span>\n )}\n </div>\n );\n })}\n </div>\n </CardContent>\n </Card>\n\n {/* Completion Message */}\n {isComplete && (\n <Card className=\"border-green-500/50 bg-green-500/5\">\n <CardContent className=\"flex items-center gap-4 p-6\">\n <div className=\"text-4xl\">🎉</div>\n <div>\n <h3 className=\"text-lg font-semibold text-green-500\">\n Onboarding Complete!\n </h3>\n <p className=\"text-muted-foreground\">\n You've completed all {totalSteps} steps. Welcome aboard!\n </p>\n </div>\n </CardContent>\n </Card>\n )}\n </div>\n );\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LearningViewProps } from "@contractspec/example.learning-journey-ui-shared";
|
|
2
|
+
import * as react_jsx_runtime4 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/views/Progress.d.ts
|
|
5
|
+
declare function ProgressView({
|
|
6
|
+
track,
|
|
7
|
+
progress
|
|
8
|
+
}: LearningViewProps): react_jsx_runtime4.JSX.Element;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { ProgressView as Progress, ProgressView };
|
|
11
|
+
//# sourceMappingURL=Progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Progress.d.ts","names":[],"sources":["../../src/views/Progress.tsx"],"sourcesContent":[],"mappings":";;;;iBAegB,YAAA;;;GAAkC,oBAAiB,kBAAA,CAAA,GAAA,CAAA"}
|