- 新增家庭共享订阅管理 - 新增用户邀请统计 - 新增签名和订阅模式设置表单 - 更新 API 服务层和国际化文件 - UI 组件优化(enhanced-input、pro-table)
This commit is contained in:
@@ -15,6 +15,7 @@ import {
|
||||
DropdownMenuTrigger,
|
||||
} from "@workspace/ui/components/dropdown-menu";
|
||||
import { Icon } from "@workspace/ui/composed/icon";
|
||||
import { shortenDeviceIdentifier } from "@workspace/ui/utils/device";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useNavs } from "@/layout/navs";
|
||||
import { useGlobalStore } from "@/stores/global";
|
||||
@@ -32,6 +33,13 @@ export function UserNav() {
|
||||
};
|
||||
|
||||
if (user) {
|
||||
const method = user?.auth_methods?.[0];
|
||||
const isDevice = method?.auth_type === "device";
|
||||
const rawIdentifier = method?.auth_identifier ?? "";
|
||||
const displayName = isDevice
|
||||
? shortenDeviceIdentifier(rawIdentifier)
|
||||
: rawIdentifier.split("@")[0] || "";
|
||||
|
||||
return (
|
||||
<DropdownMenu modal={false}>
|
||||
<DropdownMenuTrigger asChild>
|
||||
@@ -40,16 +48,14 @@ export function UserNav() {
|
||||
<AvatarImage
|
||||
alt={user?.avatar ?? ""}
|
||||
className="object-cover"
|
||||
src={user?.auth_methods?.[0]?.auth_identifier ?? ""}
|
||||
src={isDevice ? "" : rawIdentifier}
|
||||
/>
|
||||
<AvatarFallback className="bg-linear-to-br from-primary/90 to-primary font-medium text-background">
|
||||
{user?.auth_methods?.[0]?.auth_identifier
|
||||
.toUpperCase()
|
||||
.charAt(0)}
|
||||
{displayName.toUpperCase().charAt(0)}
|
||||
</AvatarFallback>
|
||||
</Avatar>
|
||||
<span className="max-w-10 truncate text-sm sm:max-w-[100px]">
|
||||
{user?.auth_methods?.[0]?.auth_identifier.split("@")[0]}
|
||||
{displayName}
|
||||
</span>
|
||||
<Icon
|
||||
className="size-4 text-muted-foreground"
|
||||
|
||||
Reference in New Issue
Block a user