mirror of
https://github.com/supabase/supabase.git
synced 2026-10-09 11:25:06 +03:00
This pull request standardizes the usage of props and value types for the `ResizablePanelGroup` and `ResizablePanel` components across multiple files in the codebase. Specifically, it replaces the deprecated `direction` prop with `orientation`, and updates numeric prop values (such as `defaultSize`, `minSize`, and `maxSize`) to be passed as strings. This ensures consistency with the updated component API and improves type safety. **Component API Updates:** * Replaced the `direction` prop with `orientation` for all usages of `ResizablePanelGroup` * Updated all `ResizablePanel` props (`defaultSize`, `minSize`, `maxSize`) to be passed as strings instead of numbers, ensuring compatibility with the latest API requirements. * Removed deprecated or unnecessary props such as `order` from `ResizablePanel` components, and ensured all size-related props are consistently formatted as strings.
84 lines
2.3 KiB
TypeScript
84 lines
2.3 KiB
TypeScript
import { LOCAL_STORAGE_KEYS as COMMON_LOCAL_STORAGE_KEYS } from 'common'
|
|
import { proxy, snapshot, useSnapshot } from 'valtio'
|
|
|
|
const getInitialState = () => {
|
|
return {
|
|
activeDocsSection: ['introduction'],
|
|
docsLanguage: 'js',
|
|
showProjectApiDocs: false,
|
|
showCreateBranchModal: false,
|
|
showAiSettingsModal: false,
|
|
showConnectDialog: false,
|
|
ongoingQueriesPanelOpen: false,
|
|
mobileMenuOpen: false,
|
|
showSidebar: true,
|
|
showEditorPanel: false,
|
|
lastRouteBeforeVisitingAccountPage: '',
|
|
}
|
|
}
|
|
|
|
export const appState = proxy({
|
|
...getInitialState(),
|
|
|
|
activeDocsSection: ['introduction'],
|
|
docsLanguage: 'js' as 'js' | 'bash',
|
|
showProjectApiDocs: false,
|
|
setShowProjectApiDocs: (value: boolean) => {
|
|
appState.showProjectApiDocs = value
|
|
},
|
|
setActiveDocsSection: (value: string[]) => {
|
|
appState.activeDocsSection = value
|
|
},
|
|
setDocsLanguage: (value: 'js' | 'bash') => {
|
|
appState.docsLanguage = value
|
|
},
|
|
|
|
isOptedInTelemetry: false,
|
|
setIsOptedInTelemetry: (value: boolean | null) => {
|
|
appState.isOptedInTelemetry = value === null ? false : value
|
|
if (typeof window !== 'undefined' && value !== null) {
|
|
localStorage.setItem(COMMON_LOCAL_STORAGE_KEYS.TELEMETRY_CONSENT, value.toString())
|
|
}
|
|
},
|
|
|
|
isMfaEnforced: false,
|
|
setIsMfaEnforced: (value: boolean) => {
|
|
appState.isMfaEnforced = value
|
|
},
|
|
|
|
showCreateBranchModal: false,
|
|
setShowCreateBranchModal: (value: boolean) => {
|
|
appState.showCreateBranchModal = value
|
|
},
|
|
|
|
showAiSettingsModal: false,
|
|
setShowAiSettingsModal: (value: boolean) => {
|
|
appState.showAiSettingsModal = value
|
|
},
|
|
|
|
showSidebar: true,
|
|
setShowSidebar: (value: boolean) => {
|
|
appState.showSidebar = value
|
|
},
|
|
|
|
showOngoingQueriesPanelOpen: false,
|
|
setOnGoingQueriesPanelOpen: (value: boolean) => {
|
|
appState.ongoingQueriesPanelOpen = value
|
|
},
|
|
|
|
mobileMenuOpen: false,
|
|
setMobileMenuOpen: (value: boolean) => {
|
|
appState.mobileMenuOpen = value
|
|
},
|
|
|
|
lastRouteBeforeVisitingAccountPage: '',
|
|
setLastRouteBeforeVisitingAccountPage: (value: string) => {
|
|
appState.lastRouteBeforeVisitingAccountPage = value
|
|
},
|
|
})
|
|
|
|
export const getAppStateSnapshot = () => snapshot(appState)
|
|
|
|
export const useAppStateSnapshot = (options?: Parameters<typeof useSnapshot>[1]) =>
|
|
useSnapshot(appState, options)
|