-
-
Notifications
You must be signed in to change notification settings - Fork 184
/
Copy pathhydration.js
37 lines (36 loc) · 1.12 KB
/
hydration.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
export const hydrateAppWithData = () => {
window.skills = Array.from( // Convert back into an array
new Set( // Remove duplicates
Object.values(window.skills)
.flat() // Combine all skills
.map(skill => skill.split('/')[0]) // Keep only the prefix
)
)
window.categories = {}
window.labels.groups.forEach(group => {
group.labels.forEach(label => {
let name = label.name
if (group.is_prefixed !== false) {
name = `${group.name}: ${name}`
}
if (label.has_emoji_name !== false) {
name = `${label.emoji} ${name}`
}
let styleName = label.color;
if (/^[A-Z]+$/.test(styleName)) {
styleName = `${group.name}-${styleName.toLocaleLowerCase()}`
} else {
styleName = group.name
}
window.categories[name] = styleName
})
})
window.labels.standalone.forEach(label => {
let name = `${label.emoji} ${label.name}`
window.categories[name] = 'miscellaneous'
})
window.skills.forEach(skill => {
let name = `💪 skill: ${skill.toLocaleLowerCase()}`
window.categories[name] = 'skill'
})
}