Skip to content

Commit

Permalink
enhancement: default open Jan Input Box Settings and Right panel (#4234)
Browse files Browse the repository at this point in the history
* enhancement: default open Jan Input Box Settings and Right panel

* chore: added option getOnInit atomstorage
  • Loading branch information
urmauur authored Dec 5, 2024
1 parent 41e0d4c commit 1c80cb2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
5 changes: 2 additions & 3 deletions web/containers/Providers/Responsive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
13 changes: 12 additions & 1 deletion web/helpers/atoms/App.atom.ts
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion web/helpers/atoms/Thread.atom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export const setThreadModelParamsAtom = atom(
*/
export const activeSettingInputBoxAtom = atomWithStorage<boolean>(
ACTIVE_SETTING_INPUT_BOX,
false,
true,
undefined,
{ getOnInit: true }
)
Expand Down

0 comments on commit 1c80cb2

Please sign in to comment.