@lssm/example.learning-journey-ui-onboarding 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 +33 -0
- package/dist/JourneyMap-C6APUTsI.mjs +120 -0
- package/dist/components/index.d.mts +2 -0
- package/dist/components/index.mjs +4 -0
- package/dist/components-Cd2J4qQ5.mjs +48 -0
- package/dist/index-jaGULFWy.d.mts +48 -0
- package/dist/index-v1pn71sC.d.mts +33 -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-DBF-jKGQ.mjs +504 -0
- package/package.json +53 -0
- package/src/OnboardingMiniApp.tsx +94 -0
- package/src/components/CodeSnippet.tsx +58 -0
- package/src/components/JourneyMap.tsx +87 -0
- package/src/components/StepChecklist.tsx +138 -0
- package/src/components/index.ts +4 -0
- package/src/index.ts +9 -0
- package/src/views/Overview.tsx +205 -0
- package/src/views/Progress.tsx +184 -0
- package/src/views/Steps.tsx +93 -0
- package/src/views/Timeline.tsx +142 -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,22 @@
|
|
|
1
|
+
$ bun build:bundle && bun build:types
|
|
2
|
+
$ tsdown
|
|
3
|
+
[34mℹ[39m tsdown [2mv0.17.0[22m powered by rolldown [2mv1.0.0-beta.53[22m
|
|
4
|
+
[34mℹ[39m config file: [4m/home/runner/work/contractspec/contractspec/packages/examples/learning-journey-ui-onboarding/tsdown.config.js[24m
|
|
5
|
+
[34mℹ[39m entry: [34msrc/index.ts, src/views/index.ts, src/components/index.ts[39m
|
|
6
|
+
[34mℹ[39m target: [34mesnext[39m
|
|
7
|
+
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
8
|
+
[34mℹ[39m Build start
|
|
9
|
+
[34mℹ[39m [2mdist/[22m[1mindex.mjs[22m [2m 2.40 kB[22m [2m│ gzip: 0.84 kB[22m
|
|
10
|
+
[34mℹ[39m [2mdist/[22m[1mviews/index.mjs[22m [2m 0.20 kB[22m [2m│ gzip: 0.15 kB[22m
|
|
11
|
+
[34mℹ[39m [2mdist/[22m[1mcomponents/index.mjs[22m [2m 0.20 kB[22m [2m│ gzip: 0.15 kB[22m
|
|
12
|
+
[34mℹ[39m [2mdist/[22mviews-DBF-jKGQ.mjs [2m20.13 kB[22m [2m│ gzip: 3.57 kB[22m
|
|
13
|
+
[34mℹ[39m [2mdist/[22mJourneyMap-C6APUTsI.mjs [2m 5.20 kB[22m [2m│ gzip: 1.53 kB[22m
|
|
14
|
+
[34mℹ[39m [2mdist/[22mcomponents-Cd2J4qQ5.mjs [2m 1.59 kB[22m [2m│ gzip: 0.67 kB[22m
|
|
15
|
+
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.mts[22m[39m [2m 0.84 kB[22m [2m│ gzip: 0.42 kB[22m
|
|
16
|
+
[34mℹ[39m [2mdist/[22m[32m[1mviews/index.d.mts[22m[39m [2m 0.16 kB[22m [2m│ gzip: 0.13 kB[22m
|
|
17
|
+
[34mℹ[39m [2mdist/[22m[32m[1mcomponents/index.d.mts[22m[39m [2m 0.14 kB[22m [2m│ gzip: 0.13 kB[22m
|
|
18
|
+
[34mℹ[39m [2mdist/[22m[32mindex-jaGULFWy.d.mts[39m [2m 1.22 kB[22m [2m│ gzip: 0.46 kB[22m
|
|
19
|
+
[34mℹ[39m [2mdist/[22m[32mindex-v1pn71sC.d.mts[39m [2m 0.93 kB[22m [2m│ gzip: 0.34 kB[22m
|
|
20
|
+
[34mℹ[39m 11 files, total: 33.01 kB
|
|
21
|
+
[32m✔[39m Build complete in [32m7707ms[39m
|
|
22
|
+
$ tsc --noEmit
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# @lssm/example.learning-journey-ui-onboarding
|
|
2
|
+
|
|
3
|
+
## 0.0.0-canary-20251212210835
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [3086383]
|
|
8
|
+
- @lssm/lib.design-system@0.0.0-canary-20251212210835
|
|
9
|
+
- @lssm/lib.ui-kit-web@0.0.0-canary-20251212210835
|
|
10
|
+
- @lssm/example.learning-journey-ui-shared@0.0.0-canary-20251212210835
|
|
11
|
+
- @lssm/example.learning-journey.platform-tour@0.0.0-canary-20251212210835
|
|
12
|
+
- @lssm/example.learning-journey.studio-onboarding@0.0.0-canary-20251212210835
|
|
13
|
+
- @lssm/module.learning-journey@0.0.0-canary-20251212210835
|
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# @lssm/example.learning-journey-ui-onboarding
|
|
2
|
+
|
|
3
|
+
Developer onboarding UI with checklists and journey maps.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Overview**: Welcome banner with progress summary and "Get Started" CTA
|
|
8
|
+
- **Steps**: Accordion-style checklist with expandable instructions
|
|
9
|
+
- **Progress**: Circular progress indicator, XP bar, and step breakdown
|
|
10
|
+
- **Timeline**: Journey map with surface icons and detailed step timeline
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
import { OnboardingMiniApp } from '@lssm/example.learning-journey-ui-onboarding';
|
|
16
|
+
import { studioGettingStartedTrack } from '@lssm/example.learning-journey.studio-onboarding/track';
|
|
17
|
+
|
|
18
|
+
function MyApp() {
|
|
19
|
+
return (
|
|
20
|
+
<OnboardingMiniApp
|
|
21
|
+
track={studioGettingStartedTrack}
|
|
22
|
+
initialView="overview"
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Components
|
|
29
|
+
|
|
30
|
+
- **StepChecklist** - Expandable accordion step with completion action
|
|
31
|
+
- **CodeSnippet** - Inline code display with copy button
|
|
32
|
+
- **JourneyMap** - Horizontal connected node journey visualization
|
|
33
|
+
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { Button } from "@lssm/lib.design-system";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { cn } from "@lssm/lib.ui-kit-web/ui/utils";
|
|
5
|
+
|
|
6
|
+
//#region src/components/StepChecklist.tsx
|
|
7
|
+
function StepChecklist({ step, stepNumber, isCompleted, isCurrent, isExpanded, onToggle, onComplete }) {
|
|
8
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
9
|
+
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"),
|
|
10
|
+
children: [/* @__PURE__ */ jsxs("button", {
|
|
11
|
+
type: "button",
|
|
12
|
+
className: "flex w-full items-center gap-4 p-4 text-left",
|
|
13
|
+
onClick: onToggle,
|
|
14
|
+
children: [
|
|
15
|
+
/* @__PURE__ */ jsx("div", {
|
|
16
|
+
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"),
|
|
17
|
+
children: isCompleted ? "✓" : stepNumber
|
|
18
|
+
}),
|
|
19
|
+
/* @__PURE__ */ jsxs("div", {
|
|
20
|
+
className: "min-w-0 flex-1",
|
|
21
|
+
children: [/* @__PURE__ */ jsx("h4", {
|
|
22
|
+
className: cn("font-semibold", isCompleted && "text-green-500", isCurrent && !isCompleted && "text-foreground", !isCompleted && !isCurrent && "text-muted-foreground"),
|
|
23
|
+
children: step.title
|
|
24
|
+
}), !isExpanded && step.description && /* @__PURE__ */ jsx("p", {
|
|
25
|
+
className: "text-muted-foreground truncate text-sm",
|
|
26
|
+
children: step.description
|
|
27
|
+
})]
|
|
28
|
+
}),
|
|
29
|
+
step.xpReward && /* @__PURE__ */ jsxs("span", {
|
|
30
|
+
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"),
|
|
31
|
+
children: [
|
|
32
|
+
"+",
|
|
33
|
+
step.xpReward,
|
|
34
|
+
" XP"
|
|
35
|
+
]
|
|
36
|
+
}),
|
|
37
|
+
/* @__PURE__ */ jsx("span", {
|
|
38
|
+
className: cn("shrink-0 transition-transform", isExpanded && "rotate-180"),
|
|
39
|
+
children: "▼"
|
|
40
|
+
})
|
|
41
|
+
]
|
|
42
|
+
}), isExpanded && /* @__PURE__ */ jsxs("div", {
|
|
43
|
+
className: "border-t px-4 py-4",
|
|
44
|
+
children: [
|
|
45
|
+
step.description && /* @__PURE__ */ jsx("p", {
|
|
46
|
+
className: "text-muted-foreground mb-4",
|
|
47
|
+
children: step.description
|
|
48
|
+
}),
|
|
49
|
+
step.instructions && /* @__PURE__ */ jsxs("div", {
|
|
50
|
+
className: "bg-muted mb-4 rounded-lg p-4",
|
|
51
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
52
|
+
className: "mb-2 text-sm font-medium",
|
|
53
|
+
children: "Instructions:"
|
|
54
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
55
|
+
className: "text-muted-foreground text-sm",
|
|
56
|
+
children: step.instructions
|
|
57
|
+
})]
|
|
58
|
+
}),
|
|
59
|
+
/* @__PURE__ */ jsxs("div", {
|
|
60
|
+
className: "flex flex-wrap gap-2",
|
|
61
|
+
children: [step.actionUrl && /* @__PURE__ */ jsx(Button, {
|
|
62
|
+
variant: "outline",
|
|
63
|
+
size: "sm",
|
|
64
|
+
onClick: () => window.open(step.actionUrl, "_blank"),
|
|
65
|
+
children: step.actionLabel ?? "Try it"
|
|
66
|
+
}), !isCompleted && /* @__PURE__ */ jsx(Button, {
|
|
67
|
+
size: "sm",
|
|
68
|
+
onClick: onComplete,
|
|
69
|
+
children: "Mark as Complete"
|
|
70
|
+
})]
|
|
71
|
+
})
|
|
72
|
+
]
|
|
73
|
+
})]
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/components/JourneyMap.tsx
|
|
79
|
+
const SURFACE_ICONS = {
|
|
80
|
+
templates: "📋",
|
|
81
|
+
"spec-editor": "✏️",
|
|
82
|
+
regenerator: "🔄",
|
|
83
|
+
playground: "🎮",
|
|
84
|
+
evolution: "🤖",
|
|
85
|
+
dashboard: "📊",
|
|
86
|
+
settings: "⚙️",
|
|
87
|
+
default: "📍"
|
|
88
|
+
};
|
|
89
|
+
function JourneyMap({ steps, completedStepIds, currentStepId }) {
|
|
90
|
+
return /* @__PURE__ */ jsx("div", {
|
|
91
|
+
className: "relative overflow-x-auto pb-4",
|
|
92
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
93
|
+
className: "flex min-w-max items-center gap-2",
|
|
94
|
+
children: steps.map((step, index) => {
|
|
95
|
+
const isCompleted = completedStepIds.includes(step.id);
|
|
96
|
+
const isCurrent = step.id === currentStepId;
|
|
97
|
+
const icon = SURFACE_ICONS[step.metadata?.surface ?? "default"] ?? SURFACE_ICONS.default;
|
|
98
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
99
|
+
className: "flex items-center",
|
|
100
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
101
|
+
className: "flex flex-col items-center gap-2",
|
|
102
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
103
|
+
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"),
|
|
104
|
+
children: isCompleted ? "✓" : icon
|
|
105
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
106
|
+
className: "text-center",
|
|
107
|
+
children: /* @__PURE__ */ jsx("p", {
|
|
108
|
+
className: cn("max-w-[100px] truncate text-xs font-medium", isCompleted && "text-green-500", isCurrent && !isCompleted && "text-violet-500", !isCompleted && !isCurrent && "text-muted-foreground"),
|
|
109
|
+
children: step.title
|
|
110
|
+
})
|
|
111
|
+
})]
|
|
112
|
+
}), 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") })]
|
|
113
|
+
}, step.id);
|
|
114
|
+
})
|
|
115
|
+
})
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
//#endregion
|
|
120
|
+
export { StepChecklist as n, JourneyMap as t };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { Button } from "@lssm/lib.design-system";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { cn } from "@lssm/lib.ui-kit-web/ui/utils";
|
|
5
|
+
|
|
6
|
+
//#region src/components/CodeSnippet.tsx
|
|
7
|
+
function CodeSnippet({ code, language = "typescript", title }) {
|
|
8
|
+
const [copied, setCopied] = useState(false);
|
|
9
|
+
const handleCopy = async () => {
|
|
10
|
+
await navigator.clipboard.writeText(code);
|
|
11
|
+
setCopied(true);
|
|
12
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
13
|
+
};
|
|
14
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
15
|
+
className: "bg-muted/50 overflow-hidden rounded-lg border",
|
|
16
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
17
|
+
className: "bg-muted flex items-center justify-between border-b px-4 py-2",
|
|
18
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
19
|
+
className: "flex items-center gap-2",
|
|
20
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
21
|
+
className: "text-muted-foreground text-xs font-medium uppercase",
|
|
22
|
+
children: language
|
|
23
|
+
}), title && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
24
|
+
className: "text-muted-foreground",
|
|
25
|
+
children: "•"
|
|
26
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
27
|
+
className: "text-sm",
|
|
28
|
+
children: title
|
|
29
|
+
})] })]
|
|
30
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
31
|
+
variant: "ghost",
|
|
32
|
+
size: "sm",
|
|
33
|
+
onClick: handleCopy,
|
|
34
|
+
className: "h-7 text-xs",
|
|
35
|
+
children: copied ? "✓ Copied" : "Copy"
|
|
36
|
+
})]
|
|
37
|
+
}), /* @__PURE__ */ jsx("pre", {
|
|
38
|
+
className: "overflow-x-auto p-4",
|
|
39
|
+
children: /* @__PURE__ */ jsx("code", {
|
|
40
|
+
className: "text-sm",
|
|
41
|
+
children: code
|
|
42
|
+
})
|
|
43
|
+
})]
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
export { CodeSnippet as t };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as react_jsx_runtime4 from "react/jsx-runtime";
|
|
2
|
+
import { LearningJourneyStepSpec } from "@lssm/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_runtime4.JSX.Element;
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/components/CodeSnippet.d.ts
|
|
25
|
+
interface CodeSnippetProps {
|
|
26
|
+
code: string;
|
|
27
|
+
language?: string;
|
|
28
|
+
title?: string;
|
|
29
|
+
}
|
|
30
|
+
declare function CodeSnippet({
|
|
31
|
+
code,
|
|
32
|
+
language,
|
|
33
|
+
title
|
|
34
|
+
}: CodeSnippetProps): react_jsx_runtime4.JSX.Element;
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/components/JourneyMap.d.ts
|
|
37
|
+
interface JourneyMapProps {
|
|
38
|
+
steps: LearningJourneyStepSpec[];
|
|
39
|
+
completedStepIds: string[];
|
|
40
|
+
currentStepId?: string | null;
|
|
41
|
+
}
|
|
42
|
+
declare function JourneyMap({
|
|
43
|
+
steps,
|
|
44
|
+
completedStepIds,
|
|
45
|
+
currentStepId
|
|
46
|
+
}: JourneyMapProps): react_jsx_runtime4.JSX.Element;
|
|
47
|
+
//#endregion
|
|
48
|
+
export { CodeSnippet as n, StepChecklist as r, JourneyMap as t };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { LearningViewProps } from "@lssm/example.learning-journey-ui-shared";
|
|
2
|
+
import * as react_jsx_runtime1 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_runtime1.JSX.Element;
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/views/Steps.d.ts
|
|
15
|
+
declare function Steps({
|
|
16
|
+
track,
|
|
17
|
+
progress,
|
|
18
|
+
onStepComplete
|
|
19
|
+
}: LearningViewProps): react_jsx_runtime1.JSX.Element;
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/views/Progress.d.ts
|
|
22
|
+
declare function ProgressView({
|
|
23
|
+
track,
|
|
24
|
+
progress
|
|
25
|
+
}: LearningViewProps): react_jsx_runtime1.JSX.Element;
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/views/Timeline.d.ts
|
|
28
|
+
declare function Timeline({
|
|
29
|
+
track,
|
|
30
|
+
progress
|
|
31
|
+
}: LearningViewProps): react_jsx_runtime1.JSX.Element;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { Overview as i, ProgressView as n, Steps as r, Timeline as t };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { n as CodeSnippet, r as StepChecklist, t as JourneyMap } from "./index-jaGULFWy.mjs";
|
|
2
|
+
import { i as Overview, n as ProgressView, r as Steps, t as Timeline } from "./index-v1pn71sC.mjs";
|
|
3
|
+
import { LearningMiniAppProps } from "@lssm/example.learning-journey-ui-shared";
|
|
4
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/OnboardingMiniApp.d.ts
|
|
7
|
+
type OnboardingMiniAppProps = Omit<LearningMiniAppProps, 'progress'> & {
|
|
8
|
+
progress?: LearningMiniAppProps['progress'];
|
|
9
|
+
};
|
|
10
|
+
declare function OnboardingMiniApp({
|
|
11
|
+
track,
|
|
12
|
+
progress: externalProgress,
|
|
13
|
+
onStepComplete: externalOnStepComplete,
|
|
14
|
+
onViewChange,
|
|
15
|
+
initialView
|
|
16
|
+
}: OnboardingMiniAppProps): react_jsx_runtime0.JSX.Element;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { CodeSnippet, JourneyMap, OnboardingMiniApp, Overview, ProgressView as Progress, StepChecklist, Steps, Timeline };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { i as Overview, n as ProgressView, r as Steps, t as Timeline } from "./views-DBF-jKGQ.mjs";
|
|
2
|
+
import { n as StepChecklist, t as JourneyMap } from "./JourneyMap-C6APUTsI.mjs";
|
|
3
|
+
import { t as CodeSnippet } from "./components-Cd2J4qQ5.mjs";
|
|
4
|
+
import { useCallback, useState } from "react";
|
|
5
|
+
import { Card, CardContent } from "@lssm/lib.ui-kit-web/ui/card";
|
|
6
|
+
import { ViewTabs, useLearningProgress } from "@lssm/example.learning-journey-ui-shared";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/OnboardingMiniApp.tsx
|
|
10
|
+
function OnboardingMiniApp({ track, progress: externalProgress, onStepComplete: externalOnStepComplete, onViewChange, initialView = "overview" }) {
|
|
11
|
+
const [currentView, setCurrentView] = useState(initialView);
|
|
12
|
+
const { progress: internalProgress, completeStep: internalCompleteStep } = useLearningProgress(track);
|
|
13
|
+
const progress = externalProgress ?? internalProgress;
|
|
14
|
+
const handleViewChange = useCallback((view) => {
|
|
15
|
+
setCurrentView(view);
|
|
16
|
+
onViewChange?.(view);
|
|
17
|
+
}, [onViewChange]);
|
|
18
|
+
const handleStepComplete = useCallback((stepId) => {
|
|
19
|
+
if (externalOnStepComplete) externalOnStepComplete(stepId);
|
|
20
|
+
else internalCompleteStep(stepId);
|
|
21
|
+
}, [externalOnStepComplete, internalCompleteStep]);
|
|
22
|
+
const handleStartFromOverview = useCallback(() => {
|
|
23
|
+
setCurrentView("steps");
|
|
24
|
+
onViewChange?.("steps");
|
|
25
|
+
}, [onViewChange]);
|
|
26
|
+
const renderView = () => {
|
|
27
|
+
const viewProps = {
|
|
28
|
+
track,
|
|
29
|
+
progress,
|
|
30
|
+
onStepComplete: handleStepComplete
|
|
31
|
+
};
|
|
32
|
+
switch (currentView) {
|
|
33
|
+
case "overview": return /* @__PURE__ */ jsx(Overview, {
|
|
34
|
+
...viewProps,
|
|
35
|
+
onStart: handleStartFromOverview
|
|
36
|
+
});
|
|
37
|
+
case "steps": return /* @__PURE__ */ jsx(Steps, { ...viewProps });
|
|
38
|
+
case "progress": return /* @__PURE__ */ jsx(ProgressView, { ...viewProps });
|
|
39
|
+
case "timeline": return /* @__PURE__ */ jsx(Timeline, { ...viewProps });
|
|
40
|
+
default: return /* @__PURE__ */ jsx(Overview, {
|
|
41
|
+
...viewProps,
|
|
42
|
+
onStart: handleStartFromOverview
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
47
|
+
className: "space-y-6",
|
|
48
|
+
children: [/* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(CardContent, {
|
|
49
|
+
className: "p-4",
|
|
50
|
+
children: /* @__PURE__ */ jsx(ViewTabs, {
|
|
51
|
+
currentView,
|
|
52
|
+
onViewChange: handleViewChange
|
|
53
|
+
})
|
|
54
|
+
}) }), renderView()]
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
//#endregion
|
|
59
|
+
export { CodeSnippet, JourneyMap, OnboardingMiniApp, Overview, ProgressView as Progress, StepChecklist, Steps, Timeline };
|