ultisuite-client/components/drive/editor-account-button.tsx
R3D347HR4Y 5304790ed5
Some checks are pending
E2E / Playwright e2e (push) Waiting to run
feat(auth): enhance session management and identity provider settings
- Added SessionGuard component to manage session expiration and online status.
- Updated AuthProvider to streamline session fetching and handling.
- Introduced IdentityProvidersSection for managing OAuth, SAML, and LDAP identity providers.
- Implemented identity provider guides for easier configuration.
- Enhanced mail settings with infinite scroll option for improved user experience.
- Updated global styles and layout components for better consistency across the application.
2026-06-09 09:36:46 +02:00

44 lines
1.3 KiB
TypeScript

"use client"
import { useRef, useState } from "react"
import { AccountAvatar } from "@/components/suite/account-avatar"
import { AccountSwitcherDropdown } from "@/components/suite/account-switcher-dropdown"
import { Button } from "@/components/ui/button"
import { useChromeIdentity } from "@/lib/hooks/use-chrome-identity"
export function EditorAccountButton() {
const [open, setOpen] = useState(false)
const containerRef = useRef<HTMLDivElement>(null)
const identity = useChromeIdentity()
return (
<div className="relative" ref={containerRef}>
<Button
variant="ghost"
size="icon"
className="size-8 overflow-hidden rounded-full p-0"
aria-label={`Compte : ${identity?.email ?? "Utilisateur"}`}
aria-expanded={open}
aria-haspopup="dialog"
onClick={() => setOpen((current) => !current)}
>
{identity ? (
<AccountAvatar
account={{ name: identity.name, email: identity.email }}
size="sm"
/>
) : (
<span className="flex size-8 items-center justify-center rounded-full bg-muted text-xs font-medium text-muted-foreground">
?
</span>
)}
</Button>
<AccountSwitcherDropdown
open={open}
onOpenChange={setOpen}
containerRef={containerRef}
/>
</div>
)
}