Files
codex-proxy-rs/frontend/src/components/ProviderIconGroup.vue
T
zyycnandClaude ae46d89de6 refactor(web): consolidate the font-weight scale to four semantic tiers
Replace the nine ad-hoc arbitrary font weights (620-820, 208 usages) with a four-tier scale: font-emphasis (650) and font-heavy (760) as new theme tokens, plus the standard font-bold (700) and font-extrabold (800). Every merge moves a weight by at most 30 units, below the perceptible threshold for UI text sizes. The SystemUpdateModal release-notes scoped styles reference the same tokens. Arbitrary font-[N] classes are now zero across the codebase; the scale is documented in the theme block.

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-26 22:21:36 +08:00

77 lines
2.6 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
import { Key, Openai, Robot, Xai } from '@boxicons/vue'
import { computed } from 'vue'
import { providerDisplayName } from '@/utils/providers'
const props = withDefaults(
defineProps<{
provider?: string | null
authenticationKind?: string | null
size?: 'sm' | 'md'
}>(),
{
size: 'md',
},
)
const normalizedProvider = computed(() => (props.provider ?? '').trim().toLowerCase())
const normalizedAuthenticationKind = computed(() =>
(props.authenticationKind ?? '').trim().toLowerCase(),
)
const showAuthenticationKind = computed(() => props.authenticationKind !== undefined)
const groupGapClass = computed(() => (props.size === 'sm' ? 'gap-1' : 'gap-2'))
const iconContainerClass = computed(() =>
props.size === 'sm' ? 'size-5 rounded-md' : 'size-7 rounded-lg',
)
const iconClass = computed(() => (props.size === 'sm' ? 'size-3' : 'size-4'))
const providerLabel = computed(
() => providerDisplayName(normalizedProvider.value) ?? (props.provider?.trim() || '未知平台'),
)
const authenticationLabel = computed(() => {
if (normalizedAuthenticationKind.value === 'agent_identity')
return 'Agent Identity'
if (normalizedAuthenticationKind.value === 'oauth')
return 'OAuth'
return props.authenticationKind?.trim() || '未知认证类型'
})
</script>
<template>
<span class="inline-flex items-center whitespace-nowrap" :class="groupGapClass">
<span
class="inline-flex shrink-0 items-center justify-center bg-(--cp-bg-muted) text-(--cp-text-primary)"
:class="iconContainerClass"
:title="providerLabel"
>
<Openai v-if="normalizedProvider === 'openai'" :class="iconClass" aria-hidden="true" />
<Xai v-else-if="normalizedProvider === 'xai'" :class="iconClass" aria-hidden="true" />
<span v-else class="text-[10px] font-heavy text-(--cp-text-muted)">?</span>
</span>
<span
v-if="showAuthenticationKind"
class="inline-flex shrink-0 items-center justify-center bg-(--cp-bg-muted) text-(--cp-text-primary)"
:class="iconContainerClass"
:title="authenticationLabel"
>
<Key
v-if="normalizedAuthenticationKind === 'oauth'"
:class="iconClass"
aria-hidden="true"
/>
<Robot
v-else-if="normalizedAuthenticationKind === 'agent_identity'"
:class="iconClass"
aria-hidden="true"
/>
<span v-else class="text-[10px] font-heavy text-(--cp-text-muted)">?</span>
</span>
<span class="sr-only">
{{ providerLabel }}<template v-if="showAuthenticationKind">,{{ authenticationLabel }}</template>
</span>
</span>
</template>