import { Dropdown, Menu, MenuButton, MenuItem } from "@mui/joy"; import clsx from "clsx"; import { LogOutIcon, SmileIcon } from "lucide-react"; import { authServiceClient } from "@/grpcweb"; import useCurrentUser from "@/hooks/useCurrentUser"; import useNavigateTo from "@/hooks/useNavigateTo"; import { Routes } from "@/router"; import { useWorkspaceSettingStore } from "@/store/v1"; import { WorkspaceGeneralSetting } from "@/types/proto/api/v1/workspace_setting_service"; import { WorkspaceSettingKey } from "@/types/proto/store/workspace_setting"; import { useTranslate } from "@/utils/i18n"; import UserAvatar from "./UserAvatar"; interface Props { collapsed?: boolean; } const UserBanner = (props: Props) => { const { collapsed } = props; const t = useTranslate(); const navigateTo = useNavigateTo(); const user = useCurrentUser(); const workspaceSettingStore = useWorkspaceSettingStore(); const workspaceGeneralSetting = workspaceSettingStore.getWorkspaceSettingByKey(WorkspaceSettingKey.GENERAL).generalSetting || WorkspaceGeneralSetting.fromPartial({}); const title = (user ? user.nickname || user.username : workspaceGeneralSetting.customProfile?.title) || "Memos"; const avatarUrl = (user ? user.avatarUrl : workspaceGeneralSetting.customProfile?.logoUrl) || "/full-logo.webp"; const handleSignOut = async () => { await authServiceClient.signOut({}); window.location.href = "/auth"; }; return (