[READ-ONLY] a fast, modern browser for the npm registry
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: add community adoption distribution link in Versions.vue (#687)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Daniel Roe <daniel@roe.dev>

+27 -12
+12
app/components/Package/Versions.vue
··· 306 306 :title="$t('package.versions.title')" 307 307 id="versions" 308 308 > 309 + <template #actions> 310 + <a 311 + :href="`https://majors.nullvoxpopuli.com/q?packages=${packageName}`" 312 + target="_blank" 313 + rel="noopener noreferrer" 314 + class="text-fg-subtle hover:text-fg transition-colors duration-200 inline-flex items-center justify-center min-w-6 min-h-6 -m-1 p-1" 315 + :title="$t('package.downloads.community_distribution')" 316 + > 317 + <span class="i-carbon:load-balancer-network w-3.5 h-3.5" aria-hidden="true" /> 318 + <span class="sr-only">{{ $t('package.downloads.community_distribution') }}</span> 319 + </a> 320 + </template> 309 321 <div class="space-y-0.5 min-w-0"> 310 322 <!-- Dist-tag rows (limited to MAX_VISIBLE_TAGS) --> 311 323 <div v-for="row in visibleTagRows" :key="row.id">
+1
i18n/locales/en.json
··· 272 272 "date_range": "{start} to {end}", 273 273 "date_range_multiline": "{start}\nto {end}", 274 274 "analyze": "Analyze downloads", 275 + "community_distribution": "View community adoption distribution", 275 276 "modal_title": "Downloads", 276 277 "granularity": "Granularity", 277 278 "granularity_daily": "Daily",
+1
lunaria/files/en-GB.json
··· 272 272 "date_range": "{start} to {end}", 273 273 "date_range_multiline": "{start}\nto {end}", 274 274 "analyze": "Analyze downloads", 275 + "community_distribution": "View community adoption distribution", 275 276 "modal_title": "Downloads", 276 277 "granularity": "Granularity", 277 278 "granularity_daily": "Daily",
+1
lunaria/files/en-US.json
··· 272 272 "date_range": "{start} to {end}", 273 273 "date_range_multiline": "{start}\nto {end}", 274 274 "analyze": "Analyze downloads", 275 + "community_distribution": "View community adoption distribution", 275 276 "modal_title": "Downloads", 276 277 "granularity": "Granularity", 277 278 "granularity_daily": "Daily",
+12 -12
test/nuxt/components/PackageVersions.spec.ts
··· 73 73 }, 74 74 }) 75 75 76 - // Find version links (exclude anchor links that start with #) 76 + // Find version links (exclude anchor links that start with # and external links) 77 77 const versionLinks = component 78 78 .findAll('a') 79 - .filter(a => !a.attributes('href')?.startsWith('#')) 79 + .filter(a => !a.attributes('href')?.startsWith('#') && a.attributes('target') !== '_blank') 80 80 expect(versionLinks.length).toBeGreaterThan(0) 81 81 expect(versionLinks[0]?.text()).toBe('2.0.0') 82 82 }) ··· 93 93 }, 94 94 }) 95 95 96 - // Find version links (exclude anchor links that start with #) 96 + // Find version links (exclude anchor links that start with # and external links) 97 97 const versionLinks = component 98 98 .findAll('a') 99 - .filter(a => !a.attributes('href')?.startsWith('#')) 99 + .filter(a => !a.attributes('href')?.startsWith('#') && a.attributes('target') !== '_blank') 100 100 expect(versionLinks.length).toBeGreaterThan(0) 101 101 expect(versionLinks[0]?.text()).toBe('1.0.0') 102 102 }) ··· 187 187 }, 188 188 }) 189 189 190 - // Find version links (exclude anchor links that start with #) 190 + // Find version links (exclude anchor links that start with # and external links) 191 191 const versionLinks = component 192 192 .findAll('a') 193 - .filter(a => !a.attributes('href')?.startsWith('#')) 193 + .filter(a => !a.attributes('href')?.startsWith('#') && a.attributes('target') !== '_blank') 194 194 const versions = versionLinks.map(l => l.text()) 195 195 // Should be sorted by version descending 196 196 expect(versions[0]).toBe('2.0.0') ··· 210 210 }, 211 211 }) 212 212 213 - // Find version links (exclude anchor links that start with #) 213 + // Find version links (exclude anchor links that start with # and external links) 214 214 const versionLinks = component 215 215 .findAll('a') 216 - .filter(a => !a.attributes('href')?.startsWith('#')) 216 + .filter(a => !a.attributes('href')?.startsWith('#') && a.attributes('target') !== '_blank') 217 217 expect(versionLinks.length).toBeGreaterThan(0) 218 218 expect(versionLinks[0]?.classes()).toContain('text-red-400') 219 219 }) ··· 230 230 }, 231 231 }) 232 232 233 - // Find version links (exclude anchor links that start with #) 233 + // Find version links (exclude anchor links that start with # and external links) 234 234 const versionLinks = component 235 235 .findAll('a') 236 - .filter(a => !a.attributes('href')?.startsWith('#')) 236 + .filter(a => !a.attributes('href')?.startsWith('#') && a.attributes('target') !== '_blank') 237 237 expect(versionLinks.length).toBeGreaterThan(0) 238 238 expect(versionLinks[0]?.attributes('title')).toContain('deprecated') 239 239 }) ··· 562 562 }, 563 563 }) 564 564 565 - // Count visible version links (excluding anchor links that start with #) 565 + // Count visible version links (excluding anchor links that start with # and external links) 566 566 const visibleLinks = component 567 567 .findAll('a') 568 - .filter(a => !a.attributes('href')?.startsWith('#')) 568 + .filter(a => !a.attributes('href')?.startsWith('#') && a.attributes('target') !== '_blank') 569 569 // Should have max 10 visible links in the main section 570 570 expect(visibleLinks.length).toBeLessThanOrEqual(10) 571 571 })