Skip to content

Commit 2c057b9

Browse files
committed
Added button to view changelog/releases on the provider website.
changed the view_on_npm to view_on with {site}
1 parent 6198a71 commit 2c057b9

60 files changed

Lines changed: 106 additions & 96 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/composables/useProviderIcon.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import type { IconClass } from '~/types/icon'
2+
3+
const PROVIDER_ICONS: Record<string, IconClass> = {
4+
github: 'i-simple-icons:github',
5+
gitlab: 'i-simple-icons:gitlab',
6+
bitbucket: 'i-simple-icons:bitbucket',
7+
codeberg: 'i-simple-icons:codeberg',
8+
gitea: 'i-simple-icons:gitea',
9+
forgejo: 'i-simple-icons:forgejo',
10+
gitee: 'i-simple-icons:gitee',
11+
sourcehut: 'i-simple-icons:sourcehut',
12+
tangled: 'i-custom:tangled',
13+
radicle: 'i-lucide:network', // Radicle is a P2P network, using network icon
14+
}
15+
16+
export function useProviderIcon(provider: MaybeRefOrGetter<ProviderId | null | undefined>) {
17+
return computed((): IconClass => {
18+
const uProvider = toValue(provider)
19+
if (!uProvider) return 'i-simple-icons:github'
20+
return PROVIDER_ICONS[uProvider] ?? 'i-lucide:code'
21+
})
22+
}

app/pages/org/[org].vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ defineOgImageComponent('Default', {
180180
target="_blank"
181181
rel="noopener noreferrer"
182182
class="link-subtle font-mono text-sm inline-flex items-center gap-1.5"
183-
:title="$t('common.view_on_npm')"
183+
:title="$t('common.view_on', { site: 'npm' })"
184184
>
185185
<span class="i-simple-icons:npm w-4 h-4" aria-hidden="true" />
186186
npm

app/pages/package-changes/[...path].vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<script setup lang="ts">
2+
import { useProviderIcon } from '~/composables/useProviderIcon'
3+
24
definePageMeta({
35
name: 'changes',
46
path: '/package-changes/:path+',
@@ -63,9 +65,9 @@ watch(
6365
)
6466
6567
// getting info
66-
6768
const { data: changelog, pending } = usePackageChangelog(packageName, version)
6869
70+
const repoProviderIcon = useProviderIcon(() => changelog.value?.provider)
6971
const header = useTemplateRef('header')
7072
</script>
7173
<template>
@@ -90,6 +92,14 @@ const header = useTemplateRef('header')
9092
:url-pattern="versionUrlPattern"
9193
/>
9294
<div class="flex-1"></div>
95+
<LinkBase
96+
v-if="changelog?.link"
97+
:to="changelog?.link"
98+
:classicon="repoProviderIcon"
99+
:title="$t('common.view_on', { site: changelog.provider })"
100+
>
101+
{{ changelog.provider }}
102+
</LinkBase>
93103
</div>
94104
</div>
95105
</header>

app/pages/package/[[org]]/[name].vue

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import type {
99
SkillsListResponse,
1010
} from '#shared/types'
1111
import type { JsrPackageInfo } from '#shared/types/jsr'
12-
import type { IconClass } from '~/types'
1312
import { assertValidPackageName } from '#shared/utils/npm'
1413
import { joinURL } from 'ufo'
1514
import { areUrlsEquivalent } from '#shared/utils/url'
@@ -18,6 +17,7 @@ import { getDependencyCount } from '~/utils/npm/dependency-count'
1817
import { detectPublishSecurityDowngradeForVersion } from '~/utils/publish-security'
1918
import { useModal } from '~/composables/useModal'
2019
import { useAtproto } from '~/composables/atproto/useAtproto'
20+
import { useProviderIcon } from '~/composables/useProviderIcon'
2121
import { togglePackageLike } from '~/utils/atproto/likes'
2222
import type { RouteLocationRaw } from 'vue-router'
2323
@@ -398,24 +398,7 @@ const repositoryUrl = computed(() => {
398398
399399
const { meta: repoMeta, repoRef, stars, starsLink, forks, forksLink } = useRepoMeta(repositoryUrl)
400400
401-
const PROVIDER_ICONS: Record<string, IconClass> = {
402-
github: 'i-simple-icons:github',
403-
gitlab: 'i-simple-icons:gitlab',
404-
bitbucket: 'i-simple-icons:bitbucket',
405-
codeberg: 'i-simple-icons:codeberg',
406-
gitea: 'i-simple-icons:gitea',
407-
forgejo: 'i-simple-icons:forgejo',
408-
gitee: 'i-simple-icons:gitee',
409-
sourcehut: 'i-simple-icons:sourcehut',
410-
tangled: 'i-custom:tangled',
411-
radicle: 'i-lucide:network', // Radicle is a P2P network, using network icon
412-
}
413-
414-
const repoProviderIcon = computed((): IconClass => {
415-
const provider = repoRef.value?.provider
416-
if (!provider) return 'i-simple-icons:github'
417-
return PROVIDER_ICONS[provider] ?? 'i-lucide:code'
418-
})
401+
const repoProviderIcon = useProviderIcon(() => repoRef.value?.provider)
419402
420403
const homepageUrl = computed(() => {
421404
const homepage = displayVersion.value?.homepage
@@ -928,7 +911,7 @@ const showSkeleton = shallowRef(false)
928911
<li>
929912
<LinkBase
930913
:to="`https://www.npmjs.com/package/${pkg.name}`"
931-
:title="$t('common.view_on_npm')"
914+
:title="$t('common.view_on', { site: 'npm' })"
932915
classicon="i-simple-icons:npm"
933916
>
934917
npm

app/pages/~[username]/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ defineOgImageComponent('Default', {
156156
target="_blank"
157157
rel="noopener noreferrer"
158158
class="link-subtle font-mono text-sm inline-flex items-center gap-1.5"
159-
:title="$t('common.view_on_npm')"
159+
:title="$t('common.view_on', { site: 'npm' })"
160160
>
161161
<span class="i-simple-icons:npm w-4 h-4" aria-hidden="true" />
162162
npm

i18n/locales/ar.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
"skip_link": "تخطي إلى المحتوى الرئيسي",
133133
"warnings": "تحذيرات:",
134134
"go_back_home": "العودة إلى الصفحة الرئيسية",
135-
"view_on_npm": "عرض على npm",
135+
"view_on": "عرض على {site}",
136136
"per_week": "/ أسبوع",
137137
"vanity_downloads_hint": "رقم زخرفي: لا توجد حزم معروضة | رقم زخرفي: للحزمة المعروضة | رقم زخرفي: للحزمتين المعروضتين | رقم زخرفي: مجموع {count} من الحزم المعروضة | رقم زخرفي: مجموع {count} من الحزم المعروضة | رقم زخرفي: مجموع {count} من الحزم المعروضة",
138138
"sort": {

i18n/locales/az-AZ.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
"skip_link": "Əsas məzmuna keç",
9393
"warnings": "Xəbərdarlıqlar:",
9494
"go_back_home": "Ana səhifəyə qayıt",
95-
"view_on_npm": "npm-də bax",
95+
"view_on": "{site}-də bax",
9696
"per_week": "/ həftə",
9797
"sort": {
9898
"name": "ad",

i18n/locales/bg-BG.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
"skip_link": "Преминаване към основното съдържание",
133133
"warnings": "Предупреждения:",
134134
"go_back_home": "Назад към начална страница",
135-
"view_on_npm": "преглед в npm",
135+
"view_on": "преглед в {site}",
136136
"per_week": "/ седмица",
137137
"vanity_downloads_hint": "Брой за показ: няма показани пакети | Брой за показ: за показания пакет | Брой за показ: Сума от {count} показани пакета",
138138
"sort": {

i18n/locales/bn-IN.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
"skip_link": "মুখ্য কন্টেন্টে যান",
100100
"warnings": "সতর্কতা:",
101101
"go_back_home": "হোমে ফিরে যান",
102-
"view_on_npm": "npm এ দেখুন",
102+
"view_on": "{site} এ দেখুন",
103103
"per_week": "/ সপ্তাহ",
104104
"vanity_downloads_hint": "ভ্যানিটি নম্বর: কোন প্যাকেজ প্রদর্শিত হয়নি | ভ্যানিটি নম্বর: প্রদর্শিত প্যাকেজের জন্য | ভ্যানিটি নম্বর: {count} প্রদর্শিত প্যাকেজের মোট",
105105
"sort": {

i18n/locales/cs-CZ.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
"skip_link": "Přejít na hlavní obsah",
133133
"warnings": "Varování:",
134134
"go_back_home": "Zpět na začátek",
135-
"view_on_npm": "Zobrazit na npm",
135+
"view_on": "Zobrazit na {site}",
136136
"per_week": "/ týden",
137137
"vanity_downloads_hint": "Pro zobrazený balíček | Součet pro {count} zobrazené balíčky | Součet pro {count} zobrazených balíčků",
138138
"sort": {

0 commit comments

Comments
 (0)