@alepha/ui 0.25.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 +12 -0
- package/components.json +20 -0
- package/package.json +85 -0
- package/src/components/action-error-toaster/action-error-toaster.tsx +70 -0
- package/src/components/admin/admin-audits.tsx +247 -0
- package/src/components/admin/admin-files.tsx +346 -0
- package/src/components/admin/admin-jobs-executions-panel.tsx +235 -0
- package/src/components/admin/admin-jobs-status-badge.tsx +33 -0
- package/src/components/admin/admin-jobs.tsx +294 -0
- package/src/components/admin/admin-keys.tsx +162 -0
- package/src/components/admin/admin-notifications.tsx +130 -0
- package/src/components/admin/admin-page.tsx +24 -0
- package/src/components/admin/admin-parameters.tsx +864 -0
- package/src/components/admin/admin-payments.tsx +93 -0
- package/src/components/admin/admin-sessions.tsx +174 -0
- package/src/components/admin/admin-user-detail-audits-tab.tsx +82 -0
- package/src/components/admin/admin-user-detail-identity-aside.tsx +218 -0
- package/src/components/admin/admin-user-detail-overview-tab.tsx +87 -0
- package/src/components/admin/admin-user-detail-password-dialog.tsx +85 -0
- package/src/components/admin/admin-user-detail-password-schema.ts +11 -0
- package/src/components/admin/admin-user-detail-profile-schema.ts +19 -0
- package/src/components/admin/admin-user-detail-provider-labels.ts +15 -0
- package/src/components/admin/admin-user-detail-security-tab.tsx +146 -0
- package/src/components/admin/admin-user-detail-sessions-tab.tsx +93 -0
- package/src/components/admin/admin-user-detail.tsx +606 -0
- package/src/components/admin/admin-users-roles-picker.tsx +126 -0
- package/src/components/admin/admin-users-status-filter.tsx +51 -0
- package/src/components/admin/admin-users.tsx +518 -0
- package/src/components/admin/diff-lines.spec.ts +58 -0
- package/src/components/admin/diff-lines.ts +58 -0
- package/src/components/admin/parameter-diff-dialog.tsx +119 -0
- package/src/components/admin/parameter-history-item.tsx +252 -0
- package/src/components/admin/parameter-json-dialog.tsx +93 -0
- package/src/components/admin/parameter-save-dialog.tsx +126 -0
- package/src/components/admin/use-confirmed-action.tsx +93 -0
- package/src/components/alepha-table/__tests__/use-table-selection.browser.spec.tsx +92 -0
- package/src/components/alepha-table/alepha-table.tsx +1158 -0
- package/src/components/alepha-table/use-table-selection.ts +95 -0
- package/src/components/app-shell/app-shell.tsx +568 -0
- package/src/components/auth/__tests__/auth-router.spec.ts +52 -0
- package/src/components/auth/auth-login.tsx +382 -0
- package/src/components/auth/auth-register.tsx +786 -0
- package/src/components/auth/auth-reset-password.tsx +349 -0
- package/src/components/auth/auth-router.tsx +126 -0
- package/src/components/auth/auth-verify-email.tsx +179 -0
- package/src/components/auto-form/auto-form.tsx +867 -0
- package/src/components/brand-icon/brand-icon.tsx +104 -0
- package/src/components/button-dark/button-dark.tsx +78 -0
- package/src/components/button-language/button-language.tsx +98 -0
- package/src/components/button-theme/button-theme.tsx +148 -0
- package/src/components/button-user/button-user.tsx +214 -0
- package/src/components/captcha/turnstile-widget.tsx +157 -0
- package/src/components/control/control.tsx +735 -0
- package/src/components/control-array/control-array.tsx +700 -0
- package/src/components/control-base/__tests__/form-field-a11y.browser.spec.tsx +93 -0
- package/src/components/control-base/field-i18n.ts +60 -0
- package/src/components/control-base/form-field.tsx +275 -0
- package/src/components/control-base/grid.tsx +59 -0
- package/src/components/control-base/icon-hint.tsx +64 -0
- package/src/components/control-date/control-date.tsx +190 -0
- package/src/components/control-number/control-number.tsx +136 -0
- package/src/components/control-object/control-object.tsx +200 -0
- package/src/components/control-select/control-select.tsx +774 -0
- package/src/components/control-upload/control-upload.tsx +475 -0
- package/src/components/file-image/file-image.tsx +52 -0
- package/src/components/language-toggle/language-toggle.tsx +66 -0
- package/src/components/markdown-view/markdown-view.css +114 -0
- package/src/components/markdown-view/markdown-view.tsx +92 -0
- package/src/components/nav-shell/nav-page.tsx +56 -0
- package/src/components/nav-shell/nav-shell.tsx +72 -0
- package/src/components/nav-shell/nav-tree-util.ts +62 -0
- package/src/components/nav-shell/spotlight.tsx +163 -0
- package/src/components/nav-shell/use-nav-breadcrumbs.ts +52 -0
- package/src/components/nav-shell/use-nav-entries.ts +101 -0
- package/src/components/nav-shell/use-nav-tree.ts +61 -0
- package/src/components/ui/accordion.tsx +77 -0
- package/src/components/ui/alert-dialog.tsx +186 -0
- package/src/components/ui/alert.tsx +75 -0
- package/src/components/ui/aspect-ratio.tsx +22 -0
- package/src/components/ui/avatar.tsx +106 -0
- package/src/components/ui/badge.tsx +51 -0
- package/src/components/ui/breadcrumb.tsx +121 -0
- package/src/components/ui/button-group.tsx +86 -0
- package/src/components/ui/button.tsx +83 -0
- package/src/components/ui/calendar.tsx +235 -0
- package/src/components/ui/card.tsx +102 -0
- package/src/components/ui/carousel.tsx +241 -0
- package/src/components/ui/chart.tsx +370 -0
- package/src/components/ui/checkbox.tsx +27 -0
- package/src/components/ui/collapsible.tsx +19 -0
- package/src/components/ui/combobox.tsx +298 -0
- package/src/components/ui/command.tsx +196 -0
- package/src/components/ui/context-menu.tsx +271 -0
- package/src/components/ui/dialog.tsx +153 -0
- package/src/components/ui/direction.tsx +4 -0
- package/src/components/ui/drawer.tsx +130 -0
- package/src/components/ui/dropdown-menu.tsx +269 -0
- package/src/components/ui/empty.tsx +100 -0
- package/src/components/ui/hover-card.tsx +50 -0
- package/src/components/ui/input-group.tsx +157 -0
- package/src/components/ui/input-otp.tsx +83 -0
- package/src/components/ui/input.tsx +19 -0
- package/src/components/ui/item.tsx +200 -0
- package/src/components/ui/kbd.tsx +26 -0
- package/src/components/ui/label.tsx +19 -0
- package/src/components/ui/menubar.tsx +283 -0
- package/src/components/ui/navigation-menu.tsx +170 -0
- package/src/components/ui/pagination.tsx +133 -0
- package/src/components/ui/popover.tsx +87 -0
- package/src/components/ui/progress.tsx +82 -0
- package/src/components/ui/radio-group.tsx +35 -0
- package/src/components/ui/resizable.tsx +49 -0
- package/src/components/ui/scroll-area.tsx +51 -0
- package/src/components/ui/segmented.tsx +232 -0
- package/src/components/ui/select.tsx +201 -0
- package/src/components/ui/separator.tsx +22 -0
- package/src/components/ui/sheet.tsx +133 -0
- package/src/components/ui/sidebar.tsx +723 -0
- package/src/components/ui/skeleton.tsx +13 -0
- package/src/components/ui/slider.tsx +51 -0
- package/src/components/ui/sonner.tsx +46 -0
- package/src/components/ui/spinner.tsx +15 -0
- package/src/components/ui/switch.tsx +29 -0
- package/src/components/ui/table.tsx +115 -0
- package/src/components/ui/tabs.tsx +79 -0
- package/src/components/ui/textarea.tsx +17 -0
- package/src/components/ui/toggle-group.tsx +86 -0
- package/src/components/ui/toggle.tsx +44 -0
- package/src/components/ui/tooltip.tsx +63 -0
- package/src/components/use-dialog/use-dialog.tsx +244 -0
- package/src/components/use-toast/use-toast.tsx +89 -0
- package/src/hooks/use-mobile.ts +21 -0
- package/src/lib/__tests__/i18n-fr.spec.ts +72 -0
- package/src/lib/i18n-fr.ts +500 -0
- package/src/lib/utils.ts +6 -0
- package/src/styles.css +129 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
void React;
|
|
4
|
+
|
|
5
|
+
import { Control } from "@alepha/ui/components/control/control";
|
|
6
|
+
import { Button } from "@alepha/ui/components/ui/button";
|
|
7
|
+
import {
|
|
8
|
+
Dialog,
|
|
9
|
+
DialogContent,
|
|
10
|
+
DialogDescription,
|
|
11
|
+
DialogFooter,
|
|
12
|
+
DialogHeader,
|
|
13
|
+
DialogTitle,
|
|
14
|
+
} from "@alepha/ui/components/ui/dialog";
|
|
15
|
+
import type { FormModel } from "alepha/react/form";
|
|
16
|
+
import { useI18n } from "alepha/react/i18n";
|
|
17
|
+
import { Ban } from "lucide-react";
|
|
18
|
+
import type { passwordSchema } from "./admin-user-detail-password-schema.ts";
|
|
19
|
+
|
|
20
|
+
export interface AdminUserDetailPasswordDialogProps {
|
|
21
|
+
open: boolean;
|
|
22
|
+
onOpenChange: (open: boolean) => void;
|
|
23
|
+
form: FormModel<typeof passwordSchema>;
|
|
24
|
+
submitting: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Set-password dialog. Submits through the caller's form model, so the
|
|
29
|
+
* success toast and dialog dismissal stay with the handler that owns them.
|
|
30
|
+
*/
|
|
31
|
+
export const AdminUserDetailPasswordDialog = (
|
|
32
|
+
props: AdminUserDetailPasswordDialogProps,
|
|
33
|
+
) => {
|
|
34
|
+
const { tr } = useI18n();
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<Dialog open={props.open} onOpenChange={props.onOpenChange}>
|
|
38
|
+
<DialogContent>
|
|
39
|
+
<DialogHeader>
|
|
40
|
+
<DialogTitle>
|
|
41
|
+
{tr("admin.userDetail.setPasswordTitle", {
|
|
42
|
+
default: "Set new password",
|
|
43
|
+
})}
|
|
44
|
+
</DialogTitle>
|
|
45
|
+
<DialogDescription>
|
|
46
|
+
{tr("admin.userDetail.setPasswordSub", {
|
|
47
|
+
default:
|
|
48
|
+
"The user can sign in with this password immediately. Existing sessions are not revoked.",
|
|
49
|
+
})}
|
|
50
|
+
</DialogDescription>
|
|
51
|
+
</DialogHeader>
|
|
52
|
+
<form
|
|
53
|
+
{...props.form.props}
|
|
54
|
+
className="flex flex-col gap-4"
|
|
55
|
+
id="set-password-form"
|
|
56
|
+
>
|
|
57
|
+
<Control
|
|
58
|
+
label={tr("admin.userDetail.newPassword", {
|
|
59
|
+
default: "New password",
|
|
60
|
+
})}
|
|
61
|
+
input={props.form.input.password}
|
|
62
|
+
password
|
|
63
|
+
/>
|
|
64
|
+
</form>
|
|
65
|
+
<DialogFooter>
|
|
66
|
+
<Button
|
|
67
|
+
type="button"
|
|
68
|
+
variant="ghost"
|
|
69
|
+
onClick={() => props.onOpenChange(false)}
|
|
70
|
+
>
|
|
71
|
+
{tr("admin.userDetail.cancel", { default: "Cancel" })}
|
|
72
|
+
</Button>
|
|
73
|
+
<Button
|
|
74
|
+
type="submit"
|
|
75
|
+
form="set-password-form"
|
|
76
|
+
loading={props.submitting}
|
|
77
|
+
>
|
|
78
|
+
<Ban className="hidden" />
|
|
79
|
+
{tr("admin.userDetail.savePassword", { default: "Save" })}
|
|
80
|
+
</Button>
|
|
81
|
+
</DialogFooter>
|
|
82
|
+
</DialogContent>
|
|
83
|
+
</Dialog>
|
|
84
|
+
);
|
|
85
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "alepha";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Body of the admin "set password" form.
|
|
5
|
+
*
|
|
6
|
+
* Lives in its own file so the dialog and the page shell that owns the form
|
|
7
|
+
* model agree on the shape without either importing the other.
|
|
8
|
+
*/
|
|
9
|
+
export const passwordSchema = z.object({
|
|
10
|
+
password: z.string().min(6),
|
|
11
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type Infer, z } from "alepha";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Editable profile fields on the admin user detail page.
|
|
5
|
+
*
|
|
6
|
+
* `username` and `email` are optional here on purpose: `useForm` decodes the
|
|
7
|
+
* schema on first mount, before the user has loaded, and required fields
|
|
8
|
+
* would fail that empty decode. The page's submit handler enforces them.
|
|
9
|
+
*/
|
|
10
|
+
export const profileSchema = z.object({
|
|
11
|
+
username: z.string().optional(),
|
|
12
|
+
email: z.string().optional(),
|
|
13
|
+
emailVerified: z.boolean().optional(),
|
|
14
|
+
firstName: z.string().optional(),
|
|
15
|
+
lastName: z.string().optional(),
|
|
16
|
+
roles: z.array(z.string()).optional(),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export type ProfileForm = Infer<typeof profileSchema>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Display names for identity providers.
|
|
3
|
+
*
|
|
4
|
+
* Shared between the security tab (which lists connections) and the
|
|
5
|
+
* remove-connection confirmation in the page shell, so both name a provider
|
|
6
|
+
* the same way.
|
|
7
|
+
*/
|
|
8
|
+
export const PROVIDER_LABELS: Record<string, string> = {
|
|
9
|
+
credentials: "Password",
|
|
10
|
+
google: "Google",
|
|
11
|
+
apple: "Apple",
|
|
12
|
+
github: "GitHub",
|
|
13
|
+
microsoft: "Microsoft",
|
|
14
|
+
facebook: "Facebook",
|
|
15
|
+
};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
void React;
|
|
4
|
+
|
|
5
|
+
import { BrandIcon } from "@alepha/ui/components/brand-icon/brand-icon";
|
|
6
|
+
import { Button } from "@alepha/ui/components/ui/button";
|
|
7
|
+
import {
|
|
8
|
+
Card,
|
|
9
|
+
CardContent,
|
|
10
|
+
CardDescription,
|
|
11
|
+
CardFooter,
|
|
12
|
+
CardHeader,
|
|
13
|
+
CardTitle,
|
|
14
|
+
} from "@alepha/ui/components/ui/card";
|
|
15
|
+
import type { IdentityResource } from "alepha/api/users";
|
|
16
|
+
import type { UseActionReturn } from "alepha/react";
|
|
17
|
+
import { useI18n } from "alepha/react/i18n";
|
|
18
|
+
import { KeyRound, Trash2 } from "lucide-react";
|
|
19
|
+
import { PROVIDER_LABELS } from "./admin-user-detail-provider-labels.ts";
|
|
20
|
+
|
|
21
|
+
export interface AdminUserDetailSecurityTabProps {
|
|
22
|
+
/**
|
|
23
|
+
* Whether a `credentials` identity exists — i.e. a password is set.
|
|
24
|
+
*/
|
|
25
|
+
hasPassword: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Every identity except `credentials`, which has its own card.
|
|
28
|
+
*/
|
|
29
|
+
socialIdentities: ReadonlyArray<IdentityResource>;
|
|
30
|
+
removeIdentity: UseActionReturn<[IdentityResource], void>;
|
|
31
|
+
onChangePassword: () => void;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Security tab: password sign-in and linked OAuth providers.
|
|
36
|
+
*/
|
|
37
|
+
export const AdminUserDetailSecurityTab = (
|
|
38
|
+
props: AdminUserDetailSecurityTabProps,
|
|
39
|
+
) => {
|
|
40
|
+
const { tr } = useI18n();
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div className="min-h-0 flex-1 overflow-auto">
|
|
44
|
+
<div className="flex max-w-6xl flex-col gap-6 p-6">
|
|
45
|
+
<Card>
|
|
46
|
+
<CardHeader>
|
|
47
|
+
<CardTitle>
|
|
48
|
+
{tr("admin.userDetail.credentials", {
|
|
49
|
+
default: "Credentials",
|
|
50
|
+
})}
|
|
51
|
+
</CardTitle>
|
|
52
|
+
<CardDescription>
|
|
53
|
+
{tr("admin.userDetail.credentialsSub", {
|
|
54
|
+
default: "Password sign-in for this account.",
|
|
55
|
+
})}
|
|
56
|
+
</CardDescription>
|
|
57
|
+
</CardHeader>
|
|
58
|
+
<CardContent>
|
|
59
|
+
<p className="text-muted-foreground text-sm">
|
|
60
|
+
{props.hasPassword
|
|
61
|
+
? tr("admin.userDetail.credentialsHasPassword", {
|
|
62
|
+
default:
|
|
63
|
+
"A password is set. You can't remove it, but you can set a new one.",
|
|
64
|
+
})
|
|
65
|
+
: tr("admin.userDetail.credentialsNoPassword", {
|
|
66
|
+
default:
|
|
67
|
+
"No password is set yet. Set one so the user can sign in with a password.",
|
|
68
|
+
})}
|
|
69
|
+
</p>
|
|
70
|
+
</CardContent>
|
|
71
|
+
<CardFooter>
|
|
72
|
+
<Button variant="outline" onClick={props.onChangePassword}>
|
|
73
|
+
<KeyRound className="size-4" />
|
|
74
|
+
{props.hasPassword
|
|
75
|
+
? tr("admin.userDetail.changePassword", {
|
|
76
|
+
default: "Change password",
|
|
77
|
+
})
|
|
78
|
+
: tr("admin.userDetail.setPassword", {
|
|
79
|
+
default: "Set password",
|
|
80
|
+
})}
|
|
81
|
+
</Button>
|
|
82
|
+
</CardFooter>
|
|
83
|
+
</Card>
|
|
84
|
+
|
|
85
|
+
<Card>
|
|
86
|
+
<CardHeader>
|
|
87
|
+
<CardTitle>
|
|
88
|
+
{tr("admin.userDetail.identities", {
|
|
89
|
+
default: "Connected accounts",
|
|
90
|
+
})}
|
|
91
|
+
</CardTitle>
|
|
92
|
+
<CardDescription>
|
|
93
|
+
{tr("admin.userDetail.identitiesSub", {
|
|
94
|
+
default: "Linked OAuth providers.",
|
|
95
|
+
})}
|
|
96
|
+
</CardDescription>
|
|
97
|
+
</CardHeader>
|
|
98
|
+
<CardContent>
|
|
99
|
+
{props.socialIdentities.length === 0 ? (
|
|
100
|
+
<p className="text-muted-foreground text-sm">
|
|
101
|
+
{tr("admin.userDetail.noIdentities", {
|
|
102
|
+
default: "No connected accounts.",
|
|
103
|
+
})}
|
|
104
|
+
</p>
|
|
105
|
+
) : (
|
|
106
|
+
<ul className="flex flex-col gap-2">
|
|
107
|
+
{props.socialIdentities.map((id) => {
|
|
108
|
+
const label = PROVIDER_LABELS[id.provider] ?? id.provider;
|
|
109
|
+
return (
|
|
110
|
+
<li
|
|
111
|
+
key={id.id}
|
|
112
|
+
className="flex items-center justify-between rounded-md border px-3 py-2"
|
|
113
|
+
>
|
|
114
|
+
<div className="flex items-center gap-3">
|
|
115
|
+
<BrandIcon provider={id.provider} className="size-5" />
|
|
116
|
+
<div className="flex flex-col">
|
|
117
|
+
<span className="text-sm font-medium">{label}</span>
|
|
118
|
+
{id.providerUserId && (
|
|
119
|
+
<span className="text-muted-foreground font-mono text-xs">
|
|
120
|
+
{id.providerUserId}
|
|
121
|
+
</span>
|
|
122
|
+
)}
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
<Button
|
|
126
|
+
variant="destructive"
|
|
127
|
+
size="sm"
|
|
128
|
+
loading={props.removeIdentity.loading}
|
|
129
|
+
onClick={() => props.removeIdentity.run(id)}
|
|
130
|
+
>
|
|
131
|
+
<Trash2 className="size-4" />
|
|
132
|
+
{tr("admin.userDetail.remove", {
|
|
133
|
+
default: "Remove",
|
|
134
|
+
})}
|
|
135
|
+
</Button>
|
|
136
|
+
</li>
|
|
137
|
+
);
|
|
138
|
+
})}
|
|
139
|
+
</ul>
|
|
140
|
+
)}
|
|
141
|
+
</CardContent>
|
|
142
|
+
</Card>
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
);
|
|
146
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
void React;
|
|
4
|
+
|
|
5
|
+
import { AlephaTable } from "@alepha/ui/components/alepha-table/alepha-table";
|
|
6
|
+
import type { SessionResource } from "alepha/api/users";
|
|
7
|
+
import type { UseActionReturn } from "alepha/react";
|
|
8
|
+
import { useI18n } from "alepha/react/i18n";
|
|
9
|
+
import { LogOut } from "lucide-react";
|
|
10
|
+
|
|
11
|
+
export interface AdminUserDetailSessionsTabProps {
|
|
12
|
+
/**
|
|
13
|
+
* Scopes the table's persisted column/sort state to this user.
|
|
14
|
+
*/
|
|
15
|
+
userId: string;
|
|
16
|
+
fetch: React.ComponentProps<typeof AlephaTable<SessionResource>>["fetch"];
|
|
17
|
+
revokeSession: UseActionReturn<[SessionResource, () => void], void>;
|
|
18
|
+
bulkRevokeSessions: UseActionReturn<
|
|
19
|
+
[SessionResource[], { refresh: () => void; clearSelection: () => void }],
|
|
20
|
+
void
|
|
21
|
+
>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Sessions tab: active sessions for the user, revocable one at a time or in
|
|
26
|
+
* bulk.
|
|
27
|
+
*/
|
|
28
|
+
export const AdminUserDetailSessionsTab = (
|
|
29
|
+
props: AdminUserDetailSessionsTabProps,
|
|
30
|
+
) => {
|
|
31
|
+
const { tr, l } = useI18n();
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<div className="flex min-h-0 flex-1 flex-col overflow-hidden p-6">
|
|
35
|
+
<AlephaTable<SessionResource>
|
|
36
|
+
className="min-h-0 flex-1"
|
|
37
|
+
persistenceKey={`admin.userDetail.${props.userId}.sessions`}
|
|
38
|
+
fetch={props.fetch}
|
|
39
|
+
bulkActions={[
|
|
40
|
+
{
|
|
41
|
+
label: tr("admin.userDetail.revokeSelected", {
|
|
42
|
+
default: "Revoke selected",
|
|
43
|
+
}),
|
|
44
|
+
icon: LogOut,
|
|
45
|
+
destructive: true,
|
|
46
|
+
onClick: (items, ctx) => props.bulkRevokeSessions.run(items, ctx),
|
|
47
|
+
},
|
|
48
|
+
]}
|
|
49
|
+
columns={{
|
|
50
|
+
ip: {
|
|
51
|
+
label: tr("admin.userDetail.colIp", { default: "IP" }),
|
|
52
|
+
cell: (s) => <code className="text-xs">{s.ip ?? "—"}</code>,
|
|
53
|
+
},
|
|
54
|
+
userAgent: {
|
|
55
|
+
label: tr("admin.userDetail.colDevice", {
|
|
56
|
+
default: "Device",
|
|
57
|
+
}),
|
|
58
|
+
cell: (s) => {
|
|
59
|
+
const ua = s.userAgent;
|
|
60
|
+
const text = ua
|
|
61
|
+
? [ua.browser, ua.os].filter(Boolean).join(" • ") || "—"
|
|
62
|
+
: "—";
|
|
63
|
+
return (
|
|
64
|
+
<span className="text-muted-foreground line-clamp-1 text-xs">
|
|
65
|
+
{text}
|
|
66
|
+
</span>
|
|
67
|
+
);
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
createdAt: {
|
|
71
|
+
label: tr("admin.userDetail.colStarted", {
|
|
72
|
+
default: "Started",
|
|
73
|
+
}),
|
|
74
|
+
sortable: true,
|
|
75
|
+
cell: (s) => (
|
|
76
|
+
<span className="text-muted-foreground text-xs">
|
|
77
|
+
{String(l(s.createdAt, { date: "fromNow" }))}
|
|
78
|
+
</span>
|
|
79
|
+
),
|
|
80
|
+
},
|
|
81
|
+
}}
|
|
82
|
+
rowActions={(s) => [
|
|
83
|
+
{
|
|
84
|
+
label: tr("admin.userDetail.revoke", { default: "Revoke" }),
|
|
85
|
+
icon: LogOut,
|
|
86
|
+
destructive: true,
|
|
87
|
+
onClick: (_s, ctx) => props.revokeSession.run(s, ctx.refresh),
|
|
88
|
+
},
|
|
89
|
+
]}
|
|
90
|
+
/>
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
};
|