mirror of
https://github.com/router-for-me/Cli-Proxy-API-Management-Center.git
synced 2026-06-16 21:03:58 +08:00
refactor(providers): share the brand logo map
ProviderCategoryList and ProviderResourcePanel each kept an identical brand-to-logo table; move it to a single module.
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
import ampcodeLogo from '@/assets/icons/amp.svg';
|
||||||
|
import claudeLogo from '@/assets/icons/claude.svg';
|
||||||
|
import codexLogo from '@/assets/icons/codex.svg';
|
||||||
|
import geminiLogo from '@/assets/icons/gemini.svg';
|
||||||
|
import openaiLogo from '@/assets/icons/openai-light.svg';
|
||||||
|
import vertexLogo from '@/assets/icons/vertex.svg';
|
||||||
|
import type { ProviderBrand } from './types';
|
||||||
|
|
||||||
|
export interface ProviderBrandLogo {
|
||||||
|
src: string;
|
||||||
|
invertOnDark?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const PROVIDER_LOGOS: Record<ProviderBrand, ProviderBrandLogo> = {
|
||||||
|
gemini: { src: geminiLogo },
|
||||||
|
claude: { src: claudeLogo },
|
||||||
|
codex: { src: codexLogo },
|
||||||
|
vertex: { src: vertexLogo },
|
||||||
|
openaiCompatibility: { src: openaiLogo, invertOnDark: true },
|
||||||
|
ampcode: { src: ampcodeLogo },
|
||||||
|
};
|
||||||
@@ -1,22 +1,8 @@
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import ampcodeLogo from '@/assets/icons/amp.svg';
|
import { PROVIDER_LOGOS } from '../brandLogos';
|
||||||
import claudeLogo from '@/assets/icons/claude.svg';
|
|
||||||
import codexLogo from '@/assets/icons/codex.svg';
|
|
||||||
import geminiLogo from '@/assets/icons/gemini.svg';
|
|
||||||
import openaiLogo from '@/assets/icons/openai-light.svg';
|
|
||||||
import vertexLogo from '@/assets/icons/vertex.svg';
|
|
||||||
import type { ProviderBrand, ProviderGroup } from '../types';
|
import type { ProviderBrand, ProviderGroup } from '../types';
|
||||||
import styles from './ProviderCategoryList.module.scss';
|
import styles from './ProviderCategoryList.module.scss';
|
||||||
|
|
||||||
const PROVIDER_LOGOS: Record<ProviderBrand, { src: string; invertOnDark?: boolean }> = {
|
|
||||||
gemini: { src: geminiLogo },
|
|
||||||
claude: { src: claudeLogo },
|
|
||||||
codex: { src: codexLogo },
|
|
||||||
vertex: { src: vertexLogo },
|
|
||||||
openaiCompatibility: { src: openaiLogo, invertOnDark: true },
|
|
||||||
ampcode: { src: ampcodeLogo },
|
|
||||||
};
|
|
||||||
|
|
||||||
interface ProviderCategoryListProps {
|
interface ProviderCategoryListProps {
|
||||||
groups: ProviderGroup[];
|
groups: ProviderGroup[];
|
||||||
activeBrand: ProviderBrand;
|
activeBrand: ProviderBrand;
|
||||||
|
|||||||
@@ -1,27 +1,13 @@
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import ampcodeLogo from '@/assets/icons/amp.svg';
|
|
||||||
import claudeLogo from '@/assets/icons/claude.svg';
|
|
||||||
import codexLogo from '@/assets/icons/codex.svg';
|
|
||||||
import geminiLogo from '@/assets/icons/gemini.svg';
|
|
||||||
import openaiLogo from '@/assets/icons/openai-light.svg';
|
|
||||||
import vertexLogo from '@/assets/icons/vertex.svg';
|
|
||||||
import { IconPlus, IconSearch } from '@/components/ui/icons';
|
import { IconPlus, IconSearch } from '@/components/ui/icons';
|
||||||
import type { ProviderRecentUsageMap } from '@/components/providers/utils';
|
import type { ProviderRecentUsageMap } from '@/components/providers/utils';
|
||||||
import type { ProviderBrand, ProviderGroup, ProviderResource } from '../types';
|
import { PROVIDER_LOGOS } from '../brandLogos';
|
||||||
|
import type { ProviderGroup, ProviderResource } from '../types';
|
||||||
import { ProviderResourceTable } from './ProviderResourceTable';
|
import { ProviderResourceTable } from './ProviderResourceTable';
|
||||||
import { ProviderResourceToolbar } from './ProviderResourceToolbar';
|
import { ProviderResourceToolbar } from './ProviderResourceToolbar';
|
||||||
import type { ProviderSortBy, SortDir } from '../types';
|
import type { ProviderSortBy, SortDir } from '../types';
|
||||||
import styles from './ProviderResourcePanel.module.scss';
|
import styles from './ProviderResourcePanel.module.scss';
|
||||||
|
|
||||||
const LOGOS: Record<ProviderBrand, { src: string; invertOnDark?: boolean }> = {
|
|
||||||
gemini: { src: geminiLogo },
|
|
||||||
claude: { src: claudeLogo },
|
|
||||||
codex: { src: codexLogo },
|
|
||||||
vertex: { src: vertexLogo },
|
|
||||||
openaiCompatibility: { src: openaiLogo, invertOnDark: true },
|
|
||||||
ampcode: { src: ampcodeLogo },
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface ProviderPanelControls {
|
export interface ProviderPanelControls {
|
||||||
sortBy: ProviderSortBy;
|
sortBy: ProviderSortBy;
|
||||||
sortDir: SortDir;
|
sortDir: SortDir;
|
||||||
@@ -64,7 +50,7 @@ export function ProviderResourcePanel({
|
|||||||
onCreate,
|
onCreate,
|
||||||
}: ProviderResourcePanelProps) {
|
}: ProviderResourcePanelProps) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const logo = LOGOS[group.id];
|
const logo = PROVIDER_LOGOS[group.id];
|
||||||
|
|
||||||
const realResources = filteredResources.filter((r) => !r.flags.isPlaceholder);
|
const realResources = filteredResources.filter((r) => !r.flags.isPlaceholder);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user