File tree Expand file tree Collapse file tree 3 files changed +10
-11
lines changed
Expand file tree Collapse file tree 3 files changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -22,13 +22,6 @@ const isSelected = computed<boolean>(() => {
2222 return isPackageSelected (props .result .package .name )
2323})
2424
25- function formatDownloads(count ? : number ): string {
26- if (count === undefined ) return ' -'
27- if (count >= 1_000_000 ) return ` ${(count / 1_000_000 ).toFixed (1 )}M `
28- if (count >= 1_000 ) return ` ${(count / 1_000 ).toFixed (1 )}K `
29- return count .toString ()
30- }
31-
3225function formatScore(value ? : number ): string {
3326 if (value === undefined || value === 0 ) return ' -'
3427 return Math .round (value * 100 ).toString ()
@@ -44,6 +37,8 @@ const allMaintainersText = computed(() => {
4437 if (! pkg .value .maintainers ?.length ) return ' '
4538 return pkg .value .maintainers .map (m => m .name || m .email ).join (' , ' )
4639})
40+
41+ const compactNumberFormatter = useCompactNumberFormatter ()
4742 </script >
4843
4944<template >
@@ -89,7 +84,11 @@ const allMaintainersText = computed(() => {
8984 v-if =" isColumnVisible('downloads')"
9085 class =" py-2 px-3 font-mono text-xs text-fg-muted text-end tabular-nums"
9186 >
92- {{ formatDownloads(result.downloads?.weekly) }}
87+ {{
88+ result.downloads?.weekly !== undefined
89+ ? compactNumberFormatter.format(result.downloads.weekly)
90+ : '-'
91+ }}
9392 </td >
9493
9594 <!-- Updated -->
Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ function handlePageSizeChange(event: Event) {
155155 @change =" handlePageSizeChange"
156156 :items ="
157157 PAGE_SIZE_OPTIONS.map(size => ({
158- label: $t('filters.pagination.per_page', { count: size }),
158+ label: $t('filters.pagination.per_page', { count: $n( size) }),
159159 value: String(size),
160160 }))
161161 "
@@ -207,7 +207,7 @@ function handlePageSizeChange(event: Event) {
207207 :aria-current =" page === currentPage ? 'page' : undefined"
208208 @click =" goToPage(page)"
209209 >
210- {{ page }}
210+ {{ $n( page) }}
211211 </button >
212212 </template >
213213
Original file line number Diff line number Diff line change @@ -809,7 +809,7 @@ onBeforeUnmount(() => {
809809 $t(
810810 'filters.count.showing_paginated',
811811 {
812- pageSize: Math.min(preferredPageSize, effectiveTotal),
812+ pageSize: $n( Math.min(preferredPageSize, effectiveTotal) ),
813813 count: $n(effectiveTotal),
814814 },
815815 effectiveTotal,
You can’t perform that action at this time.
0 commit comments