|
1 | | -<script setup lang="ts"> |
| 1 | +<script setup lang="ts"> |
2 | 2 | interface HealthScoreDimension { |
3 | 3 | score: number |
4 | 4 | weight: number |
@@ -58,13 +58,13 @@ function scoreBarColor(score: number): string { |
58 | 58 | } |
59 | 59 |
|
60 | 60 | const dimensions = computed(() => { |
61 | | - if (!data.value) return [] |
| 61 | + if (!data.value?.dimensions) return [] |
62 | 62 | const d = data.value.dimensions |
63 | 63 | return [ |
64 | | - { key: 'maintenance', label: $t('package.health_score.dimension_maintenance'), score: d.maintenance.score, weight: d.maintenance.weight }, |
65 | | - { key: 'quality', label: $t('package.health_score.dimension_quality'), score: d.quality.score, weight: d.quality.weight }, |
66 | | - { key: 'security', label: $t('package.health_score.dimension_security'), score: d.security.score, weight: d.security.weight }, |
67 | | - { key: 'popularity', label: $t('package.health_score.dimension_popularity'), score: d.popularity.score, weight: d.popularity.weight }, |
| 64 | + { key: 'maintenance', label: $t('package.health_score.dimension_maintenance'), score: d.maintenance?.score ?? 0, weight: d.maintenance?.weight ?? 0 }, |
| 65 | + { key: 'quality', label: $t('package.health_score.dimension_quality'), score: d.quality?.score ?? 0, weight: d.quality?.weight ?? 0 }, |
| 66 | + { key: 'security', label: $t('package.health_score.dimension_security'), score: d.security?.score ?? 0, weight: d.security?.weight ?? 0 }, |
| 67 | + { key: 'popularity', label: $t('package.health_score.dimension_popularity'), score: d.popularity?.score ?? 0, weight: d.popularity?.weight ?? 0 }, |
68 | 68 | ] |
69 | 69 | }) |
70 | 70 | </script> |
@@ -147,7 +147,7 @@ const dimensions = computed(() => { |
147 | 147 |
|
148 | 148 | <!-- Footer link --> |
149 | 149 | <a |
150 | | - :href="`https://npm-pulse.vercel.app/api/v1/score/${packageName}`" |
| 150 | + :href="`https://npm-pulse.vercel.app/api/v1/score/${props.packageName}`" |
151 | 151 | target="_blank" |
152 | 152 | rel="noopener noreferrer" |
153 | 153 | class="inline-flex items-center gap-1 text-xs text-fg-subtle hover:text-fg transition-colors duration-150 underline underline-offset-2 decoration-fg-subtle/40" |
|
0 commit comments