mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 05:00:30 +08:00
fix: disallow empty selection in Select component
(cherry picked from commit 48eef556770030d8a032fb6dd0e6888d1f0750a0)
This commit is contained in:
parent
f54ffcf42b
commit
511eb0c7fa
@ -193,6 +193,7 @@ const GeneralConfig: React.FC = () => {
|
||||
selectionMode="multiple"
|
||||
selectedKeys={new Set(envType)}
|
||||
aria-label={t('settings.envType')}
|
||||
disallowEmptySelection={true}
|
||||
onSelectionChange={async (v) => {
|
||||
try {
|
||||
await patchAppConfig({
|
||||
@ -389,6 +390,7 @@ const GeneralConfig: React.FC = () => {
|
||||
size="sm"
|
||||
selectedKeys={new Set([customTheme])}
|
||||
aria-label={t('settings.selectTheme')}
|
||||
disallowEmptySelection={true}
|
||||
onSelectionChange={async (v) => {
|
||||
try {
|
||||
await patchAppConfig({ customTheme: v.currentKey as string })
|
||||
|
||||
@ -129,6 +129,7 @@ const MihomoConfig: React.FC = () => {
|
||||
size="sm"
|
||||
selectedKeys={new Set([proxyCols])}
|
||||
aria-label={t('mihomo.proxyColumns.title')}
|
||||
disallowEmptySelection={true}
|
||||
onSelectionChange={async (v) => {
|
||||
await patchAppConfig({ proxyCols: v.currentKey as 'auto' | '1' | '2' | '3' | '4' })
|
||||
}}
|
||||
@ -147,6 +148,7 @@ const MihomoConfig: React.FC = () => {
|
||||
className="w-[150px]"
|
||||
size="sm"
|
||||
selectedKeys={new Set([mihomoCpuPriority])}
|
||||
disallowEmptySelection={true}
|
||||
onSelectionChange={async (v) => {
|
||||
try {
|
||||
await patchAppConfig({
|
||||
|
||||
@ -236,6 +236,7 @@ const Connections: React.FC = () => {
|
||||
className="w-[180px] min-w-[131px]"
|
||||
aria-label={t('connections.orderBy')}
|
||||
selectedKeys={new Set([connectionOrderBy])}
|
||||
disallowEmptySelection={true}
|
||||
onSelectionChange={async (v) => {
|
||||
await patchAppConfig({
|
||||
connectionOrderBy: v.currentKey as
|
||||
|
||||
@ -27,7 +27,7 @@ const CoreMap = {
|
||||
const Mihomo: React.FC = () => {
|
||||
const { t } = useTranslation()
|
||||
const { appConfig, patchAppConfig } = useAppConfig()
|
||||
const {
|
||||
const {
|
||||
core = 'mihomo',
|
||||
maxLogDays = 7,
|
||||
sysProxy,
|
||||
@ -136,6 +136,7 @@ const Mihomo: React.FC = () => {
|
||||
size="sm"
|
||||
aria-label={t('mihomo.selectCoreVersion')}
|
||||
selectedKeys={new Set([core])}
|
||||
disallowEmptySelection={true}
|
||||
onSelectionChange={async (v) => {
|
||||
handleConfigChangeWithRestart('core', v.currentKey as 'mihomo' | 'mihomo-alpha')
|
||||
}}
|
||||
@ -702,6 +703,7 @@ const Mihomo: React.FC = () => {
|
||||
size="sm"
|
||||
aria-label={t('mihomo.selectLogLevel')}
|
||||
selectedKeys={new Set([logLevel])}
|
||||
disallowEmptySelection={true}
|
||||
onSelectionChange={(v) => {
|
||||
onChangeNeedRestart({ 'log-level': v.currentKey as LogLevel })
|
||||
}}
|
||||
@ -720,6 +722,7 @@ const Mihomo: React.FC = () => {
|
||||
size="sm"
|
||||
aria-label={t('mihomo.selectFindProcessMode')}
|
||||
selectedKeys={new Set([findProcessMode])}
|
||||
disallowEmptySelection={true}
|
||||
onSelectionChange={(v) => {
|
||||
onChangeNeedRestart({ 'find-process-mode': v.currentKey as FindProcessMode })
|
||||
}}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user