@burdenoff/microfe-buildmyiq 2026.1103.1 → 2026.1107.1
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/dist/buildmyiq/pages/paths/PathsPage.d.ts.map +1 -1
- package/dist/buildmyiq/pages/paths/PathsPage.js +119 -116
- package/dist/buildmyiq/pages/paths/PathsPage.js.map +1 -1
- package/dist/buildmyiq/pages/paths/RecommendedPathsRail.d.ts.map +1 -1
- package/dist/buildmyiq/pages/paths/RecommendedPathsRail.js +64 -63
- package/dist/buildmyiq/pages/paths/RecommendedPathsRail.js.map +1 -1
- package/dist/buildmyiq/pages/paths/countLabels.d.ts +15 -0
- package/dist/buildmyiq/pages/paths/countLabels.d.ts.map +1 -0
- package/dist/buildmyiq/pages/paths/countLabels.js +18 -0
- package/dist/buildmyiq/pages/paths/countLabels.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PathsPage.d.ts","sourceRoot":"","sources":["../../../../src/buildmyiq/pages/paths/PathsPage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PathsPage.d.ts","sourceRoot":"","sources":["../../../../src/buildmyiq/pages/paths/PathsPage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AA0JhC,eAAO,MAAM,SAAS,EAAE,EAyHvB,CAAC"}
|
|
@@ -12,131 +12,134 @@ import { useBuiAllMyEnrollments as u, useBuiPathCatalogCourses as d, useBuiPathC
|
|
|
12
12
|
import "../../hooks/index.js";
|
|
13
13
|
import "../../components/index.js";
|
|
14
14
|
import { buildJourneys as m, partitionJourneys as h } from "./journeys.js";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
15
|
+
import { courseCountLabel as g } from "./countLabels.js";
|
|
16
|
+
import { RecommendedPathsRail as _ } from "./RecommendedPathsRail.js";
|
|
17
|
+
import { useMemo as v, useState as y } from "react";
|
|
18
|
+
import { ArrowRight as b, CheckCircle2 as x, Circle as S, Clock as C, Layers as w, PlayCircle as T } from "lucide-react";
|
|
19
|
+
import { Fragment as E, jsx as D, jsxs as O } from "react/jsx-runtime";
|
|
20
|
+
import { Button as k, GlassCard as A } from "@burdenoff/fe-libs/ui";
|
|
20
21
|
//#region src/buildmyiq/pages/paths/PathsPage.tsx
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
children: [/* @__PURE__ */
|
|
28
|
-
className: "flex items-center
|
|
29
|
-
children: [/* @__PURE__ */
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
children: [/* @__PURE__ */
|
|
36
|
-
className: "
|
|
37
|
-
children: [
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
className: "inline-flex items-center gap-1",
|
|
44
|
-
children: [
|
|
45
|
-
/* @__PURE__ */ E(C, { className: "h-3.5 w-3.5" }),
|
|
46
|
-
" ",
|
|
47
|
-
e.nodes.length,
|
|
48
|
-
" courses"
|
|
49
|
-
]
|
|
50
|
-
}),
|
|
51
|
-
e.totalHours > 0 && /* @__PURE__ */ D("span", {
|
|
52
|
-
className: "inline-flex items-center gap-1",
|
|
53
|
-
children: [
|
|
54
|
-
/* @__PURE__ */ E(S, { className: "h-3.5 w-3.5" }),
|
|
55
|
-
" ",
|
|
56
|
-
i(e.totalHours)
|
|
57
|
-
]
|
|
58
|
-
}),
|
|
59
|
-
/* @__PURE__ */ D("span", { children: [
|
|
60
|
-
"· ",
|
|
61
|
-
e.overallPct,
|
|
62
|
-
"% complete"
|
|
63
|
-
] })
|
|
64
|
-
]
|
|
65
|
-
})] })]
|
|
66
|
-
}), /* @__PURE__ */ D(O, {
|
|
67
|
-
variant: "secondary",
|
|
68
|
-
size: "sm",
|
|
69
|
-
className: "shrink-0 max-sm:w-full",
|
|
70
|
-
onClick: () => {
|
|
71
|
-
let n = e.nodes.find((e) => e.status === "in_progress") ?? e.nodes.find((e) => e.status === "not_started") ?? e.nodes[0];
|
|
72
|
-
n && t(n);
|
|
73
|
-
},
|
|
74
|
-
children: [e.started ? "Continue path" : "Start path", /* @__PURE__ */ E(y, { className: "ms-1 h-4 w-4 rtl:-scale-x-100" })]
|
|
75
|
-
})]
|
|
76
|
-
}), /* @__PURE__ */ E("div", {
|
|
77
|
-
className: "mt-5 overflow-x-auto",
|
|
78
|
-
children: /* @__PURE__ */ E("ol", {
|
|
79
|
-
className: "flex min-w-max items-stretch gap-0",
|
|
80
|
-
children: e.nodes.map((r, i) => /* @__PURE__ */ D("li", {
|
|
81
|
-
className: "flex items-stretch",
|
|
82
|
-
children: [/* @__PURE__ */ D("button", {
|
|
83
|
-
type: "button",
|
|
84
|
-
onClick: () => t(r),
|
|
85
|
-
className: n("group flex w-56 flex-col gap-2 rounded-xl border p-3 text-start transition-colors", r.status === "completed" ? "border-[color-mix(in_srgb,var(--color-status-success-text)_40%,transparent)] bg-status-success-bg-subtle" : r.status === "in_progress" ? "border-accent bg-[var(--color-accent-soft)]" : "border-border-seam bg-bg-surface hover:bg-bg-sunken"),
|
|
22
|
+
var j = ({ journey: e, onOpen: r }) => {
|
|
23
|
+
let o = t();
|
|
24
|
+
return /* @__PURE__ */ O(A, {
|
|
25
|
+
treatment: "plain",
|
|
26
|
+
className: "p-5 sm:p-6",
|
|
27
|
+
"data-testid": "journey-card",
|
|
28
|
+
children: [/* @__PURE__ */ O("div", {
|
|
29
|
+
className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
|
|
30
|
+
children: [/* @__PURE__ */ O("div", {
|
|
31
|
+
className: "flex items-center gap-4",
|
|
32
|
+
children: [/* @__PURE__ */ D(l, {
|
|
33
|
+
value: e.overallPct,
|
|
34
|
+
size: 64,
|
|
35
|
+
color: "var(--color-accent-teal)"
|
|
36
|
+
}), /* @__PURE__ */ O("div", { children: [/* @__PURE__ */ O("div", {
|
|
37
|
+
className: "flex flex-wrap items-center gap-2",
|
|
38
|
+
children: [/* @__PURE__ */ O("h2", {
|
|
39
|
+
className: "text-lg font-semibold text-text-primary",
|
|
40
|
+
children: ["Become skilled in ", e.skill.name]
|
|
41
|
+
}), /* @__PURE__ */ D(a, { status: e.skill.category })]
|
|
42
|
+
}), /* @__PURE__ */ O("p", {
|
|
43
|
+
className: "mt-0.5 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-sm text-text-secondary",
|
|
86
44
|
children: [
|
|
87
|
-
/* @__PURE__ */
|
|
88
|
-
className: "flex items-center
|
|
89
|
-
children: [
|
|
90
|
-
className: "
|
|
91
|
-
|
|
92
|
-
|
|
45
|
+
/* @__PURE__ */ O("span", {
|
|
46
|
+
className: "inline-flex items-center gap-1",
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ D(w, { className: "h-3.5 w-3.5" }),
|
|
49
|
+
" ",
|
|
50
|
+
g(o, e.nodes.length)
|
|
51
|
+
]
|
|
93
52
|
}),
|
|
94
|
-
/* @__PURE__ */
|
|
95
|
-
className: "
|
|
96
|
-
children:
|
|
53
|
+
e.totalHours > 0 && /* @__PURE__ */ O("span", {
|
|
54
|
+
className: "inline-flex items-center gap-1",
|
|
55
|
+
children: [
|
|
56
|
+
/* @__PURE__ */ D(C, { className: "h-3.5 w-3.5" }),
|
|
57
|
+
" ",
|
|
58
|
+
i(e.totalHours)
|
|
59
|
+
]
|
|
97
60
|
}),
|
|
98
|
-
/* @__PURE__ */
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
})]
|
|
104
|
-
})
|
|
61
|
+
/* @__PURE__ */ O("span", { children: [
|
|
62
|
+
"· ",
|
|
63
|
+
e.overallPct,
|
|
64
|
+
"% complete"
|
|
65
|
+
] })
|
|
105
66
|
]
|
|
106
|
-
})
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
67
|
+
})] })]
|
|
68
|
+
}), /* @__PURE__ */ O(k, {
|
|
69
|
+
variant: "secondary",
|
|
70
|
+
size: "sm",
|
|
71
|
+
className: "shrink-0 max-sm:w-full",
|
|
72
|
+
onClick: () => {
|
|
73
|
+
let t = e.nodes.find((e) => e.status === "in_progress") ?? e.nodes.find((e) => e.status === "not_started") ?? e.nodes[0];
|
|
74
|
+
t && r(t);
|
|
75
|
+
},
|
|
76
|
+
children: [e.started ? "Continue path" : "Start path", /* @__PURE__ */ D(b, { className: "ms-1 h-4 w-4 rtl:-scale-x-100" })]
|
|
77
|
+
})]
|
|
78
|
+
}), /* @__PURE__ */ D("div", {
|
|
79
|
+
className: "mt-5 overflow-x-auto",
|
|
80
|
+
children: /* @__PURE__ */ D("ol", {
|
|
81
|
+
className: "flex min-w-max items-stretch gap-0",
|
|
82
|
+
children: e.nodes.map((t, i) => /* @__PURE__ */ O("li", {
|
|
83
|
+
className: "flex items-stretch",
|
|
84
|
+
children: [/* @__PURE__ */ O("button", {
|
|
85
|
+
type: "button",
|
|
86
|
+
onClick: () => r(t),
|
|
87
|
+
className: n("group flex w-56 flex-col gap-2 rounded-xl border p-3 text-start transition-colors", t.status === "completed" ? "border-[color-mix(in_srgb,var(--color-status-success-text)_40%,transparent)] bg-status-success-bg-subtle" : t.status === "in_progress" ? "border-accent bg-[var(--color-accent-soft)]" : "border-border-seam bg-bg-surface hover:bg-bg-sunken"),
|
|
88
|
+
children: [
|
|
89
|
+
/* @__PURE__ */ O("div", {
|
|
90
|
+
className: "flex items-center justify-between",
|
|
91
|
+
children: [/* @__PURE__ */ O("span", {
|
|
92
|
+
className: "text-xs font-medium text-text-secondary",
|
|
93
|
+
children: ["Step ", i + 1]
|
|
94
|
+
}), t.status === "completed" ? /* @__PURE__ */ D(x, { className: "h-5 w-5 text-status-success-text" }) : t.status === "in_progress" ? /* @__PURE__ */ D(T, { className: "h-5 w-5 text-[var(--color-accent-teal)]" }) : /* @__PURE__ */ D(S, { className: "h-5 w-5 text-[var(--color-text-tertiary)]" })]
|
|
95
|
+
}),
|
|
96
|
+
/* @__PURE__ */ D("p", {
|
|
97
|
+
className: "line-clamp-2 text-sm font-medium text-text-primary",
|
|
98
|
+
children: t.course.title
|
|
99
|
+
}),
|
|
100
|
+
/* @__PURE__ */ O("div", {
|
|
101
|
+
className: "mt-auto flex items-center justify-between",
|
|
102
|
+
children: [/* @__PURE__ */ D(a, { status: t.course.level }), t.status === "in_progress" && /* @__PURE__ */ O("span", {
|
|
103
|
+
className: "text-xs tabular-nums text-text-secondary",
|
|
104
|
+
children: [t.progressPct, "%"]
|
|
105
|
+
})]
|
|
106
|
+
})
|
|
107
|
+
]
|
|
108
|
+
}), i < e.nodes.length - 1 && /* @__PURE__ */ D("div", {
|
|
109
|
+
className: "flex w-6 items-center justify-center",
|
|
110
|
+
children: /* @__PURE__ */ D(b, { className: "h-4 w-4 text-[var(--color-text-tertiary)] rtl:-scale-x-100" })
|
|
111
|
+
})]
|
|
112
|
+
}, t.course.id))
|
|
113
|
+
})
|
|
114
|
+
})]
|
|
115
|
+
});
|
|
116
|
+
}, M = ({ id: e, title: t, description: n, journeys: r, onOpen: i }) => /* @__PURE__ */ O("section", {
|
|
114
117
|
"aria-labelledby": e,
|
|
115
118
|
className: "flex flex-col gap-4",
|
|
116
119
|
"data-testid": e,
|
|
117
|
-
children: [/* @__PURE__ */
|
|
120
|
+
children: [/* @__PURE__ */ O("div", { children: [/* @__PURE__ */ D("h2", {
|
|
118
121
|
id: e,
|
|
119
122
|
className: "text-base font-semibold text-text-primary",
|
|
120
123
|
children: t
|
|
121
|
-
}), /* @__PURE__ */
|
|
124
|
+
}), /* @__PURE__ */ D("p", {
|
|
122
125
|
className: "mt-0.5 text-sm text-text-secondary",
|
|
123
126
|
children: n
|
|
124
|
-
})] }), /* @__PURE__ */
|
|
127
|
+
})] }), /* @__PURE__ */ D("div", {
|
|
125
128
|
className: "flex flex-col gap-6",
|
|
126
|
-
children: r.map((e) => /* @__PURE__ */
|
|
129
|
+
children: r.map((e) => /* @__PURE__ */ D(j, {
|
|
127
130
|
journey: e,
|
|
128
131
|
onOpen: i
|
|
129
132
|
}, e.skill.id))
|
|
130
133
|
})]
|
|
131
|
-
}),
|
|
132
|
-
let n = t(), { currentUser: i, navigateTo: a } = e(), l = i?.id, [
|
|
133
|
-
|
|
134
|
+
}), N = () => {
|
|
135
|
+
let n = t(), { currentUser: i, navigateTo: a } = e(), l = i?.id, [g, b] = y(!1), x = f(), S = d(), C = u(!!l), w = p(10, !!l), T = v(() => x.data ?? [], [x.data]), A = v(() => S.data ?? [], [S.data]), j = v(() => C.data ?? [], [C.data]), N = v(() => m(T, A, j), [
|
|
136
|
+
T,
|
|
134
137
|
A,
|
|
135
|
-
|
|
136
|
-
]), P =
|
|
138
|
+
j
|
|
139
|
+
]), P = v(() => h(N, w.data?.items ?? [], g ? 10 : 3), [
|
|
137
140
|
N,
|
|
138
141
|
w.data,
|
|
139
|
-
|
|
142
|
+
g
|
|
140
143
|
]), F = x.isLoading || S.isLoading || C.isLoading, I = [
|
|
141
144
|
x,
|
|
142
145
|
S,
|
|
@@ -146,54 +149,54 @@ var A = ({ journey: e, onOpen: t }) => /* @__PURE__ */ D(k, {
|
|
|
146
149
|
}, R = (e) => {
|
|
147
150
|
e.enrollmentId && e.status !== "not_started" ? a(`learning/${e.enrollmentId}`) : a(`catalog/${e.course.id}`);
|
|
148
151
|
};
|
|
149
|
-
return /* @__PURE__ */
|
|
152
|
+
return /* @__PURE__ */ D(r, {
|
|
150
153
|
title: "Skill Journeys",
|
|
151
154
|
description: "Guided, multi-course paths that build a skill to mastery — with your live progress across each step.",
|
|
152
155
|
titleGradient: !0,
|
|
153
156
|
aurora: !0,
|
|
154
|
-
children: /* @__PURE__ */
|
|
157
|
+
children: /* @__PURE__ */ O("div", {
|
|
155
158
|
className: "grid gap-6 lg:grid-cols-[minmax(0,1fr)_20rem] lg:items-start",
|
|
156
|
-
children: [/* @__PURE__ */
|
|
159
|
+
children: [/* @__PURE__ */ D("div", {
|
|
157
160
|
className: "flex min-w-0 flex-col gap-8",
|
|
158
|
-
children: F ? /* @__PURE__ */
|
|
161
|
+
children: F ? /* @__PURE__ */ D(c, { label: "Mapping your skill journeys…" }) : I ? /* @__PURE__ */ D(s, {
|
|
159
162
|
title: "Couldn't load journeys",
|
|
160
163
|
onRetry: L
|
|
161
|
-
}) : N.length === 0 ? /* @__PURE__ */
|
|
164
|
+
}) : N.length === 0 ? /* @__PURE__ */ D(o, {
|
|
162
165
|
illustration: "onboarding",
|
|
163
166
|
title: "No skill journeys yet",
|
|
164
167
|
description: "Journeys appear once published courses are mapped to a skill. Add a skill to a course in Authoring.",
|
|
165
|
-
action: /* @__PURE__ */
|
|
168
|
+
action: /* @__PURE__ */ D(k, {
|
|
166
169
|
onClick: () => a("catalog"),
|
|
167
170
|
children: "Browse the catalog"
|
|
168
171
|
})
|
|
169
|
-
}) : /* @__PURE__ */
|
|
172
|
+
}) : /* @__PURE__ */ O(E, { children: [P.started.length > 0 ? /* @__PURE__ */ D(M, {
|
|
170
173
|
id: "journeys-started",
|
|
171
174
|
title: n("buildmyiq.paths.yourJourneys", "Your journeys"),
|
|
172
175
|
description: n("buildmyiq.paths.yourJourneysHint", "Paths you have started, with your progress on each step."),
|
|
173
176
|
journeys: P.started,
|
|
174
177
|
onOpen: R
|
|
175
|
-
}) : /* @__PURE__ */
|
|
178
|
+
}) : /* @__PURE__ */ D("p", {
|
|
176
179
|
className: "text-sm text-text-secondary",
|
|
177
180
|
"data-testid": "journeys-started-empty",
|
|
178
181
|
children: n("buildmyiq.paths.noStartedJourneys", "You have not started a skill journey yet. Pick a recommended path or explore the ones below.")
|
|
179
|
-
}), P.more.length > 0 && /* @__PURE__ */
|
|
182
|
+
}), P.more.length > 0 && /* @__PURE__ */ D(M, {
|
|
180
183
|
id: "journeys-more",
|
|
181
184
|
title: n("buildmyiq.paths.moreJourneys", "More journeys"),
|
|
182
185
|
description: n("buildmyiq.paths.moreJourneysHint", "Other skill journeys in this workspace that you have not started."),
|
|
183
186
|
journeys: P.more,
|
|
184
187
|
onOpen: R
|
|
185
188
|
})] })
|
|
186
|
-
}), /* @__PURE__ */
|
|
189
|
+
}), /* @__PURE__ */ D(_, {
|
|
187
190
|
recommendations: w,
|
|
188
191
|
items: P.recommended,
|
|
189
192
|
canExpand: P.hiddenRecommendations > 0,
|
|
190
|
-
expanded:
|
|
193
|
+
expanded: g,
|
|
191
194
|
onToggleExpanded: () => b((e) => !e)
|
|
192
195
|
})]
|
|
193
196
|
})
|
|
194
197
|
});
|
|
195
198
|
};
|
|
196
199
|
//#endregion
|
|
197
|
-
export {
|
|
200
|
+
export { N as PathsPage };
|
|
198
201
|
|
|
199
202
|
//# sourceMappingURL=PathsPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PathsPage.js","names":[],"sources":["../../../../src/buildmyiq/pages/paths/PathsPage.tsx"],"sourcesContent":["/**\n * PathsPage — \"Skill Journeys\": published courses grouped by the skill they\n * build, ordered into a guided progression, with the learner's LIVE progress\n * across each course.\n * @module buildmyiq/pages/paths\n *\n * DERIVED, not a new backend entity: a \"journey\" for a skill = the published\n * courses whose `skillId` is that skill, ordered by level (Beginner → Expert)\n * then title. Each node's state comes from the caller's real enrollment for that\n * course (completed / in-progress with %/ not started). No locking is invented —\n * \"not started\" is honest. No fabricated data.\n *\n * BOFF-3979: the right rail recommends journeys the learner has not started\n * (backend `buiRecommendPaths`) and offers the path-finder assessment. The\n * page's three journey sets never overlap: \"Your journeys\" (started), the\n * rail's recommendations (never started) and \"More journeys\" (everything\n * else). See `journeys.ts`.\n */\n\nimport type { FC } from 'react';\nimport { useMemo, useState } from 'react';\nimport { CheckCircle2, PlayCircle, Circle, ArrowRight, Clock, Layers } from 'lucide-react';\nimport { Button, GlassCard } from '@burdenoff/fe-libs/ui';\nimport {\n PageLayout,\n LoadingView,\n ErrorView,\n EmptyState,\n StatusBadge,\n ProgressRing,\n} from '../../components';\nimport { useBuildmyiq } from '../../context';\nimport {\n useBuiPathCatalogSkills,\n useBuiPathCatalogCourses,\n useBuiAllMyEnrollments,\n useBuiRecommendPaths,\n} from '../../hooks';\nimport { useTr } from '../../shared/hooks/useTr';\nimport { cn } from '../../utils/cn';\nimport { formatHours } from '../../utils/formatters';\nimport type { BuiCourse, BuiEnrollment, BuiSkill } from '../../types';\nimport type { Journey, JourneyNode } from './journeys';\nimport { buildJourneys, partitionJourneys } from './journeys';\nimport {\n COLLAPSED_RECOMMENDATIONS,\n EXPANDED_RECOMMENDATIONS,\n RecommendedPathsRail,\n} from './RecommendedPathsRail';\n\nconst JourneyCard: FC<{ journey: Journey; onOpen: (node: JourneyNode) => void }> = ({\n journey,\n onOpen: goToCourse,\n}) => (\n <GlassCard treatment=\"plain\" className=\"p-5 sm:p-6\" data-testid=\"journey-card\">\n {/* Journey header */}\n <div className=\"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between\">\n <div className=\"flex items-center gap-4\">\n <ProgressRing value={journey.overallPct} size={64} color=\"var(--color-accent-teal)\" />\n <div>\n <div className=\"flex flex-wrap items-center gap-2\">\n <h2 className=\"text-lg font-semibold text-text-primary\">\n Become skilled in {journey.skill.name}\n </h2>\n <StatusBadge status={journey.skill.category} />\n </div>\n <p className=\"mt-0.5 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-sm text-text-secondary\">\n <span className=\"inline-flex items-center gap-1\">\n <Layers className=\"h-3.5 w-3.5\" /> {journey.nodes.length} courses\n </span>\n {journey.totalHours > 0 && (\n <span className=\"inline-flex items-center gap-1\">\n <Clock className=\"h-3.5 w-3.5\" /> {formatHours(journey.totalHours)}\n </span>\n )}\n <span>· {journey.overallPct}% complete</span>\n </p>\n </div>\n </div>\n <Button\n variant=\"secondary\"\n size=\"sm\"\n className=\"shrink-0 max-sm:w-full\"\n onClick={() => {\n const next =\n journey.nodes.find((n) => n.status === 'in_progress') ??\n journey.nodes.find((n) => n.status === 'not_started') ??\n journey.nodes[0];\n if (next) goToCourse(next);\n }}\n >\n {journey.started ? 'Continue path' : 'Start path'}\n <ArrowRight className=\"ms-1 h-4 w-4 rtl:-scale-x-100\" />\n </Button>\n </div>\n\n {/* Node stepper — horizontal scroll on small screens */}\n <div className=\"mt-5 overflow-x-auto\">\n <ol className=\"flex min-w-max items-stretch gap-0\">\n {journey.nodes.map((node, i) => (\n <li key={node.course.id} className=\"flex items-stretch\">\n <button\n type=\"button\"\n onClick={() => goToCourse(node)}\n className={cn(\n 'group flex w-56 flex-col gap-2 rounded-xl border p-3 text-start transition-colors',\n node.status === 'completed'\n ? 'border-[color-mix(in_srgb,var(--color-status-success-text)_40%,transparent)] bg-status-success-bg-subtle'\n : node.status === 'in_progress'\n ? 'border-accent bg-[var(--color-accent-soft)]'\n : 'border-border-seam bg-bg-surface hover:bg-bg-sunken'\n )}\n >\n <div className=\"flex items-center justify-between\">\n <span className=\"text-xs font-medium text-text-secondary\">Step {i + 1}</span>\n {node.status === 'completed' ? (\n <CheckCircle2 className=\"h-5 w-5 text-status-success-text\" />\n ) : node.status === 'in_progress' ? (\n <PlayCircle className=\"h-5 w-5 text-[var(--color-accent-teal)]\" />\n ) : (\n <Circle className=\"h-5 w-5 text-[var(--color-text-tertiary)]\" />\n )}\n </div>\n <p className=\"line-clamp-2 text-sm font-medium text-text-primary\">\n {node.course.title}\n </p>\n <div className=\"mt-auto flex items-center justify-between\">\n <StatusBadge status={node.course.level} />\n {node.status === 'in_progress' && (\n <span className=\"text-xs tabular-nums text-text-secondary\">\n {node.progressPct}%\n </span>\n )}\n </div>\n </button>\n {i < journey.nodes.length - 1 && (\n <div className=\"flex w-6 items-center justify-center\">\n <ArrowRight className=\"h-4 w-4 text-[var(--color-text-tertiary)] rtl:-scale-x-100\" />\n </div>\n )}\n </li>\n ))}\n </ol>\n </div>\n </GlassCard>\n);\n\nconst JourneySection: FC<{\n id: string;\n title: string;\n description: string;\n journeys: readonly Journey[];\n onOpen: (node: JourneyNode) => void;\n}> = ({ id, title, description, journeys, onOpen }) => (\n <section aria-labelledby={id} className=\"flex flex-col gap-4\" data-testid={id}>\n <div>\n <h2 id={id} className=\"text-base font-semibold text-text-primary\">\n {title}\n </h2>\n <p className=\"mt-0.5 text-sm text-text-secondary\">{description}</p>\n </div>\n <div className=\"flex flex-col gap-6\">\n {journeys.map((journey) => (\n <JourneyCard key={journey.skill.id} journey={journey} onOpen={onOpen} />\n ))}\n </div>\n </section>\n);\n\nexport const PathsPage: FC = () => {\n const tr = useTr();\n const { currentUser, navigateTo } = useBuildmyiq();\n const learnerId = currentUser?.id;\n const [railExpanded, setRailExpanded] = useState(false);\n\n // Every page of skills, published courses and the learner's enrollments:\n // a truncated list could hide a started course and let a started journey\n // look unstarted, which would break the disjoint sets below.\n const skillsQuery = useBuiPathCatalogSkills();\n const coursesQuery = useBuiPathCatalogCourses();\n const enrollmentsQuery = useBuiAllMyEnrollments(Boolean(learnerId));\n // Always fetch the expanded list and cap the rail on the client, so \"View\n // all\" never swaps the query (and briefly empties the rail) mid-toggle.\n const recommendations = useBuiRecommendPaths(EXPANDED_RECOMMENDATIONS, Boolean(learnerId));\n\n const skills: BuiSkill[] = useMemo(() => skillsQuery.data ?? [], [skillsQuery.data]);\n const courses: BuiCourse[] = useMemo(() => coursesQuery.data ?? [], [coursesQuery.data]);\n const enrollments: BuiEnrollment[] = useMemo(\n () => enrollmentsQuery.data ?? [],\n [enrollmentsQuery.data]\n );\n\n const journeys = useMemo(\n () => buildJourneys(skills, courses, enrollments),\n [skills, courses, enrollments]\n );\n const sets = useMemo(\n () =>\n partitionJourneys(\n journeys,\n recommendations.data?.items ?? [],\n railExpanded ? EXPANDED_RECOMMENDATIONS : COLLAPSED_RECOMMENDATIONS\n ),\n [journeys, recommendations.data, railExpanded]\n );\n\n // Wait for the enrollments too: until they arrive every journey would look\n // unstarted and then jump between sets. A failed background refetch keeps\n // the last good data on screen; only a failure with nothing loaded errors.\n const isLoading = skillsQuery.isLoading || coursesQuery.isLoading || enrollmentsQuery.isLoading;\n const loadFailed = [skillsQuery, coursesQuery, enrollmentsQuery].some(\n (q) => q.isError && q.data === undefined\n );\n const retryLoad = (): void => {\n void skillsQuery.refetch();\n void coursesQuery.refetch();\n void enrollmentsQuery.refetch();\n };\n\n const goToCourse = (n: JourneyNode): void => {\n if (n.enrollmentId && n.status !== 'not_started') navigateTo(`learning/${n.enrollmentId}`);\n else navigateTo(`catalog/${n.course.id}`);\n };\n\n return (\n <PageLayout\n title=\"Skill Journeys\"\n description=\"Guided, multi-course paths that build a skill to mastery — with your live progress across each step.\"\n titleGradient\n aurora\n >\n <div className=\"grid gap-6 lg:grid-cols-[minmax(0,1fr)_20rem] lg:items-start\">\n <div className=\"flex min-w-0 flex-col gap-8\">\n {isLoading ? (\n <LoadingView label=\"Mapping your skill journeys…\" />\n ) : loadFailed ? (\n <ErrorView title=\"Couldn't load journeys\" onRetry={retryLoad} />\n ) : journeys.length === 0 ? (\n <EmptyState\n illustration=\"onboarding\"\n title=\"No skill journeys yet\"\n description=\"Journeys appear once published courses are mapped to a skill. Add a skill to a course in Authoring.\"\n action={<Button onClick={() => navigateTo('catalog')}>Browse the catalog</Button>}\n />\n ) : (\n <>\n {sets.started.length > 0 ? (\n <JourneySection\n id=\"journeys-started\"\n title={tr('buildmyiq.paths.yourJourneys', 'Your journeys')}\n description={tr(\n 'buildmyiq.paths.yourJourneysHint',\n 'Paths you have started, with your progress on each step.'\n )}\n journeys={sets.started}\n onOpen={goToCourse}\n />\n ) : (\n <p className=\"text-sm text-text-secondary\" data-testid=\"journeys-started-empty\">\n {tr(\n 'buildmyiq.paths.noStartedJourneys',\n 'You have not started a skill journey yet. Pick a recommended path or explore the ones below.'\n )}\n </p>\n )}\n {sets.more.length > 0 && (\n <JourneySection\n id=\"journeys-more\"\n title={tr('buildmyiq.paths.moreJourneys', 'More journeys')}\n description={tr(\n 'buildmyiq.paths.moreJourneysHint',\n 'Other skill journeys in this workspace that you have not started.'\n )}\n journeys={sets.more}\n onOpen={goToCourse}\n />\n )}\n </>\n )}\n </div>\n <RecommendedPathsRail\n recommendations={recommendations}\n items={sets.recommended}\n canExpand={sets.hiddenRecommendations > 0}\n expanded={railExpanded}\n onToggleExpanded={() => setRailExpanded((v) => !v)}\n />\n </div>\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkDA,IAAM,KAA8E,EAClF,YACA,QAAQ,QAER,kBAAC,GAAD;CAAW,WAAU;CAAQ,WAAU;CAAa,eAAY;WAAhE,CAEE,kBAAC,OAAD;EAAK,WAAU;YAAf,CACE,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,GAAD;IAAc,OAAO,EAAQ;IAAY,MAAM;IAAI,OAAM;GAA4B,CAAA,GACrF,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,MAAD;KAAI,WAAU;eAAd,CAAwD,sBACnC,EAAQ,MAAM,IAC/B;QACJ,kBAAC,GAAD,EAAa,QAAQ,EAAQ,MAAM,SAAW,CAAA,CAC3C;OACL,kBAAC,KAAD;IAAG,WAAU;cAAb;KACE,kBAAC,QAAD;MAAM,WAAU;gBAAhB;OACE,kBAAC,GAAD,EAAQ,WAAU,cAAe,CAAA;OAAC;OAAE,EAAQ,MAAM;OAAO;MACrD;;KACL,EAAQ,aAAa,KACpB,kBAAC,QAAD;MAAM,WAAU;gBAAhB;OACE,kBAAC,GAAD,EAAO,WAAU,cAAe,CAAA;OAAC;OAAE,EAAY,EAAQ,UAAU;MAC7D;;KAER,kBAAC,QAAD,EAAA,UAAA;MAAM;MAAG,EAAQ;MAAW;KAAgB,EAAA,CAA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,MAAM,CAAC,CAAC;GAClD,CAAA,CACE;;CACK,CAAA;AAEhB"}
|
|
1
|
+
{"version":3,"file":"PathsPage.js","names":[],"sources":["../../../../src/buildmyiq/pages/paths/PathsPage.tsx"],"sourcesContent":["/**\n * PathsPage — \"Skill Journeys\": published courses grouped by the skill they\n * build, ordered into a guided progression, with the learner's LIVE progress\n * across each course.\n * @module buildmyiq/pages/paths\n *\n * DERIVED, not a new backend entity: a \"journey\" for a skill = the published\n * courses whose `skillId` is that skill, ordered by level (Beginner → Expert)\n * then title. Each node's state comes from the caller's real enrollment for that\n * course (completed / in-progress with %/ not started). No locking is invented —\n * \"not started\" is honest. No fabricated data.\n *\n * BOFF-3979: the right rail recommends journeys the learner has not started\n * (backend `buiRecommendPaths`) and offers the path-finder assessment. The\n * page's three journey sets never overlap: \"Your journeys\" (started), the\n * rail's recommendations (never started) and \"More journeys\" (everything\n * else). See `journeys.ts`.\n */\n\nimport type { FC } from 'react';\nimport { useMemo, useState } from 'react';\nimport { CheckCircle2, PlayCircle, Circle, ArrowRight, Clock, Layers } from 'lucide-react';\nimport { Button, GlassCard } from '@burdenoff/fe-libs/ui';\nimport {\n PageLayout,\n LoadingView,\n ErrorView,\n EmptyState,\n StatusBadge,\n ProgressRing,\n} from '../../components';\nimport { useBuildmyiq } from '../../context';\nimport {\n useBuiPathCatalogSkills,\n useBuiPathCatalogCourses,\n useBuiAllMyEnrollments,\n useBuiRecommendPaths,\n} from '../../hooks';\nimport { useTr } from '../../shared/hooks/useTr';\nimport { cn } from '../../utils/cn';\nimport { formatHours } from '../../utils/formatters';\nimport type { BuiCourse, BuiEnrollment, BuiSkill } from '../../types';\nimport type { Journey, JourneyNode } from './journeys';\nimport { buildJourneys, partitionJourneys } from './journeys';\nimport { courseCountLabel } from './countLabels';\nimport {\n COLLAPSED_RECOMMENDATIONS,\n EXPANDED_RECOMMENDATIONS,\n RecommendedPathsRail,\n} from './RecommendedPathsRail';\n\nconst JourneyCard: FC<{ journey: Journey; onOpen: (node: JourneyNode) => void }> = ({\n journey,\n onOpen: goToCourse,\n}) => {\n const tr = useTr();\n return (\n <GlassCard treatment=\"plain\" className=\"p-5 sm:p-6\" data-testid=\"journey-card\">\n {/* Journey header */}\n <div className=\"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between\">\n <div className=\"flex items-center gap-4\">\n <ProgressRing value={journey.overallPct} size={64} color=\"var(--color-accent-teal)\" />\n <div>\n <div className=\"flex flex-wrap items-center gap-2\">\n <h2 className=\"text-lg font-semibold text-text-primary\">\n Become skilled in {journey.skill.name}\n </h2>\n <StatusBadge status={journey.skill.category} />\n </div>\n <p className=\"mt-0.5 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-sm text-text-secondary\">\n <span className=\"inline-flex items-center gap-1\">\n <Layers className=\"h-3.5 w-3.5\" /> {courseCountLabel(tr, journey.nodes.length)}\n </span>\n {journey.totalHours > 0 && (\n <span className=\"inline-flex items-center gap-1\">\n <Clock className=\"h-3.5 w-3.5\" /> {formatHours(journey.totalHours)}\n </span>\n )}\n <span>· {journey.overallPct}% complete</span>\n </p>\n </div>\n </div>\n <Button\n variant=\"secondary\"\n size=\"sm\"\n className=\"shrink-0 max-sm:w-full\"\n onClick={() => {\n const next =\n journey.nodes.find((n) => n.status === 'in_progress') ??\n journey.nodes.find((n) => n.status === 'not_started') ??\n journey.nodes[0];\n if (next) goToCourse(next);\n }}\n >\n {journey.started ? 'Continue path' : 'Start path'}\n <ArrowRight className=\"ms-1 h-4 w-4 rtl:-scale-x-100\" />\n </Button>\n </div>\n\n {/* Node stepper — horizontal scroll on small screens */}\n <div className=\"mt-5 overflow-x-auto\">\n <ol className=\"flex min-w-max items-stretch gap-0\">\n {journey.nodes.map((node, i) => (\n <li key={node.course.id} className=\"flex items-stretch\">\n <button\n type=\"button\"\n onClick={() => goToCourse(node)}\n className={cn(\n 'group flex w-56 flex-col gap-2 rounded-xl border p-3 text-start transition-colors',\n node.status === 'completed'\n ? 'border-[color-mix(in_srgb,var(--color-status-success-text)_40%,transparent)] bg-status-success-bg-subtle'\n : node.status === 'in_progress'\n ? 'border-accent bg-[var(--color-accent-soft)]'\n : 'border-border-seam bg-bg-surface hover:bg-bg-sunken'\n )}\n >\n <div className=\"flex items-center justify-between\">\n <span className=\"text-xs font-medium text-text-secondary\">Step {i + 1}</span>\n {node.status === 'completed' ? (\n <CheckCircle2 className=\"h-5 w-5 text-status-success-text\" />\n ) : node.status === 'in_progress' ? (\n <PlayCircle className=\"h-5 w-5 text-[var(--color-accent-teal)]\" />\n ) : (\n <Circle className=\"h-5 w-5 text-[var(--color-text-tertiary)]\" />\n )}\n </div>\n <p className=\"line-clamp-2 text-sm font-medium text-text-primary\">\n {node.course.title}\n </p>\n <div className=\"mt-auto flex items-center justify-between\">\n <StatusBadge status={node.course.level} />\n {node.status === 'in_progress' && (\n <span className=\"text-xs tabular-nums text-text-secondary\">\n {node.progressPct}%\n </span>\n )}\n </div>\n </button>\n {i < journey.nodes.length - 1 && (\n <div className=\"flex w-6 items-center justify-center\">\n <ArrowRight className=\"h-4 w-4 text-[var(--color-text-tertiary)] rtl:-scale-x-100\" />\n </div>\n )}\n </li>\n ))}\n </ol>\n </div>\n </GlassCard>\n );\n};\n\nconst JourneySection: FC<{\n id: string;\n title: string;\n description: string;\n journeys: readonly Journey[];\n onOpen: (node: JourneyNode) => void;\n}> = ({ id, title, description, journeys, onOpen }) => (\n <section aria-labelledby={id} className=\"flex flex-col gap-4\" data-testid={id}>\n <div>\n <h2 id={id} className=\"text-base font-semibold text-text-primary\">\n {title}\n </h2>\n <p className=\"mt-0.5 text-sm text-text-secondary\">{description}</p>\n </div>\n <div className=\"flex flex-col gap-6\">\n {journeys.map((journey) => (\n <JourneyCard key={journey.skill.id} journey={journey} onOpen={onOpen} />\n ))}\n </div>\n </section>\n);\n\nexport const PathsPage: FC = () => {\n const tr = useTr();\n const { currentUser, navigateTo } = useBuildmyiq();\n const learnerId = currentUser?.id;\n const [railExpanded, setRailExpanded] = useState(false);\n\n // Every page of skills, published courses and the learner's enrollments:\n // a truncated list could hide a started course and let a started journey\n // look unstarted, which would break the disjoint sets below.\n const skillsQuery = useBuiPathCatalogSkills();\n const coursesQuery = useBuiPathCatalogCourses();\n const enrollmentsQuery = useBuiAllMyEnrollments(Boolean(learnerId));\n // Always fetch the expanded list and cap the rail on the client, so \"View\n // all\" never swaps the query (and briefly empties the rail) mid-toggle.\n const recommendations = useBuiRecommendPaths(EXPANDED_RECOMMENDATIONS, Boolean(learnerId));\n\n const skills: BuiSkill[] = useMemo(() => skillsQuery.data ?? [], [skillsQuery.data]);\n const courses: BuiCourse[] = useMemo(() => coursesQuery.data ?? [], [coursesQuery.data]);\n const enrollments: BuiEnrollment[] = useMemo(\n () => enrollmentsQuery.data ?? [],\n [enrollmentsQuery.data]\n );\n\n const journeys = useMemo(\n () => buildJourneys(skills, courses, enrollments),\n [skills, courses, enrollments]\n );\n const sets = useMemo(\n () =>\n partitionJourneys(\n journeys,\n recommendations.data?.items ?? [],\n railExpanded ? EXPANDED_RECOMMENDATIONS : COLLAPSED_RECOMMENDATIONS\n ),\n [journeys, recommendations.data, railExpanded]\n );\n\n // Wait for the enrollments too: until they arrive every journey would look\n // unstarted and then jump between sets. A failed background refetch keeps\n // the last good data on screen; only a failure with nothing loaded errors.\n const isLoading = skillsQuery.isLoading || coursesQuery.isLoading || enrollmentsQuery.isLoading;\n const loadFailed = [skillsQuery, coursesQuery, enrollmentsQuery].some(\n (q) => q.isError && q.data === undefined\n );\n const retryLoad = (): void => {\n void skillsQuery.refetch();\n void coursesQuery.refetch();\n void enrollmentsQuery.refetch();\n };\n\n const goToCourse = (n: JourneyNode): void => {\n if (n.enrollmentId && n.status !== 'not_started') navigateTo(`learning/${n.enrollmentId}`);\n else navigateTo(`catalog/${n.course.id}`);\n };\n\n return (\n <PageLayout\n title=\"Skill Journeys\"\n description=\"Guided, multi-course paths that build a skill to mastery — with your live progress across each step.\"\n titleGradient\n aurora\n >\n <div className=\"grid gap-6 lg:grid-cols-[minmax(0,1fr)_20rem] lg:items-start\">\n <div className=\"flex min-w-0 flex-col gap-8\">\n {isLoading ? (\n <LoadingView label=\"Mapping your skill journeys…\" />\n ) : loadFailed ? (\n <ErrorView title=\"Couldn't load journeys\" onRetry={retryLoad} />\n ) : journeys.length === 0 ? (\n <EmptyState\n illustration=\"onboarding\"\n title=\"No skill journeys yet\"\n description=\"Journeys appear once published courses are mapped to a skill. Add a skill to a course in Authoring.\"\n action={<Button onClick={() => navigateTo('catalog')}>Browse the catalog</Button>}\n />\n ) : (\n <>\n {sets.started.length > 0 ? (\n <JourneySection\n id=\"journeys-started\"\n title={tr('buildmyiq.paths.yourJourneys', 'Your journeys')}\n description={tr(\n 'buildmyiq.paths.yourJourneysHint',\n 'Paths you have started, with your progress on each step.'\n )}\n journeys={sets.started}\n onOpen={goToCourse}\n />\n ) : (\n <p className=\"text-sm text-text-secondary\" data-testid=\"journeys-started-empty\">\n {tr(\n 'buildmyiq.paths.noStartedJourneys',\n 'You have not started a skill journey yet. Pick a recommended path or explore the ones below.'\n )}\n </p>\n )}\n {sets.more.length > 0 && (\n <JourneySection\n id=\"journeys-more\"\n title={tr('buildmyiq.paths.moreJourneys', 'More journeys')}\n description={tr(\n 'buildmyiq.paths.moreJourneysHint',\n 'Other skill journeys in this workspace that you have not started.'\n )}\n journeys={sets.more}\n onOpen={goToCourse}\n />\n )}\n </>\n )}\n </div>\n <RecommendedPathsRail\n recommendations={recommendations}\n items={sets.recommended}\n canExpand={sets.hiddenRecommendations > 0}\n expanded={railExpanded}\n onToggleExpanded={() => setRailExpanded((v) => !v)}\n />\n </div>\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmDA,IAAM,KAA8E,EAClF,YACA,QAAQ,QACJ;CACJ,IAAM,IAAK,EAAM;CACjB,OACE,kBAAC,GAAD;EAAW,WAAU;EAAQ,WAAU;EAAa,eAAY;YAAhE,CAEE,kBAAC,OAAD;GAAK,WAAU;aAAf,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CAAA,IAC7D,EAAS,WAAW,IACtB,kBAAC,GAAD;KACE,cAAa;KACb,OAAM;KACN,aAAY;KACZ,QAAQ,kBAAC,GAAD;MAAQ,eAAe,EAAW,SAAS;gBAAG;KAA0B,CAAA;IACjF,CAAA,IAED,kBAAA,GAAA,EAAA,UAAA,CACG,EAAK,QAAQ,SAAS,IACrB,kBAAC,GAAD;KACE,IAAG;KACH,OAAO,EAAG,gCAAgC,eAAe;KACzD,aAAa,EACX,oCACA,0DACF;KACA,UAAU,EAAK;KACf,QAAQ;IACT,CAAA,IAED,kBAAC,KAAD;KAAG,WAAU;KAA8B,eAAY;eACpD,EACC,qCACA,8FACF;IACC,CAAA,GAEJ,EAAK,KAAK,SAAS,KAClB,kBAAC,GAAD;KACE,IAAG;KACH,OAAO,EAAG,gCAAgC,eAAe;KACzD,aAAa,EACX,oCACA,mEACF;KACA,UAAU,EAAK;KACf,QAAQ;IACT,CAAA,CAEH,EAAA,CAAA;GAED,CAAA,GACL,kBAAC,GAAD;IACmB;IACjB,OAAO,EAAK;IACZ,WAAW,EAAK,wBAAwB;IACxC,UAAU;IACV,wBAAwB,GAAiB,MAAM,CAAC,CAAC;GAClD,CAAA,CACE;;CACK,CAAA;AAEhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecommendedPathsRail.d.ts","sourceRoot":"","sources":["../../../../src/buildmyiq/pages/paths/RecommendedPathsRail.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAoB5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,kBAAkB,EAAoB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"RecommendedPathsRail.d.ts","sourceRoot":"","sources":["../../../../src/buildmyiq/pages/paths/RecommendedPathsRail.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAoB5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,kBAAkB,EAAoB,MAAM,aAAa,CAAC;AAKhG,kFAAkF;AAClF,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAC3C,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAsF3C,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,eAAe,EAAE,cAAc,CAAC,sBAAsB,CAAC,CAAC;IACxD;;;OAGG;IACH,KAAK,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACrC,yEAAyE;IACzE,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC,yBAAyB,CAiI9D,CAAC"}
|
|
@@ -7,181 +7,182 @@ import { ErrorView as i } from "../../components/StateViews.js";
|
|
|
7
7
|
import { useBuiMyLearnerProfile as a } from "../../hooks/useBuildmyiqApi.js";
|
|
8
8
|
import "../../hooks/index.js";
|
|
9
9
|
import "../../components/index.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
10
|
+
import { courseCountLabel as o, learnerCountLabel as s } from "./countLabels.js";
|
|
11
|
+
import { REASON_COPY as c } from "./pathFinder.js";
|
|
12
|
+
import { PathFinderDialog as l } from "./PathFinderDialog.js";
|
|
13
|
+
import { useState as u } from "react";
|
|
14
|
+
import { ArrowRight as d, Brain as f, Briefcase as p, Clock as m, Code2 as h, Languages as g, Layers as _, Palette as v, Sparkles as y, Users as b } from "lucide-react";
|
|
15
|
+
import { jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
16
|
+
import { Button as C, GlassCard as w } from "@burdenoff/fe-libs/ui";
|
|
17
|
+
var T = {
|
|
17
18
|
TECHNICAL: {
|
|
18
|
-
icon:
|
|
19
|
+
icon: h,
|
|
19
20
|
color: "var(--color-accent-teal)"
|
|
20
21
|
},
|
|
21
22
|
BUSINESS: {
|
|
22
|
-
icon:
|
|
23
|
+
icon: p,
|
|
23
24
|
color: "var(--color-accent-blue)"
|
|
24
25
|
},
|
|
25
26
|
CREATIVE: {
|
|
26
|
-
icon:
|
|
27
|
+
icon: v,
|
|
27
28
|
color: "var(--color-status-warning-text)"
|
|
28
29
|
},
|
|
29
30
|
COGNITIVE: {
|
|
30
|
-
icon:
|
|
31
|
+
icon: f,
|
|
31
32
|
color: "var(--color-accent-purple)"
|
|
32
33
|
},
|
|
33
34
|
SOCIAL: {
|
|
34
|
-
icon:
|
|
35
|
+
icon: b,
|
|
35
36
|
color: "var(--color-status-success-text)"
|
|
36
37
|
},
|
|
37
38
|
LANGUAGE: {
|
|
38
|
-
icon:
|
|
39
|
+
icon: g,
|
|
39
40
|
color: "var(--color-accent-indigo)"
|
|
40
41
|
}
|
|
41
|
-
},
|
|
42
|
-
let a = t(),
|
|
43
|
-
let t =
|
|
42
|
+
}, E = ({ path: e, onExplore: i }) => {
|
|
43
|
+
let a = t(), l = T[e.skill.category] ?? T.TECHNICAL, u = l.icon, f = e.reasons.flatMap((e) => {
|
|
44
|
+
let t = c[e];
|
|
44
45
|
return t ? [a(t.key, t.fallback)] : [];
|
|
45
46
|
});
|
|
46
|
-
return /* @__PURE__ */
|
|
47
|
+
return /* @__PURE__ */ x("li", { children: /* @__PURE__ */ S(w, {
|
|
47
48
|
treatment: "plain",
|
|
48
49
|
className: "flex flex-col gap-3 p-4",
|
|
49
50
|
"data-testid": "recommended-path",
|
|
50
51
|
children: [
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ S("div", {
|
|
52
53
|
className: "flex items-start gap-3",
|
|
53
54
|
children: [
|
|
54
|
-
/* @__PURE__ */
|
|
55
|
+
/* @__PURE__ */ x("span", {
|
|
55
56
|
"aria-hidden": "true",
|
|
56
57
|
className: "flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-bg-sunken",
|
|
57
|
-
style: { color:
|
|
58
|
-
children: /* @__PURE__ */
|
|
58
|
+
style: { color: l.color },
|
|
59
|
+
children: /* @__PURE__ */ x(u, { className: "h-5 w-5" })
|
|
59
60
|
}),
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
+
/* @__PURE__ */ S("div", {
|
|
61
62
|
className: "min-w-0 flex-1",
|
|
62
|
-
children: [/* @__PURE__ */
|
|
63
|
+
children: [/* @__PURE__ */ x("h3", {
|
|
63
64
|
className: "truncate text-sm font-semibold text-text-primary",
|
|
64
65
|
children: e.skill.name
|
|
65
|
-
}), /* @__PURE__ */
|
|
66
|
+
}), /* @__PURE__ */ S("p", {
|
|
66
67
|
className: "mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-text-secondary",
|
|
67
68
|
children: [
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
+
/* @__PURE__ */ S("span", {
|
|
69
70
|
className: "inline-flex items-center gap-1",
|
|
70
|
-
children: [/* @__PURE__ */
|
|
71
|
+
children: [/* @__PURE__ */ x(_, {
|
|
71
72
|
className: "h-3 w-3",
|
|
72
73
|
"aria-hidden": "true"
|
|
73
|
-
}), a
|
|
74
|
+
}), o(a, e.courseCount)]
|
|
74
75
|
}),
|
|
75
|
-
e.totalHours > 0 && /* @__PURE__ */
|
|
76
|
+
e.totalHours > 0 && /* @__PURE__ */ S("span", {
|
|
76
77
|
className: "inline-flex items-center gap-1",
|
|
77
|
-
children: [/* @__PURE__ */
|
|
78
|
+
children: [/* @__PURE__ */ x(m, {
|
|
78
79
|
className: "h-3 w-3",
|
|
79
80
|
"aria-hidden": "true"
|
|
80
81
|
}), n(e.totalHours)]
|
|
81
82
|
}),
|
|
82
|
-
e.learnerCount > 0 && /* @__PURE__ */
|
|
83
|
+
e.learnerCount > 0 && /* @__PURE__ */ x("span", { children: s(a, e.learnerCount) })
|
|
83
84
|
]
|
|
84
85
|
})]
|
|
85
86
|
}),
|
|
86
|
-
/* @__PURE__ */
|
|
87
|
+
/* @__PURE__ */ x(r, { status: e.skill.category })
|
|
87
88
|
]
|
|
88
89
|
}),
|
|
89
|
-
|
|
90
|
+
f.length > 0 && /* @__PURE__ */ x("ul", {
|
|
90
91
|
className: "flex flex-wrap gap-1.5",
|
|
91
92
|
"aria-label": a("buildmyiq.paths.why", "Why we suggest it"),
|
|
92
|
-
children:
|
|
93
|
+
children: f.map((e) => /* @__PURE__ */ x("li", {
|
|
93
94
|
className: "rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-text-secondary",
|
|
94
95
|
children: e
|
|
95
96
|
}, e))
|
|
96
97
|
}),
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
+
/* @__PURE__ */ S("p", {
|
|
98
99
|
className: "text-xs text-text-secondary",
|
|
99
100
|
children: [
|
|
100
101
|
a("buildmyiq.paths.startWith", "Start with"),
|
|
101
102
|
" ",
|
|
102
|
-
/* @__PURE__ */
|
|
103
|
+
/* @__PURE__ */ x("span", {
|
|
103
104
|
className: "font-medium text-text-primary",
|
|
104
105
|
children: e.startCourse.title
|
|
105
106
|
})
|
|
106
107
|
]
|
|
107
108
|
}),
|
|
108
|
-
/* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ S(C, {
|
|
109
110
|
variant: "secondary",
|
|
110
111
|
size: "sm",
|
|
111
112
|
className: "w-full",
|
|
112
113
|
onClick: i,
|
|
113
|
-
children: [a("buildmyiq.paths.explore", "Explore path"), /* @__PURE__ */
|
|
114
|
+
children: [a("buildmyiq.paths.explore", "Explore path"), /* @__PURE__ */ x(d, {
|
|
114
115
|
className: "ms-1 h-4 w-4 rtl:-scale-x-100",
|
|
115
116
|
"aria-hidden": "true"
|
|
116
117
|
})]
|
|
117
118
|
})
|
|
118
119
|
]
|
|
119
120
|
}) });
|
|
120
|
-
},
|
|
121
|
-
let f = t(), { currentUser: p, workspaceId: m, navigateTo: h } = e(), g = !!p?.id,
|
|
122
|
-
return /* @__PURE__ */
|
|
121
|
+
}, D = ({ recommendations: n, items: r, canExpand: o, expanded: s, onToggleExpanded: c }) => {
|
|
122
|
+
let f = t(), { currentUser: p, workspaceId: m, navigateTo: h } = e(), g = !!p?.id, _ = `${p?.id ?? ""}:${m ?? ""}`, [v, b] = u(null), T = v === _, [D, O] = u(0), k = a(g), A = n.data, j = !!k.data?.pathFinderCompletedAt, M = A?.suggestAssessment ?? !0;
|
|
123
|
+
return /* @__PURE__ */ S("aside", {
|
|
123
124
|
"aria-labelledby": "recommended-paths-heading",
|
|
124
125
|
className: "flex flex-col gap-4",
|
|
125
126
|
"data-testid": "recommended-paths",
|
|
126
127
|
children: [
|
|
127
|
-
/* @__PURE__ */
|
|
128
|
+
/* @__PURE__ */ S("div", {
|
|
128
129
|
className: "flex items-center justify-between gap-2",
|
|
129
|
-
children: [/* @__PURE__ */
|
|
130
|
+
children: [/* @__PURE__ */ x("h2", {
|
|
130
131
|
id: "recommended-paths-heading",
|
|
131
132
|
className: "text-base font-semibold text-text-primary",
|
|
132
133
|
children: f("buildmyiq.paths.recommended", "Recommended Paths")
|
|
133
|
-
}), (
|
|
134
|
+
}), (s || o) && r.length >= 3 && /* @__PURE__ */ x(C, {
|
|
134
135
|
variant: "ghost",
|
|
135
136
|
size: "sm",
|
|
136
|
-
onClick:
|
|
137
|
-
children:
|
|
137
|
+
onClick: c,
|
|
138
|
+
children: s ? f("buildmyiq.paths.showFewer", "Show fewer") : f("buildmyiq.paths.viewAll", "View all")
|
|
138
139
|
})]
|
|
139
140
|
}),
|
|
140
|
-
n.isLoading ? /* @__PURE__ */
|
|
141
|
+
n.isLoading ? /* @__PURE__ */ x("p", {
|
|
141
142
|
className: "text-sm text-text-secondary",
|
|
142
143
|
children: f("buildmyiq.paths.loadingRecommendations", "Finding paths for you…")
|
|
143
|
-
}) : n.isError && A === void 0 ? /* @__PURE__ */
|
|
144
|
+
}) : n.isError && A === void 0 ? /* @__PURE__ */ x(i, {
|
|
144
145
|
title: f("buildmyiq.paths.recommendationsError", "Couldn't load recommendations"),
|
|
145
146
|
onRetry: () => void n.refetch()
|
|
146
|
-
}) : r.length === 0 ? /* @__PURE__ */
|
|
147
|
+
}) : r.length === 0 ? /* @__PURE__ */ x("p", {
|
|
147
148
|
className: "text-sm text-text-secondary",
|
|
148
149
|
"data-testid": "recommended-paths-empty",
|
|
149
150
|
children: f("buildmyiq.paths.noRecommendations", "You've started every skill journey in this workspace. New ones appear here as courses are published.")
|
|
150
|
-
}) : /* @__PURE__ */
|
|
151
|
+
}) : /* @__PURE__ */ x("ul", {
|
|
151
152
|
className: "flex flex-col gap-3",
|
|
152
|
-
children: r.map((e) => /* @__PURE__ */
|
|
153
|
+
children: r.map((e) => /* @__PURE__ */ x(E, {
|
|
153
154
|
path: e,
|
|
154
155
|
onExplore: () => h(`catalog/${e.startCourse.id}`)
|
|
155
156
|
}, e.skillId))
|
|
156
157
|
}),
|
|
157
|
-
/* @__PURE__ */
|
|
158
|
+
/* @__PURE__ */ S(w, {
|
|
158
159
|
treatment: "plain",
|
|
159
160
|
className: "flex gap-3 border border-border-seam p-4",
|
|
160
161
|
"data-testid": "path-finder-cta",
|
|
161
|
-
children: [/* @__PURE__ */ y
|
|
162
|
+
children: [/* @__PURE__ */ x(y, {
|
|
162
163
|
className: "mt-0.5 h-5 w-5 shrink-0 text-[var(--color-status-warning-text)]",
|
|
163
164
|
"aria-hidden": "true"
|
|
164
|
-
}), /* @__PURE__ */
|
|
165
|
+
}), /* @__PURE__ */ S("div", {
|
|
165
166
|
className: "min-w-0",
|
|
166
167
|
children: [
|
|
167
|
-
/* @__PURE__ */
|
|
168
|
+
/* @__PURE__ */ x("h3", {
|
|
168
169
|
className: "text-sm font-semibold text-text-primary",
|
|
169
170
|
children: M || !j ? f("buildmyiq.paths.notSure", "Not sure which path?") : f("buildmyiq.paths.personalised", "Personalized for you")
|
|
170
171
|
}),
|
|
171
|
-
/* @__PURE__ */
|
|
172
|
+
/* @__PURE__ */ x("p", {
|
|
172
173
|
className: "mt-1 text-xs text-text-secondary",
|
|
173
174
|
children: j ? f("buildmyiq.paths.retakeHint", "These suggestions use your path-finder answers. Retake it any time your goals change.") : f("buildmyiq.paths.assessmentHint", "Take a quick assessment to get personalized path recommendations.")
|
|
174
175
|
}),
|
|
175
|
-
/* @__PURE__ */
|
|
176
|
+
/* @__PURE__ */ S(C, {
|
|
176
177
|
variant: "link",
|
|
177
178
|
size: "sm",
|
|
178
179
|
className: "mt-1 h-auto px-0",
|
|
179
180
|
disabled: !g,
|
|
180
181
|
onClick: () => {
|
|
181
|
-
O((e) => e + 1),
|
|
182
|
+
O((e) => e + 1), b(_);
|
|
182
183
|
},
|
|
183
184
|
"data-testid": "path-finder-open",
|
|
184
|
-
children: [j ? f("buildmyiq.paths.retakeAssessment", "Retake assessment") : f("buildmyiq.paths.takeAssessment", "Take assessment"), /* @__PURE__ */
|
|
185
|
+
children: [j ? f("buildmyiq.paths.retakeAssessment", "Retake assessment") : f("buildmyiq.paths.takeAssessment", "Take assessment"), /* @__PURE__ */ x(d, {
|
|
185
186
|
className: "ms-1 h-4 w-4 rtl:-scale-x-100",
|
|
186
187
|
"aria-hidden": "true"
|
|
187
188
|
})]
|
|
@@ -189,15 +190,15 @@ var C = {
|
|
|
189
190
|
]
|
|
190
191
|
})]
|
|
191
192
|
}),
|
|
192
|
-
/* @__PURE__ */
|
|
193
|
-
open:
|
|
194
|
-
onOpenChange: (e) =>
|
|
193
|
+
/* @__PURE__ */ x(l, {
|
|
194
|
+
open: T,
|
|
195
|
+
onOpenChange: (e) => b(e ? _ : null),
|
|
195
196
|
profile: k.data
|
|
196
|
-
}, `${
|
|
197
|
+
}, `${_}:${D}`)
|
|
197
198
|
]
|
|
198
199
|
});
|
|
199
200
|
};
|
|
200
201
|
//#endregion
|
|
201
|
-
export {
|
|
202
|
+
export { D as RecommendedPathsRail };
|
|
202
203
|
|
|
203
204
|
//# sourceMappingURL=RecommendedPathsRail.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecommendedPathsRail.js","names":[],"sources":["../../../../src/buildmyiq/pages/paths/RecommendedPathsRail.tsx"],"sourcesContent":["/**\n * RecommendedPathsRail — the Learning Paths right rail (BOFF-3979): skill\n * journeys the learner has not started, ranked by the backend's deterministic\n * recommender (`buiRecommendPaths`), plus the \"Not sure which path?\"\n * path-finder assessment entry point.\n * @module buildmyiq/pages/paths\n *\n * Every recommendation says why it was suggested (the reasons come straight\n * from the backend), so nothing here is a black box or invented.\n */\n\nimport type { FC } from 'react';\nimport { useState } from 'react';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport type { LucideIcon } from 'lucide-react';\nimport {\n ArrowRight,\n Brain,\n Briefcase,\n Clock,\n Code2,\n Languages,\n Layers,\n Palette,\n Sparkles,\n Users,\n} from 'lucide-react';\nimport { Button, GlassCard } from '@burdenoff/fe-libs/ui';\nimport { ErrorView, StatusBadge } from '../../components';\nimport { useBuildmyiq } from '../../context';\nimport { useBuiMyLearnerProfile } from '../../hooks';\nimport { useTr } from '../../shared/hooks/useTr';\nimport { formatHours } from '../../utils/formatters';\nimport type { BuiPathRecommendations, BuiRecommendedPath, BuiSkillCategory } from '../../types';\nimport { PathFinderDialog } from './PathFinderDialog';\nimport { REASON_COPY } from './pathFinder';\n\n/** Recommendations shown before and after \"View all\" (the backend caps at 10). */\nexport const COLLAPSED_RECOMMENDATIONS = 3;\nexport const EXPANDED_RECOMMENDATIONS = 10;\n\n/** Same per-category icon and semantic colour as the Skills page. */\nconst CATEGORY_VISUAL: Record<BuiSkillCategory, { icon: LucideIcon; color: string }> = {\n TECHNICAL: { icon: Code2, color: 'var(--color-accent-teal)' },\n BUSINESS: { icon: Briefcase, color: 'var(--color-accent-blue)' },\n CREATIVE: { icon: Palette, color: 'var(--color-status-warning-text)' },\n COGNITIVE: { icon: Brain, color: 'var(--color-accent-purple)' },\n SOCIAL: { icon: Users, color: 'var(--color-status-success-text)' },\n LANGUAGE: { icon: Languages, color: 'var(--color-accent-indigo)' },\n};\n\nconst RecommendationCard: FC<{ path: BuiRecommendedPath; onExplore: () => void }> = ({\n path,\n onExplore,\n}) => {\n const tr = useTr();\n const visual = CATEGORY_VISUAL[path.skill.category] ?? CATEGORY_VISUAL.TECHNICAL;\n const Icon = visual.icon;\n // A reason the backend added after this build has no copy yet: skip it\n // rather than crash the rail.\n const reasons = path.reasons.flatMap((r) => {\n const copy = REASON_COPY[r] as (typeof REASON_COPY)[keyof typeof REASON_COPY] | undefined;\n return copy ? [tr(copy.key, copy.fallback)] : [];\n });\n return (\n <li>\n <GlassCard\n treatment=\"plain\"\n className=\"flex flex-col gap-3 p-4\"\n data-testid=\"recommended-path\"\n >\n <div className=\"flex items-start gap-3\">\n <span\n aria-hidden=\"true\"\n className=\"flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-bg-sunken\"\n style={{ color: visual.color }}\n >\n <Icon className=\"h-5 w-5\" />\n </span>\n <div className=\"min-w-0 flex-1\">\n <h3 className=\"truncate text-sm font-semibold text-text-primary\">{path.skill.name}</h3>\n <p className=\"mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-text-secondary\">\n <span className=\"inline-flex items-center gap-1\">\n <Layers className=\"h-3 w-3\" aria-hidden=\"true\" />\n {tr('buildmyiq.paths.courseCount', '{{count}} courses', {\n count: path.courseCount,\n })}\n </span>\n {path.totalHours > 0 && (\n <span className=\"inline-flex items-center gap-1\">\n <Clock className=\"h-3 w-3\" aria-hidden=\"true\" />\n {formatHours(path.totalHours)}\n </span>\n )}\n {path.learnerCount > 0 && (\n <span>\n {tr('buildmyiq.paths.learnerCount', '{{count}} learners', {\n count: path.learnerCount,\n })}\n </span>\n )}\n </p>\n </div>\n <StatusBadge status={path.skill.category} />\n </div>\n {reasons.length > 0 && (\n <ul\n className=\"flex flex-wrap gap-1.5\"\n aria-label={tr('buildmyiq.paths.why', 'Why we suggest it')}\n >\n {reasons.map((reason) => (\n <li\n key={reason}\n className=\"rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-text-secondary\"\n >\n {reason}\n </li>\n ))}\n </ul>\n )}\n <p className=\"text-xs text-text-secondary\">\n {tr('buildmyiq.paths.startWith', 'Start with')}{' '}\n <span className=\"font-medium text-text-primary\">{path.startCourse.title}</span>\n </p>\n <Button variant=\"secondary\" size=\"sm\" className=\"w-full\" onClick={onExplore}>\n {tr('buildmyiq.paths.explore', 'Explore path')}\n <ArrowRight className=\"ms-1 h-4 w-4 rtl:-scale-x-100\" aria-hidden=\"true\" />\n </Button>\n </GlassCard>\n </li>\n );\n};\n\nexport interface RecommendedPathsRailProps {\n /**\n * The page owns the recommendations query so it can leave every\n * recommended journey out of its own lists (the sets never overlap).\n */\n recommendations: UseQueryResult<BuiPathRecommendations>;\n /**\n * The recommendations to render, already filtered by the page so none of\n * them is a journey listed under \"Your journeys\" or \"More journeys\".\n */\n items: readonly BuiRecommendedPath[];\n /** More eligible recommendations exist than the collapsed rail shows. */\n canExpand: boolean;\n expanded: boolean;\n onToggleExpanded: () => void;\n}\n\nexport const RecommendedPathsRail: FC<RecommendedPathsRailProps> = ({\n recommendations,\n items,\n canExpand,\n expanded,\n onToggleExpanded,\n}) => {\n const tr = useTr();\n const { currentUser, workspaceId, navigateTo } = useBuildmyiq();\n const signedIn = Boolean(currentUser?.id);\n // The learner and workspace the dialog was opened for. If the host switches\n // either while it is open, the dialog closes and its answers are discarded,\n // so answers typed in one context are never submitted in another.\n const scopeKey = `${currentUser?.id ?? ''}:${workspaceId ?? ''}`;\n const [finderScope, setFinderScope] = useState<string | null>(null);\n const finderOpen = finderScope === scopeKey;\n // Bumped on every open so the dialog remounts with the stored answers.\n const [finderKey, setFinderKey] = useState(0);\n\n const profile = useBuiMyLearnerProfile(signedIn);\n\n const data = recommendations.data;\n const tookAssessment = Boolean(profile.data?.pathFinderCompletedAt);\n const suggestAssessment = data?.suggestAssessment ?? true;\n\n return (\n <aside\n aria-labelledby=\"recommended-paths-heading\"\n className=\"flex flex-col gap-4\"\n data-testid=\"recommended-paths\"\n >\n <div className=\"flex items-center justify-between gap-2\">\n <h2 id=\"recommended-paths-heading\" className=\"text-base font-semibold text-text-primary\">\n {tr('buildmyiq.paths.recommended', 'Recommended Paths')}\n </h2>\n {(expanded || canExpand) && items.length >= COLLAPSED_RECOMMENDATIONS && (\n <Button variant=\"ghost\" size=\"sm\" onClick={onToggleExpanded}>\n {expanded\n ? tr('buildmyiq.paths.showFewer', 'Show fewer')\n : tr('buildmyiq.paths.viewAll', 'View all')}\n </Button>\n )}\n </div>\n\n {recommendations.isLoading ? (\n <p className=\"text-sm text-text-secondary\">\n {tr('buildmyiq.paths.loadingRecommendations', 'Finding paths for you…')}\n </p>\n ) : recommendations.isError && data === undefined ? (\n // Only when nothing was ever loaded. After a failed background\n // refetch React Query keeps the last good data, and the page has\n // already left those journeys out of its own lists, so the cards\n // must stay visible or those journeys would vanish from the page.\n <ErrorView\n title={tr('buildmyiq.paths.recommendationsError', \"Couldn't load recommendations\")}\n onRetry={() => void recommendations.refetch()}\n />\n ) : items.length === 0 ? (\n <p className=\"text-sm text-text-secondary\" data-testid=\"recommended-paths-empty\">\n {tr(\n 'buildmyiq.paths.noRecommendations',\n \"You've started every skill journey in this workspace. New ones appear here as courses are published.\"\n )}\n </p>\n ) : (\n <ul className=\"flex flex-col gap-3\">\n {items.map((path) => (\n <RecommendationCard\n key={path.skillId}\n path={path}\n onExplore={() => navigateTo(`catalog/${path.startCourse.id}`)}\n />\n ))}\n </ul>\n )}\n\n <GlassCard\n treatment=\"plain\"\n className=\"flex gap-3 border border-border-seam p-4\"\n data-testid=\"path-finder-cta\"\n >\n <Sparkles\n className=\"mt-0.5 h-5 w-5 shrink-0 text-[var(--color-status-warning-text)]\"\n aria-hidden=\"true\"\n />\n <div className=\"min-w-0\">\n <h3 className=\"text-sm font-semibold text-text-primary\">\n {suggestAssessment || !tookAssessment\n ? tr('buildmyiq.paths.notSure', 'Not sure which path?')\n : tr('buildmyiq.paths.personalised', 'Personalized for you')}\n </h3>\n <p className=\"mt-1 text-xs text-text-secondary\">\n {tookAssessment\n ? tr(\n 'buildmyiq.paths.retakeHint',\n 'These suggestions use your path-finder answers. Retake it any time your goals change.'\n )\n : tr(\n 'buildmyiq.paths.assessmentHint',\n 'Take a quick assessment to get personalized path recommendations.'\n )}\n </p>\n <Button\n variant=\"link\"\n size=\"sm\"\n className=\"mt-1 h-auto px-0\"\n disabled={!signedIn}\n onClick={() => {\n setFinderKey((k) => k + 1);\n setFinderScope(scopeKey);\n }}\n data-testid=\"path-finder-open\"\n >\n {tookAssessment\n ? tr('buildmyiq.paths.retakeAssessment', 'Retake assessment')\n : tr('buildmyiq.paths.takeAssessment', 'Take assessment')}\n <ArrowRight className=\"ms-1 h-4 w-4 rtl:-scale-x-100\" aria-hidden=\"true\" />\n </Button>\n </div>\n </GlassCard>\n\n <PathFinderDialog\n key={`${scopeKey}:${finderKey}`}\n open={finderOpen}\n onOpenChange={(open) => setFinderScope(open ? scopeKey : null)}\n profile={profile.data}\n />\n </aside>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;AA0CA,IAAM,IAAiF;CACrF,WAAW;EAAE,MAAM;EAAO,OAAO;CAA2B;CAC5D,UAAU;EAAE,MAAM;EAAW,OAAO;CAA2B;CAC/D,UAAU;EAAE,MAAM;EAAS,OAAO;CAAmC;CACrE,WAAW;EAAE,MAAM;EAAO,OAAO;CAA6B;CAC9D,QAAQ;EAAE,MAAM;EAAO,OAAO;CAAmC;CACjE,UAAU;EAAE,MAAM;EAAW,OAAO;CAA6B;AACnE,GAEM,KAA+E,EACnF,SACA,mBACI;CACJ,IAAM,IAAK,EAAM,GACX,IAAS,EAAgB,EAAK,MAAM,aAAa,EAAgB,WACjE,IAAO,EAAO,MAGd,IAAU,EAAK,QAAQ,SAAS,MAAM;EAC1C,IAAM,IAA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AAC,KAAD;IAAG,WAAU;IAA8B,eAAY;cACpD,EACC,qCACA,sGACF;GACC,CAAA,IAEH,kBAAC,MAAD;IAAI,WAAU;cACX,EAAM,KAAK,MACV,kBAAC,GAAD;KAEQ;KACN,iBAAiB,EAAW,WAAW,EAAK,YAAY,IAAI;IAC7D,GAHM,EAAK,OAGX,CACF;GACC,CAAA;GAGN,kBAAC,GAAD;IACE,WAAU;IACV,WAAU;IACV,eAAY;cAHd,CAKE,kBAAC,GAAD;KACE,WAAU;KACV,eAAY;IACb,CAAA,GACD,kBAAC,OAAD;KAAK,WAAU;eAAf;MACE,kBAAC,MAAD;OAAI,WAAU;iBACX,KAAqB,CAAC,IACnB,EAAG,2BAA2B,sBAAsB,IACpD,EAAG,gCAAgC,sBAAsB;MAC3D,CAAA;MACJ,kBAAC,KAAD;OAAG,WAAU;iBACV,IACG,EACE,8BACA,uFACF,IACA,EACE,kCACA,mEACF;MACH,CAAA;MACH,kBAAC,GAAD;OACE,SAAQ;OACR,MAAK;OACL,WAAU;OACV,UAAU,CAAC;OACX,eAAe;QAEb,AADA,GAAc,MAAM,IAAI,CAAC,GACzB,EAAe,CAAQ;OACzB;OACA,eAAY;iBATd,CAWG,IACG,EAAG,oCAAoC,mBAAmB,IAC1D,EAAG,kCAAkC,iBAAiB,GAC1D,kBAAC,GAAD;QAAY,WAAU;QAAgC,eAAY;OAAQ,CAAA,CACpE;;KACL;MACI;;GAEX,kBAAC,GAAD;IAEE,MAAM;IACN,eAAe,MAAS,EAAe,IAAO,IAAW,IAAI;IAC7D,SAAS,EAAQ;GAClB,GAJM,GAAG,EAAS,GAAG,GAIrB;EACI;;AAEX"}
|
|
1
|
+
{"version":3,"file":"RecommendedPathsRail.js","names":[],"sources":["../../../../src/buildmyiq/pages/paths/RecommendedPathsRail.tsx"],"sourcesContent":["/**\n * RecommendedPathsRail — the Learning Paths right rail (BOFF-3979): skill\n * journeys the learner has not started, ranked by the backend's deterministic\n * recommender (`buiRecommendPaths`), plus the \"Not sure which path?\"\n * path-finder assessment entry point.\n * @module buildmyiq/pages/paths\n *\n * Every recommendation says why it was suggested (the reasons come straight\n * from the backend), so nothing here is a black box or invented.\n */\n\nimport type { FC } from 'react';\nimport { useState } from 'react';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport type { LucideIcon } from 'lucide-react';\nimport {\n ArrowRight,\n Brain,\n Briefcase,\n Clock,\n Code2,\n Languages,\n Layers,\n Palette,\n Sparkles,\n Users,\n} from 'lucide-react';\nimport { Button, GlassCard } from '@burdenoff/fe-libs/ui';\nimport { ErrorView, StatusBadge } from '../../components';\nimport { useBuildmyiq } from '../../context';\nimport { useBuiMyLearnerProfile } from '../../hooks';\nimport { useTr } from '../../shared/hooks/useTr';\nimport { formatHours } from '../../utils/formatters';\nimport type { BuiPathRecommendations, BuiRecommendedPath, BuiSkillCategory } from '../../types';\nimport { courseCountLabel, learnerCountLabel } from './countLabels';\nimport { PathFinderDialog } from './PathFinderDialog';\nimport { REASON_COPY } from './pathFinder';\n\n/** Recommendations shown before and after \"View all\" (the backend caps at 10). */\nexport const COLLAPSED_RECOMMENDATIONS = 3;\nexport const EXPANDED_RECOMMENDATIONS = 10;\n\n/** Same per-category icon and semantic colour as the Skills page. */\nconst CATEGORY_VISUAL: Record<BuiSkillCategory, { icon: LucideIcon; color: string }> = {\n TECHNICAL: { icon: Code2, color: 'var(--color-accent-teal)' },\n BUSINESS: { icon: Briefcase, color: 'var(--color-accent-blue)' },\n CREATIVE: { icon: Palette, color: 'var(--color-status-warning-text)' },\n COGNITIVE: { icon: Brain, color: 'var(--color-accent-purple)' },\n SOCIAL: { icon: Users, color: 'var(--color-status-success-text)' },\n LANGUAGE: { icon: Languages, color: 'var(--color-accent-indigo)' },\n};\n\nconst RecommendationCard: FC<{ path: BuiRecommendedPath; onExplore: () => void }> = ({\n path,\n onExplore,\n}) => {\n const tr = useTr();\n const visual = CATEGORY_VISUAL[path.skill.category] ?? CATEGORY_VISUAL.TECHNICAL;\n const Icon = visual.icon;\n // A reason the backend added after this build has no copy yet: skip it\n // rather than crash the rail.\n const reasons = path.reasons.flatMap((r) => {\n const copy = REASON_COPY[r] as (typeof REASON_COPY)[keyof typeof REASON_COPY] | undefined;\n return copy ? [tr(copy.key, copy.fallback)] : [];\n });\n return (\n <li>\n <GlassCard\n treatment=\"plain\"\n className=\"flex flex-col gap-3 p-4\"\n data-testid=\"recommended-path\"\n >\n <div className=\"flex items-start gap-3\">\n <span\n aria-hidden=\"true\"\n className=\"flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-bg-sunken\"\n style={{ color: visual.color }}\n >\n <Icon className=\"h-5 w-5\" />\n </span>\n <div className=\"min-w-0 flex-1\">\n <h3 className=\"truncate text-sm font-semibold text-text-primary\">{path.skill.name}</h3>\n <p className=\"mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-text-secondary\">\n <span className=\"inline-flex items-center gap-1\">\n <Layers className=\"h-3 w-3\" aria-hidden=\"true\" />\n {courseCountLabel(tr, path.courseCount)}\n </span>\n {path.totalHours > 0 && (\n <span className=\"inline-flex items-center gap-1\">\n <Clock className=\"h-3 w-3\" aria-hidden=\"true\" />\n {formatHours(path.totalHours)}\n </span>\n )}\n {path.learnerCount > 0 && <span>{learnerCountLabel(tr, path.learnerCount)}</span>}\n </p>\n </div>\n <StatusBadge status={path.skill.category} />\n </div>\n {reasons.length > 0 && (\n <ul\n className=\"flex flex-wrap gap-1.5\"\n aria-label={tr('buildmyiq.paths.why', 'Why we suggest it')}\n >\n {reasons.map((reason) => (\n <li\n key={reason}\n className=\"rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-text-secondary\"\n >\n {reason}\n </li>\n ))}\n </ul>\n )}\n <p className=\"text-xs text-text-secondary\">\n {tr('buildmyiq.paths.startWith', 'Start with')}{' '}\n <span className=\"font-medium text-text-primary\">{path.startCourse.title}</span>\n </p>\n <Button variant=\"secondary\" size=\"sm\" className=\"w-full\" onClick={onExplore}>\n {tr('buildmyiq.paths.explore', 'Explore path')}\n <ArrowRight className=\"ms-1 h-4 w-4 rtl:-scale-x-100\" aria-hidden=\"true\" />\n </Button>\n </GlassCard>\n </li>\n );\n};\n\nexport interface RecommendedPathsRailProps {\n /**\n * The page owns the recommendations query so it can leave every\n * recommended journey out of its own lists (the sets never overlap).\n */\n recommendations: UseQueryResult<BuiPathRecommendations>;\n /**\n * The recommendations to render, already filtered by the page so none of\n * them is a journey listed under \"Your journeys\" or \"More journeys\".\n */\n items: readonly BuiRecommendedPath[];\n /** More eligible recommendations exist than the collapsed rail shows. */\n canExpand: boolean;\n expanded: boolean;\n onToggleExpanded: () => void;\n}\n\nexport const RecommendedPathsRail: FC<RecommendedPathsRailProps> = ({\n recommendations,\n items,\n canExpand,\n expanded,\n onToggleExpanded,\n}) => {\n const tr = useTr();\n const { currentUser, workspaceId, navigateTo } = useBuildmyiq();\n const signedIn = Boolean(currentUser?.id);\n // The learner and workspace the dialog was opened for. If the host switches\n // either while it is open, the dialog closes and its answers are discarded,\n // so answers typed in one context are never submitted in another.\n const scopeKey = `${currentUser?.id ?? ''}:${workspaceId ?? ''}`;\n const [finderScope, setFinderScope] = useState<string | null>(null);\n const finderOpen = finderScope === scopeKey;\n // Bumped on every open so the dialog remounts with the stored answers.\n const [finderKey, setFinderKey] = useState(0);\n\n const profile = useBuiMyLearnerProfile(signedIn);\n\n const data = recommendations.data;\n const tookAssessment = Boolean(profile.data?.pathFinderCompletedAt);\n const suggestAssessment = data?.suggestAssessment ?? true;\n\n return (\n <aside\n aria-labelledby=\"recommended-paths-heading\"\n className=\"flex flex-col gap-4\"\n data-testid=\"recommended-paths\"\n >\n <div className=\"flex items-center justify-between gap-2\">\n <h2 id=\"recommended-paths-heading\" className=\"text-base font-semibold text-text-primary\">\n {tr('buildmyiq.paths.recommended', 'Recommended Paths')}\n </h2>\n {(expanded || canExpand) && items.length >= COLLAPSED_RECOMMENDATIONS && (\n <Button variant=\"ghost\" size=\"sm\" onClick={onToggleExpanded}>\n {expanded\n ? tr('buildmyiq.paths.showFewer', 'Show fewer')\n : tr('buildmyiq.paths.viewAll', 'View all')}\n </Button>\n )}\n </div>\n\n {recommendations.isLoading ? (\n <p className=\"text-sm text-text-secondary\">\n {tr('buildmyiq.paths.loadingRecommendations', 'Finding paths for you…')}\n </p>\n ) : recommendations.isError && data === undefined ? (\n // Only when nothing was ever loaded. After a failed background\n // refetch React Query keeps the last good data, and the page has\n // already left those journeys out of its own lists, so the cards\n // must stay visible or those journeys would vanish from the page.\n <ErrorView\n title={tr('buildmyiq.paths.recommendationsError', \"Couldn't load recommendations\")}\n onRetry={() => void recommendations.refetch()}\n />\n ) : items.length === 0 ? (\n <p className=\"text-sm text-text-secondary\" data-testid=\"recommended-paths-empty\">\n {tr(\n 'buildmyiq.paths.noRecommendations',\n \"You've started every skill journey in this workspace. New ones appear here as courses are published.\"\n )}\n </p>\n ) : (\n <ul className=\"flex flex-col gap-3\">\n {items.map((path) => (\n <RecommendationCard\n key={path.skillId}\n path={path}\n onExplore={() => navigateTo(`catalog/${path.startCourse.id}`)}\n />\n ))}\n </ul>\n )}\n\n <GlassCard\n treatment=\"plain\"\n className=\"flex gap-3 border border-border-seam p-4\"\n data-testid=\"path-finder-cta\"\n >\n <Sparkles\n className=\"mt-0.5 h-5 w-5 shrink-0 text-[var(--color-status-warning-text)]\"\n aria-hidden=\"true\"\n />\n <div className=\"min-w-0\">\n <h3 className=\"text-sm font-semibold text-text-primary\">\n {suggestAssessment || !tookAssessment\n ? tr('buildmyiq.paths.notSure', 'Not sure which path?')\n : tr('buildmyiq.paths.personalised', 'Personalized for you')}\n </h3>\n <p className=\"mt-1 text-xs text-text-secondary\">\n {tookAssessment\n ? tr(\n 'buildmyiq.paths.retakeHint',\n 'These suggestions use your path-finder answers. Retake it any time your goals change.'\n )\n : tr(\n 'buildmyiq.paths.assessmentHint',\n 'Take a quick assessment to get personalized path recommendations.'\n )}\n </p>\n <Button\n variant=\"link\"\n size=\"sm\"\n className=\"mt-1 h-auto px-0\"\n disabled={!signedIn}\n onClick={() => {\n setFinderKey((k) => k + 1);\n setFinderScope(scopeKey);\n }}\n data-testid=\"path-finder-open\"\n >\n {tookAssessment\n ? tr('buildmyiq.paths.retakeAssessment', 'Retake assessment')\n : tr('buildmyiq.paths.takeAssessment', 'Take assessment')}\n <ArrowRight className=\"ms-1 h-4 w-4 rtl:-scale-x-100\" aria-hidden=\"true\" />\n </Button>\n </div>\n </GlassCard>\n\n <PathFinderDialog\n key={`${scopeKey}:${finderKey}`}\n open={finderOpen}\n onOpenChange={(open) => setFinderScope(open ? scopeKey : null)}\n profile={profile.data}\n />\n </aside>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AA2CA,IAAM,IAAiF;CACrF,WAAW;EAAE,MAAM;EAAO,OAAO;CAA2B;CAC5D,UAAU;EAAE,MAAM;EAAW,OAAO;CAA2B;CAC/D,UAAU;EAAE,MAAM;EAAS,OAAO;CAAmC;CACrE,WAAW;EAAE,MAAM;EAAO,OAAO;CAA6B;CAC9D,QAAQ;EAAE,MAAM;EAAO,OAAO;CAAmC;CACjE,UAAU;EAAE,MAAM;EAAW,OAAO;CAA6B;AACnE,GAEM,KAA+E,EACnF,SACA,mBACI;CACJ,IAAM,IAAK,EAAM,GACX,IAAS,EAAgB,EAAK,MAAM,aAAa,EAAgB,WACjE,IAAO,EAAO,MAGd,IAAU,EAAK,QAAQ,SAAS,MAAM;EAC1C,IAAM,IAAO,EAAY;EACzB,OAAO,IAAO,CAAC,EAAG,EAAK,KAAK,EAAK,QAAQ,CAAC,IAAI,CAAC;CACjD,CAAC;CACD,OACE,kBAAC,MAAD,EAAA,UACE,kBAAC,GAAD;EACE,WAAU;EACV,WAAU;EACV,eAAY;YAHd;GAKE,kBAAC,OAAD;IAAK,WAAU;cAAf;KACE,kBAAC,QAAD;MACE,eAAY;MACZ,WAAU;MACV,OAAO,EAAE,OAAO,EAAO,MAAM;gBAE7B,kBAAC,GAAD,EAAM,WAAU,UAAW,CAAA;KAC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AD;OAAI,WAAU;iBACX,KAAqB,CAAC,IACnB,EAAG,2BAA2B,sBAAsB,IACpD,EAAG,gCAAgC,sBAAsB;MAC3D,CAAA;MACJ,kBAAC,KAAD;OAAG,WAAU;iBACV,IACG,EACE,8BACA,uFACF,IACA,EACE,kCACA,mEACF;MACH,CAAA;MACH,kBAAC,GAAD;OACE,SAAQ;OACR,MAAK;OACL,WAAU;OACV,UAAU,CAAC;OACX,eAAe;QAEb,AADA,GAAc,MAAM,IAAI,CAAC,GACzB,EAAe,CAAQ;OACzB;OACA,eAAY;iBATd,CAWG,IACG,EAAG,oCAAoC,mBAAmB,IAC1D,EAAG,kCAAkC,iBAAiB,GAC1D,kBAAC,GAAD;QAAY,WAAU;QAAgC,eAAY;OAAQ,CAAA,CACpE;;KACL;MACI;;GAEX,kBAAC,GAAD;IAEE,MAAM;IACN,eAAe,MAAS,EAAe,IAAO,IAAW,IAAI;IAC7D,SAAS,EAAQ;GAClB,GAJM,GAAG,EAAS,GAAG,GAIrB;EACI;;AAEX"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Singular/plural count labels for the Learning Paths page (BOFF-10672).
|
|
3
|
+
*
|
|
4
|
+
* The shell's `tr` helper interpolates `{{count}}` but has no plural rules, so
|
|
5
|
+
* a single `'{{count}} courses'` key rendered "1 courses". Each label uses a
|
|
6
|
+
* dedicated `…One` key for a count of exactly one and the plural key for every
|
|
7
|
+
* other count (including zero), matching the pattern in AccessibilityChecker.
|
|
8
|
+
*/
|
|
9
|
+
/** The `tr` signature returned by `useTr()`. */
|
|
10
|
+
export type TrFn = (key: string, fallback: string, params?: Record<string, string | number>) => string;
|
|
11
|
+
/** "1 course" / "N courses". */
|
|
12
|
+
export declare const courseCountLabel: (tr: TrFn, count: number) => string;
|
|
13
|
+
/** "1 learner" / "N learners". */
|
|
14
|
+
export declare const learnerCountLabel: (tr: TrFn, count: number) => string;
|
|
15
|
+
//# sourceMappingURL=countLabels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"countLabels.d.ts","sourceRoot":"","sources":["../../../../src/buildmyiq/pages/paths/countLabels.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,gDAAgD;AAChD,MAAM,MAAM,IAAI,GAAG,CACjB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KACrC,MAAM,CAAC;AAUZ,gCAAgC;AAChC,eAAO,MAAM,gBAAgB,GAAI,IAAI,IAAI,EAAE,OAAO,MAAM,KAAG,MAMxD,CAAC;AAEJ,kCAAkC;AAClC,eAAO,MAAM,iBAAiB,GAAI,IAAI,IAAI,EAAE,OAAO,MAAM,KAAG,MAMzD,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/buildmyiq/pages/paths/countLabels.ts
|
|
2
|
+
var e = (e, t, n, r) => t === 1 ? e(n.key, n.fallback, { count: t }) : e(r.key, r.fallback, { count: t }), t = (t, n) => e(t, n, {
|
|
3
|
+
key: "buildmyiq.paths.courseCountOne",
|
|
4
|
+
fallback: "{{count}} course"
|
|
5
|
+
}, {
|
|
6
|
+
key: "buildmyiq.paths.courseCount",
|
|
7
|
+
fallback: "{{count}} courses"
|
|
8
|
+
}), n = (t, n) => e(t, n, {
|
|
9
|
+
key: "buildmyiq.paths.learnerCountOne",
|
|
10
|
+
fallback: "{{count}} learner"
|
|
11
|
+
}, {
|
|
12
|
+
key: "buildmyiq.paths.learnerCount",
|
|
13
|
+
fallback: "{{count}} learners"
|
|
14
|
+
});
|
|
15
|
+
//#endregion
|
|
16
|
+
export { t as courseCountLabel, n as learnerCountLabel };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=countLabels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"countLabels.js","names":[],"sources":["../../../../src/buildmyiq/pages/paths/countLabels.ts"],"sourcesContent":["/**\n * Singular/plural count labels for the Learning Paths page (BOFF-10672).\n *\n * The shell's `tr` helper interpolates `{{count}}` but has no plural rules, so\n * a single `'{{count}} courses'` key rendered \"1 courses\". Each label uses a\n * dedicated `…One` key for a count of exactly one and the plural key for every\n * other count (including zero), matching the pattern in AccessibilityChecker.\n */\n\n/** The `tr` signature returned by `useTr()`. */\nexport type TrFn = (\n key: string,\n fallback: string,\n params?: Record<string, string | number>\n) => string;\n\nconst pluralLabel = (\n tr: TrFn,\n count: number,\n one: { key: string; fallback: string },\n other: { key: string; fallback: string }\n): string =>\n count === 1 ? tr(one.key, one.fallback, { count }) : tr(other.key, other.fallback, { count });\n\n/** \"1 course\" / \"N courses\". */\nexport const courseCountLabel = (tr: TrFn, count: number): string =>\n pluralLabel(\n tr,\n count,\n { key: 'buildmyiq.paths.courseCountOne', fallback: '{{count}} course' },\n { key: 'buildmyiq.paths.courseCount', fallback: '{{count}} courses' }\n );\n\n/** \"1 learner\" / \"N learners\". */\nexport const learnerCountLabel = (tr: TrFn, count: number): string =>\n pluralLabel(\n tr,\n count,\n { key: 'buildmyiq.paths.learnerCountOne', fallback: '{{count}} learner' },\n { key: 'buildmyiq.paths.learnerCount', fallback: '{{count}} learners' }\n );\n"],"mappings":";AAgBA,IAAM,KACJ,GACA,GACA,GACA,MAEA,MAAU,IAAI,EAAG,EAAI,KAAK,EAAI,UAAU,EAAE,SAAM,CAAC,IAAI,EAAG,EAAM,KAAK,EAAM,UAAU,EAAE,SAAM,CAAC,GAGjF,KAAoB,GAAU,MACzC,EACE,GACA,GACA;CAAE,KAAK;CAAkC,UAAU;AAAmB,GACtE;CAAE,KAAK;CAA+B,UAAU;AAAoB,CACtE,GAGW,KAAqB,GAAU,MAC1C,EACE,GACA,GACA;CAAE,KAAK;CAAmC,UAAU;AAAoB,GACxE;CAAE,KAAK;CAAgC,UAAU;AAAqB,CACxE"}
|