feat(ui): enhance provider form with brand icons and colors
- Add Save icon to submit buttons in provider forms - Replace generic Zap icon with brand-specific icons (ClaudeIcon, CodexIcon) - Update selected state colors: Claude uses brand color #D97757, Codex uses black - Maintain visual consistency with AppSwitcher component
This commit is contained in:
@@ -15,7 +15,7 @@ import ApiKeyInput from "./ProviderForm/ApiKeyInput";
|
|||||||
import ClaudeConfigEditor from "./ProviderForm/ClaudeConfigEditor";
|
import ClaudeConfigEditor from "./ProviderForm/ClaudeConfigEditor";
|
||||||
import CodexConfigEditor from "./ProviderForm/CodexConfigEditor";
|
import CodexConfigEditor from "./ProviderForm/CodexConfigEditor";
|
||||||
import KimiModelSelector from "./ProviderForm/KimiModelSelector";
|
import KimiModelSelector from "./ProviderForm/KimiModelSelector";
|
||||||
import { X, AlertCircle } from "lucide-react";
|
import { X, AlertCircle, Save } from "lucide-react";
|
||||||
// 分类仅用于控制少量交互(如官方禁用 API Key),不显示介绍组件
|
// 分类仅用于控制少量交互(如官方禁用 API Key),不显示介绍组件
|
||||||
|
|
||||||
interface ProviderFormProps {
|
interface ProviderFormProps {
|
||||||
@@ -936,8 +936,9 @@ const ProviderForm: React.FC<ProviderFormProps> = ({
|
|||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
className="px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition-colors text-sm font-medium"
|
className="px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition-colors text-sm font-medium flex items-center gap-2"
|
||||||
>
|
>
|
||||||
|
<Save className="w-4 h-4" />
|
||||||
{submitText}
|
{submitText}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { Zap } from "lucide-react";
|
import { Zap } from "lucide-react";
|
||||||
import { ProviderCategory } from "../../types";
|
import { ProviderCategory } from "../../types";
|
||||||
|
import { ClaudeIcon, CodexIcon } from "../BrandIcons";
|
||||||
|
|
||||||
interface Preset {
|
interface Preset {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -27,17 +28,22 @@ const PresetSelector: React.FC<PresetSelectorProps> = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const getButtonClass = (
|
const getButtonClass = (
|
||||||
index: number,
|
index: number,
|
||||||
isOfficial?: boolean,
|
preset?: Preset,
|
||||||
category?: ProviderCategory,
|
|
||||||
) => {
|
) => {
|
||||||
const isSelected = selectedIndex === index;
|
const isSelected = selectedIndex === index;
|
||||||
const baseClass =
|
const baseClass =
|
||||||
"inline-flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-colors";
|
"inline-flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-colors";
|
||||||
|
|
||||||
if (isSelected) {
|
if (isSelected) {
|
||||||
return isOfficial || category === "official"
|
if (preset?.isOfficial || preset?.category === "official") {
|
||||||
? `${baseClass} bg-amber-500 text-white`
|
// Codex 官方使用黑色背景
|
||||||
: `${baseClass} bg-blue-500 text-white`;
|
if (preset?.name.includes("Codex")) {
|
||||||
|
return `${baseClass} bg-gray-900 text-white`;
|
||||||
|
}
|
||||||
|
// Claude 官方使用品牌色背景
|
||||||
|
return `${baseClass} bg-[#D97757] text-white`;
|
||||||
|
}
|
||||||
|
return `${baseClass} bg-blue-500 text-white`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return `${baseClass} bg-gray-100 text-gray-500 hover:bg-gray-200`;
|
return `${baseClass} bg-gray-100 text-gray-500 hover:bg-gray-200`;
|
||||||
@@ -76,15 +82,19 @@ const PresetSelector: React.FC<PresetSelectorProps> = ({
|
|||||||
<button
|
<button
|
||||||
key={index}
|
key={index}
|
||||||
type="button"
|
type="button"
|
||||||
className={getButtonClass(
|
className={getButtonClass(index, preset)}
|
||||||
index,
|
|
||||||
preset.isOfficial,
|
|
||||||
preset.category,
|
|
||||||
)}
|
|
||||||
onClick={() => onSelectPreset(index)}
|
onClick={() => onSelectPreset(index)}
|
||||||
>
|
>
|
||||||
{(preset.isOfficial || preset.category === "official") && (
|
{(preset.isOfficial || preset.category === "official") && (
|
||||||
<Zap size={14} />
|
<>
|
||||||
|
{preset.name.includes("Claude") ? (
|
||||||
|
<ClaudeIcon size={14} />
|
||||||
|
) : preset.name.includes("Codex") ? (
|
||||||
|
<CodexIcon size={14} />
|
||||||
|
) : (
|
||||||
|
<Zap size={14} />
|
||||||
|
)}
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
{preset.name}
|
{preset.name}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user