Home / Function/ AdminBar() — supabase Function Reference

AdminBar() — supabase Function Reference

Architecture documentation for the AdminBar() function in index.tsx from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  1dc9d047_bfff_8ce6_da05_e00e4998fd57["AdminBar()"]
  6215f5f8_959b_0d27_9c02_ce5f395aab88["cn()"]
  1dc9d047_bfff_8ce6_da05_e00e4998fd57 -->|calls| 6215f5f8_959b_0d27_9c02_ce5f395aab88
  220cf376_6913_f930_10cc_441b6ddcb173["getClientSideURL()"]
  1dc9d047_bfff_8ce6_da05_e00e4998fd57 -->|calls| 220cf376_6913_f930_10cc_441b6ddcb173
  style 1dc9d047_bfff_8ce6_da05_e00e4998fd57 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/cms/src/components/AdminBar/index.tsx lines 35–88

}> = (props) => {
  const { adminBarProps } = props || {}
  const segments = useSelectedLayoutSegments()
  const [show, setShow] = useState(false)
  const collection = (
    collectionLabels[segments?.[1] as keyof typeof collectionLabels] ? segments[1] : 'pages'
  ) as keyof typeof collectionLabels
  const router = useRouter()

  const onAuthChange = React.useCallback((user: PayloadMeUser) => {
    setShow(Boolean(user?.id))
  }, [])

  return (
    <div
      className={cn(baseClass, 'py-2 bg-black text-white', {
        block: show,
        hidden: !show,
      })}
    >
      <div className="container">
        <PayloadAdminBar
          {...adminBarProps}
          className="py-2 text-white"
          classNames={{
            controls: 'font-medium text-white',
            logo: 'text-white',
            user: 'text-white',
          }}
          cmsURL={getClientSideURL()}
          collectionSlug={collection}
          collectionLabels={{
            plural: collectionLabels[collection]?.plural || 'Pages',
            singular: collectionLabels[collection]?.singular || 'Page',
          }}
          logo={<Title />}
          onAuthChange={onAuthChange}
          onPreviewExit={() => {
            fetch('/next/exit-preview').then(() => {
              router.push('/')
              router.refresh()
            })
          }}
          style={{
            backgroundColor: 'transparent',
            padding: 0,
            position: 'relative',
            zIndex: 'unset',
          }}
        />
      </div>
    </div>
  )
}

Subdomains

Frequently Asked Questions

What does AdminBar() do?
AdminBar() is a function in the supabase codebase.
What does AdminBar() call?
AdminBar() calls 2 function(s): cn, getClientSideURL.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free