side-panels.ts 805 B

1234567891011121314151617181920212223
  1. import { proxy, snapshot, useSnapshot } from 'valtio'
  2. export type SidePanelTypeProps = 'VERCEL_CONNECTIONS' | 'GITHUB_CONNECTIONS'
  3. export const sidePanelsState = proxy({
  4. /**
  5. * Vercel connections
  6. */
  7. vercelConnectionsOpen: false as boolean,
  8. setVercelConnectionsOpen: (bool: boolean) => {
  9. sidePanelsState.vercelConnectionsOpen = bool
  10. },
  11. // ID to determine which vercel integration installation to use
  12. vercelConnectionsIntegrationId: undefined as undefined | string,
  13. setVercelConnectionsIntegrationId: (id: string) => {
  14. sidePanelsState.vercelConnectionsIntegrationId = id
  15. },
  16. })
  17. export const getSidePanelsState = () => snapshot(sidePanelsState)
  18. export const useSidePanelsStateSnapshot = (options?: Parameters<typeof useSnapshot>[1]) =>
  19. useSnapshot(sidePanelsState, options)