import { atom } from 'recoil'; type TOptionSettings = { showExamples?: boolean; isCodeChat?: boolean; }; const abortScroll = atom({ key: 'abortScroll', default: false, }); const optionSettings = atom({ key: 'optionSettings', default: {}, }); const showPluginStoreDialog = atom({ key: 'showPluginStoreDialog', default: false, }); const showAgentSettings = atom({ key: 'showAgentSettings', default: false, }); const showBingToneSetting = atom({ key: 'showBingToneSetting', default: false, }); const showPopover = atom({ key: 'showPopover', default: false, }); const autoScroll = atom({ key: 'autoScroll', default: localStorage.getItem('autoScroll') === 'true', effects: [ ({ setSelf, onSet }) => { const savedValue = localStorage.getItem('autoScroll'); if (savedValue != null) { setSelf(savedValue === 'true'); } onSet((newValue: unknown) => { if (typeof newValue === 'boolean') { localStorage.setItem('autoScroll', newValue.toString()); } }); }, ] as const, }); export default { abortScroll, optionSettings, showPluginStoreDialog, showAgentSettings, showBingToneSetting, showPopover, autoScroll, };