From ab21699dfe4d607f6ca3a0bece780a072c8a9b12 Mon Sep 17 00:00:00 2001 From: ZhaiSoul <842607283@qq.com> Date: Sun, 9 Mar 2025 23:27:40 +0800 Subject: [PATCH] fix: fix some page name error --- .../components/overlay/CreateUserDialog.tsx | 28 ++++++++++++------- .../components/overlay/RoleChangeDialog.tsx | 12 ++++++-- .../components/overlay/SetPasswordDialog.tsx | 28 +++++++++++++++---- web/src/pages/Settings.tsx | 6 ++-- web/src/views/settings/AuthenticationView.tsx | 4 ++- 5 files changed, 55 insertions(+), 23 deletions(-) diff --git a/web/src/components/overlay/CreateUserDialog.tsx b/web/src/components/overlay/CreateUserDialog.tsx index 129859a2e..5da5530f8 100644 --- a/web/src/components/overlay/CreateUserDialog.tsx +++ b/web/src/components/overlay/CreateUserDialog.tsx @@ -51,9 +51,12 @@ export default function CreateUserDialog({ .object({ user: z .string() - .min(1, t("users.dialog.form.usernameIsRequired", { - ns: "views/settings", - })) + .min( + 1, + t("users.dialog.form.usernameIsRequired", { + ns: "views/settings", + }), + ) .regex(/^[A-Za-z0-9._]+$/, { message: t("users.dialog.createUser.usernameOnlyInclude", { ns: "views/settings", @@ -135,13 +138,13 @@ export default function CreateUserDialog({ render={({ field }) => ( - - users.dialog.form.user - + users.dialog.form.user @@ -167,7 +170,9 @@ export default function CreateUserDialog({ - users.dialog.form.password.notMatch + users.dialog.form.password.notMatch diff --git a/web/src/components/overlay/RoleChangeDialog.tsx b/web/src/components/overlay/RoleChangeDialog.tsx index 8689764a7..468a72f0a 100644 --- a/web/src/components/overlay/RoleChangeDialog.tsx +++ b/web/src/components/overlay/RoleChangeDialog.tsx @@ -45,7 +45,9 @@ export default function RoleChangeDialog({ users.dialog.changeRole.title - users.dialog.changeRole.desc + + users.dialog.changeRole.desc + @@ -67,13 +69,17 @@ export default function RoleChangeDialog({
- role.admin + + role.admin +
- role.viewer + + role.viewer +
diff --git a/web/src/components/overlay/SetPasswordDialog.tsx b/web/src/components/overlay/SetPasswordDialog.tsx index 81409c1fb..97dc40cb6 100644 --- a/web/src/components/overlay/SetPasswordDialog.tsx +++ b/web/src/components/overlay/SetPasswordDialog.tsx @@ -79,10 +79,21 @@ export default function SetPasswordDialog({ const getStrengthLabel = () => { if (!password) return ""; - if (passwordStrength <= 1) return t("users.dialog.form.password.strength.weak", { ns: "views/settings" }); - if (passwordStrength === 2) return t("users.dialog.form.password.strength.medium", { ns: "views/settings" }); - if (passwordStrength === 3) return t("users.dialog.form.password.strength.strong", { ns: "views/settings" }); - return t("users.dialog.form.password.strength.veryStrong", { ns: "views/settings" }); + if (passwordStrength <= 1) + return t("users.dialog.form.password.strength.weak", { + ns: "views/settings", + }); + if (passwordStrength === 2) + return t("users.dialog.form.password.strength.medium", { + ns: "views/settings", + }); + if (passwordStrength === 3) + return t("users.dialog.form.password.strength.strong", { + ns: "views/settings", + }); + return t("users.dialog.form.password.strength.veryStrong", { + ns: "views/settings", + }); }; const getStrengthColor = () => { @@ -142,7 +153,9 @@ export default function SetPasswordDialog({ />

- users.dialog.form.password.strength + + users.dialog.form.password.strength + {getStrengthLabel()}

@@ -164,7 +177,10 @@ export default function SetPasswordDialog({ setConfirmPassword(event.target.value); setError(null); }} - placeholder={t("users.dialog.form.newPassword.confirm.placeholder", { ns: "views/settings"})} + placeholder={t( + "users.dialog.form.newPassword.confirm.placeholder", + { ns: "views/settings" }, + )} /> {/* Password match indicator */} diff --git a/web/src/pages/Settings.tsx b/web/src/pages/Settings.tsx index 225642590..2d39f64b3 100644 --- a/web/src/pages/Settings.tsx +++ b/web/src/pages/Settings.tsx @@ -70,7 +70,7 @@ export default function Settings() { const isAdmin = useIsAdmin(); - const allowedViewsForViewer: SettingsType[] = ["UI settings", "debug"]; + const allowedViewsForViewer: SettingsType[] = ["uiSettings", "debug"]; const visibleSettingsViews = !isAdmin ? allowedViewsForViewer : allSettingsViews; @@ -164,7 +164,7 @@ export default function Settings() { if (allSettingsViews.includes(page as SettingsType)) { // Restrict viewer to UI settings if (!isAdmin && !["UI settings", "debug"].includes(page)) { - setPage("UI settings"); + setPage("uiSettings"); } else { setPage(page as SettingsType); } @@ -200,7 +200,7 @@ export default function Settings() { if (value) { // Restrict viewer navigation if (!isAdmin && !["UI settings", "debug"].includes(value)) { - setPageToggle("UI settings"); + setPageToggle("uiSettings"); } else { setPageToggle(value); } diff --git a/web/src/views/settings/AuthenticationView.tsx b/web/src/views/settings/AuthenticationView.tsx index 01fe193ef..fbaab5336 100644 --- a/web/src/views/settings/AuthenticationView.tsx +++ b/web/src/views/settings/AuthenticationView.tsx @@ -224,7 +224,9 @@ export default function AuthenticationView() { users.table.username - users.table.role + + users.table.role + users.table.actions