14221422 :id =" getGroupSelectorPopoverId(groupSelectorKeyId)"
14231423 ref =" dropdownRef"
14241424 :data-ui-skin =" uiSkin"
1425- class =" data-teleport-panel animate-in fade-in slide-in-from-top-2 fixed z-[100000020] flex max-h-[calc(100dvh-2rem)] min-w-0 w-[calc(100vw-2rem)] max-w-[380px ] flex-col duration-200"
1425+ class =" data-teleport-panel animate-in fade-in slide-in-from-top-2 fixed z-[100000020] flex max-h-[calc(100dvh-2rem)] min-w-0 w-[min(34rem, calc(100vw-2rem)) ] flex-col duration-200"
14261426 style =" pointer-events : auto !important ;"
14271427 role =" dialog"
14281428 :aria-label =" t('keys.groupSelectorLabel')"
14521452 @click.stop
14531453 />
14541454 </div >
1455+ <div class =" mt-2 flex items-center gap-1 overflow-x-auto pb-0.5" role =" tablist" :aria-label =" t('keys.groupSelectorLabel')" >
1456+ <button
1457+ v-for =" platform in groupPlatforms"
1458+ :key =" platform.value || 'all'"
1459+ type =" button"
1460+ role =" tab"
1461+ :aria-selected =" activeGroupPlatform === platform.value"
1462+ :class =" [
1463+ 'inline-flex min-h-8 shrink-0 items-center gap-1.5 rounded-lg px-2.5 text-xs font-medium transition-colors',
1464+ activeGroupPlatform === platform.value
1465+ ? 'bg-brand-soft text-brand'
1466+ : 'text-content-muted hover:bg-surface-muted hover:text-content'
1467+ ]"
1468+ @click =" activeGroupPlatform = platform.value"
1469+ >
1470+ <PlatformIcon v-if =" platform .value " :platform =" platform .value " size="xs" />
1471+ <span >{{ platform.label }}</span >
1472+ <span class =" rounded-full bg-black/5 px-1.5 py-0.5 text-[10px] dark:bg-white/10" >{{ platform.count }}</span >
1473+ </button >
1474+ </div >
14551475 </div >
14561476 <!-- Group list -->
14571477 <div
@@ -1536,6 +1556,7 @@ import TablePageLayout from '@/components/layout/TablePageLayout.vue'
15361556 import GroupBadge from ' @/components/common/GroupBadge.vue'
15371557 import GroupApiKeyBadge from ' @/components/common/GroupApiKeyBadge.vue'
15381558 import GroupOptionItem from ' @/components/common/GroupOptionItem.vue'
1559+ import PlatformIcon from ' @/components/common/PlatformIcon.vue'
15391560 import type {
15401561 ApiKey ,
15411562 ApiKeyGroupBadgeType ,
@@ -1551,6 +1572,7 @@ import type { BatchApiKeyUsageStats } from '@/api/usage'
15511572import type { AccountShareAPIKeyBindingStatus } from ' @/api/accountShare'
15521573import { formatDateTime } from ' @/utils/format'
15531574import { maskApiKey } from ' @/utils/maskApiKey'
1575+ import { displayText } from ' @/utils/displayText'
15541576import { buildCcSwitchImportDeeplink } from ' @/utils/ccswitchImport'
15551577import { buildImagePlaygroundImportUrl } from ' @/utils/imagePlaygroundImport'
15561578import { extractApiErrorCode , extractApiErrorMessage , isAbortError } from ' @/utils/apiError'
@@ -2012,8 +2034,8 @@ const groupOptions = computed<GroupOption[]>(() =>
20122034 const fallbackUserRate = userGroupRates .value [group .id ] ?? null
20132035 return {
20142036 value: group .id ,
2015- label: group .name ,
2016- description: group .description ,
2037+ label: displayText ( group .name ) ,
2038+ description: displayText ( group .description ) ,
20172039 rate: group .rate_multiplier ,
20182040 userRate: fallbackUserRate ,
20192041 effectiveRate: group .effective_rate_multiplier ?? fallbackUserRate ,
@@ -2176,11 +2198,29 @@ const groupRoutingChanged = (
21762198
21772199// Group dropdown search
21782200const groupSearchQuery = ref (' ' )
2201+ const activeGroupPlatform = ref <GroupPlatform | null >(null )
2202+ const groupPlatforms = computed (() => {
2203+ const platforms = Array .from (new Set (groupOptions .value .map ((option ) => option .platform )))
2204+ return [
2205+ {
2206+ value: null as GroupPlatform | null ,
2207+ label: t (' admin.groups.platforms.all' ),
2208+ count: groupOptions .value .length
2209+ },
2210+ ... platforms .map ((platform ) => ({
2211+ value: platform ,
2212+ label: t (` admin.groups.platforms.${platform } ` ),
2213+ count: groupOptions .value .filter ((option ) => option .platform === platform ).length
2214+ }))
2215+ ]
2216+ })
21792217const filteredGroupOptions = computed (() => {
21802218 const query = groupSearchQuery .value .trim ().toLowerCase ()
2181- if (! query ) return groupOptions .value
2219+ const platform = activeGroupPlatform .value
2220+ if (! query && ! platform ) return groupOptions .value
21822221 return groupOptions .value .filter ((opt ) => {
2183- return opt .label .toLowerCase ().includes (query ) ||
2222+ if (platform && opt .platform !== platform ) return false
2223+ return ! query || opt .label .toLowerCase ().includes (query ) ||
21842224 (opt .description && opt .description .toLowerCase ().includes (query ))
21852225 })
21862226})
@@ -2350,6 +2390,7 @@ const closeGroupSelectorPopover = (restoreFocus: boolean) => {
23502390 groupSelectorKeyId .value = null
23512391 dropdownPosition .value = null
23522392 groupSearchQuery .value = ' '
2393+ activeGroupPlatform .value = null
23532394 if (restoreFocus ) {
23542395 void nextTick (() => groupButtonRefs .value .get (keyId )?.focus ())
23552396 }
@@ -2367,7 +2408,7 @@ const updateGroupSelectorPosition = (): boolean => {
23672408 const dropdownHeight = Math .min (dropdownRef .value ?.offsetHeight || 400 , maxDropdownHeight )
23682409 const spaceBelow = window .innerHeight - rect .bottom - viewportPadding
23692410 const spaceAbove = rect .top - viewportPadding
2370- const dropdownWidth = Math .min (380 , Math .max (0 , window .innerWidth - viewportPadding * 2 ))
2411+ const dropdownWidth = Math .min (544 , Math .max (0 , window .innerWidth - viewportPadding * 2 ))
23712412 const maxLeft = Math .max (viewportPadding , window .innerWidth - dropdownWidth - viewportPadding )
23722413 const clampedLeft = Math .min (Math .max (rect .left , viewportPadding ), maxLeft )
23732414 const preferredTop = spaceBelow >= dropdownHeight || spaceBelow >= spaceAbove
@@ -2395,6 +2436,7 @@ const openGroupSelector = async (key: ApiKey) => {
23952436
23962437 groupSelectorKeyId .value = key .id
23972438 groupSearchQuery .value = ' '
2439+ activeGroupPlatform .value = null
23982440 if (! updateGroupSelectorPosition ()) {
23992441 closeGroupSelectorPopover (false )
24002442 return
0 commit comments