enhancement: default open Jan Input Box Settings and Right panel (#4234)

* enhancement: default open Jan Input Box Settings and Right panel

* chore: added option getOnInit atomstorage
This commit is contained in:
Faisal Amir 2024-12-05 19:00:50 +08:00 committed by GitHub
parent 41e0d4cddc
commit 1c80cb2cd5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 5 deletions

View File

@ -11,15 +11,14 @@ const Responsive = () => {
const [showRightPanel, setShowRightPanel] = useAtom(showRightPanelAtom)
// Refs to store the last known state of the panels
const lastLeftPanelState = useRef<boolean>(true)
const lastRightPanelState = useRef<boolean>(true)
const lastLeftPanelState = useRef<boolean>(showLeftPanel)
const lastRightPanelState = useRef<boolean>(showRightPanel)
useEffect(() => {
if (matches) {
// Store the last known state before closing the panels
lastLeftPanelState.current = showLeftPanel
lastRightPanelState.current = showRightPanel
setShowLeftPanel(false)
setShowRightPanel(false)
} else {

View File

@ -1,14 +1,25 @@
import { atom } from 'jotai'
import { atomWithStorage } from 'jotai/utils'
import { MainViewState } from '@/constants/screens'
export const mainViewStateAtom = atom<MainViewState>(MainViewState.Thread)
export const defaultJanDataFolderAtom = atom<string>('')
const SHOW_RIGHT_PANEL = 'showRightPanel'
// Store panel atom
export const showLeftPanelAtom = atom<boolean>(true)
export const showRightPanelAtom = atom<boolean>(true)
export const showRightPanelAtom = atomWithStorage<boolean>(
SHOW_RIGHT_PANEL,
false,
undefined,
{ getOnInit: true }
)
export const showSystemMonitorPanelAtom = atom<boolean>(false)
export const appDownloadProgressAtom = atom<number>(-1)
export const updateVersionErrorAtom = atom<string | undefined>(undefined)

View File

@ -207,7 +207,7 @@ export const setThreadModelParamsAtom = atom(
*/
export const activeSettingInputBoxAtom = atomWithStorage<boolean>(
ACTIVE_SETTING_INPUT_BOX,
false,
true,
undefined,
{ getOnInit: true }
)