@@ -3,10 +3,32 @@ const props = defineProps<{
33 score: PackageScore
44}>()
55
6+ const categoryLabels: Record <ScoreCategory , string > = {
7+ documentation: $t (' package.score.categories.documentation' ),
8+ maintenance: $t (' package.score.categories.maintenance' ),
9+ types: $t (' package.score.categories.types' ),
10+ bestPractices: $t (' package.score.categories.bestPractices' ),
11+ security: $t (' package.score.categories.security' ),
12+ }
13+
14+ const checkLabels: Record <string , string > = {
15+ ' has-readme' : $t (' package.score.checks.has-readme' ),
16+ ' has-description' : $t (' package.score.checks.has-description' ),
17+ ' update-frequency' : $t (' package.score.checks.update-frequency' ),
18+ ' has-types' : $t (' package.score.checks.has-types' ),
19+ ' has-license' : $t (' package.score.checks.has-license' ),
20+ ' has-repository' : $t (' package.score.checks.has-repository' ),
21+ ' has-provenance' : $t (' package.score.checks.has-provenance' ),
22+ ' has-esm' : $t (' package.score.checks.has-esm' ),
23+ ' no-vulnerabilities' : $t (' package.score.checks.no-vulnerabilities' ),
24+ ' not-deprecated' : $t (' package.score.checks.not-deprecated' ),
25+ }
26+
627const categories = computed (() => {
7- const order = [' documentation' , ' maintenance' , ' types' , ' bestPractices' , ' security' ] as const
28+ const order: ScoreCategory [] = [' documentation' , ' maintenance' , ' types' , ' bestPractices' , ' security' ]
829 return order .map (cat => ({
930 key: cat ,
31+ label: categoryLabels [cat ],
1032 checks: props .score .checks .filter (c => c .category === cat ),
1133 }))
1234})
@@ -67,7 +89,7 @@ const scoreLabel = computed(() =>
6789 <div class =" space-y-3" >
6890 <div v-for =" cat in categories" :key =" cat.key" >
6991 <h3 class =" text-2xs text-fg-subtle uppercase tracking-wider mb-1.5" >
70- {{ $t(`package.score.categories.${ cat.key}`) }}
92+ {{ cat.label }}
7193 </h3 >
7294 <ul class =" space-y-1 list-none m-0 p-0" >
7395 <li
@@ -87,7 +109,7 @@ const scoreLabel = computed(() =>
87109 aria-hidden =" true"
88110 />
89111 <span class =" flex-1 text-fg-muted" :class =" { 'text-fg-subtle': check.points === 0 }" >
90- {{ $t(`package.score.checks.${ check.id}`) }}
112+ {{ checkLabels[ check.id] }}
91113 </span >
92114 <span class =" font-mono text-2xs text-fg-subtle shrink-0" >
93115 {{ check.points }}/{{ check.maxPoints }}
0 commit comments