import { atom } from 'jotai' import { atomWithStorage } from 'jotai/utils' import { MainViewState } from '@/constants/screens' export const mainViewStateAtom = atom(MainViewState.Thread) export const defaultJanDataFolderAtom = atom('') const SHOW_RIGHT_PANEL = 'showRightPanel' // Store panel atom export const showLeftPanelAtom = atom(true) export const showRightPanelAtom = atomWithStorage( SHOW_RIGHT_PANEL, false, undefined, { getOnInit: true } ) export const showSystemMonitorPanelAtom = atom(false) export const appDownloadProgressAtom = atom(-1) export const updateVersionErrorAtom = atom(undefined) export const appUpdateAvailableAtom = atom(false) export const appUpdateNotAvailableAtom = atom(false) const COPY_OVER_INSTRUCTION_ENABLED = 'copy_over_instruction_enabled' export const copyOverInstructionEnabledAtom = atomWithStorage( COPY_OVER_INSTRUCTION_ENABLED, false ) /** * App Banner Hub Atom - storage last banner setting - default undefined */ const appBannerHubStorageAtom = atomWithStorage( 'appBannerHub', undefined, undefined, { getOnInit: true, } ) /** * App Hub Banner configured image - Retrieve from appBannerHubStorageAtom - fallback a random banner */ export const getAppBannerHubAtom = atom( (get) => get(appBannerHubStorageAtom) ?? `./images/HubBanner/banner-${Math.floor(Math.random() * 30) + 1}.jpg` ) /** * Set App Hub Banner - store in appBannerHubStorageAtom */ export const setAppBannerHubAtom = atom(null, (get, set, banner: string) => { set(appBannerHubStorageAtom, banner) })