feat(web): show member creation and last login times

This commit is contained in:
tianma-if committed 2026-10-08 01:08:26 +08:00
1 parent 50f3bdee5e
commit 41cfb4ca29
5 files changed
+29 -1

No files matched your search

@@ -22,8 +22,18 @@ interface UserManagementCardProps {
demoMode: boolean;
}
const formatMemberTime = (value: string, locale: string) =>
new Intl.DateTimeFormat(locale, {
year: "numeric",
month: "short",
day: "numeric",
hour: "2-digit",
minute: "2-digit",
}).format(new Date(value));
export const UserManagementCard = ({ demoMode }: UserManagementCardProps) => {
const { t } = useTranslation();
const { t, i18n } = useTranslation();
const locale = i18n.resolvedLanguage ?? i18n.language;
const queryClient = useQueryClient();
const [createOpen, setCreateOpen] = useState(false);
const [resetUser, setResetUser] = useState<InstanceUser | null>(null);
@@ -103,6 +113,12 @@ export const UserManagementCard = ({ demoMode }: UserManagementCardProps) => {
<div className="min-w-0">
<p className={cn("truncate", SETTINGS_ITEM_TITLE_CLASSNAME)}>{user.displayName || user.username}</p>
<p className="truncate text-xs text-slate-500">@{user.username} · {t(`users.roles.${user.role}`)}</p>
<p className="mt-1 flex flex-wrap gap-x-3 gap-y-0.5 text-xs text-slate-500">
<span>{t("users.createdAt", { time: formatMemberTime(user.createdAt, locale) })}</span>
<span>{user.lastLoginAt
? t("users.lastLoginAt", { time: formatMemberTime(user.lastLoginAt, locale) })
: t("users.noLoginRecord")}</span>
</p>
</div>
<div className="flex items-center gap-3">
{demoMode && user.role === "owner" ? null : (
+3
View File
@@ -2542,6 +2542,9 @@ export const enUS = {
title: "Members",
description: "Create isolated personal note spaces for family or team members. Public registration stays disabled.",
loading: "Loading accounts...",
createdAt: "Created {{time}}",
lastLoginAt: "Last signed in {{time}}",
noLoginRecord: "No sign-in recorded",
create: "Add member",
creating: "Creating...",
createTitle: "Add new member",
+3
View File
@@ -2542,6 +2542,9 @@ export const ja = {
title: "メンバー",
description: "家族やチーム向けに、分離された個人ノート空間を作成します。公開登録はオフのままです。",
loading: "アカウントを読み込み中...",
createdAt: "作成日時:{{time}}",
lastLoginAt: "最終ログイン:{{time}}",
noLoginRecord: "ログイン記録なし",
create: "メンバーを追加",
creating: "作成中...",
createTitle: "新しいメンバーを追加",
+3
View File
@@ -2542,6 +2542,9 @@ export const pl = {
title: "Członkowie",
description: "Twórz odizolowane, osobiste przestrzenie notatek dla członków rodziny lub zespołu. Publiczna rejestracja pozostaje wyłączona.",
loading: "Wczytywanie kont...",
createdAt: "Utworzono: {{time}}",
lastLoginAt: "Ostatnie logowanie: {{time}}",
noLoginRecord: "Brak zapisanego logowania",
create: "Dodaj członka",
creating: "Tworzenie...",
createTitle: "Dodaj nowego członka",
+3
View File
@@ -2540,6 +2540,9 @@ export const zhCN = {
title: "成员管理",
description: "为家人或团队成员创建独立的个人笔记空间。实例不开放公开注册。",
loading: "正在加载账号...",
createdAt: "创建于 {{time}}",
lastLoginAt: "上次登录 {{time}}",
noLoginRecord: "暂无登录记录",
create: "添加成员",
creating: "正在创建...",
createTitle: "添加新成员",