Skip to content

Commit 8c319e4

Browse files
committed
Fix rollups category displaying
1 parent 5f30548 commit 8c319e4

File tree

2 files changed

+31
-10
lines changed

2 files changed

+31
-10
lines changed

pages/rollups.vue

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,19 @@ const categories = computed(() => {
9595
9696
return res
9797
})
98+
const getCategoryDisplayName = (category) => {
99+
switch (category) {
100+
case 'nft':
101+
return 'NFT'
102+
103+
case 'uncategorized':
104+
return 'Other'
105+
106+
default:
107+
return capitilize(category)
108+
}
109+
}
110+
98111
const filters = reactive({
99112
categories: categories.value?.reduce((a, b) => ({ ...a, [b]: false }), {}),
100113
})
@@ -279,7 +292,7 @@ watch(
279292
<Text size="12" weight="600" color="primary" style="text-transform: capitalize">
280293
{{ Object.keys(filters.categories)
281294
.filter((c) => filters.categories[c])
282-
.map(c => c === 'nft' ? c.toUpperCase() : capitilize(c))
295+
.map(c => getCategoryDisplayName(c))
283296
.join(", ")
284297
}}
285298
</Text>
@@ -298,7 +311,7 @@ watch(
298311
v-model="filters.categories[c]"
299312
>
300313
<Text size="12" weight="500" color="primary">
301-
{{ c === 'nft' ? c.toUpperCase() : capitilize(c) }}
314+
{{ getCategoryDisplayName(c) }}
302315
</Text>
303316
</Checkbox>
304317
</Flex>
@@ -417,7 +430,7 @@ watch(
417430
<td>
418431
<NuxtLink :to="`/rollup/${r.slug}`">
419432
<Flex align="center">
420-
<Text size="13" weight="600" color="primary"> {{ r.category === 'nft' ? r.category.toUpperCase() : capitilize(r.category) }} </Text>
433+
<Text size="13" weight="600" color="primary"> {{ getCategoryDisplayName(r.category) }} </Text>
421434
</Flex>
422435
</NuxtLink>
423436
</td>

pages/widgets/rollups.vue

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,19 @@ const categories = computed(() => {
9191
})
9292
const selectedCategories = ref([])
9393
94+
const getCategoryDisplayName = (category) => {
95+
switch (category) {
96+
case 'nft':
97+
return 'NFT'
98+
99+
case 'uncategorized':
100+
return 'Other'
101+
102+
default:
103+
return capitilize(category)
104+
}
105+
}
106+
94107
const handleSelectCategory = (category) => {
95108
if (selectedCategories.value.includes(category)) {
96109
selectedCategories.value = selectedCategories.value.filter(c => c !== category)
@@ -232,7 +245,7 @@ watch(
232245
:class="[$style.chip, selectedCategories.includes(c) && $style.active]"
233246
>
234247
<Flex align="center" :class="$style.content">
235-
<Text size="12" weight="600" color="primary"> {{ c === 'nft' ? c.toUpperCase() : capitilize(c) }} </Text>
248+
<Text size="12" weight="600" color="primary"> {{ getCategoryDisplayName(c) }} </Text>
236249
</Flex>
237250
</Flex>
238251
@@ -346,12 +359,7 @@ watch(
346359
<Flex align="center" :class="$style.chip" :style="{ borderRadius: '8px' }">
347360
<Flex align="center" :class="$style.content" :style="{ padding: '4px 8px' }">
348361
<Text size="12" color="tertiary">
349-
{{ r.category === 'nft'
350-
? r.category.toUpperCase()
351-
: r.category === 'uncategorized'
352-
? 'Other'
353-
: capitilize(r.category)
354-
}}
362+
{{ getCategoryDisplayName(r.category) }}
355363
</Text>
356364
</Flex>
357365
</Flex>

0 commit comments

Comments
 (0)