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:
parent
41e0d4cddc
commit
1c80cb2cd5
@ -11,15 +11,14 @@ const Responsive = () => {
|
|||||||
const [showRightPanel, setShowRightPanel] = useAtom(showRightPanelAtom)
|
const [showRightPanel, setShowRightPanel] = useAtom(showRightPanelAtom)
|
||||||
|
|
||||||
// Refs to store the last known state of the panels
|
// Refs to store the last known state of the panels
|
||||||
const lastLeftPanelState = useRef<boolean>(true)
|
const lastLeftPanelState = useRef<boolean>(showLeftPanel)
|
||||||
const lastRightPanelState = useRef<boolean>(true)
|
const lastRightPanelState = useRef<boolean>(showRightPanel)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (matches) {
|
if (matches) {
|
||||||
// Store the last known state before closing the panels
|
// Store the last known state before closing the panels
|
||||||
lastLeftPanelState.current = showLeftPanel
|
lastLeftPanelState.current = showLeftPanel
|
||||||
lastRightPanelState.current = showRightPanel
|
lastRightPanelState.current = showRightPanel
|
||||||
|
|
||||||
setShowLeftPanel(false)
|
setShowLeftPanel(false)
|
||||||
setShowRightPanel(false)
|
setShowRightPanel(false)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -1,14 +1,25 @@
|
|||||||
import { atom } from 'jotai'
|
import { atom } from 'jotai'
|
||||||
|
|
||||||
|
import { atomWithStorage } from 'jotai/utils'
|
||||||
|
|
||||||
import { MainViewState } from '@/constants/screens'
|
import { MainViewState } from '@/constants/screens'
|
||||||
|
|
||||||
export const mainViewStateAtom = atom<MainViewState>(MainViewState.Thread)
|
export const mainViewStateAtom = atom<MainViewState>(MainViewState.Thread)
|
||||||
|
|
||||||
export const defaultJanDataFolderAtom = atom<string>('')
|
export const defaultJanDataFolderAtom = atom<string>('')
|
||||||
|
|
||||||
|
const SHOW_RIGHT_PANEL = 'showRightPanel'
|
||||||
|
|
||||||
// Store panel atom
|
// Store panel atom
|
||||||
export const showLeftPanelAtom = atom<boolean>(true)
|
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 showSystemMonitorPanelAtom = atom<boolean>(false)
|
||||||
export const appDownloadProgressAtom = atom<number>(-1)
|
export const appDownloadProgressAtom = atom<number>(-1)
|
||||||
export const updateVersionErrorAtom = atom<string | undefined>(undefined)
|
export const updateVersionErrorAtom = atom<string | undefined>(undefined)
|
||||||
|
|||||||
@ -207,7 +207,7 @@ export const setThreadModelParamsAtom = atom(
|
|||||||
*/
|
*/
|
||||||
export const activeSettingInputBoxAtom = atomWithStorage<boolean>(
|
export const activeSettingInputBoxAtom = atomWithStorage<boolean>(
|
||||||
ACTIVE_SETTING_INPUT_BOX,
|
ACTIVE_SETTING_INPUT_BOX,
|
||||||
false,
|
true,
|
||||||
undefined,
|
undefined,
|
||||||
{ getOnInit: true }
|
{ getOnInit: true }
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user