mirror of
https://github.com/router-for-me/Cli-Proxy-API-Management-Center.git
synced 2026-08-29 00:41:25 +08:00
feat(auth-files): add theme surface icon support for Kimi provider and update styles accordingly
This commit is contained in:
@@ -25,9 +25,11 @@ import {
|
||||
formatModified,
|
||||
getAuthFileIcon,
|
||||
getAuthFileStatusMessage,
|
||||
getThemeSurfaceIconBackground,
|
||||
getTypeColor,
|
||||
getTypeLabel,
|
||||
isRuntimeOnlyAuthFile,
|
||||
isThemeSurfaceIconProvider,
|
||||
normalizeProviderKey,
|
||||
parsePriorityValue,
|
||||
type QuotaProviderType,
|
||||
@@ -95,6 +97,8 @@ export function AuthFileCard(props: AuthFileCardProps) {
|
||||
const typeColor = getTypeColor(providerKey, resolvedTheme);
|
||||
const typeLabel = getTypeLabel(t, providerKey);
|
||||
const providerIcon = getAuthFileIcon(providerKey, resolvedTheme);
|
||||
// 与 AI 提供商界面一致:Kimi 图标底座随主题切换颜色
|
||||
const useThemeSurfaceIcon = isThemeSurfaceIconProvider(providerKey);
|
||||
|
||||
const quotaType =
|
||||
quotaFilterType && resolveQuotaType(file) === quotaFilterType ? quotaFilterType : null;
|
||||
@@ -162,11 +166,18 @@ export function AuthFileCard(props: AuthFileCardProps) {
|
||||
)}
|
||||
<div
|
||||
className={styles.providerAvatar}
|
||||
style={{
|
||||
backgroundColor: typeColor.bg,
|
||||
color: typeColor.text,
|
||||
...(typeColor.border ? { border: typeColor.border } : {}),
|
||||
}}
|
||||
style={
|
||||
useThemeSurfaceIcon
|
||||
? {
|
||||
backgroundColor: getThemeSurfaceIconBackground(resolvedTheme),
|
||||
color: typeColor.text,
|
||||
}
|
||||
: {
|
||||
backgroundColor: typeColor.bg,
|
||||
color: typeColor.text,
|
||||
...(typeColor.border ? { border: typeColor.border } : {}),
|
||||
}
|
||||
}
|
||||
>
|
||||
{providerIcon ? (
|
||||
<img src={providerIcon} alt="" className={styles.providerAvatarImage} />
|
||||
|
||||
@@ -198,6 +198,16 @@ export const getAuthFileIcon = (type: string, resolvedTheme: ResolvedTheme): str
|
||||
: iconEntry.light;
|
||||
};
|
||||
|
||||
// 与 AI 提供商界面(PROVIDER_LOGOS 的 themeSurface)保持一致:
|
||||
// 这些提供商的图标底座颜色随主题切换(浅色主题黑底,深色主题白底)
|
||||
export const THEME_SURFACE_ICON_PROVIDERS = new Set(['kimi']);
|
||||
|
||||
export const isThemeSurfaceIconProvider = (type: string): boolean =>
|
||||
THEME_SURFACE_ICON_PROVIDERS.has(normalizeProviderKey(type));
|
||||
|
||||
export const getThemeSurfaceIconBackground = (resolvedTheme: ResolvedTheme): string =>
|
||||
resolvedTheme === 'dark' ? '#ffffff' : '#000000';
|
||||
|
||||
export const parsePriorityValue = (value: unknown): number | undefined => {
|
||||
if (typeof value === 'number') {
|
||||
return Number.isInteger(value) ? value : undefined;
|
||||
|
||||
@@ -32,10 +32,12 @@ import {
|
||||
QUOTA_PROVIDER_TYPES,
|
||||
clampCardPageSize,
|
||||
getAuthFileIcon,
|
||||
getThemeSurfaceIconBackground,
|
||||
getTypeColor,
|
||||
getTypeLabel,
|
||||
hasAuthFileStatusMessage,
|
||||
isRuntimeOnlyAuthFile,
|
||||
isThemeSurfaceIconProvider,
|
||||
normalizeProviderKey,
|
||||
parsePriorityValue,
|
||||
type QuotaProviderType,
|
||||
@@ -635,7 +637,18 @@ export function AuthFilesPage() {
|
||||
<IconFilterAll className={styles.filterAllIcon} size={16} />
|
||||
</span>
|
||||
) : (
|
||||
<span className={styles.filterTagIconWrap}>
|
||||
<span
|
||||
className={styles.filterTagIconWrap}
|
||||
style={
|
||||
// 与 AI 提供商界面一致:Kimi 图标底座随主题切换颜色
|
||||
isThemeSurfaceIconProvider(type)
|
||||
? {
|
||||
background: getThemeSurfaceIconBackground(resolvedTheme),
|
||||
borderColor: 'transparent',
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
{iconSrc ? (
|
||||
<img src={iconSrc} alt="" className={styles.filterTagIcon} />
|
||||
) : (
|
||||
|
||||
Reference in New Issue
Block a user