From 8041ddab65ff25355517ff967c5c490f9f8a64cf Mon Sep 17 00:00:00 2001 From: Zyy Date: Sat, 21 Nov 2026 10:55:06 +0800 Subject: [PATCH] refactor(frontend): consolidate chart, form, icon and proxy display rules Co-authored-by: Codex --- frontend/src/components/ProviderIconGroup.vue | 37 +-- frontend/src/components/schema-form/index.vue | 36 +-- .../proxies/components/ProxyBatchResults.vue | 72 +++-- .../composables/useProxyBatchTesting.ts | 14 +- frontend/src/views/proxies/utils/batch.ts | 20 ++ .../views/usage/components/UsageCostCard.vue | 265 +++++++----------- 6 files changed, 196 insertions(+), 248 deletions(-) diff --git a/frontend/src/components/ProviderIconGroup.vue b/frontend/src/components/ProviderIconGroup.vue index 0d7fb44b6..e254056a1 100644 --- a/frontend/src/components/ProviderIconGroup.vue +++ b/frontend/src/components/ProviderIconGroup.vue @@ -23,27 +23,12 @@ const providerIconComponent = computed(() => normalizedProvider.value : undefined) const authenticationIconComponent = computed(() => authenticationIcon(props.authenticationKind)) const showAuthenticationKind = computed(() => props.authenticationKind !== undefined) -const groupGapClass = computed(() => { - if (props.size === 'xs') - return 'gap-0.75' - return props.size === 'sm' - ? 'gap-1' - : 'gap-2' -}) -const iconContainerClass = computed(() => { - if (props.size === 'xs') - return 'size-4.5 rounded-md' - return props.size === 'sm' - ? 'size-5 rounded-md' - : 'size-7 rounded-lg' -}) -const iconClass = computed(() => { - if (props.size === 'xs') - return 'size-2.5' - return props.size === 'sm' - ? 'size-3' - : 'size-4' -}) +const sizeClasses = { + xs: { gap: 'gap-0.75', container: 'size-4.5 rounded-md', icon: 'size-2.5' }, + sm: { gap: 'gap-1', container: 'size-5 rounded-md', icon: 'size-3' }, + md: { gap: 'gap-2', container: 'size-7 rounded-lg', icon: 'size-4' }, +} +const classes = computed(() => sizeClasses[props.size]) const providerLabel = computed(() => formatProviderLabel(props.provider, t('common.providers.unknown'))) @@ -51,23 +36,23 @@ const authenticationLabel = computed(() => formatAuthenticationLabel(props.authe