import { OnboardingButtons, useDismiss, useNextClick } from '.' import { onboardingPaths } from 'routes/Onboarding/paths' import { useEffect, useState } from 'react' import { useUser } from 'machines/appMachine' export default function UserMenu() { const user = useUser() const dismiss = useDismiss() const next = useNextClick(onboardingPaths.PROJECT_MENU) const [avatarErrored, setAvatarErrored] = useState(false) const errorOrNoImage = !user?.image || avatarErrored const buttonDescription = errorOrNoImage ? 'the menu button' : 'your avatar' // Set up error handling for the user's avatar image, // so the onboarding text can be updated if it fails to load. useEffect(() => { const element = globalThis.document.querySelector( '[data-testid="user-sidebar-toggle"] img' ) const onError = () => setAvatarErrored(true) if (element?.tagName === 'IMG') { element?.addEventListener('error', onError) } return () => { element?.removeEventListener('error', onError) } }, []) return (
Click {buttonDescription} in the upper right to open the user menu. You can change your user-level settings, sign out, report a bug, manage your account, request a feature, and more.
Many settings can be set either a user or per-project level. User settings will apply to all projects, while project settings will only apply to the current project.