@alepha/ui 0.31.0 → 0.33.0
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/README.md +1 -1
- package/dist/account/AccountConnections.js +1 -1
- package/dist/account/AccountConnections.js.map +1 -1
- package/dist/account/AccountDeleteDialog.d.ts.map +1 -1
- package/dist/account/AccountDeleteDialog.js +17 -17
- package/dist/account/AccountDeleteDialog.js.map +1 -1
- package/dist/account/AccountKeys.js +2 -2
- package/dist/account/AccountKeys.js.map +1 -1
- package/dist/account/AccountMfaDialog.d.ts.map +1 -1
- package/dist/account/AccountMfaDialog.js +19 -25
- package/dist/account/AccountMfaDialog.js.map +1 -1
- package/dist/account/AccountPasswordDialog.d.ts.map +1 -1
- package/dist/account/AccountPasswordDialog.js +25 -24
- package/dist/account/AccountPasswordDialog.js.map +1 -1
- package/dist/account/AccountProfile.d.ts.map +1 -1
- package/dist/account/AccountProfile.js +17 -24
- package/dist/account/AccountProfile.js.map +1 -1
- package/dist/account/AccountSecurity.d.ts.map +1 -1
- package/dist/account/AccountSecurity.js +21 -19
- package/dist/account/AccountSecurity.js.map +1 -1
- package/dist/account/AccountSessions.js +1 -1
- package/dist/account/AccountSessions.js.map +1 -1
- package/dist/account/ApiKeyCreateDialog.d.ts.map +1 -1
- package/dist/account/ApiKeyCreateDialog.js +8 -12
- package/dist/account/ApiKeyCreateDialog.js.map +1 -1
- package/dist/admin/AdminFiles.js +1 -1
- package/dist/admin/AdminFiles.js.map +1 -1
- package/dist/admin/AdminJobs.js +1 -1
- package/dist/admin/AdminJobs.js.map +1 -1
- package/dist/admin/AdminKeys.js +1 -1
- package/dist/admin/AdminKeys.js.map +1 -1
- package/dist/admin/AdminParameters.d.ts.map +1 -1
- package/dist/admin/AdminParameters.js +7 -5
- package/dist/admin/AdminParameters.js.map +1 -1
- package/dist/admin/AdminParametersTreeFooterActions.d.ts +2 -2
- package/dist/admin/AdminParametersTreeFooterActions.d.ts.map +1 -1
- package/dist/admin/AdminParametersTreeFooterActions.js.map +1 -1
- package/dist/admin/AdminParametersTreePane.d.ts +2 -2
- package/dist/admin/AdminParametersTreePane.d.ts.map +1 -1
- package/dist/admin/AdminParametersTreePane.js.map +1 -1
- package/dist/admin/AdminRouter.d.ts +1 -3
- package/dist/admin/AdminRouter.d.ts.map +1 -1
- package/dist/admin/AdminRouter.js +2 -4
- package/dist/admin/AdminRouter.js.map +1 -1
- package/dist/admin/AdminSessions.js +1 -1
- package/dist/admin/AdminSessions.js.map +1 -1
- package/dist/admin/AdminUserAvatarControl.d.ts.map +1 -1
- package/dist/admin/AdminUserAvatarControl.js +9 -16
- package/dist/admin/AdminUserAvatarControl.js.map +1 -1
- package/dist/admin/AdminUserDetail.js +4 -4
- package/dist/admin/AdminUserDetail.js.map +1 -1
- package/dist/admin/AdminUsers.d.ts.map +1 -1
- package/dist/admin/AdminUsers.js +10 -12
- package/dist/admin/AdminUsers.js.map +1 -1
- package/dist/admin/AdminUsersRolesPicker.d.ts +5 -1
- package/dist/admin/AdminUsersRolesPicker.d.ts.map +1 -1
- package/dist/admin/AdminUsersRolesPicker.js +2 -3
- package/dist/admin/AdminUsersRolesPicker.js.map +1 -1
- package/dist/admin/analytics/QueryPanel.js +1 -1
- package/dist/admin/analytics/QueryPanel.js.map +1 -1
- package/dist/admin/useConfirmedAction.d.ts +8 -2
- package/dist/admin/useConfirmedAction.d.ts.map +1 -1
- package/dist/admin/useConfirmedAction.js +15 -4
- package/dist/admin/useConfirmedAction.js.map +1 -1
- package/dist/auth/AuthLogin.d.ts.map +1 -1
- package/dist/auth/AuthLogin.js +4 -4
- package/dist/auth/AuthLogin.js.map +1 -1
- package/dist/auth/AuthRegister.js.map +1 -1
- package/dist/form/AutoForm.js +1 -1
- package/dist/form/AutoForm.js.map +1 -1
- package/dist/form/Control.d.ts.map +1 -1
- package/dist/form/Control.js +11 -1
- package/dist/form/Control.js.map +1 -1
- package/dist/form/ControlArray.js +5 -5
- package/dist/form/ControlArray.js.map +1 -1
- package/dist/form/ControlSelect.js +2 -2
- package/dist/form/ControlSelect.js.map +1 -1
- package/dist/form/ControlUpload.d.ts +1 -1
- package/dist/form/ControlUpload.js.map +1 -1
- package/dist/i18n/fr/uiFr.d.ts.map +1 -1
- package/dist/i18n/fr/uiFr.js +0 -9
- package/dist/i18n/fr/uiFr.js.map +1 -1
- package/dist/organizations/MyOrganizationInvitations.js +2 -2
- package/dist/organizations/MyOrganizationInvitations.js.map +1 -1
- package/dist/organizations/OrganizationInviteDialog.js +1 -1
- package/dist/organizations/OrganizationInviteDialog.js.map +1 -1
- package/dist/organizations/OrganizationMembers.js +1 -1
- package/dist/organizations/OrganizationMembers.js.map +1 -1
- package/dist/organizations/OrganizationPendingInvitations.js +1 -1
- package/dist/organizations/OrganizationPendingInvitations.js.map +1 -1
- package/dist/organizations/OrganizationRanks.js +3 -3
- package/dist/organizations/OrganizationRanks.js.map +1 -1
- package/dist/organizations/useInviteOrganizationMember.d.ts +6 -1
- package/dist/organizations/useInviteOrganizationMember.d.ts.map +1 -1
- package/dist/organizations/useInviteOrganizationMember.js +13 -13
- package/dist/organizations/useInviteOrganizationMember.js.map +1 -1
- package/dist/organizations/useRevokeOrganizationInvitation.d.ts +7 -1
- package/dist/organizations/useRevokeOrganizationInvitation.d.ts.map +1 -1
- package/dist/organizations/useRevokeOrganizationInvitation.js +13 -2
- package/dist/organizations/useRevokeOrganizationInvitation.js.map +1 -1
- package/dist/shell/ButtonUser.d.ts +1 -2
- package/dist/shell/ButtonUser.d.ts.map +1 -1
- package/dist/shell/ButtonUser.js +14 -42
- package/dist/shell/ButtonUser.js.map +1 -1
- package/dist/shell/ButtonUserContent.d.ts +13 -0
- package/dist/shell/ButtonUserContent.d.ts.map +1 -0
- package/dist/shell/ButtonUserContent.js +52 -0
- package/dist/shell/ButtonUserContent.js.map +1 -0
- package/dist/shell/ButtonUserPlaceholder.d.ts +14 -0
- package/dist/shell/ButtonUserPlaceholder.d.ts.map +1 -0
- package/dist/shell/ButtonUserPlaceholder.js +17 -0
- package/dist/shell/ButtonUserPlaceholder.js.map +1 -0
- package/dist/styles.css +94 -0
- package/dist/table/DataTable.js +1 -1
- package/dist/table/DataTable.js.map +1 -1
- package/dist/table/DataTableFilterBar.js +2 -2
- package/dist/table/DataTableFilterBar.js.map +1 -1
- package/dist/table/dataTableBaseProps.d.ts +1 -1
- package/dist/table/dataTableTypes.d.ts +3 -3
- package/dist/table/dataTableTypes.d.ts.map +1 -1
- package/dist/table/useDataTableData.d.ts.map +1 -1
- package/dist/table/useDataTableData.js +3 -1
- package/dist/table/useDataTableData.js.map +1 -1
- package/dist/table/useDataTableRefresh.js +2 -2
- package/dist/table/useDataTableRefresh.js.map +1 -1
- package/dist/table/useDataTableSummary.d.ts.map +1 -1
- package/dist/table/useDataTableSummary.js +2 -1
- package/dist/table/useDataTableSummary.js.map +1 -1
- package/package.json +9 -9
- package/src/account/AccountConnections.tsx +1 -1
- package/src/account/AccountDeleteDialog.tsx +25 -31
- package/src/account/AccountKeys.tsx +2 -2
- package/src/account/AccountMfaDialog.tsx +33 -27
- package/src/account/AccountPasswordDialog.tsx +36 -39
- package/src/account/AccountProfile.tsx +29 -43
- package/src/account/AccountSecurity.tsx +57 -64
- package/src/account/AccountSessions.tsx +1 -1
- package/src/account/ApiKeyCreateDialog.tsx +12 -20
- package/src/account/__tests__/AccountRouter.spec.ts +2 -1
- package/src/admin/AdminFiles.tsx +1 -1
- package/src/admin/AdminJobs.tsx +1 -1
- package/src/admin/AdminKeys.tsx +1 -1
- package/src/admin/AdminParameters.tsx +7 -5
- package/src/admin/AdminParametersTreeFooterActions.tsx +2 -2
- package/src/admin/AdminParametersTreePane.tsx +2 -2
- package/src/admin/AdminRouter.tsx +2 -4
- package/src/admin/AdminSessions.tsx +1 -1
- package/src/admin/AdminUserAvatarControl.tsx +17 -22
- package/src/admin/AdminUserDetail.tsx +4 -4
- package/src/admin/AdminUsers.tsx +10 -12
- package/src/admin/AdminUsersRolesPicker.tsx +11 -4
- package/src/admin/__tests__/AdminRouter.spec.ts +3 -2
- package/src/admin/analytics/QueryPanel.tsx +1 -1
- package/src/admin/useConfirmedAction.tsx +24 -10
- package/src/auth/AuthLogin.tsx +10 -9
- package/src/auth/AuthRegister.tsx +2 -2
- package/src/form/AutoForm.tsx +1 -1
- package/src/form/Control.tsx +14 -1
- package/src/form/ControlArray.tsx +5 -5
- package/src/form/ControlSelect.tsx +2 -2
- package/src/form/ControlUpload.tsx +1 -1
- package/src/form/__tests__/ControlArrayChildChange.browser.spec.tsx +1 -1
- package/src/form/__tests__/ControlVerbatim.browser.spec.tsx +71 -0
- package/src/i18n/fr/uiFr.ts +0 -9
- package/src/organizations/MyOrganizationInvitations.tsx +2 -2
- package/src/organizations/OrganizationInviteDialog.tsx +1 -1
- package/src/organizations/OrganizationMembers.tsx +1 -1
- package/src/organizations/OrganizationPendingInvitations.tsx +1 -1
- package/src/organizations/OrganizationRanks.tsx +3 -3
- package/src/organizations/useInviteOrganizationMember.ts +22 -15
- package/src/organizations/useRevokeOrganizationInvitation.ts +23 -4
- package/src/shell/ButtonUser.tsx +14 -79
- package/src/shell/ButtonUserContent.tsx +92 -0
- package/src/shell/ButtonUserPlaceholder.tsx +25 -0
- package/src/shell/__tests__/ActionErrorToaster.browser.spec.tsx +1 -1
- package/src/shell/__tests__/ActionErrorToasterHandled.browser.spec.tsx +1 -2
- package/src/shell/__tests__/AppShell.pageCache.spec.tsx +67 -0
- package/src/styles.css +94 -0
- package/src/table/DataTable.tsx +1 -1
- package/src/table/DataTableFilterBar.tsx +2 -2
- package/src/table/__tests__/DataTableFilterDateRange.browser.spec.tsx +1 -1
- package/src/table/__tests__/DataTableQuerySeed.browser.spec.tsx +1 -1
- package/src/table/__tests__/DataTableShareFilters.browser.spec.tsx +1 -1
- package/src/table/dataTableBaseProps.ts +1 -1
- package/src/table/dataTableTypes.ts +3 -3
- package/src/table/useDataTableData.ts +2 -0
- package/src/table/useDataTableRefresh.ts +3 -3
- package/src/table/useDataTableSummary.ts +2 -1
package/src/admin/AdminUsers.tsx
CHANGED
|
@@ -154,7 +154,7 @@ export const AdminUsers = (props: AdminUsersProps) => {
|
|
|
154
154
|
|
|
155
155
|
const setRoles = useAction<[UserEntity, string[]]>(
|
|
156
156
|
{
|
|
157
|
-
handler: async (user, roles) => {
|
|
157
|
+
handler: async (_ctx, user, roles) => {
|
|
158
158
|
await client.updateUser({
|
|
159
159
|
params: { id: user.id },
|
|
160
160
|
query: { userRealmName: props.userRealmName },
|
|
@@ -172,7 +172,7 @@ export const AdminUsers = (props: AdminUsersProps) => {
|
|
|
172
172
|
|
|
173
173
|
const toggleEnabled = useAction<[UserEntity]>(
|
|
174
174
|
{
|
|
175
|
-
handler: async (user) => {
|
|
175
|
+
handler: async (_ctx, user) => {
|
|
176
176
|
if (isSelf(user)) {
|
|
177
177
|
toast.error(
|
|
178
178
|
tr("admin.users.cantDisableSelf", {
|
|
@@ -216,7 +216,7 @@ export const AdminUsers = (props: AdminUsersProps) => {
|
|
|
216
216
|
|
|
217
217
|
const deleteUser = useAction<[UserEntity]>(
|
|
218
218
|
{
|
|
219
|
-
handler: async (user) => {
|
|
219
|
+
handler: async (_ctx, user) => {
|
|
220
220
|
const label = userLabel(user);
|
|
221
221
|
const ok = await dialog.confirm({
|
|
222
222
|
title: tr("admin.users.deleteTitle", { default: "Delete user" }),
|
|
@@ -239,7 +239,7 @@ export const AdminUsers = (props: AdminUsersProps) => {
|
|
|
239
239
|
|
|
240
240
|
const bulkDelete = useAction<[UserEntity[]]>(
|
|
241
241
|
{
|
|
242
|
-
handler: async (items) => {
|
|
242
|
+
handler: async (_ctx, items) => {
|
|
243
243
|
const targets = items.filter((u) => !isSelf(u));
|
|
244
244
|
if (targets.length === 0) {
|
|
245
245
|
toast.error(
|
|
@@ -275,7 +275,7 @@ export const AdminUsers = (props: AdminUsersProps) => {
|
|
|
275
275
|
|
|
276
276
|
const bulkDisable = useAction<[UserEntity[]]>(
|
|
277
277
|
{
|
|
278
|
-
handler: async (items) => {
|
|
278
|
+
handler: async (_ctx, items) => {
|
|
279
279
|
const enabled = items.filter((u) => u.enabled && !isSelf(u));
|
|
280
280
|
if (enabled.length === 0) {
|
|
281
281
|
toast.error(
|
|
@@ -329,7 +329,7 @@ export const AdminUsers = (props: AdminUsersProps) => {
|
|
|
329
329
|
icon: UserX,
|
|
330
330
|
destructive: true,
|
|
331
331
|
onClick: async (items, ctx) => {
|
|
332
|
-
await bulkDisable.run(items);
|
|
332
|
+
if (!(await bulkDisable.run(items)).ok) return;
|
|
333
333
|
ctx.clearSelection();
|
|
334
334
|
ctx.refresh();
|
|
335
335
|
},
|
|
@@ -341,7 +341,7 @@ export const AdminUsers = (props: AdminUsersProps) => {
|
|
|
341
341
|
icon: Trash2,
|
|
342
342
|
destructive: true,
|
|
343
343
|
onClick: async (items, ctx) => {
|
|
344
|
-
await bulkDelete.run(items);
|
|
344
|
+
if (!(await bulkDelete.run(items)).ok) return;
|
|
345
345
|
ctx.clearSelection();
|
|
346
346
|
ctx.refresh();
|
|
347
347
|
},
|
|
@@ -422,7 +422,7 @@ export const AdminUsers = (props: AdminUsersProps) => {
|
|
|
422
422
|
<AdminUsersRolesPicker
|
|
423
423
|
user={u}
|
|
424
424
|
availableRoles={availableRoles}
|
|
425
|
-
onToggle={(roles) => setRoles.run(u, roles)}
|
|
425
|
+
onToggle={async (roles) => (await setRoles.run(u, roles)).ok}
|
|
426
426
|
rolesLabel={tr("admin.users.rolesLabel", { default: "Roles" })}
|
|
427
427
|
noRolesLabel={tr("admin.users.noRoles", {
|
|
428
428
|
default: "No roles",
|
|
@@ -477,8 +477,7 @@ export const AdminUsers = (props: AdminUsersProps) => {
|
|
|
477
477
|
_u: UserEntity,
|
|
478
478
|
{ refresh }: { refresh: () => void },
|
|
479
479
|
) => {
|
|
480
|
-
await toggleEnabled.run(u);
|
|
481
|
-
refresh();
|
|
480
|
+
if ((await toggleEnabled.run(u)).ok) refresh();
|
|
482
481
|
},
|
|
483
482
|
},
|
|
484
483
|
{
|
|
@@ -491,8 +490,7 @@ export const AdminUsers = (props: AdminUsersProps) => {
|
|
|
491
490
|
_u: UserEntity,
|
|
492
491
|
{ refresh }: { refresh: () => void },
|
|
493
492
|
) => {
|
|
494
|
-
await deleteUser.run(u);
|
|
495
|
-
refresh();
|
|
493
|
+
if ((await deleteUser.run(u)).ok) refresh();
|
|
496
494
|
},
|
|
497
495
|
},
|
|
498
496
|
]
|
|
@@ -25,8 +25,12 @@ export interface AdminUsersRolesPickerProps {
|
|
|
25
25
|
* Persist the row's full role list. The picker computes it: it is the only
|
|
26
26
|
* place that knows the roles already toggled on this row, since the table
|
|
27
27
|
* does not reload the row after a toggle.
|
|
28
|
+
*
|
|
29
|
+
* Resolves whether the change was saved: the picker shows it only then, so
|
|
30
|
+
* a failed save, or a toggle dropped while another was in flight, leaves
|
|
31
|
+
* the row as it was.
|
|
28
32
|
*/
|
|
29
|
-
onToggle: (roles: string[]) => Promise<
|
|
33
|
+
onToggle: (roles: string[]) => Promise<boolean>;
|
|
30
34
|
rolesLabel: string;
|
|
31
35
|
noRolesLabel: string;
|
|
32
36
|
}
|
|
@@ -36,6 +40,8 @@ export interface AdminUsersRolesPickerProps {
|
|
|
36
40
|
*/
|
|
37
41
|
export const AdminUsersRolesPicker = (props: AdminUsersRolesPickerProps) => {
|
|
38
42
|
const [open, setOpen] = useState(false);
|
|
43
|
+
// The role being saved. While one is, every checkbox is disabled: a second
|
|
44
|
+
// toggle would be dropped by the action anyway.
|
|
39
45
|
const [pending, setPending] = useState<string | null>(null);
|
|
40
46
|
// The users table no longer hard-reloads after a role toggle, so the row's
|
|
41
47
|
// `user.roles` would stay stale. Track an optimistic override locally so the
|
|
@@ -84,7 +90,7 @@ export const AdminUsersRolesPicker = (props: AdminUsersRolesPickerProps) => {
|
|
|
84
90
|
<div className="flex flex-col">
|
|
85
91
|
{rows.map((role) => {
|
|
86
92
|
const checked = userRoles.includes(role.name);
|
|
87
|
-
const disabled = role.default === true || pending
|
|
93
|
+
const disabled = role.default === true || pending !== null;
|
|
88
94
|
return (
|
|
89
95
|
// `cursor-pointer` stays: the global rule in
|
|
90
96
|
// `@alepha/ui/src/styles.css` covers controls and menu items,
|
|
@@ -111,8 +117,9 @@ export const AdminUsersRolesPicker = (props: AdminUsersRolesPickerProps) => {
|
|
|
111
117
|
? Array.from(new Set([...userRoles, role.name]))
|
|
112
118
|
: userRoles.filter((r) => r !== role.name);
|
|
113
119
|
try {
|
|
114
|
-
await props.onToggle(roles)
|
|
115
|
-
|
|
120
|
+
if (await props.onToggle(roles)) {
|
|
121
|
+
setOptimisticRoles(roles);
|
|
122
|
+
}
|
|
116
123
|
} finally {
|
|
117
124
|
setPending(null);
|
|
118
125
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { $inject, Alepha
|
|
1
|
+
import { $inject, Alepha } from "alepha";
|
|
2
|
+
import { OPTIONS } from "alepha/internal";
|
|
2
3
|
import { $dictionary, AlephaReactI18n, I18nProvider } from "alepha/react/i18n";
|
|
3
4
|
import {
|
|
4
5
|
$page,
|
|
@@ -107,7 +108,7 @@ describe("AdminRouter", () => {
|
|
|
107
108
|
[router.audits, ["admin:audit:read"]],
|
|
108
109
|
[router.files, ["admin:file:read"]],
|
|
109
110
|
[router.parameters, ["admin:parameter:read"]],
|
|
110
|
-
[router.payments, ["admin:payment:read"
|
|
111
|
+
[router.payments, ["admin:payment:read"]],
|
|
111
112
|
[router.analytics, ["admin:analytics:read"]],
|
|
112
113
|
];
|
|
113
114
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useAction } from "alepha/react";
|
|
2
|
-
import type
|
|
1
|
+
import { type RunResult, useAction } from "alepha/react";
|
|
2
|
+
import { type DependencyList, useCallback } from "react";
|
|
3
3
|
|
|
4
4
|
import { type ConfirmOptions, useDialog } from "../core/useDialog.tsx";
|
|
5
5
|
import { useToast } from "../core/useToast.tsx";
|
|
@@ -24,7 +24,12 @@ export interface UseConfirmedActionConfig<TArgs extends unknown[]> {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export interface UseConfirmedActionReturn<TArgs extends unknown[]> {
|
|
27
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Ask, then run. Resolves `{ ok: true }` when the mutation ran,
|
|
29
|
+
* `{ ok: false, reason: "cancelled" }` when the user declined the confirm,
|
|
30
|
+
* and `useAction`'s other results otherwise.
|
|
31
|
+
*/
|
|
32
|
+
run: (...args: TArgs) => Promise<RunResult<void>>;
|
|
28
33
|
loading: boolean;
|
|
29
34
|
}
|
|
30
35
|
|
|
@@ -62,18 +67,15 @@ export function useConfirmedAction<TArgs extends unknown[]>(
|
|
|
62
67
|
const dialog = useDialog();
|
|
63
68
|
const toast = useToast();
|
|
64
69
|
|
|
65
|
-
const action = useAction<TArgs,
|
|
70
|
+
const action = useAction<TArgs, boolean>(
|
|
66
71
|
{
|
|
67
|
-
handler: async (...
|
|
68
|
-
// useAction appends an ActionContext as the last argument — strip it so
|
|
69
|
-
// the caller's `confirm` / `handler` / `success` see only their args.
|
|
70
|
-
const args = argsWithCtx.slice(0, -1) as unknown as TArgs;
|
|
72
|
+
handler: async (_ctx, ...args) => {
|
|
71
73
|
const options =
|
|
72
74
|
typeof config.confirm === "function"
|
|
73
75
|
? config.confirm(...args)
|
|
74
76
|
: config.confirm;
|
|
75
77
|
const confirmed = await dialog.confirm(options);
|
|
76
|
-
if (!confirmed) return;
|
|
78
|
+
if (!confirmed) return false;
|
|
77
79
|
await config.handler(...args);
|
|
78
80
|
if (config.success != null) {
|
|
79
81
|
toast.success(
|
|
@@ -82,10 +84,22 @@ export function useConfirmedAction<TArgs extends unknown[]>(
|
|
|
82
84
|
: config.success,
|
|
83
85
|
);
|
|
84
86
|
}
|
|
87
|
+
return true;
|
|
85
88
|
},
|
|
86
89
|
},
|
|
87
90
|
deps,
|
|
88
91
|
);
|
|
89
92
|
|
|
90
|
-
|
|
93
|
+
const run = useCallback(
|
|
94
|
+
async (...args: TArgs): Promise<RunResult<void>> => {
|
|
95
|
+
const result = await action.run(...args);
|
|
96
|
+
if (!result.ok) return result;
|
|
97
|
+
return result.value
|
|
98
|
+
? { ok: true, value: undefined }
|
|
99
|
+
: { ok: false, reason: "cancelled" };
|
|
100
|
+
},
|
|
101
|
+
[action.run],
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
return { run, loading: action.loading };
|
|
91
105
|
}
|
package/src/auth/AuthLogin.tsx
CHANGED
|
@@ -4,11 +4,15 @@ void React;
|
|
|
4
4
|
|
|
5
5
|
import { AlephaError, SchemaValidationError, z } from "alepha";
|
|
6
6
|
import type { RealmConfig } from "alepha/api/users";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
type MfaChallenge,
|
|
9
|
+
MfaRequiredError,
|
|
10
|
+
useAuth,
|
|
11
|
+
} from "alepha/react/auth";
|
|
8
12
|
import { FormValidationError, useForm, useFormState } from "alepha/react/form";
|
|
9
13
|
import { useI18n } from "alepha/react/i18n";
|
|
10
14
|
import { useRouter } from "alepha/react/router";
|
|
11
|
-
import { HttpError } from "alepha/server";
|
|
15
|
+
import { HttpError, isHttpError } from "alepha/server";
|
|
12
16
|
import { AlertCircle, Mail, User } from "lucide-react";
|
|
13
17
|
import { type ReactNode, useMemo, useState } from "react";
|
|
14
18
|
|
|
@@ -148,17 +152,14 @@ export const AuthLogin = (props: AuthLoginProps) => {
|
|
|
148
152
|
} catch (err) {
|
|
149
153
|
// The password was right and the realm wants a second factor. Not a
|
|
150
154
|
// failure: swap the form for the code step and carry on.
|
|
151
|
-
if (
|
|
155
|
+
if (err instanceof MfaRequiredError) {
|
|
152
156
|
setChallenge(err.data);
|
|
153
157
|
return;
|
|
154
158
|
}
|
|
155
159
|
// A 401 from the password grant is a refused password. Matched on the
|
|
156
|
-
// status
|
|
157
|
-
//
|
|
158
|
-
|
|
159
|
-
// the alert as an untranslated "Invalid credentials" instead of the
|
|
160
|
-
// password field.
|
|
161
|
-
if (HttpError.is(err, 401)) {
|
|
160
|
+
// status rather than on `INVALID_CREDENTIALS`, so any refusal of the
|
|
161
|
+
// grant lands on the password field instead of the alert.
|
|
162
|
+
if (isHttpError(err, 401)) {
|
|
162
163
|
throw new FormValidationError({
|
|
163
164
|
message: tr("auth.login.invalid", {
|
|
164
165
|
default: "Invalid identifier or password",
|
|
@@ -147,11 +147,11 @@ export const AuthRegister = (props: AuthRegisterProps) => {
|
|
|
147
147
|
const schema = useMemo(() => {
|
|
148
148
|
// Optionality is decided as each field is built, because that is the only
|
|
149
149
|
// thing the form reads: `FormModel` derives both the required marker and
|
|
150
|
-
// the pre-submit check from `z.schema.
|
|
150
|
+
// the pre-submit check from `z.schema.requiredInputKeys(schema)`, which asks
|
|
151
151
|
// whether the field is optional or defaulted.
|
|
152
152
|
//
|
|
153
153
|
// This used to declare every field optional and then push the configured
|
|
154
|
-
// names onto the array returned by `z.schema.
|
|
154
|
+
// names onto the array returned by `z.schema.requiredInputKeys(s)` , a TypeBox
|
|
155
155
|
// habit, where a JSON Schema's `required` was a live array hanging off the
|
|
156
156
|
// schema. The zod implementation computes a fresh array from the shape, so
|
|
157
157
|
// the pushes mutated a detached value and vanished: a realm with
|
package/src/form/AutoForm.tsx
CHANGED
|
@@ -237,7 +237,7 @@ export const AutoForm = <T extends ZObject>(props: AutoFormProps<T>) => {
|
|
|
237
237
|
useEffect(() => {
|
|
238
238
|
if (!autoSaveEnabled) return;
|
|
239
239
|
let handle: ReturnType<typeof setTimeout> | undefined;
|
|
240
|
-
const off = alepha.events.on("form:
|
|
240
|
+
const off = alepha.events.on("form:changed", (ev) => {
|
|
241
241
|
if (ev.id !== props.form.id) return;
|
|
242
242
|
if (ev.initial) return;
|
|
243
243
|
// FormModel paths look like "/title" or "/contacts/0/email". The
|
package/src/form/Control.tsx
CHANGED
|
@@ -738,6 +738,16 @@ export const Control = (props: ControlProps) => {
|
|
|
738
738
|
: undefined;
|
|
739
739
|
const autoComplete = merged.autoComplete ?? autoCompleteFromFormat;
|
|
740
740
|
|
|
741
|
+
// A value typed verbatim (an account identifier, an address, a code) must
|
|
742
|
+
// not be rewritten by the keyboard: iOS capitalises the first letter of a
|
|
743
|
+
// username by default, and a sign-in then fails on "Test@mobile.test".
|
|
744
|
+
const verbatim =
|
|
745
|
+
htmlType === "email" ||
|
|
746
|
+
htmlType === "url" ||
|
|
747
|
+
["username", "email", "tel", "url", "one-time-code"].includes(
|
|
748
|
+
autoComplete ?? "",
|
|
749
|
+
);
|
|
750
|
+
|
|
741
751
|
// ── Right-side affordance: tick (when dirty) or clear (when nullable) ─
|
|
742
752
|
// Tick only renders inside an `<AutoForm autoSave>` tree (or any caller
|
|
743
753
|
// that explicitly wraps with `<FormFieldAutoSaveProvider value>`).
|
|
@@ -772,6 +782,9 @@ export const Control = (props: ControlProps) => {
|
|
|
772
782
|
<Icon className="text-muted-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2" />
|
|
773
783
|
)}
|
|
774
784
|
<Input
|
|
785
|
+
autoCapitalize={verbatim ? "none" : undefined}
|
|
786
|
+
autoCorrect={verbatim ? "off" : undefined}
|
|
787
|
+
spellCheck={verbatim ? false : undefined}
|
|
775
788
|
{...merged.inputProps}
|
|
776
789
|
{...formFieldAriaProps({
|
|
777
790
|
id: meta.id,
|
|
@@ -911,7 +924,7 @@ export const useDynamicControlRefresh = (input: BaseInputField | undefined) => {
|
|
|
911
924
|
useEffect(() => {
|
|
912
925
|
if (!isDynamic || !input?.form) return;
|
|
913
926
|
const formId = input.form.id;
|
|
914
|
-
return alepha.events.on("form:
|
|
927
|
+
return alepha.events.on("form:changed", (e) => {
|
|
915
928
|
if (e.id === formId && e.path !== input.path) bump((n) => n + 1);
|
|
916
929
|
});
|
|
917
930
|
}, [alepha, input?.form, input?.path, isDynamic]);
|
|
@@ -149,7 +149,7 @@ const useArrayItems = (input: BaseInputField | undefined) => {
|
|
|
149
149
|
/**
|
|
150
150
|
* Tell the CHILD paths what changed.
|
|
151
151
|
*
|
|
152
|
-
* `input.set()` writes the whole array and `FormModel` emits `form:
|
|
152
|
+
* `input.set()` writes the whole array and `FormModel` emits `form:changed`
|
|
153
153
|
* for the array's own path only. The per-item and per-field inputs this
|
|
154
154
|
* component builds carry paths of their own (`.../2/name`), so a child
|
|
155
155
|
* subscribed through `useFieldValue` never heard about its own edit and
|
|
@@ -166,7 +166,7 @@ const useArrayItems = (input: BaseInputField | undefined) => {
|
|
|
166
166
|
|
|
167
167
|
const emit = (path: string, value: unknown) =>
|
|
168
168
|
void alepha.events.emit(
|
|
169
|
-
"form:
|
|
169
|
+
"form:changed",
|
|
170
170
|
{ id: form.id, path, value },
|
|
171
171
|
{ catch: true },
|
|
172
172
|
);
|
|
@@ -220,7 +220,7 @@ const useArrayItems = (input: BaseInputField | undefined) => {
|
|
|
220
220
|
if (!input?.form) return;
|
|
221
221
|
const formId = input.form.id;
|
|
222
222
|
const path = input.path;
|
|
223
|
-
return alepha.events.on("form:
|
|
223
|
+
return alepha.events.on("form:changed", (e) => {
|
|
224
224
|
if (e.id === formId && e.path === path) sync(e.value as unknown[]);
|
|
225
225
|
});
|
|
226
226
|
}, [alepha, input, sync]);
|
|
@@ -336,7 +336,7 @@ const buildFieldInput = (
|
|
|
336
336
|
): BaseInputField => ({
|
|
337
337
|
schema: z.schema.shape(itemSchema)[fieldName],
|
|
338
338
|
path: `${parent.path}/${index}/${fieldName}`,
|
|
339
|
-
required: z.schema.
|
|
339
|
+
required: z.schema.requiredInputKeys(itemSchema).includes(fieldName),
|
|
340
340
|
form: parent.form,
|
|
341
341
|
initialValue: itemValue?.[fieldName],
|
|
342
342
|
props: {
|
|
@@ -433,7 +433,7 @@ export const ControlArray = (props: ControlArrayProps) => {
|
|
|
433
433
|
if (shape) {
|
|
434
434
|
value = {};
|
|
435
435
|
for (const [k, p] of Object.entries(z.schema.shape(shape))) {
|
|
436
|
-
const def = z.schema.
|
|
436
|
+
const def = z.schema.defaultValue(p);
|
|
437
437
|
if (def !== undefined) (value as Record<string, unknown>)[k] = def;
|
|
438
438
|
// Stamp the discriminant so the new item resolves to its variant.
|
|
439
439
|
const literal = literalValueOf(p);
|
|
@@ -370,7 +370,7 @@ export const ControlSelect = (props: ControlSelectProps) => {
|
|
|
370
370
|
value={value}
|
|
371
371
|
onChange={(v) => setValue(v)}
|
|
372
372
|
coerce={coerce}
|
|
373
|
-
onSearch={mode === "long" ? search.run : undefined}
|
|
373
|
+
onSearch={mode === "long" ? (text) => search.run(text) : undefined}
|
|
374
374
|
createNewEntry={props.createNewEntry}
|
|
375
375
|
icon={props.icon}
|
|
376
376
|
// Used to be dropped on this path, so a filter chip sized `w-40` lost
|
|
@@ -548,7 +548,7 @@ const useAsyncLoader = (
|
|
|
548
548
|
const search = useAction<[string]>(
|
|
549
549
|
{
|
|
550
550
|
debounce: debounceMs,
|
|
551
|
-
handler: async (text) => {
|
|
551
|
+
handler: async (_ctx, text) => {
|
|
552
552
|
if (!loader || mode !== "long") return;
|
|
553
553
|
if (cache.current.has(text)) {
|
|
554
554
|
setData(cache.current.get(text)!);
|
|
@@ -75,7 +75,7 @@ export interface ControlUploadProps {
|
|
|
75
75
|
* image the decoder chokes on is uploaded as-is, and the storage's own
|
|
76
76
|
* `maxSize` remains what actually bounds it. That trade is deliberate — a
|
|
77
77
|
* server-side codec able to close the gap costs more bundle than the case is
|
|
78
|
-
* worth on an edge runtime, and encodes worse (see `files:
|
|
78
|
+
* worth on an edge runtime, and encodes worse (see `files:upload:before` in
|
|
79
79
|
* `alepha/api/files` for where it would attach if you want it anyway).
|
|
80
80
|
*
|
|
81
81
|
* @example { maxWidth: 256 }
|
|
@@ -12,7 +12,7 @@ import { AutoForm } from "../AutoForm.tsx";
|
|
|
12
12
|
/**
|
|
13
13
|
* `ControlArray` builds an input of its own for each item and each item field,
|
|
14
14
|
* with a path of its own (`.../1/name`), but wrote through `input.set()` -
|
|
15
|
-
* which sets the ARRAY and makes `FormModel` emit `form:
|
|
15
|
+
* which sets the ARRAY and makes `FormModel` emit `form:changed` for the
|
|
16
16
|
* array's path alone.
|
|
17
17
|
*
|
|
18
18
|
* So a child subscribed through `useFieldValue` never heard about its own
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { render } from "@testing-library/react";
|
|
2
|
+
import { Alepha, z } from "alepha";
|
|
3
|
+
import { AlephaLogger } from "alepha/logger";
|
|
4
|
+
import { AlephaContext } from "alepha/react";
|
|
5
|
+
import { useForm } from "alepha/react/form";
|
|
6
|
+
import { AlephaReactI18n } from "alepha/react/i18n";
|
|
7
|
+
import type { ReactNode } from "react";
|
|
8
|
+
import { describe, it } from "vitest";
|
|
9
|
+
|
|
10
|
+
import { Control } from "../Control.tsx";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Found on an iOS simulator: the keyboard capitalised the first letter of the
|
|
14
|
+
* sign-in identifier ("Test@mobile.test"), so the sign-in failed. A field that
|
|
15
|
+
* holds a value typed verbatim turns capitalisation, correction and spelling
|
|
16
|
+
* off.
|
|
17
|
+
*/
|
|
18
|
+
describe("Control verbatim fields", () => {
|
|
19
|
+
const mount = (alepha: Alepha, ui: ReactNode) =>
|
|
20
|
+
render(
|
|
21
|
+
<AlephaContext.Provider value={alepha}>{ui}</AlephaContext.Provider>,
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const start = async () => {
|
|
25
|
+
const alepha = Alepha.create().with(AlephaLogger).with(AlephaReactI18n);
|
|
26
|
+
await alepha.start();
|
|
27
|
+
return alepha;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const Probe = (props: { autoComplete?: string; format?: "email" }) => {
|
|
31
|
+
const form = useForm({
|
|
32
|
+
schema: z.object({
|
|
33
|
+
value:
|
|
34
|
+
props.format === "email" ? z.text({ format: "email" }) : z.text(),
|
|
35
|
+
}),
|
|
36
|
+
handler: () => {},
|
|
37
|
+
});
|
|
38
|
+
return (
|
|
39
|
+
<Control input={form.input.value} autoComplete={props.autoComplete} />
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const input = (container: HTMLElement) =>
|
|
44
|
+
container.querySelector("input") as HTMLInputElement;
|
|
45
|
+
|
|
46
|
+
it("does not let the keyboard rewrite a username", async ({ expect }) => {
|
|
47
|
+
const { container } = mount(
|
|
48
|
+
await start(),
|
|
49
|
+
<Probe autoComplete="username" />,
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
expect(input(container).getAttribute("autocapitalize")).toBe("none");
|
|
53
|
+
expect(input(container).getAttribute("autocorrect")).toBe("off");
|
|
54
|
+
expect(input(container).getAttribute("spellcheck")).toBe("false");
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("does the same for an email field derived from the schema", async ({
|
|
58
|
+
expect,
|
|
59
|
+
}) => {
|
|
60
|
+
const { container } = mount(await start(), <Probe format="email" />);
|
|
61
|
+
|
|
62
|
+
expect(input(container).getAttribute("autocapitalize")).toBe("none");
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("leaves ordinary text alone", async ({ expect }) => {
|
|
66
|
+
const { container } = mount(await start(), <Probe />);
|
|
67
|
+
|
|
68
|
+
expect(input(container).hasAttribute("autocapitalize")).toBe(false);
|
|
69
|
+
expect(input(container).hasAttribute("spellcheck")).toBe(false);
|
|
70
|
+
});
|
|
71
|
+
});
|
package/src/i18n/fr/uiFr.ts
CHANGED
|
@@ -791,7 +791,6 @@ export const uiFr: Record<string, string> = {
|
|
|
791
791
|
"admin.userDetail.avatar.replaced": "Avatar remplacé.",
|
|
792
792
|
"admin.userDetail.avatar.remove": "Retirer",
|
|
793
793
|
"admin.userDetail.avatar.removed": "Avatar retiré.",
|
|
794
|
-
"admin.userDetail.avatar.failed": "Impossible de changer l'avatar.",
|
|
795
794
|
"admin.userDetail.credentials": "Identifiants",
|
|
796
795
|
"admin.userDetail.credentialsHasPassword":
|
|
797
796
|
"Un mot de passe est défini. Vous ne pouvez pas le retirer, mais vous pouvez en définir un nouveau.",
|
|
@@ -950,7 +949,6 @@ export const uiFr: Record<string, string> = {
|
|
|
950
949
|
"account.delete.currentPassword": "Mot de passe actuel",
|
|
951
950
|
"account.delete.description":
|
|
952
951
|
"Cela supprime définitivement votre compte, ses méthodes de connexion et toutes vos sessions. C'est irréversible.",
|
|
953
|
-
"account.delete.error": "Impossible de supprimer votre compte",
|
|
954
952
|
"account.delete.submit": "Supprimer le compte",
|
|
955
953
|
"account.delete.title": "Supprimer votre compte",
|
|
956
954
|
"account.keys.access": "Accès",
|
|
@@ -974,7 +972,6 @@ export const uiFr: Record<string, string> = {
|
|
|
974
972
|
"account.keys.statusAll": "Tous les statuts",
|
|
975
973
|
"account.keys.copied": "Copiée",
|
|
976
974
|
"account.keys.copy": "Copier",
|
|
977
|
-
"account.keys.createError": "Impossible de créer cette clé",
|
|
978
975
|
"account.keys.description":
|
|
979
976
|
"Une clé agit en votre nom. Révoquez celles que vous ne reconnaissez plus.",
|
|
980
977
|
"account.keys.descriptionLabel": "Description",
|
|
@@ -1032,7 +1029,6 @@ export const uiFr: Record<string, string> = {
|
|
|
1032
1029
|
"account.mfa.copyCodes": "Copier les codes",
|
|
1033
1030
|
"account.mfa.enrollError":
|
|
1034
1031
|
"Impossible de démarrer l'activation. Fermez cette fenêtre et réessayez.",
|
|
1035
|
-
"account.mfa.invalidCode": "Ce code n'est pas valide",
|
|
1036
1032
|
"account.mfa.preparing": "Préparation…",
|
|
1037
1033
|
"account.mfa.recoveryCopied": "Codes de secours copiés",
|
|
1038
1034
|
"account.mfa.recoveryDescription":
|
|
@@ -1064,7 +1060,6 @@ export const uiFr: Record<string, string> = {
|
|
|
1064
1060
|
"Mot de passe changé - $1 autre(s) session(s) déconnectée(s)",
|
|
1065
1061
|
"account.password.confirm": "Confirmer le nouveau mot de passe",
|
|
1066
1062
|
"account.password.current": "Mot de passe actuel",
|
|
1067
|
-
"account.password.error": "Impossible d'enregistrer ce mot de passe",
|
|
1068
1063
|
"account.password.mismatch": "Les deux mots de passe ne correspondent pas",
|
|
1069
1064
|
"account.password.new": "Nouveau mot de passe",
|
|
1070
1065
|
"account.password.set": "Mot de passe défini",
|
|
@@ -1078,9 +1073,7 @@ export const uiFr: Record<string, string> = {
|
|
|
1078
1073
|
"account.profile.avatarChange": "Changer l'avatar",
|
|
1079
1074
|
"account.profile.avatarDescription": "PNG, JPEG, GIF ou WebP, jusqu'à 5 Mo.",
|
|
1080
1075
|
"account.profile.avatarRemove": "Supprimer",
|
|
1081
|
-
"account.profile.avatarRemoveError": "Impossible de supprimer votre avatar",
|
|
1082
1076
|
"account.profile.avatarUpdated": "Avatar mis à jour",
|
|
1083
|
-
"account.profile.avatarUploadError": "Impossible d'envoyer cette image",
|
|
1084
1077
|
"account.profile.email": "E-mail",
|
|
1085
1078
|
"account.profile.emailDescription":
|
|
1086
1079
|
"Changer d'e-mail demande une vérification, ce n'est donc pas une modification de profil.",
|
|
@@ -1104,7 +1097,6 @@ export const uiFr: Record<string, string> = {
|
|
|
1104
1097
|
"account.security.deleteButton": "Supprimer le compte",
|
|
1105
1098
|
"account.security.deleteDescription":
|
|
1106
1099
|
"Supprime votre compte, ses méthodes de connexion et toutes vos sessions.",
|
|
1107
|
-
"account.security.invalidCode": "Ce code n'est pas valide",
|
|
1108
1100
|
"account.security.methodsDescription":
|
|
1109
1101
|
"Il doit en rester au moins une. Supprimer la dernière vous priverait définitivement d'accès.",
|
|
1110
1102
|
"account.security.methodsTitle": "Méthodes de connexion",
|
|
@@ -1137,7 +1129,6 @@ export const uiFr: Record<string, string> = {
|
|
|
1137
1129
|
"account.security.unlinkAria": "Supprimer $1",
|
|
1138
1130
|
"account.security.unlinkDescription":
|
|
1139
1131
|
"Vous ne pourrez plus vous connecter avec $1.",
|
|
1140
|
-
"account.security.unlinkError": "Impossible de supprimer cette méthode",
|
|
1141
1132
|
"account.security.unlinkTitle": "Supprimer $1 ?",
|
|
1142
1133
|
"account.sessions.colDevice": "Appareil",
|
|
1143
1134
|
"account.sessions.colIp": "IP",
|
|
@@ -78,7 +78,7 @@ export const MyOrganizationInvitations = (
|
|
|
78
78
|
);
|
|
79
79
|
const accept = useAction<[invitationId: string], void>(
|
|
80
80
|
{
|
|
81
|
-
handler: async (invitationId) => {
|
|
81
|
+
handler: async (_ctx, invitationId) => {
|
|
82
82
|
const organizationId = props.accept
|
|
83
83
|
? await props.accept(invitationId)
|
|
84
84
|
: (
|
|
@@ -99,7 +99,7 @@ export const MyOrganizationInvitations = (
|
|
|
99
99
|
);
|
|
100
100
|
const decline = useAction<[invitationId: string], void>(
|
|
101
101
|
{
|
|
102
|
-
handler: async (invitationId) => {
|
|
102
|
+
handler: async (_ctx, invitationId) => {
|
|
103
103
|
if (props.decline) {
|
|
104
104
|
await props.decline(invitationId);
|
|
105
105
|
} else {
|
|
@@ -46,7 +46,7 @@ export const OrganizationInviteDialog = (
|
|
|
46
46
|
props.onBusyChange?.(true);
|
|
47
47
|
try {
|
|
48
48
|
const invited = await invite.invite(props.organizationId, email, rank);
|
|
49
|
-
if (!invited) return;
|
|
49
|
+
if (!invited.ok) return;
|
|
50
50
|
setEmail("");
|
|
51
51
|
form.input.rank.set("member");
|
|
52
52
|
props.onOpenChange(false);
|
|
@@ -90,7 +90,7 @@ export const OrganizationMembers = (props: OrganizationMembersProps) => {
|
|
|
90
90
|
|
|
91
91
|
const remove = useAction<[OrganizationMemberResource], void>(
|
|
92
92
|
{
|
|
93
|
-
handler: async (member) => {
|
|
93
|
+
handler: async (_ctx, member) => {
|
|
94
94
|
const name =
|
|
95
95
|
member.user.username ||
|
|
96
96
|
member.user.email ||
|
|
@@ -121,7 +121,7 @@ export const OrganizationRanks = (props: OrganizationRanksProps) => {
|
|
|
121
121
|
);
|
|
122
122
|
const create = useAction<[OrganizationRankPreset | undefined], void>(
|
|
123
123
|
{
|
|
124
|
-
handler: async (preset) => {
|
|
124
|
+
handler: async (_ctx, preset) => {
|
|
125
125
|
const name = await dialog.prompt({
|
|
126
126
|
title: tr("organizations.ranks.createTitle", {
|
|
127
127
|
default: "Create a rank",
|
|
@@ -152,7 +152,7 @@ export const OrganizationRanks = (props: OrganizationRanksProps) => {
|
|
|
152
152
|
);
|
|
153
153
|
const rename = useAction<[OrganizationRankResource], void>(
|
|
154
154
|
{
|
|
155
|
-
handler: async (rank) => {
|
|
155
|
+
handler: async (_ctx, rank) => {
|
|
156
156
|
const name = await dialog.prompt({
|
|
157
157
|
title: tr("organizations.ranks.renameTitle", {
|
|
158
158
|
default: "Rename $1",
|
|
@@ -178,7 +178,7 @@ export const OrganizationRanks = (props: OrganizationRanksProps) => {
|
|
|
178
178
|
);
|
|
179
179
|
const remove = useAction<[OrganizationRankResource], void>(
|
|
180
180
|
{
|
|
181
|
-
handler: async (rank) => {
|
|
181
|
+
handler: async (_ctx, rank) => {
|
|
182
182
|
const confirmed = await dialog.confirm({
|
|
183
183
|
title: tr("organizations.ranks.deleteTitle", {
|
|
184
184
|
default: "Delete $1?",
|