Files
gohoarder/frontend/src/lib/packages.ts
T
lukaszraczylo 64793f9c7e feat(ui): page, filter and sort packages on the server
The packages and security pages ask for one page of rows instead of the whole cache. Search is debounced, and the filters and sort stay in the URL.
2026-11-24 01:33:30 +00:00

13 lines
574 B
TypeScript

import type { RouteLocationRaw } from 'vue-router'
import type { Package } from '@/stores/packages'
import { displayVersion } from '@/lib/format'
/** Route of a package's full page. A name with slashes becomes the repeatable `name` segments. */
export function packageRoute(pkg: Pick<Package, 'registry' | 'name' | 'version'>): RouteLocationRaw {
return { name: 'package-details', params: { registry: pkg.registry, name: pkg.name.split('/'), version: pkg.version } }
}
export function packageLabel(pkg: Package): string {
return `${pkg.name} ${displayVersion(pkg)}`
}