Skip to content

Commit f4233b1

Browse files
committed
dynamic ID generation
1 parent 54f74e7 commit f4233b1

File tree

2 files changed

+43
-84
lines changed

2 files changed

+43
-84
lines changed

src/assets/Features.tsx

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
interface RawFeatureInterface {
2121
color?: string;
2222
icon?: ComponentType<SVGIconProps>;
23-
id: string;
2423
label: string;
2524
description?: JSX.Element;
2625
colorIcon?: ComponentType<SVGIconProps>;
@@ -30,11 +29,11 @@ interface RawFeatureInterface {
3029
export interface FeatureInterface {
3130
color: string;
3231
icon: ComponentType<SVGIconProps>;
33-
id: string;
3432
label: string;
3533
description: JSX.Element;
3634
colorIcon: ComponentType<SVGIconProps>;
3735
link?: string;
36+
id: string;
3837
}
3938

4039
type BrandKey =
@@ -94,7 +93,6 @@ const RawFeatures: RawFeaturesType = {
9493
</>
9594
),
9695
icon: Canvas.icon,
97-
id: "canvas_career",
9896
label: "Canvas Career",
9997
link: "https://instructure.com/canvas/canvas-career",
10098
},
@@ -109,7 +107,6 @@ const RawFeatures: RawFeaturesType = {
109107
</>
110108
),
111109
icon: Canvas.icon,
112-
id: "canvas_apps",
113110
label: "Canvas Apps",
114111
link: "https://www.instructure.com/k12/products/learnplatform",
115112
},
@@ -124,13 +121,11 @@ const RawFeatures: RawFeaturesType = {
124121
</>
125122
),
126123
icon: Canvas.icon,
127-
id: "canvas_modules",
128124
label: "Canvas Modules Redesign",
129125
},
130126
],
131127
IgniteAI: [
132128
{
133-
id: "ignite",
134129
label: "Ignite Agent",
135130
link: "http://instructure.com/ignite-ai",
136131
},
@@ -143,7 +138,6 @@ const RawFeatures: RawFeaturesType = {
143138
coverage.
144139
</>
145140
),
146-
id: "rubric_generator",
147141
label: "Canvas Rubric Generator",
148142
},
149143
{
@@ -155,7 +149,6 @@ const RawFeatures: RawFeaturesType = {
155149
instructors and facilitating personalized assessments for students.
156150
</>
157151
),
158-
id: "mastery_item_generator",
159152
label: "Mastery Connect Item Generator",
160153
},
161154
{
@@ -166,7 +159,6 @@ const RawFeatures: RawFeaturesType = {
166159
reports and automated remediation of issues in Canvas content.
167160
</>
168161
),
169-
id: "accessibility_remediation",
170162
label: "Content Accessibility Checker",
171163
},
172164
{
@@ -178,7 +170,6 @@ const RawFeatures: RawFeaturesType = {
178170
engagement at a glance.
179171
</>
180172
),
181-
id: "discussion_insights",
182173
label: "Canvas Discussion Insights",
183174
},
184175
{
@@ -190,7 +181,6 @@ const RawFeatures: RawFeaturesType = {
190181
videos for accessibility issues.
191182
</>
192183
),
193-
id: "studio_captioning",
194184
label: "Studio Caption Review",
195185
},
196186
{
@@ -208,7 +198,6 @@ const RawFeatures: RawFeaturesType = {
208198
</List>
209199
</>
210200
),
211-
id: "studio_translation",
212201
label: "Studio Caption Translation",
213202
},
214203
{
@@ -220,7 +209,6 @@ const RawFeatures: RawFeaturesType = {
220209
instructors and facilitating personalized assessments for students.
221210
</>
222211
),
223-
id: "canvas_quiz_generator",
224212
label: "Canvas Quizzes Item Generator",
225213
},
226214
],
@@ -238,7 +226,6 @@ const RawFeatures: RawFeaturesType = {
238226
</>
239227
),
240228
icon: Instructure.icon,
241-
id: "irn",
242229
label: "Instructure Research Network",
243230
},
244231
],
@@ -258,57 +245,48 @@ const RawFeatures: RawFeaturesType = {
258245
</>
259246
),
260247
icon: Studio.icon,
261-
id: "media_archiving",
262248
label: "Studio Archive & Restore",
263249
},
264250
{
265251
color: Canvas.color,
266252
colorIcon: Canvas.colorIcon,
267253
icon: Canvas.icon,
268-
id: "canvas_admin_experience",
269254
label: "Canvas Admin Experience",
270255
},
271256
{
272257
color: Canvas.color,
273258
colorIcon: Canvas.colorIcon,
274259
icon: Canvas.icon,
275-
id: "improved_lmgb",
276260
label: "Improved Learning Mastery Gradebook",
277261
},
278262
{
279263
color: Canvas.color,
280264
colorIcon: Canvas.colorIcon,
281265
icon: Canvas.icon,
282-
id: "canvas_portfolio",
283266
label: "Canvas Portfolios",
284267
},
285268
{
286-
id: "grading_assistance",
287269
label: "Grading Assistance",
288270
},
289271
{
290-
id: "translations",
291272
label: "Translations",
292273
},
293274
{
294275
color: Canvas.color,
295276
colorIcon: Canvas.colorIcon,
296277
icon: Canvas.icon,
297-
id: "block_editor",
298278
label: "Block Content Editor",
299279
},
300280
{
301281
color: Canvas.color,
302282
colorIcon: Canvas.colorIcon,
303283
icon: Canvas.icon,
304-
id: "peer_review",
305284
label: "Updated Peer Review",
306285
},
307286
{
308287
color: Canvas.color,
309288
colorIcon: Canvas.colorIcon,
310289
icon: Canvas.icon,
311-
id: "concurrent_grading",
312290
label: "Concurrent Grading",
313291
},
314292
],
@@ -318,12 +296,13 @@ const RawFeatures: RawFeaturesType = {
318296
const Features = Object.fromEntries(
319297
Object.entries(RawFeatures).map(([name, features]) => [
320298
name,
321-
[...features].map((feature) => ({
299+
features.map((feature) => ({
322300
...feature,
323301
color: feature.color ?? IgniteAI.color,
324302
colorIcon: feature.colorIcon ?? IgniteAI.colorIcon,
325303
description: feature.description ?? <React.Fragment />,
326304
icon: feature.icon ?? IgniteAI.icon,
305+
id: `${name}_${feature.label}`.toLowerCase().replace(/[^a-z0-9]/g, "_"),
327306
stage: name,
328307
})),
329308
]),

src/assets/Roles.tsx

Lines changed: 40 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -5,71 +5,51 @@ export interface Role {
55

66
export type RolesType = Record<string, Role[]>;
77

8-
const Roles: RolesType = {
8+
type RolesRawType = {
9+
[key: string]: string[];
10+
};
11+
12+
const RolesRaw: RolesRawType = {
913
Business: [
10-
{
11-
id: "chief_technology_officer",
12-
label: "Chief Product/Technology Officer",
13-
},
14-
{ id: "chief_learning_officer", label: "Chief Learning Officer" },
15-
{ id: "chief_people_officer", label: "Chief People Officer" },
16-
{ id: "chief_customer_officer", label: "Chief Customer Officer" },
17-
{ id: "vp_training", label: "VP of Training" },
18-
{ id: "vp_hr", label: "VP of Human Resources" },
19-
{ id: "dir_talend_dev", label: "Director of Talent Development" },
20-
{ id: "training_manager", label: "Training & Development Manager" },
21-
{ id: "dir_lnd", label: "Director of Learning & Development" },
22-
{ id: "dir_od", label: "Director of Organizational Development" },
23-
{ id: "head_of_learning", label: "Head of Learning" },
24-
{ id: "prod_mgr", label: "Product Manager" },
25-
{ id: "instructional_designer_biz", label: "Instructional Designer" },
26-
{ id: "dir_product", label: "Director of Product Management" },
27-
{ id: "dir_cust_training", label: "Director of Customer Training" },
28-
{ id: "other_biz", label: "Other" },
14+
"Chief Product/Technology Officer",
15+
"Chief Learning Officer",
16+
"Chief People Officer",
17+
"Chief Customer Officer",
18+
"VP of Training",
19+
"VP of Human Resources",
20+
"Director of Talent Development",
21+
"Training & Development Manager",
22+
"Director of Learning & Development",
23+
"Director of Organizational Development",
24+
"Head of Learning",
25+
"Product Manager",
26+
"Instructional Designer",
27+
"Director of Product Management",
28+
"Director of Customer Training",
29+
"Other",
2930
],
3031
Government: [],
31-
"Higher Education": [
32-
{
33-
id: "instructor",
34-
label: "Faculty / Instructor",
35-
},
36-
{
37-
id: "instructional_designer",
38-
label: "Instructional Designer",
39-
},
40-
],
32+
"Higher Education": ["Faculty / Instructor", "Instructional Designer"],
4133
"K-12 & Primary": [
42-
{
43-
id: "teacher",
44-
label: "Teacher",
45-
},
46-
{
47-
id: "tech_coach",
48-
label: "Technology Coach",
49-
},
50-
{
51-
id: "principal",
52-
label: "Principal",
53-
},
54-
{
55-
id: "superintendent",
56-
label: "Superintendent",
57-
},
58-
{
59-
id: "school_board",
60-
label: "School Board Member",
61-
},
62-
{
63-
id: "librarian",
64-
label: "Librarian",
65-
},
66-
],
67-
Other: [
68-
{
69-
id: "other",
70-
label: "Other",
71-
},
34+
"Teacher",
35+
"Technology Coach",
36+
"Principal",
37+
"Superintendent",
38+
"School Board Member",
39+
"Librarian",
7240
],
41+
Other: ["Other"],
7342
"Technical & Vocational": [],
7443
};
44+
45+
const Roles: RolesType = Object.fromEntries(
46+
Object.entries(RolesRaw).map(([category, roles]) => [
47+
category,
48+
roles.map((role) => ({
49+
id: `${category}_${role}`.toLowerCase().replace(/[^a-z0-9]/g, "_"),
50+
label: role,
51+
})),
52+
]),
53+
);
54+
7555
export default Roles;

0 commit comments

Comments
 (0)