"use client"

import { Sheet, SheetContent, SheetDescription, SheetTitle } from "@/components/ui/sheet"
import { AccountSwitcherPanel } from "@/components/suite/account-switcher-panel"
import {
  DRIVE_SHEET_CONTENT,
  DRIVE_SHEET_OVERLAY,
} from "@/lib/drive/drive-dialog-styles"
import { cn } from "@/lib/utils"

export function AccountSwitcherSheet({
  open,
  onOpenChange,
}: {
  open: boolean
  onOpenChange: (open: boolean) => void
}) {
  const close = () => onOpenChange(false)

  return (
    <Sheet open={open} onOpenChange={onOpenChange}>
      <SheetContent
        side="bottom"
        hideClose
        overlayClassName={DRIVE_SHEET_OVERLAY}
        className={cn(DRIVE_SHEET_CONTENT, "max-h-[min(90dvh,560px)] gap-0")}
      >
        <SheetTitle className="sr-only">Comptes connectés</SheetTitle>
        <SheetDescription className="sr-only">
          Changer de compte ou en ajouter un.
        </SheetDescription>
        <AccountSwitcherPanel onClose={close} />
      </SheetContent>
    </Sheet>
  )
}
