Skip to content

Commit 93673ed

Browse files
committed
Set up app hydration
1 parent bdcf861 commit 93673ed

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

webpack/js/hydration.js

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
export const hydrateAppWithData = () => {
2+
window.skillSet = Array.from( // Convert back into an array
3+
new Set( // Remove duplicates
4+
Object.values(window.skills)
5+
.flat() // Combine all skills
6+
.map(skill => skill.split('/')[0]) // Keep only the prefix
7+
)
8+
)
9+
10+
window.className = {}
11+
window.labels.groups.forEach(group => {
12+
group.labels.forEach(label => {
13+
let name = label.name
14+
if (group.is_prefixed !== false) {
15+
name = `${group.name}: ${name}`
16+
}
17+
if (label.has_emoji_name !== false) {
18+
name = `${label.emoji} ${name}`
19+
}
20+
let styleName = label.color;
21+
if (/^[A-Z]+$/.test(styleName)) {
22+
styleName = `${group.name}-${styleName.toLocaleLowerCase()}`
23+
} else {
24+
styleName = group.name
25+
}
26+
window.className[name] = styleName
27+
})
28+
})
29+
window.labels.standalone.forEach(label => {
30+
let name = `${label.emoji} ${label.name}`
31+
window.className[name] = 'miscellaneous'
32+
})
33+
window.skillSet.forEach(skill => {
34+
let name = `💪 skill: ${skill.toLocaleLowerCase()}`
35+
window.className[name] = 'skill'
36+
})
37+
}

0 commit comments

Comments
 (0)