feat: disable auto expand in float mode

This commit is contained in:
EnixCoda 2021-05-27 00:51:03 +08:00
parent e7745e10c9
commit 1507206e4a
No known key found for this signature in database
GPG key ID: 0C1A07377913A1DD
2 changed files with 6 additions and 2 deletions

View file

@ -9,6 +9,7 @@ export type SimpleField<Key extends keyof Config> = {
wikiLink?: string
tooltip?: string
description?: string
disabled?: boolean
overwrite?: {
value: (value: Config[Key]) => boolean
onChange: (checked: boolean) => Config[Key]
@ -54,6 +55,7 @@ export function SimpleToggleField<Key extends keyof Config>({ field, onChange }:
<input
id={field.key}
name={field.key}
disabled={field.disabled}
type={'checkbox'}
onChange={async e => {
const enabled = e.currentTarget.checked

View file

@ -104,10 +104,12 @@ export function SidebarSettings(props: React.PropsWithChildren<Props>) {
field={{
key: 'intelligentToggle',
label: 'Auto expand',
disabled: configContext.value.sidebarToggleMode === 'float',
tooltip:
'Gitako will expand when exploring source files, pull requests, etc. And collapse otherwise.',
'Gitako will expand when exploring source files, pull requests, etc. And collapse otherwise. Will be disabled when "Dock sidebar on expand" is disabled.',
overwrite: {
value: enabled => enabled === null,
value: enabled =>
configContext.value.sidebarToggleMode === 'float' ? false : enabled === null,
onChange: checked => (checked ? null : true),
},
}}