2025-12-18 13:50:39 +08:00
|
|
|
<template>
|
|
|
|
|
<span
|
|
|
|
|
:class="[
|
|
|
|
|
'inline-flex items-center gap-1.5 px-2 py-0.5 rounded-md text-xs font-medium transition-colors',
|
2025-12-23 10:01:58 +08:00
|
|
|
badgeClass
|
2025-12-18 13:50:39 +08:00
|
|
|
]"
|
|
|
|
|
>
|
2025-12-23 10:01:58 +08:00
|
|
|
<!-- Platform logo -->
|
|
|
|
|
<PlatformIcon v-if="platform" :platform="platform" size="sm" />
|
|
|
|
|
<!-- Group name -->
|
2025-12-18 13:50:39 +08:00
|
|
|
<span class="truncate">{{ name }}</span>
|
2025-12-23 10:01:58 +08:00
|
|
|
<!-- Right side label: subscription shows "订阅", standard shows rate multiplier -->
|
2025-12-18 13:50:39 +08:00
|
|
|
<span
|
2025-12-23 10:01:58 +08:00
|
|
|
v-if="showRate"
|
|
|
|
|
:class="labelClass"
|
2025-12-18 13:50:39 +08:00
|
|
|
>
|
2025-12-23 10:01:58 +08:00
|
|
|
{{ labelText }}
|
2025-12-18 13:50:39 +08:00
|
|
|
</span>
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { computed } from 'vue'
|
2025-12-23 10:01:58 +08:00
|
|
|
import { useI18n } from 'vue-i18n'
|
|
|
|
|
import type { SubscriptionType, GroupPlatform } from '@/types'
|
|
|
|
|
import PlatformIcon from './PlatformIcon.vue'
|
2025-12-18 13:50:39 +08:00
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
|
name: string
|
2025-12-23 10:01:58 +08:00
|
|
|
platform?: GroupPlatform
|
2025-12-18 13:50:39 +08:00
|
|
|
subscriptionType?: SubscriptionType
|
|
|
|
|
rateMultiplier?: number
|
|
|
|
|
showRate?: boolean
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const props = withDefaults(defineProps<Props>(), {
|
|
|
|
|
subscriptionType: 'standard',
|
|
|
|
|
showRate: true
|
|
|
|
|
})
|
|
|
|
|
|
2025-12-23 10:01:58 +08:00
|
|
|
const { t } = useI18n()
|
|
|
|
|
|
2025-12-18 13:50:39 +08:00
|
|
|
const isSubscription = computed(() => props.subscriptionType === 'subscription')
|
2025-12-23 10:01:58 +08:00
|
|
|
|
|
|
|
|
// Label text: subscription shows localized text, standard shows rate
|
|
|
|
|
const labelText = computed(() => {
|
|
|
|
|
if (isSubscription.value) {
|
|
|
|
|
return t('groups.subscription')
|
|
|
|
|
}
|
|
|
|
|
return props.rateMultiplier !== undefined ? `${props.rateMultiplier}x` : ''
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// Label style based on type
|
|
|
|
|
const labelClass = computed(() => {
|
|
|
|
|
const base = 'px-1.5 py-0.5 rounded text-[10px] font-semibold'
|
|
|
|
|
if (isSubscription.value) {
|
|
|
|
|
// Subscription: more prominent style with border
|
|
|
|
|
if (props.platform === 'anthropic') {
|
|
|
|
|
return `${base} bg-orange-200/60 text-orange-800 dark:bg-orange-800/40 dark:text-orange-300`
|
|
|
|
|
} else if (props.platform === 'openai') {
|
|
|
|
|
return `${base} bg-emerald-200/60 text-emerald-800 dark:bg-emerald-800/40 dark:text-emerald-300`
|
|
|
|
|
}
|
|
|
|
|
return `${base} bg-violet-200/60 text-violet-800 dark:bg-violet-800/40 dark:text-violet-300`
|
|
|
|
|
}
|
|
|
|
|
// Standard: subtle background
|
|
|
|
|
return `${base} bg-black/10 dark:bg-white/10`
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// Badge color based on platform and subscription type
|
|
|
|
|
const badgeClass = computed(() => {
|
|
|
|
|
if (props.platform === 'anthropic') {
|
|
|
|
|
// Claude: orange theme
|
|
|
|
|
return isSubscription.value
|
|
|
|
|
? 'bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400'
|
|
|
|
|
: 'bg-amber-50 text-amber-700 dark:bg-amber-900/20 dark:text-amber-400'
|
|
|
|
|
} else if (props.platform === 'openai') {
|
|
|
|
|
// OpenAI: green theme
|
|
|
|
|
return isSubscription.value
|
|
|
|
|
? 'bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400'
|
|
|
|
|
: 'bg-green-50 text-green-700 dark:bg-green-900/20 dark:text-green-400'
|
|
|
|
|
}
|
|
|
|
|
// Fallback: original colors
|
|
|
|
|
return isSubscription.value
|
|
|
|
|
? 'bg-violet-100 text-violet-700 dark:bg-violet-900/30 dark:text-violet-400'
|
|
|
|
|
: 'bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400'
|
|
|
|
|
})
|
2025-12-18 13:50:39 +08:00
|
|
|
</script>
|