mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-24 12:44:18 +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:
@@ -1251,23 +1251,6 @@ function ProviderFormFull({
|
||||
await onSubmit(payload);
|
||||
};
|
||||
|
||||
const groupedPresets = useMemo(() => {
|
||||
return presetEntries.reduce<Record<string, PresetEntry[]>>((acc, entry) => {
|
||||
const category = entry.preset.category ?? "others";
|
||||
if (!acc[category]) {
|
||||
acc[category] = [];
|
||||
}
|
||||
acc[category].push(entry);
|
||||
return acc;
|
||||
}, {});
|
||||
}, [presetEntries]);
|
||||
|
||||
const categoryKeys = useMemo(() => {
|
||||
return Object.keys(groupedPresets).filter(
|
||||
(key) => key !== "custom" && groupedPresets[key]?.length,
|
||||
);
|
||||
}, [groupedPresets]);
|
||||
|
||||
const shouldShowSpeedTest =
|
||||
category !== "official" && category !== "cloud_provider";
|
||||
|
||||
@@ -1553,8 +1536,7 @@ function ProviderFormFull({
|
||||
{!initialData && (
|
||||
<ProviderPresetSelector
|
||||
selectedPresetId={selectedPresetId}
|
||||
groupedPresets={groupedPresets}
|
||||
categoryKeys={categoryKeys}
|
||||
presetEntries={presetEntries}
|
||||
presetCategoryLabels={presetCategoryLabels}
|
||||
onPresetChange={handlePresetChange}
|
||||
onUniversalPresetSelect={onUniversalPresetSelect}
|
||||
|
||||
Reference in New Issue
Block a user