@carlonicora/nextjs-jsonapi 1.29.1 → 1.29.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BlockNoteEditor-7BDLLHRA.js → BlockNoteEditor-CJWHJRG3.js} +17 -17
- package/dist/BlockNoteEditor-CJWHJRG3.js.map +1 -0
- package/dist/{BlockNoteEditor-F5KCNLVF.mjs → BlockNoteEditor-ZET7ANBC.mjs} +7 -7
- package/dist/BlockNoteEditor-ZET7ANBC.mjs.map +1 -0
- package/dist/billing/index.js +334 -333
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +8 -7
- package/dist/billing/index.mjs.map +1 -1
- package/dist/{chunk-YLSLXQ3O.mjs → chunk-3HGZMKT4.mjs} +494 -524
- package/dist/chunk-3HGZMKT4.mjs.map +1 -0
- package/dist/{chunk-7M7NPKOF.js → chunk-6HQ6CPVL.js} +916 -946
- package/dist/chunk-6HQ6CPVL.js.map +1 -0
- package/dist/{chunk-DU64WMZD.mjs → chunk-NYNLJEPF.mjs} +4 -4
- package/dist/chunk-NYNLJEPF.mjs.map +1 -0
- package/dist/{chunk-J22NEVSK.js → chunk-UYBCHXXL.js} +4 -4
- package/dist/chunk-UYBCHXXL.js.map +1 -0
- package/dist/client/index.js +3 -3
- package/dist/client/index.mjs +2 -2
- package/dist/components/index.js +3 -3
- package/dist/components/index.mjs +2 -2
- package/dist/contexts/index.js +3 -3
- package/dist/contexts/index.mjs +2 -2
- package/dist/core/index.js +2 -2
- package/dist/core/index.mjs +1 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +1 -1
- package/package.json +1 -1
- package/src/components/details/AllowedUsersDetails.tsx +1 -1
- package/src/components/editors/BlockNoteEditor.tsx +5 -5
- package/src/components/forms/CommonAssociationForm.tsx +9 -9
- package/src/components/forms/CommonDeleter.tsx +14 -8
- package/src/components/forms/CommonEditorButtons.tsx +2 -2
- package/src/components/forms/CommonEditorHeader.tsx +4 -4
- package/src/components/forms/CommonEditorTrigger.tsx +1 -1
- package/src/components/forms/FileUploader.tsx +8 -8
- package/src/components/forms/FormDateTime.tsx +6 -12
- package/src/components/forms/FormInput.tsx +4 -20
- package/src/components/forms/PasswordInput.tsx +1 -1
- package/src/components/navigations/Breadcrumb.tsx +1 -1
- package/src/components/navigations/Header.tsx +2 -2
- package/src/components/navigations/RecentPagesNavigator.tsx +3 -3
- package/src/components/tables/ContentTableSearch.tsx +1 -1
- package/src/contexts/CommonContext.tsx +2 -2
- package/src/core/abstracts/AbstractService.ts +2 -2
- package/src/features/auth/components/details/LandingComponent.tsx +5 -5
- package/src/features/auth/components/forms/AcceptInvitation.tsx +16 -22
- package/src/features/auth/components/forms/ActivateAccount.tsx +8 -8
- package/src/features/auth/components/forms/ForgotPassword.tsx +9 -9
- package/src/features/auth/components/forms/Login.tsx +12 -12
- package/src/features/auth/components/forms/Register.tsx +19 -21
- package/src/features/auth/components/forms/ResetPassword.tsx +12 -18
- package/src/features/billing/stripe-subscription/hooks/useSubscriptionWizard.ts +5 -4
- package/src/features/company/components/details/TokenStatusIndicator.tsx +7 -7
- package/src/features/company/components/forms/CompanyConfigurationEditor.tsx +2 -2
- package/src/features/company/components/forms/CompanyDeleter.tsx +13 -11
- package/src/features/company/components/forms/CompanyEditor.tsx +7 -13
- package/src/features/company/components/lists/CompaniesList.tsx +1 -1
- package/src/features/company/contexts/CompanyContext.tsx +1 -1
- package/src/features/company/hooks/useCompanyTableStructure.tsx +2 -2
- package/src/features/content/components/lists/ContentsList.tsx +1 -1
- package/src/features/content/components/lists/ContentsListById.tsx +1 -1
- package/src/features/content/components/lists/RelevantContentsList.tsx +1 -1
- package/src/features/content/hooks/useContentTableStructure.tsx +5 -5
- package/src/features/notification/components/containers/NotificationsListContainer.tsx +2 -2
- package/src/features/notification/components/lists/NotificationsList.tsx +3 -3
- package/src/features/notification/components/modals/NotificationModal.tsx +3 -5
- package/src/features/notification/components/notifications/Notification.tsx +4 -4
- package/src/features/notification/contexts/NotificationContext.tsx +2 -2
- package/src/features/role/components/details/RoleDetails.tsx +1 -1
- package/src/features/role/components/forms/FormRoles.tsx +2 -2
- package/src/features/role/components/forms/RemoveUserFromRole.tsx +9 -11
- package/src/features/role/components/forms/UserRoleAdd.tsx +18 -18
- package/src/features/role/components/lists/RolesList.tsx +1 -1
- package/src/features/role/components/lists/UserRolesList.tsx +1 -1
- package/src/features/role/contexts/RoleContext.tsx +2 -2
- package/src/features/role/hooks/useRoleTableStructure.tsx +3 -3
- package/src/features/user/components/containers/UsersListContainer.tsx +2 -2
- package/src/features/user/components/details/UserDetails.tsx +6 -6
- package/src/features/user/components/forms/RoleUserAdd.tsx +8 -8
- package/src/features/user/components/forms/UserAvatarEditor.tsx +2 -2
- package/src/features/user/components/forms/UserEditor.tsx +21 -25
- package/src/features/user/components/forms/UserReactivator.tsx +7 -7
- package/src/features/user/components/forms/UserResentInvitationEmail.tsx +9 -9
- package/src/features/user/components/forms/UserSelector.tsx +4 -9
- package/src/features/user/components/lists/AdminUsersList.tsx +1 -1
- package/src/features/user/components/lists/CompanyUsersList.tsx +1 -1
- package/src/features/user/components/lists/RelevantUsersList.tsx +1 -1
- package/src/features/user/components/lists/RoleUsersList.tsx +1 -1
- package/src/features/user/components/lists/UsersList.tsx +1 -1
- package/src/features/user/components/lists/UsersListByContentIds.tsx +1 -1
- package/src/features/user/components/widgets/UserSearchPopover.tsx +3 -3
- package/src/features/user/contexts/UserContext.tsx +5 -5
- package/src/features/user/hooks/useUserTableStructure.tsx +6 -6
- package/src/utils/blocknote-diff.util.ts +1 -1
- package/dist/BlockNoteEditor-7BDLLHRA.js.map +0 -1
- package/dist/BlockNoteEditor-F5KCNLVF.mjs.map +0 -1
- package/dist/chunk-7M7NPKOF.js.map +0 -1
- package/dist/chunk-DU64WMZD.mjs.map +0 -1
- package/dist/chunk-J22NEVSK.js.map +0 -1
- package/dist/chunk-YLSLXQ3O.mjs.map +0 -1
|
@@ -141,7 +141,7 @@ export const NotificationContextProvider = ({ children }: NotificationContextPro
|
|
|
141
141
|
const response: BreadcrumbItemData[] = [];
|
|
142
142
|
|
|
143
143
|
response.push({
|
|
144
|
-
name: t(`
|
|
144
|
+
name: t(`entities.notifications`, { count: 2 }),
|
|
145
145
|
});
|
|
146
146
|
|
|
147
147
|
return response;
|
|
@@ -149,7 +149,7 @@ export const NotificationContextProvider = ({ children }: NotificationContextPro
|
|
|
149
149
|
|
|
150
150
|
const title = () => {
|
|
151
151
|
const response: any = {
|
|
152
|
-
type: t(`
|
|
152
|
+
type: t(`entities.notifications`, { count: 2 }),
|
|
153
153
|
};
|
|
154
154
|
|
|
155
155
|
return response;
|
|
@@ -14,7 +14,7 @@ export function RoleDetails() {
|
|
|
14
14
|
return (
|
|
15
15
|
<Card className="w-full">
|
|
16
16
|
<CardContent className="p-4">
|
|
17
|
-
<AttributeElement title={t(`
|
|
17
|
+
<AttributeElement title={t(`role.fields.description.label`)} value={role.description} />
|
|
18
18
|
</CardContent>
|
|
19
19
|
</Card>
|
|
20
20
|
);
|
|
@@ -53,11 +53,11 @@ export function FormRoles({ form, id, name, roles }: FormRolesProps) {
|
|
|
53
53
|
<Tooltip>
|
|
54
54
|
<TooltipTrigger>
|
|
55
55
|
<FieldLabel className="ml-3 font-normal">
|
|
56
|
-
{t(`
|
|
56
|
+
{t(`role.roles`, { role: role.id.replaceAll(`-`, ``) })}
|
|
57
57
|
</FieldLabel>
|
|
58
58
|
</TooltipTrigger>
|
|
59
59
|
<TooltipContent>
|
|
60
|
-
{t(`
|
|
60
|
+
{t(`role.roles_descriptions`, { role: role.id.replaceAll(`-`, ``) })}
|
|
61
61
|
</TooltipContent>
|
|
62
62
|
</Tooltip>
|
|
63
63
|
</div>
|
|
@@ -56,11 +56,11 @@ export function RemoveUserFromRole({ role, user, refresh }: RemoveUserFromRolePr
|
|
|
56
56
|
setOpen(false);
|
|
57
57
|
refresh();
|
|
58
58
|
} catch (error) {
|
|
59
|
-
errorToast({ title: t(`
|
|
59
|
+
errorToast({ title: t(`common.errors.error`), error: error });
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
const roleName = t(`
|
|
63
|
+
const roleName = t(`role.roles`, { role: role.id.replaceAll(`-`, ``) });
|
|
64
64
|
|
|
65
65
|
return (
|
|
66
66
|
<Dialog open={open} onOpenChange={setOpen}>
|
|
@@ -71,23 +71,21 @@ export function RemoveUserFromRole({ role, user, refresh }: RemoveUserFromRolePr
|
|
|
71
71
|
setOpen(true);
|
|
72
72
|
}}
|
|
73
73
|
>
|
|
74
|
-
<span className="hover:text-destructive cursor-pointer">{t(`
|
|
74
|
+
<span className="hover:text-destructive cursor-pointer">{t(`role.remove_user.title`)}</span>
|
|
75
75
|
</DialogTrigger>
|
|
76
76
|
<DialogContent className={`flex max-h-[70vh] max-w-3xl flex-col overflow-y-auto`}>
|
|
77
77
|
<DialogHeader>
|
|
78
|
-
<DialogTitle>{t(`
|
|
78
|
+
<DialogTitle>{t(`role.remove_user.title`)}</DialogTitle>
|
|
79
79
|
<DialogDescription>
|
|
80
|
-
{canRemove
|
|
81
|
-
? t(`foundations.role.remove_user.subtitle_allowed`)
|
|
82
|
-
: t(`foundations.role.remove_user.subtitle_not_allowed`)}
|
|
80
|
+
{canRemove ? t(`role.remove_user.subtitle_allowed`) : t(`role.remove_user.subtitle_not_allowed`)}
|
|
83
81
|
</DialogDescription>
|
|
84
82
|
</DialogHeader>
|
|
85
83
|
{canRemove ? (
|
|
86
84
|
<>
|
|
87
|
-
{t(`
|
|
85
|
+
{t(`role.remove_user.description_allowed`, { role: roleName, user: user.name })}
|
|
88
86
|
<div className="flex justify-end">
|
|
89
87
|
<Button className="mr-2" variant={"outline"} type={`button`} onClick={() => setOpen(false)}>
|
|
90
|
-
{t(`
|
|
88
|
+
{t(`ui.buttons.cancel`)}
|
|
91
89
|
</Button>
|
|
92
90
|
<Button
|
|
93
91
|
type="submit"
|
|
@@ -97,12 +95,12 @@ export function RemoveUserFromRole({ role, user, refresh }: RemoveUserFromRolePr
|
|
|
97
95
|
}}
|
|
98
96
|
variant={"destructive"}
|
|
99
97
|
>
|
|
100
|
-
{t(`
|
|
98
|
+
{t(`ui.buttons.confirm_delete`)}
|
|
101
99
|
</Button>
|
|
102
100
|
</div>
|
|
103
101
|
</>
|
|
104
102
|
) : (
|
|
105
|
-
<>{t(`
|
|
103
|
+
<>{t(`role.remove_user.description_not_allowed`, { role: roleName, user: user.name })}</>
|
|
106
104
|
)}
|
|
107
105
|
</DialogContent>
|
|
108
106
|
</Dialog>
|
|
@@ -40,14 +40,14 @@ export function UserRoleAdd({ user, refresh }: UserRoleAddProps) {
|
|
|
40
40
|
setRoles(roles.filter((u) => u.id !== role.id));
|
|
41
41
|
|
|
42
42
|
toast.message(
|
|
43
|
-
t(`
|
|
44
|
-
source: t(`
|
|
45
|
-
destination: t(`
|
|
43
|
+
t(`common.association.label`, {
|
|
44
|
+
source: t(`entities.roles`, { count: 1 }),
|
|
45
|
+
destination: t(`entities.users`, { count: 1 }),
|
|
46
46
|
}),
|
|
47
47
|
{
|
|
48
|
-
description: t(`
|
|
49
|
-
source: t(`
|
|
50
|
-
destination: t(`
|
|
48
|
+
description: t(`common.association.success`, {
|
|
49
|
+
source: t(`entities.roles`, { count: 1 }),
|
|
50
|
+
destination: t(`entities.users`, { count: 1 }),
|
|
51
51
|
source_name: role.name,
|
|
52
52
|
destination_name: user.name,
|
|
53
53
|
}),
|
|
@@ -83,34 +83,34 @@ export function UserRoleAdd({ user, refresh }: UserRoleAddProps) {
|
|
|
83
83
|
<>
|
|
84
84
|
<Button size="sm" onClick={() => setOpen(true)}>
|
|
85
85
|
<PlusCircle className="mr-3 h-3.5 w-3.5" />
|
|
86
|
-
{t(`
|
|
87
|
-
source: t(`
|
|
88
|
-
destination: t(`
|
|
86
|
+
{t(`common.association.label`, {
|
|
87
|
+
source: t(`entities.roles`, { count: 1 }),
|
|
88
|
+
destination: t(`entities.users`, { count: 1 }),
|
|
89
89
|
})}
|
|
90
90
|
</Button>
|
|
91
91
|
<CommandDialog open={open} onOpenChange={setOpen}>
|
|
92
92
|
<DialogTitle>
|
|
93
|
-
{t(`
|
|
94
|
-
source: t(`
|
|
95
|
-
destination: t(`
|
|
93
|
+
{t(`common.association.label`, {
|
|
94
|
+
source: t(`entities.roles`, { count: 1 }),
|
|
95
|
+
destination: t(`entities.users`, { count: 1 }),
|
|
96
96
|
})}
|
|
97
97
|
</DialogTitle>
|
|
98
98
|
<DialogDescription>
|
|
99
|
-
{t(`
|
|
100
|
-
source: t(`
|
|
101
|
-
destination: t(`
|
|
99
|
+
{t(`common.association.description`, {
|
|
100
|
+
source: t(`entities.roles`, { count: 1 }),
|
|
101
|
+
destination: t(`entities.users`, { count: 1 }),
|
|
102
102
|
destination_name: user.name,
|
|
103
103
|
})}
|
|
104
104
|
</DialogDescription>
|
|
105
105
|
<Command shouldFilter={false}>
|
|
106
106
|
<CommandInput
|
|
107
|
-
placeholder={t(`
|
|
107
|
+
placeholder={t(`ui.search.placeholder`, { type: t(`entities.roles`, { count: 1 }) })}
|
|
108
108
|
value={searchTerm}
|
|
109
109
|
onValueChange={setSearchTerm}
|
|
110
110
|
ref={inputRef}
|
|
111
111
|
/>
|
|
112
112
|
<CommandList className="mt-3 h-auto max-h-96 min-h-96 max-w-full overflow-x-hidden overflow-y-auto">
|
|
113
|
-
<CommandEmpty>{t(`
|
|
113
|
+
<CommandEmpty>{t(`ui.search.no_results`, { type: t(`entities.roles`, { count: 1 }) })}</CommandEmpty>
|
|
114
114
|
{roles.map((role: RoleInterface) => (
|
|
115
115
|
<CommandItem
|
|
116
116
|
className="cursor-pointer hover:bg-muted data-selected:hover:bg-muted bg-transparent data-selected:bg-transparent"
|
|
@@ -118,7 +118,7 @@ export function UserRoleAdd({ user, refresh }: UserRoleAddProps) {
|
|
|
118
118
|
onSelect={() => addUserToRole(role)}
|
|
119
119
|
onClick={() => addUserToRole(role)}
|
|
120
120
|
>
|
|
121
|
-
{t(`
|
|
121
|
+
{t(`role.roles`, { role: role.id.replaceAll(`-`, ``) })}
|
|
122
122
|
</CommandItem>
|
|
123
123
|
))}
|
|
124
124
|
</CommandList>
|
|
@@ -26,7 +26,7 @@ export function UserRolesList({ user }: UserRolesListProps) {
|
|
|
26
26
|
data={data}
|
|
27
27
|
fields={[RoleFields.name, RoleFields.description]}
|
|
28
28
|
tableGeneratorType={Modules.Role}
|
|
29
|
-
title={t(`
|
|
29
|
+
title={t(`entities.roles`, { count: 2 })}
|
|
30
30
|
/>
|
|
31
31
|
);
|
|
32
32
|
}
|
|
@@ -32,7 +32,7 @@ export const RoleProvider = ({ children, dehydratedRole }: RoleProviderProps) =>
|
|
|
32
32
|
const response: BreadcrumbItemData[] = [];
|
|
33
33
|
|
|
34
34
|
response.push({
|
|
35
|
-
name: t(`
|
|
35
|
+
name: t(`entities.roles`, { count: 2 }),
|
|
36
36
|
href: generateUrl({ page: Modules.Role }),
|
|
37
37
|
});
|
|
38
38
|
|
|
@@ -47,7 +47,7 @@ export const RoleProvider = ({ children, dehydratedRole }: RoleProviderProps) =>
|
|
|
47
47
|
|
|
48
48
|
const title = () => {
|
|
49
49
|
const response: any = {
|
|
50
|
-
type: t(`
|
|
50
|
+
type: t(`entities.roles`, { count: role ? 1 : 2 }),
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
const functions: ReactNode[] = [];
|
|
@@ -37,7 +37,7 @@ export const useRoleTableStructure: UseTableStructureHook<RoleInterface, RoleFie
|
|
|
37
37
|
[RoleFields.name]: () => ({
|
|
38
38
|
id: "name",
|
|
39
39
|
accessorKey: "name",
|
|
40
|
-
header: t(`
|
|
40
|
+
header: t(`role.fields.name.label`),
|
|
41
41
|
cell: ({ row }: { row: Row<TableContent<RoleInterface>> }) => {
|
|
42
42
|
const role = row.original.jsonApiData as RoleInterface;
|
|
43
43
|
return <Link href={generateUrl({ page: Modules.Role, id: role.id })}>{row.getValue("name")}</Link>;
|
|
@@ -48,7 +48,7 @@ export const useRoleTableStructure: UseTableStructureHook<RoleInterface, RoleFie
|
|
|
48
48
|
[RoleFields.description]: () => ({
|
|
49
49
|
id: "description",
|
|
50
50
|
accessorKey: "description",
|
|
51
|
-
header: t(`
|
|
51
|
+
header: t(`role.fields.description.label`),
|
|
52
52
|
cell: ({ row }: { row: Row<TableContent<RoleInterface>> }) => <>{row.getValue("description")}</>,
|
|
53
53
|
enableSorting: false,
|
|
54
54
|
enableHiding: false,
|
|
@@ -56,7 +56,7 @@ export const useRoleTableStructure: UseTableStructureHook<RoleInterface, RoleFie
|
|
|
56
56
|
[RoleFields.createdAt]: () =>
|
|
57
57
|
cellDate({
|
|
58
58
|
name: "createdAt",
|
|
59
|
-
title: t(`
|
|
59
|
+
title: t(`common.date.create`),
|
|
60
60
|
}),
|
|
61
61
|
};
|
|
62
62
|
|
|
@@ -15,13 +15,13 @@ function UsersListContainerInternal() {
|
|
|
15
15
|
|
|
16
16
|
const tabs: Tab[] = [
|
|
17
17
|
{
|
|
18
|
-
label: t(`
|
|
18
|
+
label: t(`entities.users`, { count: 2 }),
|
|
19
19
|
content: <CompanyUsersList />,
|
|
20
20
|
modules: [Modules.Company],
|
|
21
21
|
action: Action.Read,
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
|
-
label: t(`
|
|
24
|
+
label: t(`user.deleted`),
|
|
25
25
|
content: <CompanyUsersList isDeleted={true} />,
|
|
26
26
|
modules: [Modules.Company],
|
|
27
27
|
action: Action.Update,
|
|
@@ -29,7 +29,7 @@ export function UserDetails({ user }: UserDetailsProps) {
|
|
|
29
29
|
{user.roles.map((role: RoleInterface, index: number) => (
|
|
30
30
|
<Link key={role.id} href={generateUrl({ page: Modules.Role, id: role.id })}>
|
|
31
31
|
<Badge className="mr-2" variant={`default`}>
|
|
32
|
-
{t(`
|
|
32
|
+
{t(`role.roles`, { role: role.id.replaceAll(`-`, ``) })}
|
|
33
33
|
</Badge>
|
|
34
34
|
</Link>
|
|
35
35
|
))}
|
|
@@ -54,21 +54,21 @@ export function UserDetails({ user }: UserDetailsProps) {
|
|
|
54
54
|
<ContentTitle module={Modules.User} type={title.type} element={title.element} functions={title.functions} />
|
|
55
55
|
{user.isDeleted ? (
|
|
56
56
|
<div>
|
|
57
|
-
<Badge variant="destructive">{t(`
|
|
57
|
+
<Badge variant="destructive">{t(`user.errors.deleted`)}</Badge>
|
|
58
58
|
</div>
|
|
59
59
|
) : (
|
|
60
60
|
<>
|
|
61
61
|
{!user.isActivated && (
|
|
62
62
|
<div>
|
|
63
|
-
<Badge variant="destructive">{t(`
|
|
63
|
+
<Badge variant="destructive">{t(`user.errors.inactive`)}</Badge>
|
|
64
64
|
</div>
|
|
65
65
|
)}
|
|
66
66
|
</>
|
|
67
67
|
)}
|
|
68
68
|
{roles}
|
|
69
|
-
<AttributeElement inline={true} title={t(`
|
|
70
|
-
<AttributeElement inline={true} title={t(`
|
|
71
|
-
<AttributeElement inline={false} title={t(`
|
|
69
|
+
<AttributeElement inline={true} title={t(`user.fields.title.label`)} value={user.title} />
|
|
70
|
+
<AttributeElement inline={true} title={t(`common.fields.email.label`)} value={user.email} />
|
|
71
|
+
<AttributeElement inline={false} title={t(`user.fields.bio.label`)} value={user.bio} />
|
|
72
72
|
</div>
|
|
73
73
|
);
|
|
74
74
|
}
|
|
@@ -47,10 +47,10 @@ function AddUserToRoleInternal({ role, refresh }: AddUserToRoleProps) {
|
|
|
47
47
|
|
|
48
48
|
triggerAssociationToast({
|
|
49
49
|
t: t,
|
|
50
|
-
source: t(`
|
|
51
|
-
destination: t(`
|
|
50
|
+
source: t(`entities.users`, { count: 1 }),
|
|
51
|
+
destination: t(`entities.roles`, { count: 1 }),
|
|
52
52
|
source_name: user.name,
|
|
53
|
-
destination_name: t(`
|
|
53
|
+
destination_name: t(`role.roles`, { role: role.id.replaceAll(`-`, ``) }),
|
|
54
54
|
});
|
|
55
55
|
|
|
56
56
|
refresh();
|
|
@@ -72,17 +72,17 @@ function AddUserToRoleInternal({ role, refresh }: AddUserToRoleProps) {
|
|
|
72
72
|
return (
|
|
73
73
|
<>
|
|
74
74
|
<CommonAssociationTrigger
|
|
75
|
-
sourceType={t(`
|
|
76
|
-
destinationType={t(`
|
|
75
|
+
sourceType={t(`entities.users`, { count: 1 })}
|
|
76
|
+
destinationType={t(`entities.roles`, { count: 1 })}
|
|
77
77
|
onTrigger={() => setShow(true)}
|
|
78
78
|
/>
|
|
79
79
|
<CommonAssociationCommandDialog
|
|
80
80
|
show={show}
|
|
81
81
|
setShow={setShow}
|
|
82
82
|
data={data}
|
|
83
|
-
source={t(`
|
|
84
|
-
destination={t(`
|
|
85
|
-
destinationName={t(`
|
|
83
|
+
source={t(`entities.users`, { count: 1 })}
|
|
84
|
+
destination={t(`entities.roles`, { count: 1 })}
|
|
85
|
+
destinationName={t(`role.roles`, { role: role.id.replaceAll(`-`, ``) })}
|
|
86
86
|
>
|
|
87
87
|
<UserListInAdd data={data} existingUsers={existingUsers} setSelectedUser={addUserToRole} />
|
|
88
88
|
</CommonAssociationCommandDialog>
|
|
@@ -49,7 +49,7 @@ export function UserAvatarEditor({ user, file, setFile, resetImage, setResetImag
|
|
|
49
49
|
{!resetImage && (file || user?.avatar) ? (
|
|
50
50
|
<Image
|
|
51
51
|
src={file ? URL.createObjectURL(file) : user?.avatar || ""}
|
|
52
|
-
alt={t(`
|
|
52
|
+
alt={t(`common.avatar`)}
|
|
53
53
|
width={200}
|
|
54
54
|
height={200}
|
|
55
55
|
/>
|
|
@@ -70,7 +70,7 @@ export function UserAvatarEditor({ user, file, setFile, resetImage, setResetImag
|
|
|
70
70
|
setResetImage(true);
|
|
71
71
|
}}
|
|
72
72
|
>
|
|
73
|
-
{t(`
|
|
73
|
+
{t(`ui.buttons.remove`)}
|
|
74
74
|
</Button>
|
|
75
75
|
)}
|
|
76
76
|
</div>
|
|
@@ -67,8 +67,8 @@ function UserEditorInternal({ user, propagateChanges, adminCreated, trigger, onR
|
|
|
67
67
|
|
|
68
68
|
const formSchema = z.object({
|
|
69
69
|
id: z.uuidv4(),
|
|
70
|
-
name: z.string().min(1, { message: t(`
|
|
71
|
-
email: z.string().min(1, { message: t(`
|
|
70
|
+
name: z.string().min(1, { message: t(`user.fields.name.error`) }),
|
|
71
|
+
email: z.string().min(1, { message: t(`common.fields.email.error`) }),
|
|
72
72
|
password: z.string().optional(),
|
|
73
73
|
title: z.string().optional(),
|
|
74
74
|
bio: z.string().optional(),
|
|
@@ -101,9 +101,9 @@ function UserEditorInternal({ user, propagateChanges, adminCreated, trigger, onR
|
|
|
101
101
|
if (existingUser) {
|
|
102
102
|
form.setError("email", {
|
|
103
103
|
type: "manual",
|
|
104
|
-
message: t(`
|
|
104
|
+
message: t(`user.errors.email_exists`),
|
|
105
105
|
});
|
|
106
|
-
errorToast({ title: t(`
|
|
106
|
+
errorToast({ title: t(`user.errors.email_exists`), error: "" });
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
109
109
|
} catch (error) {
|
|
@@ -157,7 +157,7 @@ function UserEditorInternal({ user, propagateChanges, adminCreated, trigger, onR
|
|
|
157
157
|
router.push(generateUrl({ page: Modules.User, id: updatedUser.id }));
|
|
158
158
|
}
|
|
159
159
|
} catch (error) {
|
|
160
|
-
errorToast({ title: user ? t(`
|
|
160
|
+
errorToast({ title: user ? t(`common.errors.update`) : t(`common.errors.create`), error });
|
|
161
161
|
}
|
|
162
162
|
};
|
|
163
163
|
|
|
@@ -216,7 +216,7 @@ function UserEditorInternal({ user, propagateChanges, adminCreated, trigger, onR
|
|
|
216
216
|
<DialogContent
|
|
217
217
|
className={`flex max-h-[70vh] ${canChangeRoles ? `max-w-[90vw]` : `max-w-3xl`} min-h-3xl max-h-[90vh] flex-col overflow-y-auto`}
|
|
218
218
|
>
|
|
219
|
-
<CommonEditorHeader type={t(`
|
|
219
|
+
<CommonEditorHeader type={t(`entities.users`, { count: 1 })} name={user?.name} />
|
|
220
220
|
<Form {...form}>
|
|
221
221
|
<form onSubmit={form.handleSubmit(onSubmit)} className={`flex w-full flex-col gap-y-4`}>
|
|
222
222
|
<div className={`flex flex-row gap-x-4`}>
|
|
@@ -233,54 +233,50 @@ function UserEditorInternal({ user, propagateChanges, adminCreated, trigger, onR
|
|
|
233
233
|
<FormInput
|
|
234
234
|
form={form}
|
|
235
235
|
id="name"
|
|
236
|
-
name={t(`
|
|
237
|
-
placeholder={t(`
|
|
236
|
+
name={t(`user.fields.name.label`)}
|
|
237
|
+
placeholder={t(`user.fields.name.placeholder`)}
|
|
238
238
|
/>
|
|
239
239
|
<FormInput
|
|
240
240
|
form={form}
|
|
241
241
|
id="email"
|
|
242
|
-
name={t(`
|
|
243
|
-
placeholder={t(`
|
|
242
|
+
name={t(`common.fields.email.label`)}
|
|
243
|
+
placeholder={t(`common.fields.email.placeholder`)}
|
|
244
244
|
/>
|
|
245
245
|
<FormInput
|
|
246
246
|
form={form}
|
|
247
247
|
id="phone"
|
|
248
|
-
name={t(`
|
|
249
|
-
placeholder={t(`
|
|
248
|
+
name={t(`user.fields.phone.label`)}
|
|
249
|
+
placeholder={t(`user.fields.phone.placeholder`)}
|
|
250
250
|
/>
|
|
251
251
|
<FormPassword
|
|
252
252
|
form={form}
|
|
253
253
|
id="password"
|
|
254
|
-
name={t(`
|
|
255
|
-
placeholder={t(`
|
|
254
|
+
name={t(`user.fields.password.label`)}
|
|
255
|
+
placeholder={t(`user.fields.password.placeholder`)}
|
|
256
256
|
/>
|
|
257
257
|
<FormInput
|
|
258
258
|
form={form}
|
|
259
259
|
id="title"
|
|
260
|
-
name={t(`
|
|
261
|
-
placeholder={t(`
|
|
260
|
+
name={t(`user.fields.title.label`)}
|
|
261
|
+
placeholder={t(`user.fields.title.placeholder`)}
|
|
262
262
|
/>
|
|
263
263
|
<FormTextarea
|
|
264
264
|
form={form}
|
|
265
265
|
id="bio"
|
|
266
|
-
name={t(`
|
|
267
|
-
placeholder={t(`
|
|
266
|
+
name={t(`user.fields.bio.label`)}
|
|
267
|
+
placeholder={t(`user.fields.bio.placeholder`)}
|
|
268
268
|
className="min-h-40"
|
|
269
269
|
/>
|
|
270
270
|
</div>
|
|
271
271
|
{canChangeRoles && (
|
|
272
272
|
<div className="flex w-1/3 flex-col">
|
|
273
273
|
{canChangeRoles && (
|
|
274
|
-
<FormRoles form={form} id="roleIds" name={t(`
|
|
274
|
+
<FormRoles form={form} id="roleIds" name={t(`entities.roles`, { count: 2 })} roles={roles} />
|
|
275
275
|
)}
|
|
276
276
|
{!user && (
|
|
277
277
|
<div className="flex flex-col gap-y-4">
|
|
278
|
-
<div className="text-sm font-semibold">{t(`
|
|
279
|
-
<FormCheckbox
|
|
280
|
-
form={form}
|
|
281
|
-
id="sendInvitationEmail"
|
|
282
|
-
name={t(`foundations.user.send_activation_email`)}
|
|
283
|
-
/>
|
|
278
|
+
<div className="text-sm font-semibold">{t(`user.send_activation_email`)}</div>
|
|
279
|
+
<FormCheckbox form={form} id="sendInvitationEmail" name={t(`user.send_activation_email`)} />
|
|
284
280
|
</div>
|
|
285
281
|
)}
|
|
286
282
|
</div>
|
|
@@ -35,7 +35,7 @@ function UserReactivatorInterface({ user, propagateChanges }: UserReactivatorPro
|
|
|
35
35
|
setOpen(false);
|
|
36
36
|
propagateChanges(updatedUser);
|
|
37
37
|
} catch (error) {
|
|
38
|
-
errorToast({ title: t(`
|
|
38
|
+
errorToast({ title: t(`common.errors.error`), error: error });
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
|
|
@@ -44,18 +44,18 @@ function UserReactivatorInterface({ user, propagateChanges }: UserReactivatorPro
|
|
|
44
44
|
<DialogTrigger>
|
|
45
45
|
<Button size="sm">
|
|
46
46
|
<UserCheckIcon className="mr-3 h-3.5 w-3.5" />
|
|
47
|
-
{t(`
|
|
47
|
+
{t(`user.buttons.reactivate`)}
|
|
48
48
|
</Button>
|
|
49
49
|
</DialogTrigger>
|
|
50
50
|
<DialogContent className={`flex max-h-[70vh] max-w-3xl flex-col overflow-y-auto`}>
|
|
51
51
|
<DialogHeader>
|
|
52
|
-
<DialogTitle>{t(`
|
|
53
|
-
<DialogDescription>{t(`
|
|
52
|
+
<DialogTitle>{t(`user.reactivate.title`)}</DialogTitle>
|
|
53
|
+
<DialogDescription>{t(`user.reactivate.subtitle`)}</DialogDescription>
|
|
54
54
|
</DialogHeader>
|
|
55
|
-
{t(`
|
|
55
|
+
{t(`user.reactivate.description`, { name: user.name })}
|
|
56
56
|
<div className="flex justify-end">
|
|
57
57
|
<Button className="mr-2" variant={"outline"} type={`button`} onClick={() => setOpen(false)}>
|
|
58
|
-
{t(`
|
|
58
|
+
{t(`ui.buttons.cancel`)}
|
|
59
59
|
</Button>
|
|
60
60
|
<Button
|
|
61
61
|
type="submit"
|
|
@@ -64,7 +64,7 @@ function UserReactivatorInterface({ user, propagateChanges }: UserReactivatorPro
|
|
|
64
64
|
reactivateUser();
|
|
65
65
|
}}
|
|
66
66
|
>
|
|
67
|
-
{t(`
|
|
67
|
+
{t(`user.buttons.reactivate`)}
|
|
68
68
|
</Button>
|
|
69
69
|
</div>
|
|
70
70
|
</DialogContent>
|
|
@@ -36,11 +36,11 @@ function UserResentInvitationEmailInternal({ user }: UserResentInvitationEmailPr
|
|
|
36
36
|
await UserService.sendInvitation({ userId: user.id, companyId: user.company!.id });
|
|
37
37
|
|
|
38
38
|
setOpen(false);
|
|
39
|
-
toast.message(t(`
|
|
40
|
-
description: t(`
|
|
39
|
+
toast.message(t(`user.resend_activation.email_sent`), {
|
|
40
|
+
description: t(`user.resend_activation.email_sent_description`, { email: user.email }),
|
|
41
41
|
});
|
|
42
42
|
} catch (error) {
|
|
43
|
-
errorToast({ title: t(`
|
|
43
|
+
errorToast({ title: t(`common.errors.error`), error: error });
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
46
|
|
|
@@ -54,17 +54,17 @@ function UserResentInvitationEmailInternal({ user }: UserResentInvitationEmailPr
|
|
|
54
54
|
</Button>
|
|
55
55
|
</DialogTrigger>
|
|
56
56
|
</TooltipTrigger>
|
|
57
|
-
<TooltipContent>{t(`
|
|
57
|
+
<TooltipContent>{t(`user.buttons.resend_activation`)}</TooltipContent>
|
|
58
58
|
</Tooltip>
|
|
59
59
|
<DialogContent className={`flex max-h-[70vh] max-w-3xl flex-col overflow-y-auto`}>
|
|
60
60
|
<DialogHeader>
|
|
61
|
-
<DialogTitle>{t(`
|
|
62
|
-
<DialogDescription>{t(`
|
|
61
|
+
<DialogTitle>{t(`user.resend_activation.title`)}</DialogTitle>
|
|
62
|
+
<DialogDescription>{t(`user.resend_activation.subtitle`)}</DialogDescription>
|
|
63
63
|
</DialogHeader>
|
|
64
|
-
{t(`
|
|
64
|
+
{t(`user.resend_activation.description`, { email: user.email })}
|
|
65
65
|
<div className="flex justify-end">
|
|
66
66
|
<Button className="mr-2" variant={"outline"} type={`button`} onClick={() => setOpen(false)}>
|
|
67
|
-
{t(`
|
|
67
|
+
{t(`ui.buttons.cancel`)}
|
|
68
68
|
</Button>
|
|
69
69
|
<Button
|
|
70
70
|
type="submit"
|
|
@@ -73,7 +73,7 @@ function UserResentInvitationEmailInternal({ user }: UserResentInvitationEmailPr
|
|
|
73
73
|
sendInvitationEmail();
|
|
74
74
|
}}
|
|
75
75
|
>
|
|
76
|
-
{t(`
|
|
76
|
+
{t(`user.buttons.resend_activation`)}
|
|
77
77
|
</Button>
|
|
78
78
|
</div>
|
|
79
79
|
</DialogContent>
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import { CircleX, RefreshCwIcon, SearchIcon, XIcon } from "lucide-react";
|
|
4
4
|
import { useTranslations } from "next-intl";
|
|
5
5
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
6
|
+
import { FormFieldWrapper } from "../../../../components/forms";
|
|
6
7
|
import { Modules } from "../../../../core";
|
|
7
8
|
import { DataListRetriever, useDataListRetriever, useDebounce } from "../../../../hooks";
|
|
8
|
-
import { FormFieldWrapper } from "../../../../components/forms";
|
|
9
9
|
import {
|
|
10
10
|
Avatar,
|
|
11
11
|
AvatarFallback,
|
|
@@ -88,12 +88,7 @@ export function UserSelector({ id, form, label, placeholder, onChange, isRequire
|
|
|
88
88
|
|
|
89
89
|
return (
|
|
90
90
|
<div className="flex w-full flex-col">
|
|
91
|
-
<FormFieldWrapper
|
|
92
|
-
form={form}
|
|
93
|
-
name={id}
|
|
94
|
-
label={label}
|
|
95
|
-
isRequired={isRequired}
|
|
96
|
-
>
|
|
91
|
+
<FormFieldWrapper form={form} name={id} label={label} isRequired={isRequired}>
|
|
97
92
|
{(field) => (
|
|
98
93
|
<Popover open={open} onOpenChange={setOpen} modal={true}>
|
|
99
94
|
<div className="flex w-full flex-row items-center justify-between">
|
|
@@ -117,7 +112,7 @@ export function UserSelector({ id, form, label, placeholder, onChange, isRequire
|
|
|
117
112
|
</>
|
|
118
113
|
) : (
|
|
119
114
|
<div className="text-muted-foreground mr-7 flex h-10 w-full flex-row items-center justify-start rounded-md border p-2 text-sm">
|
|
120
|
-
{placeholder ?? t(`
|
|
115
|
+
{placeholder ?? t(`ui.search.placeholder`, { type: t(`entities.users`, { count: 1 }) })}
|
|
121
116
|
</div>
|
|
122
117
|
)}
|
|
123
118
|
</div>
|
|
@@ -134,7 +129,7 @@ export function UserSelector({ id, form, label, placeholder, onChange, isRequire
|
|
|
134
129
|
<div className="relative mb-2 w-full">
|
|
135
130
|
<SearchIcon className="text-muted-foreground absolute top-2.5 left-2.5 h-4 w-4" />
|
|
136
131
|
<Input
|
|
137
|
-
placeholder={t(`
|
|
132
|
+
placeholder={t(`ui.search.placeholder`, { type: t(`entities.users`, { count: 1 }) })}
|
|
138
133
|
type="text"
|
|
139
134
|
className="w-full pr-8 pl-8"
|
|
140
135
|
onChange={(e) => setSearchTerm(e.target.value)}
|
|
@@ -25,7 +25,7 @@ function AdminUsersListInternal({ company }: AdminUsersListProps) {
|
|
|
25
25
|
|
|
26
26
|
return (
|
|
27
27
|
<ContentListTable
|
|
28
|
-
title={t(`
|
|
28
|
+
title={t(`entities.users`, { count: 2 })}
|
|
29
29
|
data={data}
|
|
30
30
|
fields={[UserFields.name, UserFields.email, UserFields.createdAt]}
|
|
31
31
|
tableGeneratorType={Modules.User}
|
|
@@ -39,7 +39,7 @@ export function CompanyUsersList({ isDeleted }: CompanyUsersListProps) {
|
|
|
39
39
|
fields={[UserFields.name, UserFields.email]}
|
|
40
40
|
tableGeneratorType={Modules.User}
|
|
41
41
|
functions={functions}
|
|
42
|
-
title={t(`
|
|
42
|
+
title={t(`entities.users`, { count: 2 })}
|
|
43
43
|
/>
|
|
44
44
|
);
|
|
45
45
|
}
|
|
@@ -25,7 +25,7 @@ export function RelevantUsersList({ id }: RelevantUsersListProps) {
|
|
|
25
25
|
data={data}
|
|
26
26
|
fields={[UserFields.name, UserFields.email, UserFields.relevance]}
|
|
27
27
|
tableGeneratorType={Modules.User}
|
|
28
|
-
title={t(`
|
|
28
|
+
title={t(`common.relevant_users`)}
|
|
29
29
|
/>
|
|
30
30
|
);
|
|
31
31
|
}
|
|
@@ -26,7 +26,7 @@ export function RoleUsersList({ role }: RoleUsersListProps) {
|
|
|
26
26
|
data={data}
|
|
27
27
|
fields={[UserFields.name, UserFields.email]}
|
|
28
28
|
tableGeneratorType={Modules.User}
|
|
29
|
-
title={t(`
|
|
29
|
+
title={t(`entities.users`, { count: 2 })}
|
|
30
30
|
/>
|
|
31
31
|
);
|
|
32
32
|
}
|