mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-10 15:49:29 +08:00
refactor(provider): change hide disabled providers to show disabled providers
Update the provider settings to use a more intuitive "show disabled" toggle instead of "hide disabled". This includes updating the preference schema, default value, and UI components to reflect this change.
This commit is contained in:
parent
b6fa2583d1
commit
5ee120db7c
@ -47,7 +47,6 @@ export interface PreferenceSchemas {
|
|||||||
'app.proxy.mode': PreferenceTypes.ProxyMode
|
'app.proxy.mode': PreferenceTypes.ProxyMode
|
||||||
// redux/settings/proxyUrl
|
// redux/settings/proxyUrl
|
||||||
'app.proxy.url': string
|
'app.proxy.url': string
|
||||||
'app.settings.provider.hide_disabled': boolean
|
|
||||||
// redux/settings/enableSpellCheck
|
// redux/settings/enableSpellCheck
|
||||||
'app.spell_check.enabled': boolean
|
'app.spell_check.enabled': boolean
|
||||||
// redux/settings/spellCheckLanguages
|
// redux/settings/spellCheckLanguages
|
||||||
@ -400,6 +399,7 @@ export interface PreferenceSchemas {
|
|||||||
'ui.custom_css': string
|
'ui.custom_css': string
|
||||||
// redux/settings/navbarPosition
|
// redux/settings/navbarPosition
|
||||||
'ui.navbar.position': 'left' | 'top'
|
'ui.navbar.position': 'left' | 'top'
|
||||||
|
'ui.provider.show_disabled': boolean
|
||||||
// redux/settings/sidebarIcons.disabled
|
// redux/settings/sidebarIcons.disabled
|
||||||
'ui.sidebar.icons.invisible': PreferenceTypes.SidebarIcon[]
|
'ui.sidebar.icons.invisible': PreferenceTypes.SidebarIcon[]
|
||||||
// redux/settings/sidebarIcons.visible
|
// redux/settings/sidebarIcons.visible
|
||||||
@ -434,7 +434,6 @@ export const DefaultPreferences: PreferenceSchemas = {
|
|||||||
'app.proxy.bypass_rules': '',
|
'app.proxy.bypass_rules': '',
|
||||||
'app.proxy.mode': 'system',
|
'app.proxy.mode': 'system',
|
||||||
'app.proxy.url': '',
|
'app.proxy.url': '',
|
||||||
'app.settings.provider.hide_disabled': false,
|
|
||||||
'app.spell_check.enabled': false,
|
'app.spell_check.enabled': false,
|
||||||
'app.spell_check.languages': [],
|
'app.spell_check.languages': [],
|
||||||
'app.tray.enabled': true,
|
'app.tray.enabled': true,
|
||||||
@ -658,6 +657,7 @@ export const DefaultPreferences: PreferenceSchemas = {
|
|||||||
'topic.tab.show_time': false,
|
'topic.tab.show_time': false,
|
||||||
'ui.custom_css': '',
|
'ui.custom_css': '',
|
||||||
'ui.navbar.position': 'top',
|
'ui.navbar.position': 'top',
|
||||||
|
'ui.provider.show_disabled': true,
|
||||||
'ui.sidebar.icons.invisible': [],
|
'ui.sidebar.icons.invisible': [],
|
||||||
'ui.sidebar.icons.visible': [
|
'ui.sidebar.icons.visible': [
|
||||||
'assistants',
|
'assistants',
|
||||||
|
|||||||
@ -4178,7 +4178,7 @@
|
|||||||
"get_api_key": "Get API Key",
|
"get_api_key": "Get API Key",
|
||||||
"list": {
|
"list": {
|
||||||
"settings": {
|
"settings": {
|
||||||
"hide_disabled": "Hide disabled providers"
|
"show_disabled": "Show disabled providers"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"misc": "Other",
|
"misc": "Other",
|
||||||
|
|||||||
@ -45,7 +45,7 @@ const ProviderList: FC = () => {
|
|||||||
const [dragging, setDragging] = useState(false)
|
const [dragging, setDragging] = useState(false)
|
||||||
const [providerLogos, setProviderLogos] = useState<Record<string, string>>({})
|
const [providerLogos, setProviderLogos] = useState<Record<string, string>>({})
|
||||||
const listRef = useRef<DraggableVirtualListRef>(null)
|
const listRef = useRef<DraggableVirtualListRef>(null)
|
||||||
const [hideDisabled, setHideDisabled] = usePreference('app.settings.provider.hide_disabled')
|
const [showDisabled, setShowDisabled] = usePreference('ui.provider.show_disabled')
|
||||||
|
|
||||||
const setSelectedProvider = useCallback((provider: Provider) => {
|
const setSelectedProvider = useCallback((provider: Provider) => {
|
||||||
startTransition(() => _setSelectedProvider(provider))
|
startTransition(() => _setSelectedProvider(provider))
|
||||||
@ -284,7 +284,7 @@ const ProviderList: FC = () => {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hideDisabled && !provider.enabled) {
|
if (!showDisabled && !provider.enabled) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -346,10 +346,10 @@ const ProviderList: FC = () => {
|
|||||||
<ul className="flex h-full w-full flex-col">
|
<ul className="flex h-full w-full flex-col">
|
||||||
<li className="flex flex-row items-center justify-between">
|
<li className="flex flex-row items-center justify-between">
|
||||||
<Switch
|
<Switch
|
||||||
isSelected={hideDisabled}
|
isSelected={showDisabled}
|
||||||
onValueChange={setHideDisabled}
|
onValueChange={setShowDisabled}
|
||||||
classNames={{ base: 'flex-1 flex-row-reverse justify-between max-w-full' }}>
|
classNames={{ base: 'flex-1 flex-row-reverse justify-between max-w-full' }}>
|
||||||
{t('settings.provider.list.settings.hide_disabled')}
|
{t('settings.provider.list.settings.show_disabled')}
|
||||||
</Switch>
|
</Switch>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user