useDashboardSettings.ts36 lines · main
| 1 | import { LOCAL_STORAGE_KEYS } from 'common' |
| 2 | |
| 3 | import { useLocalStorageQuery } from '@/hooks/misc/useLocalStorage' |
| 4 | |
| 5 | export const useIsInlineEditorSetting = () => { |
| 6 | const [inlineEditorEnabled, setInlineEditorEnabled] = useLocalStorageQuery( |
| 7 | LOCAL_STORAGE_KEYS.UI_PREVIEW_INLINE_EDITOR, |
| 8 | false |
| 9 | ) |
| 10 | |
| 11 | return { |
| 12 | inlineEditorEnabled: inlineEditorEnabled ?? false, |
| 13 | setInlineEditorEnabled, |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | export const useIsQueueOperationsSetting = () => { |
| 18 | const [isQueueOperationsEnabled, setIsQueueOperationsEnabled] = useLocalStorageQuery( |
| 19 | LOCAL_STORAGE_KEYS.UI_PREVIEW_QUEUE_OPERATIONS, |
| 20 | false |
| 21 | ) |
| 22 | return { |
| 23 | isQueueOperationsEnabled: isQueueOperationsEnabled ?? false, |
| 24 | setIsQueueOperationsEnabled, |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | export const useIsInlineEditorEnabled = () => { |
| 29 | const { inlineEditorEnabled } = useIsInlineEditorSetting() |
| 30 | return inlineEditorEnabled ?? false |
| 31 | } |
| 32 | |
| 33 | export const useIsQueueOperationsEnabled = () => { |
| 34 | const { isQueueOperationsEnabled } = useIsQueueOperationsSetting() |
| 35 | return isQueueOperationsEnabled ?? false |
| 36 | } |