Skip to content

Commit 0ecdaac

Browse files
committed
Fix rollup rank description
1 parent 7868812 commit 0ecdaac

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

pages/rollup/rank/[slug].vue

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ const rollupRanking = computed(() => {
6565
const category = getMetricCategory(key, value / 100)
6666
ranking[key] = { category, score: value }
6767
68+
if (category.name.toLowerCase() === "offline") continue
69+
6870
description.push({
6971
text: getMetricDescription(key),
7072
category,
@@ -77,11 +79,20 @@ const rollupRanking = computed(() => {
7779
score: rawRanking.rank,
7880
}
7981
80-
description = sortArrayOfObjects(description, "category.rank", false).slice(0, 3)
81-
description[0].text += ", "
82-
description[1].text += " and "
83-
description[2].text += "."
84-
82+
if (description.length) {
83+
description = sortArrayOfObjects(description, "category.rank", false).slice(0, Math.min(3, description.length))
84+
if (description[2]?.text) {
85+
description[0].text += ", "
86+
description[1].text += " and "
87+
description[2].text += "."
88+
} else if (description[1]?.text) {
89+
description[0].text += " and "
90+
description[1].text += "."
91+
} else {
92+
description[0].text += "."
93+
}
94+
}
95+
8596
return {
8697
...rollupRaw,
8798
ranking,
@@ -428,7 +439,7 @@ onMounted(() => {
428439
</Flex>
429440
</Flex>
430441
431-
<Text size="13" color="primary" weight="600" :style="{ lineHeight: '1.4' }">
442+
<Text v-if="rollupRanking?.description.length" size="13" color="primary" weight="600" :style="{ lineHeight: '1.4' }">
432443
{{ rollup.name }}
433444
<Text weight="500" color="secondary">shows the </Text>
434445
<span v-for="d in rollupRanking?.description">
@@ -438,6 +449,10 @@ onMounted(() => {
438449
<Text weight="500" color="secondary"> {{ d.text }} </Text>
439450
</span>
440451
</Text>
452+
<Text v-else size="13" color="primary" weight="600" :style="{ lineHeight: '1.4' }">
453+
{{ rollup.name }}
454+
<Text weight="500" color="secondary"> is possible offline. </Text>
455+
</Text>
441456
</Flex>
442457
<div :class="$style.divider" />
443458

0 commit comments

Comments
 (0)