Skip to content

Commit c39d591

Browse files
committed
refactor: optimize type and css
1 parent a233df6 commit c39d591

1 file changed

Lines changed: 6 additions & 13 deletions

File tree

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

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,13 @@ definePageMeta({
1818
/** Number of flat items (headers + version rows) to render statically during SSR */
1919
const SSR_COUNT = 20
2020
21-
const route = useRoute()
21+
const route = useRoute('package-versions')
2222
2323
const packageName = computed(() => {
24-
const { org, name } = route.params as { org?: string; name: string }
25-
return org ? `${org}/${name}` : (name as string)
26-
})
27-
28-
const orgName = computed(() => {
29-
const name = packageName.value
30-
if (!name.startsWith('@')) return null
31-
const match = name.match(/^@([^/]+)\//)
32-
return match ? match[1] : null
24+
const { org, name } = route.params
25+
return org ? `${org}/${name}` : name
3326
})
27+
const orgName = computed(() => route.params.org?.replace('@', '') ?? null)
3428
3529
// ─── Phase 1: lightweight fetch (page load) ───────────────────────────────────
3630
// Fetches only version strings, dist-tags, and publish times — no deprecated/provenance metadata.
@@ -349,7 +343,7 @@ const selectedChangelogContent = computed(() => {
349343
<div v-else class="flex">
350344
<!-- Version list (grouped by major, virtualized) -->
351345
<div
352-
class="flex-1 min-w-0 border-y sm:border border-border sm:rounded-lg sm:overflow-hidden"
346+
class="flex-1 min-w-0 self-start border-y sm:border border-border sm:rounded-lg sm:overflow-hidden"
353347
>
354348
<ClientOnly>
355349
<WindowVirtualizer :data="flatItems">
@@ -507,7 +501,7 @@ const selectedChangelogContent = computed(() => {
507501
v-for="item in versionGroups.slice(0, SSR_COUNT)"
508502
:key="item.groupKey"
509503
type="button"
510-
class="flex items-center gap-3 px-4 py-2.5 w-full text-start border-b border-border"
504+
class="flex items-center gap-3 px-4 py-2.5 w-full text-start border-b border-border last:border-b-0"
511505
:aria-expanded="false"
512506
:aria-label="`Expand ${item.label}`"
513507
>
@@ -580,7 +574,6 @@ const selectedChangelogContent = computed(() => {
580574
</template>
581575

582576
<style scoped>
583-
/* Changelog panel prose styles — mirrors readme.vue conventions */
584577
.changelog-body {
585578
color: var(--fg-muted);
586579
line-height: 1.6;

0 commit comments

Comments
 (0)