mirror of
https://github.com/supabase/supabase.git
synced 2026-10-14 13:49:09 +03:00
28 lines
683 B
TypeScript
28 lines
683 B
TypeScript
import { proxy, snapshot, useSnapshot } from 'valtio'
|
|
|
|
export const appState = proxy({
|
|
hideCode: false,
|
|
setHideCode: (value: boolean) => {
|
|
appState.hideCode = value
|
|
},
|
|
|
|
selectedCode: '',
|
|
setSelectedCode: (value: string) => {
|
|
appState.selectedCode = value
|
|
},
|
|
|
|
loginDialogOpen: false,
|
|
setLoginDialogOpen: (value: boolean) => {
|
|
appState.loginDialogOpen = value
|
|
},
|
|
|
|
runsLoading: [] as string[],
|
|
setRunsLoading: (value: string[]) => {
|
|
appState.runsLoading = value
|
|
},
|
|
})
|
|
|
|
export const getAppStateSnapshot = () => snapshot(appState)
|
|
export const useAppStateSnapshot = (options?: Parameters<typeof useSnapshot>[1]) =>
|
|
useSnapshot(appState, options)
|