Skip to content

Commit aaea9ee

Browse files
committed
showing skeleton loaders for changelog.
giving a msg when loading changelogs failed
1 parent 41e395f commit aaea9ee

4 files changed

Lines changed: 55 additions & 22 deletions

File tree

app/components/Changelog/Releases.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ watch(
5757
</script>
5858
<template>
5959
<div class="flex flex-col gap-2 py-3" v-if="releases">
60-
<ClientOnly>
61-
<ChangelogCard v-for="release of releases" :release :key="release.id" />
62-
</ClientOnly>
60+
<ChangelogCard v-for="release of releases" :release :key="release.id" />
6361
</div>
6462
</template>

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

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ definePageMeta({
55
name: 'changes',
66
path: '/package-changes/:path+',
77
alias: ['/package/changes/:path+', '/changes/:path+'],
8-
scrollMargin: 200,
8+
scrollMargin: 190,
99
})
1010
1111
/// routing
@@ -69,7 +69,7 @@ watch(
6969
)
7070
7171
// getting info
72-
const { data: changelog, pending } = usePackageChangelog(packageName, version)
72+
const { data: changelog, pending, error } = usePackageChangelog(packageName, version)
7373
7474
const repoProviderIcon = useProviderIcon(() => changelog.value?.provider)
7575
const tptoc = useTemplateRef('tptoc')
@@ -109,9 +109,9 @@ defineOgImageComponent('Default', {
109109
:resolved-version="version"
110110
:display-version="pkg?.requestedVersion"
111111
/>
112-
<section class="container w-full pt-3" v-if="!pending">
112+
<section class="container w-full pt-3">
113113
<div
114-
class="sticky top-[--combined-header-height] pa-3 z-2 flex justify-between gap-4"
114+
class="sticky top-[--combined-header-height] pa-3 z-2 flex justify-between gap-4 h-12"
115115
:class="$style.gitTocHeader"
116116
>
117117
<LinkBase
@@ -126,20 +126,39 @@ defineOgImageComponent('Default', {
126126
<!- prevents layout shift while loading ->
127127
</div>
128128
</div>
129-
130-
<LazyChangelogReleases
131-
v-if="changelog?.type == 'release'"
132-
:info="changelog"
133-
:requestedDate="versionDate"
134-
:requested-version="version || latestVersion?.version"
135-
/>
136-
<LazyChangelogMarkdown
137-
v-else-if="changelog?.type == 'md'"
138-
:info="changelog"
139-
:tpTarget="tptoc"
140-
:requested-version="version || latestVersion?.version"
141-
/>
142-
<p class="mt-5" v-else>{{ $t('changelog.no_logs') }}</p>
129+
<section v-if="pending" class="flex flex-col gap-2 py-3">
130+
<SkeletonBlock class="h-8 w-40 rounded" />
131+
<ul class="ms-3 list-disc my-[1rem] ps-[1.5rem] marker:color-[--border-hover]">
132+
<li class="mb-1" v-for="n in 5">
133+
<SkeletonBlock class="h-7 w-full max-w-2xl rounded" />
134+
</li>
135+
</ul>
136+
137+
<SkeletonBlock class="h-5 w-5/6 max-w-2xl rounded" />
138+
<SkeletonBlock class="h-5 w-3/4 max-w-2xl rounded" />
139+
</section>
140+
141+
<template v-else-if="!error">
142+
<LazyChangelogReleases
143+
v-if="changelog?.type == 'release'"
144+
:info="changelog"
145+
:requestedDate="versionDate"
146+
:requested-version="version || latestVersion?.version"
147+
/>
148+
<LazyChangelogMarkdown
149+
v-else-if="changelog?.type == 'md'"
150+
:info="changelog"
151+
:tpTarget="tptoc"
152+
:requested-version="version || latestVersion?.version"
153+
/>
154+
<p class="mt-5" v-else>{{ $t('changelog.no_logs') }}</p>
155+
</template>
156+
<section v-else class="flex items-center pa-3 flex-col text-lg gap-2">
157+
<p>{{ $t('changelog.error.p1', { package: pkg?.name }) }}</p>
158+
<i18n-t keypath="changelog.error.p2" tag="p" #viewon>
159+
<LinkBase :to="changelog?.link">{{ viewOnGit.toLowerCase() }}</LinkBase>
160+
</i18n-t>
161+
</section>
143162
</section>
144163
</main>
145164
</template>

i18n/locales/en.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1370,6 +1370,10 @@
13701370
"changelog": {
13711371
"pre_release": "Pre-release",
13721372
"draft": "Draft",
1373-
"no_logs": "Sorry, this package does not publish changelogs, or its changelog format is not supported."
1373+
"no_logs": "Sorry, this package does not publish changelogs, or its changelog format is not supported.",
1374+
"error": {
1375+
"p1": "Sorry, the changelogs for {package} couldn't be loaded",
1376+
"p2": "Please try again later or {viewon}"
1377+
}
13741378
}
13751379
}

i18n/schema.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4116,6 +4116,18 @@
41164116
},
41174117
"no_logs": {
41184118
"type": "string"
4119+
},
4120+
"error": {
4121+
"type": "object",
4122+
"properties": {
4123+
"p1": {
4124+
"type": "string"
4125+
},
4126+
"p2": {
4127+
"type": "string"
4128+
}
4129+
},
4130+
"additionalProperties": false
41194131
}
41204132
},
41214133
"additionalProperties": false

0 commit comments

Comments
 (0)