Refactor package types and improve filter handling

Switch to API schema-defined types for package properties, replacing custom typings for consistency. Streamline filter initialization, validation, and URL parameter handling, while adding safeguards for null values. Simplify components by removing unused exports and types.
This commit is contained in:
2025-05-04 23:32:51 +02:00
parent 3886c7bcbd
commit 7445919003
7 changed files with 45 additions and 37 deletions

View File

@@ -1,4 +1,4 @@
import { type Package } from '@/types/Package'
import { components } from '@/api'
export function usePackageDisplay() {
const repoName = (repo: string) => repo.split('-')[0]
@@ -17,7 +17,7 @@ export function usePackageDisplay() {
}
}
const getStatusColor = (status: Package['status']) => {
const getStatusColor = (status: components['schemas']['Package']['status']) => {
switch (status) {
case 'skipped':
return '#373737'
@@ -38,7 +38,7 @@ export function usePackageDisplay() {
}
}
const getLto = (lto: Package['lto']) => {
const getLto = (lto: components['schemas']['Package']['lto']) => {
switch (lto) {
case 'enabled':
return {
@@ -65,7 +65,7 @@ export function usePackageDisplay() {
}
}
const getDs = (ds: Package['debug_symbols']) => {
const getDs = (ds: components['schemas']['Package']['debug_symbols']) => {
switch (ds) {
case 'available':
return {