mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-08-02 18:41:35 +08:00
refactor(presets): render presets in array order and prioritize partners
Remove the category-based grouping logic from ProviderPresetSelector, letting the array position in each preset config file be the single source of truth for display order. Move partner presets (PatewayAI, 火山Agentplan, BytePlus, DouBaoSeed) right after Shengsuanyun across all 6 config files so they appear earlier in the UI.
This commit is contained in:
@@ -395,25 +395,6 @@ export function ClaudeDesktopProviderForm({
|
||||
[],
|
||||
);
|
||||
|
||||
const groupedPresets = useMemo(
|
||||
() =>
|
||||
presetEntries.reduce<Record<string, PresetEntry[]>>((acc, entry) => {
|
||||
const cat = entry.preset.category ?? "others";
|
||||
if (!acc[cat]) acc[cat] = [];
|
||||
acc[cat].push(entry);
|
||||
return acc;
|
||||
}, {}),
|
||||
[presetEntries],
|
||||
);
|
||||
|
||||
const categoryKeys = useMemo(
|
||||
() =>
|
||||
Object.keys(groupedPresets).filter(
|
||||
(key) => key !== "custom" && groupedPresets[key]?.length,
|
||||
),
|
||||
[groupedPresets],
|
||||
);
|
||||
|
||||
const presetCategoryLabels: Record<string, string> = useMemo(
|
||||
() => ({
|
||||
official: t("providerForm.categoryOfficial", { defaultValue: "官方" }),
|
||||
@@ -777,8 +758,7 @@ export function ClaudeDesktopProviderForm({
|
||||
{!initialData && (
|
||||
<ProviderPresetSelector
|
||||
selectedPresetId={selectedPresetId}
|
||||
groupedPresets={groupedPresets}
|
||||
categoryKeys={categoryKeys}
|
||||
presetEntries={presetEntries}
|
||||
presetCategoryLabels={presetCategoryLabels}
|
||||
onPresetChange={handlePresetChange}
|
||||
category={activePreset?.category}
|
||||
|
||||
Reference in New Issue
Block a user