Skip to content

Commit 0904fa5

Browse files
committed
feat: enhance role management dialogs with i18n support
- Added translation support for RoleCopyDialog, RoleDialog, RoleMembersDialog, and RolePermissionDialog components. - Updated validation messages and success/error notifications to use translated strings. - Improved user interface text for better clarity and localization. - Refactored role service methods to streamline API calls for batch updates. - Ensured consistent use of translation hooks across all relevant components.
1 parent 16e82ca commit 0904fa5

File tree

16 files changed

+1878
-208
lines changed

16 files changed

+1878
-208
lines changed

web-site/bun.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web-site/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"md-editor-rt": "^6.0.1",
4747
"mermaid": "^11.11.0",
4848
"mind-elixir": "^5.1.1",
49+
"next-themes": "^0.4.6",
4950
"react": "^19.1.1",
5051
"react-dom": "^19.1.1",
5152
"react-hook-form": "^7.62.0",

web-site/src/components/admin/UserDialog/index.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,10 @@ const UserDialog: React.FC<UserDialogProps> = ({
204204
<DialogContent className="sm:max-w-[500px]">
205205
<DialogHeader>
206206
<DialogTitle>
207-
{isEdit ? t('admin.users.dialogs.edit_title') : t('admin.users.dialogs.create_title')}
207+
{isEdit ? t('users.dialogs.edit_title') : t('users.dialogs.create_title')}
208208
</DialogTitle>
209209
<DialogDescription>
210-
{isEdit ? t('admin.users.dialogs.edit_description') : t('admin.users.dialogs.create_description')}
210+
{isEdit ? t('users.dialogs.edit_description') : t('users.dialogs.create_description')}
211211
</DialogDescription>
212212
</DialogHeader>
213213

@@ -259,7 +259,7 @@ const UserDialog: React.FC<UserDialogProps> = ({
259259

260260
{/* 用户名 */}
261261
<div className="space-y-2">
262-
<Label htmlFor="name">{t('admin.users.form.username')}</Label>
262+
<Label htmlFor="name">{t('users.form.username')}</Label>
263263
<Input
264264
id="name"
265265
value={form.name}
@@ -274,7 +274,7 @@ const UserDialog: React.FC<UserDialogProps> = ({
274274

275275
{/* 邮箱 */}
276276
<div className="space-y-2">
277-
<Label htmlFor="email">{t('admin.users.form.email')}</Label>
277+
<Label htmlFor="email">{t('users.form.email')}</Label>
278278
<Input
279279
id="email"
280280
type="email"
@@ -291,7 +291,7 @@ const UserDialog: React.FC<UserDialogProps> = ({
291291
{/* 密码 */}
292292
<div className="space-y-2">
293293
<Label htmlFor="password">
294-
{t('admin.users.form.password')}
294+
{t('users.form.password')}
295295
{isEdit && <span className="text-sm text-gray-500 ml-1">(留空表示不修改)</span>}
296296
</Label>
297297
<Input
@@ -311,7 +311,7 @@ const UserDialog: React.FC<UserDialogProps> = ({
311311
{(!isEdit || form.password) && (
312312
<div className="space-y-2">
313313
<Label htmlFor="confirmPassword">
314-
{t('admin.users.form.confirm_password')}
314+
{t('users.form.confirm_password')}
315315
</Label>
316316
<Input
317317
id="confirmPassword"
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import {
2+
CircleCheckIcon,
3+
InfoIcon,
4+
Loader2Icon,
5+
OctagonXIcon,
6+
TriangleAlertIcon,
7+
} from "lucide-react"
8+
import { useTheme } from "next-themes"
9+
import { Toaster as Sonner, type ToasterProps } from "sonner"
10+
11+
const Toaster = ({ ...props }: ToasterProps) => {
12+
const { theme = "system" } = useTheme()
13+
14+
return (
15+
<Sonner
16+
theme={theme as ToasterProps["theme"]}
17+
className="toaster group"
18+
icons={{
19+
success: <CircleCheckIcon className="size-4" />,
20+
info: <InfoIcon className="size-4" />,
21+
warning: <TriangleAlertIcon className="size-4" />,
22+
error: <OctagonXIcon className="size-4" />,
23+
loading: <Loader2Icon className="size-4 animate-spin" />,
24+
}}
25+
style={
26+
{
27+
"--normal-bg": "var(--popover)",
28+
"--normal-text": "var(--popover-foreground)",
29+
"--normal-border": "var(--border)",
30+
"--border-radius": "var(--radius)",
31+
} as React.CSSProperties
32+
}
33+
{...props}
34+
/>
35+
)
36+
}
37+
38+
export { Toaster }

0 commit comments

Comments
 (0)