mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 19:43:15 +00:00
Co-authored-by: Ramon Nogueira <270434257+ramon-langchain@users.noreply.github.com> Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com> (cherry picked from commit 3e8089c36995cccaeee3694599cf58857b06e557) Co-authored-by: Ramon Nogueira <ramon.nogueira@langchain.dev>
20 lines
788 B
TypeScript
20 lines
788 B
TypeScript
const PANEL_STORAGE_COLLAPSED = "open-swe.gitpanel.collapsed"
|
|
const COLLAPSED_STATE_TRUE = "1"
|
|
const COLLAPSED_STATE_FALSE = "0"
|
|
const PANEL_DEFAULT_EXPANDED_MEDIA_QUERY = "(min-width: 1536px)"
|
|
|
|
export function readStoredPanelCollapsed(): boolean {
|
|
if (typeof window === "undefined") return true
|
|
const stored = window.localStorage.getItem(PANEL_STORAGE_COLLAPSED)
|
|
if (stored === COLLAPSED_STATE_TRUE) return true
|
|
if (stored === COLLAPSED_STATE_FALSE) return false
|
|
return !window.matchMedia(PANEL_DEFAULT_EXPANDED_MEDIA_QUERY).matches
|
|
}
|
|
|
|
export function writeStoredPanelCollapsed(collapsed: boolean): void {
|
|
if (typeof window === "undefined") return
|
|
window.localStorage.setItem(
|
|
PANEL_STORAGE_COLLAPSED,
|
|
collapsed ? COLLAPSED_STATE_TRUE : COLLAPSED_STATE_FALSE
|
|
)
|
|
}
|