feat: add pref to disable note status updates (#1702)

This commit is contained in:
Aman Harwara
2022-09-30 20:34:56 +05:30
committed by GitHub
parent 0fa9f6d7b6
commit 08b70968f2
5 changed files with 149 additions and 39 deletions

View File

@@ -7,6 +7,7 @@ import { FunctionComponent, useState } from 'react'
import PreferencesGroup from '../../PreferencesComponents/PreferencesGroup'
import PreferencesSegment from '../../PreferencesComponents/PreferencesSegment'
import { PrefDefaults } from '@/Constants/PrefDefaults'
import HorizontalSeparator from '@/Components/Shared/HorizontalSeparator'
type Props = {
application: WebApplication
@@ -22,6 +23,15 @@ const Tools: FunctionComponent<Props> = ({ application }: Props) => {
application.setPreference(PrefKey.EditorResizersEnabled, !marginResizers).catch(console.error)
}
const [updateSavingIndicator, setUpdateSavingIndicator] = useState(() =>
application.getPreference(PrefKey.UpdateSavingStatusIndicator, PrefDefaults[PrefKey.UpdateSavingStatusIndicator]),
)
const toggleSavingIndicatorUpdates = () => {
setUpdateSavingIndicator(!updateSavingIndicator)
application.setPreference(PrefKey.UpdateSavingStatusIndicator, !updateSavingIndicator).catch(console.error)
}
return (
<PreferencesGroup>
<PreferencesSegment>
@@ -34,6 +44,17 @@ const Tools: FunctionComponent<Props> = ({ application }: Props) => {
</div>
<Switch onChange={toggleMarginResizers} checked={marginResizers} />
</div>
<HorizontalSeparator classes="my-4" />
<div className="flex items-center justify-between">
<div className="flex flex-col">
<Subtitle>Show note saving status while editing</Subtitle>
<Text>
Control whether the animated saving status is shown while editing. Error statuses are always shown
regardless of preference.
</Text>
</div>
<Switch onChange={toggleSavingIndicatorUpdates} checked={updateSavingIndicator} />
</div>
</div>
</PreferencesSegment>
</PreferencesGroup>