@xk2800/nextjs-template 0.7.2-beta.3 → 0.7.2-beta.5
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/components/auth/{loginErrorRecovery.tsx → forms/login-error-recovery.tsx} +1 -1
- package/components/auth/{emailPasswordLogin.tsx → forms/login-form.tsx} +8 -8
- package/components/auth/{emailPasswordSignup.tsx → forms/signup-form.tsx} +8 -8
- package/components/auth/{authCard.tsx → layout/auth-card.tsx} +5 -5
- package/components/auth/{authShell.tsx → layout/auth-shell.tsx} +17 -5
- package/components/auth/{oneTap.tsx → methods/one-tap.tsx} +2 -2
- package/components/auth/{passkeyLogin.tsx → methods/passkey-login.tsx} +2 -2
- package/components/auth/{socialLogin.tsx → methods/social-login.tsx} +3 -3
- package/components/auth/{twoFactorVerifyForm.tsx → mfa/two-factor-verify-form.tsx} +5 -5
- package/components/auth/{forgotPasswordForm.tsx → recovery/forgot-password-form.tsx} +4 -4
- package/components/auth/{resetPasswordForm.tsx → recovery/reset-password-form.tsx} +4 -4
- package/components/auth/{deviceCheck.tsx → session/device-check.tsx} +3 -3
- package/components/auth/{logoutButtons.tsx → session/logout-buttons.tsx} +2 -2
- package/components/dashboard/admin/{activityLogsSection.tsx → activity-logs/activity-logs-section.tsx} +1 -1
- package/components/dashboard/admin/activity-logs/admin-activity-logs-table.tsx +375 -0
- package/components/dashboard/admin/activity-logs/audit-severity-badge.tsx +50 -0
- package/components/dashboard/admin/activity-logs/security-highlights-collapsible.tsx +129 -0
- package/components/dashboard/admin/{adminActivityLogsSkeleton.tsx → activity-logs/skeletons/activity-logs-skeleton.tsx} +2 -2
- package/components/dashboard/admin/{adminStatsGrid.tsx → home/admin-stats-grid.tsx} +1 -1
- package/components/dashboard/admin/{deviceThrottleCard.tsx → home/device-throttle-card.tsx} +8 -5
- package/components/dashboard/admin/{deviceThrottleTable.tsx → home/device-throttle-table.tsx} +3 -3
- package/components/dashboard/admin/{newDeviceCard.tsx → home/new-device-card.tsx} +6 -2
- package/components/dashboard/admin/{newDeviceTable.tsx → home/new-device-table.tsx} +4 -4
- package/components/dashboard/admin/{sharedDeviceCard.tsx → home/shared-device-card.tsx} +3 -3
- package/components/dashboard/admin/{sharedDeviceTable.tsx → home/shared-device-table.tsx} +3 -3
- package/components/dashboard/admin/{adminStatsGridSkeleton.tsx → home/skeletons/admin-stats-skeleton.tsx} +2 -2
- package/components/dashboard/admin/{broadcastActions.tsx → marketing/broadcast-actions.tsx} +3 -3
- package/components/dashboard/admin/{confirmSendDialog.tsx → marketing/confirm-send-dialog.tsx} +1 -1
- package/components/dashboard/admin/{marketingEmailForm.tsx → marketing/marketing-email-form.tsx} +7 -7
- package/components/dashboard/admin/{marketingSection.tsx → marketing/marketing-section.tsx} +6 -6
- package/components/dashboard/admin/{subscribersCard.tsx → marketing/subscribers-card.tsx} +3 -3
- package/components/dashboard/admin/{feedbackTestForm.tsx → system-settings/feedback-test-form.tsx} +4 -4
- package/components/dashboard/admin/{systemSettingsSkeleton.tsx → system-settings/skeletons/system-settings-skeleton.tsx} +2 -2
- package/components/dashboard/admin/system-settings/system-settings-form.tsx +362 -0
- package/components/dashboard/admin/{systemSettingsSection.tsx → system-settings/system-settings-section.tsx} +3 -2
- package/components/dashboard/admin/users/admin-user-actions.tsx +238 -0
- package/components/dashboard/admin/users/admin-user-profile-card.tsx +70 -0
- package/components/dashboard/admin/users/admin-user-security-card.tsx +47 -0
- package/components/dashboard/admin/users/admin-user-status-card.tsx +89 -0
- package/components/dashboard/admin/{adminUsersTable.tsx → users/admin-users-table.tsx} +129 -132
- package/components/dashboard/admin/{adminUserActivityLogCard.tsx → users/detail/admin-user-activity-log-card.tsx} +3 -3
- package/components/dashboard/admin/{adminUserActivityLogTable.tsx → users/detail/admin-user-activity-log-table.tsx} +3 -3
- package/components/dashboard/admin/{adminUserConsentCard.tsx → users/detail/admin-user-consent-card.tsx} +4 -4
- package/components/dashboard/admin/{adminUserDevicesCard.tsx → users/detail/admin-user-devices-card.tsx} +2 -2
- package/components/dashboard/admin/{adminUserLoginInfoCard.tsx → users/detail/admin-user-login-info-card.tsx} +3 -3
- package/components/dashboard/admin/{adminUserLoginInfoTable.tsx → users/detail/admin-user-login-info-table.tsx} +3 -3
- package/components/dashboard/admin/{adminUserSessionsCard.tsx → users/detail/admin-user-sessions-card.tsx} +5 -5
- package/components/dashboard/admin/{impersonationLogCard.tsx → users/impersonation-log-card.tsx} +10 -5
- package/components/dashboard/admin/users/impersonation-tab.tsx +255 -0
- package/components/dashboard/admin/users/invite-user-dialog.tsx +80 -0
- package/components/dashboard/admin/{revokeAllSessionsButton.tsx → users/revoke-all-sessions.tsx} +5 -3
- package/components/dashboard/admin/{adminUsersSkeleton.tsx → users/skeletons/admin-users-skeleton.tsx} +2 -2
- package/components/dashboard/admin/{usersSection.tsx → users/users-section.tsx} +1 -1
- package/components/dashboard/{errorFeedback.tsx → common/error-feedback.tsx} +1 -1
- package/components/dashboard/{feedbackDialog.tsx → common/feedback-dialog.tsx} +4 -4
- package/components/dashboard/{sectionErrorFallback.tsx → common/section-error-fallback.tsx} +1 -1
- package/components/dashboard/{verifyEmailButton.tsx → common/verify-email-button.tsx} +2 -2
- package/components/dashboard/{appSidebar.tsx → layout/app-sidebar.tsx} +4 -6
- package/components/dashboard/{dashboardHeader.tsx → layout/dashboard-header.tsx} +1 -1
- package/components/dashboard/{impersonationBanner.tsx → layout/impersonation-banner.tsx} +2 -2
- package/components/dashboard/{navStyleToggle.tsx → layout/nav-style-toggle.tsx} +1 -1
- package/components/dashboard/{topNav.tsx → layout/top-nav.tsx} +5 -5
- package/components/dashboard/{installAppCard.tsx → overview/install-app-card.tsx} +2 -2
- package/components/dashboard/{accountDetailsCard.tsx → settings/account-details-card.tsx} +5 -5
- package/components/dashboard/{activityLogsCard.tsx → settings/activity-logs-card.tsx} +5 -5
- package/components/dashboard/{activityLogsSection.tsx → settings/activity-logs-section.tsx} +1 -1
- package/components/dashboard/{adminSection.tsx → settings/admin-section.tsx} +2 -2
- package/components/dashboard/{deleteAccountCard.tsx → settings/delete-account-card.tsx} +7 -7
- package/components/dashboard/{marketingUpdatesCard.tsx → settings/marketing-updates-card.tsx} +3 -3
- package/components/dashboard/{marketingUpdatesSection.tsx → settings/marketing-updates-section.tsx} +1 -1
- package/components/dashboard/{passkeysCard.tsx → settings/passkeys-card.tsx} +8 -8
- package/components/dashboard/{profileCard.tsx → settings/profile-card.tsx} +4 -4
- package/components/dashboard/{sessionsCard.tsx → settings/sessions/sessions-card.tsx} +6 -6
- package/components/dashboard/{sessionsSection.tsx → settings/sessions/sessions-section.tsx} +1 -1
- package/components/dashboard/{sessionsCardSkeleton.tsx → settings/sessions/skeletons/sessions-card-skeleton.tsx} +2 -2
- package/components/dashboard/{activityLogsCardSkeleton.tsx → settings/skeletons/activity-logs-card-skeleton.tsx} +2 -2
- package/components/dashboard/{twoFactorCard.tsx → settings/two-factor-card.tsx} +8 -8
- package/components/email/team/workspace-invite.tsx +51 -0
- package/components/email/{send-email-button.tsx → ui/send-email-button.tsx} +1 -1
- package/components/error-boundary.tsx +32 -0
- package/components/settings/appearance/appearance-section.tsx +64 -0
- package/components/settings/index.ts +5 -0
- package/components/settings/notifications/notifications-section.tsx +31 -0
- package/components/settings/profile/profile-section.tsx +38 -0
- package/components/settings/security/security-section.tsx +24 -0
- package/components/settings/settings-nav.tsx +35 -0
- package/components/site/{cookie-banner.tsx → compliance/cookie-banner.tsx} +6 -6
- package/components/site/push/push-notifications-card.tsx +117 -0
- package/components/ui/collapsible.tsx +9 -0
- package/components/ui/column-picker.tsx +1 -1
- package/components/ui/data-table.tsx +1 -1
- package/components/ui/dialog.tsx +46 -13
- package/components/ui/tabs.tsx +52 -0
- package/dist/activity/logger.js +2 -2
- package/dist/activity/logger.js.map +1 -1
- package/dist/activity/logger.mjs +3 -3
- package/dist/activity/queries.d.mts +7 -3
- package/dist/activity/queries.d.ts +7 -3
- package/dist/activity/queries.js +16 -5
- package/dist/activity/queries.js.map +1 -1
- package/dist/activity/queries.mjs +18 -7
- package/dist/activity/queries.mjs.map +1 -1
- package/dist/admin/queries.js +4 -4
- package/dist/admin/queries.js.map +1 -1
- package/dist/admin/queries.mjs +5 -5
- package/dist/admin/queries.mjs.map +1 -1
- package/dist/api/feedback.js +24 -24
- package/dist/api/feedback.js.map +1 -1
- package/dist/api/feedback.mjs +8 -8
- package/dist/api/feedback.mjs.map +1 -1
- package/dist/api/marketing.js +27 -27
- package/dist/api/marketing.js.map +1 -1
- package/dist/api/marketing.mjs +12 -12
- package/dist/api/marketing.mjs.map +1 -1
- package/dist/auth/helpers.d.mts +22 -22
- package/dist/auth/helpers.d.ts +22 -22
- package/dist/auth/helpers.js +25 -25
- package/dist/auth/helpers.js.map +1 -1
- package/dist/auth/helpers.mjs +8 -8
- package/dist/auth/index.js +23 -23
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/index.mjs +7 -7
- package/dist/auth-client/index.js +1 -1
- package/dist/auth-client/index.js.map +1 -1
- package/dist/auth-client/index.mjs.map +1 -1
- package/dist/{chunk-YHQ4A5RF.mjs → chunk-2BKXG4MG.mjs} +8 -7
- package/dist/chunk-2BKXG4MG.mjs.map +1 -0
- package/dist/{chunk-653GF7OT.mjs → chunk-AOSJUQQG.mjs} +4 -4
- package/dist/chunk-AOSJUQQG.mjs.map +1 -0
- package/dist/{chunk-L242CZ64.mjs → chunk-CRDC62BU.mjs} +2 -2
- package/dist/chunk-CRDC62BU.mjs.map +1 -0
- package/dist/{chunk-NQELV53D.mjs → chunk-J5XRJ2GW.mjs} +3 -3
- package/dist/chunk-J5XRJ2GW.mjs.map +1 -0
- package/dist/{chunk-6OAHCEDJ.mjs → chunk-JRDMU6I2.mjs} +4 -4
- package/dist/chunk-JRDMU6I2.mjs.map +1 -0
- package/dist/{chunk-O5EQYHNC.mjs → chunk-JSB36AY6.mjs} +4 -4
- package/dist/chunk-JSB36AY6.mjs.map +1 -0
- package/dist/{chunk-TE5BEAQB.mjs → chunk-M6Y2XNJC.mjs} +3 -3
- package/dist/chunk-M6Y2XNJC.mjs.map +1 -0
- package/dist/{chunk-ONJDPUVO.mjs → chunk-NOFQCVHC.mjs} +13 -13
- package/dist/chunk-NOFQCVHC.mjs.map +1 -0
- package/dist/{chunk-K62JYJRR.mjs → chunk-RLZ7F7ZY.mjs} +3 -3
- package/dist/{chunk-K62JYJRR.mjs.map → chunk-RLZ7F7ZY.mjs.map} +1 -1
- package/dist/{chunk-2BJ3B4FR.mjs → chunk-TMANA7KL.mjs} +41 -5
- package/dist/chunk-TMANA7KL.mjs.map +1 -0
- package/dist/db/index.js +1 -1
- package/dist/db/index.js.map +1 -1
- package/dist/db/index.mjs +2 -2
- package/dist/db/schema.js +1 -1
- package/dist/db/schema.js.map +1 -1
- package/dist/db/schema.mjs +1 -1
- package/dist/errors.js +2 -2
- package/dist/errors.js.map +1 -1
- package/dist/errors.mjs +3 -3
- package/dist/marketing/index.js +2 -2
- package/dist/marketing/index.js.map +1 -1
- package/dist/marketing/index.mjs +2 -2
- package/dist/{email-template-passkey-change-F5Q2SXHD.mjs → passkey-changed-KEGNTIPE.mjs} +2 -2
- package/dist/passkey-changed-KEGNTIPE.mjs.map +1 -0
- package/dist/{email-template-reset-password-QTCQNXOD.mjs → reset-password-64VQEXBW.mjs} +2 -2
- package/dist/reset-password-64VQEXBW.mjs.map +1 -0
- package/dist/sessions/queries.js +1 -1
- package/dist/sessions/queries.js.map +1 -1
- package/dist/sessions/queries.mjs +2 -2
- package/dist/sessions/queries.mjs.map +1 -1
- package/dist/settings/queries.d.mts +9 -1
- package/dist/settings/queries.d.ts +9 -1
- package/dist/settings/queries.js +38 -1
- package/dist/settings/queries.js.map +1 -1
- package/dist/settings/queries.mjs +3 -3
- package/dist/users/queries.d.mts +18 -3
- package/dist/users/queries.d.ts +18 -3
- package/dist/users/queries.js +70 -11
- package/dist/users/queries.js.map +1 -1
- package/dist/users/queries.mjs +53 -15
- package/dist/users/queries.mjs.map +1 -1
- package/dist/{email-template-verify-email-WZDCCAKK.mjs → verify-email-4KMNGDKN.mjs} +2 -2
- package/dist/verify-email-4KMNGDKN.mjs.map +1 -0
- package/lib/push/client.ts +39 -0
- package/lib/security/activity-severity.ts +57 -0
- package/package.json +114 -18
- package/components/dashboard/admin/adminActivityLogsTable.tsx +0 -323
- package/components/dashboard/admin/adminUserStatusCard.tsx +0 -57
- package/components/dashboard/admin/systemSettingsForm.tsx +0 -289
- package/dist/chunk-2BJ3B4FR.mjs.map +0 -1
- package/dist/chunk-653GF7OT.mjs.map +0 -1
- package/dist/chunk-6OAHCEDJ.mjs.map +0 -1
- package/dist/chunk-L242CZ64.mjs.map +0 -1
- package/dist/chunk-NQELV53D.mjs.map +0 -1
- package/dist/chunk-O5EQYHNC.mjs.map +0 -1
- package/dist/chunk-ONJDPUVO.mjs.map +0 -1
- package/dist/chunk-TE5BEAQB.mjs.map +0 -1
- package/dist/chunk-YHQ4A5RF.mjs.map +0 -1
- package/dist/email-template-passkey-change-F5Q2SXHD.mjs.map +0 -1
- package/dist/email-template-reset-password-QTCQNXOD.mjs.map +0 -1
- package/dist/email-template-verify-email-WZDCCAKK.mjs.map +0 -1
- /package/components/dashboard/{heartbeat.tsx → common/heartbeat.tsx} +0 -0
- /package/components/email/{email-template-reset-password.tsx → auth/reset-password.tsx} +0 -0
- /package/components/email/{email-template-verify-email.tsx → auth/verify-email.tsx} +0 -0
- /package/components/email/{email-template-welcome.tsx → auth/welcome.tsx} +0 -0
- /package/components/email/{email-template.tsx → layout/base-layout.tsx} +0 -0
- /package/components/email/{email-template-2.tsx → marketing/general-announcement.tsx} +0 -0
- /package/components/email/{email-template-banned.tsx → security/account-banned.tsx} +0 -0
- /package/components/email/{email-template-new-device.tsx → security/new-device-alert.tsx} +0 -0
- /package/components/email/{email-template-passkey-change.tsx → security/passkey-changed.tsx} +0 -0
- /package/lib/{auth-client.ts → auth/client.ts} +0 -0
- /package/lib/{maintenance.ts → config/maintenance.ts} +0 -0
- /package/lib/{cookie-consent.ts → security/cookie-consent.ts} +0 -0
- /package/lib/{cookie-names.ts → security/cookie-names.ts} +0 -0
- /package/lib/{device-fingerprint.ts → security/device-fingerprint.ts} +0 -0
- /package/lib/{formatters.ts → utils/formatters.ts} +0 -0
- /package/lib/{recalculate-columns.ts → utils/recalculate-columns.ts} +0 -0
- /package/lib/{request-info.ts → utils/request-info.ts} +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Card, CardContent, CardHeader, CardTitle } from "../../../ui/card"
|
|
2
|
+
import { Badge } from "../../../ui/badge"
|
|
3
|
+
import { Separator } from "../../../ui/separator"
|
|
4
|
+
|
|
5
|
+
const PROVIDER_LABELS: Record<string, string> = { credential: 'Email & password', google: 'Google' }
|
|
6
|
+
|
|
7
|
+
export default function AdminUserSecurityCard({
|
|
8
|
+
security,
|
|
9
|
+
}: {
|
|
10
|
+
security: { twoFactorEnabled: boolean; passkeyCount: number; providers: string[] }
|
|
11
|
+
}) {
|
|
12
|
+
return (
|
|
13
|
+
<Card>
|
|
14
|
+
<CardHeader>
|
|
15
|
+
<CardTitle>Security</CardTitle>
|
|
16
|
+
</CardHeader>
|
|
17
|
+
<CardContent className="space-y-4">
|
|
18
|
+
<div>
|
|
19
|
+
<p className="text-sm font-medium text-gray-600">Two-factor authentication</p>
|
|
20
|
+
<div className="mt-1">
|
|
21
|
+
<Badge variant={security.twoFactorEnabled ? 'default' : 'outline'}>
|
|
22
|
+
{security.twoFactorEnabled ? 'Enabled' : 'Not enabled'}
|
|
23
|
+
</Badge>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
<Separator />
|
|
27
|
+
<div>
|
|
28
|
+
<p className="text-sm font-medium text-gray-600">Passkeys</p>
|
|
29
|
+
<p className="text-base">{security.passkeyCount === 0 ? 'None registered' : `${security.passkeyCount} registered`}</p>
|
|
30
|
+
</div>
|
|
31
|
+
<Separator />
|
|
32
|
+
<div>
|
|
33
|
+
<p className="text-sm font-medium text-gray-600">Sign-in methods</p>
|
|
34
|
+
<div className="mt-1 flex flex-wrap gap-2">
|
|
35
|
+
{security.providers.length === 0 ? (
|
|
36
|
+
<span className="text-base">None linked yet</span>
|
|
37
|
+
) : (
|
|
38
|
+
security.providers.map((p) => (
|
|
39
|
+
<Badge key={p} variant="secondary">{PROVIDER_LABELS[p] ?? p}</Badge>
|
|
40
|
+
))
|
|
41
|
+
)}
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</CardContent>
|
|
45
|
+
</Card>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { Card, CardContent, CardHeader, CardTitle } from "../../../ui/card"
|
|
2
|
+
import { Badge } from "../../../ui/badge"
|
|
3
|
+
import { Separator } from "../../../ui/separator"
|
|
4
|
+
import { formatDate, formatDateTime } from "../../../../lib/utils/formatters"
|
|
5
|
+
|
|
6
|
+
type User = {
|
|
7
|
+
banned: boolean
|
|
8
|
+
bannedAt: Date | null
|
|
9
|
+
bannedReason: string | null
|
|
10
|
+
lastLoginAt: Date | null
|
|
11
|
+
lastActiveAt: Date | null
|
|
12
|
+
/** Expiry of an outstanding invite/password link, if any. */
|
|
13
|
+
inviteExpiresAt?: Date | null
|
|
14
|
+
/** From the invite activity log row; null for users who weren't invited. */
|
|
15
|
+
invitedAt?: Date | null
|
|
16
|
+
/** First login after the invite. */
|
|
17
|
+
acceptedAt?: Date | null
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default function AdminUserStatusCard({ user }: { user: User }) {
|
|
21
|
+
return (
|
|
22
|
+
<Card>
|
|
23
|
+
<CardHeader>
|
|
24
|
+
<CardTitle>Account Status</CardTitle>
|
|
25
|
+
</CardHeader>
|
|
26
|
+
<CardContent className="space-y-4">
|
|
27
|
+
<div>
|
|
28
|
+
<p className="text-sm font-medium text-gray-600">Status</p>
|
|
29
|
+
<div className="mt-1">
|
|
30
|
+
{user.banned ? (
|
|
31
|
+
<Badge variant="destructive">Banned</Badge>
|
|
32
|
+
) : !user.lastLoginAt && user.inviteExpiresAt ? (
|
|
33
|
+
user.inviteExpiresAt > new Date() ? (
|
|
34
|
+
<Badge variant="secondary">Invited</Badge>
|
|
35
|
+
) : (
|
|
36
|
+
<Badge variant="outline">Invite expired</Badge>
|
|
37
|
+
)
|
|
38
|
+
) : (
|
|
39
|
+
<Badge variant="outline">Active</Badge>
|
|
40
|
+
)}
|
|
41
|
+
</div>
|
|
42
|
+
{!user.banned && !user.lastLoginAt && user.inviteExpiresAt && (
|
|
43
|
+
<p className="text-sm text-gray-600 dark:text-gray-400 mt-1">
|
|
44
|
+
{user.inviteExpiresAt > new Date()
|
|
45
|
+
? `Invite sent, awaiting acceptance (expires ${formatDate(user.inviteExpiresAt)})`
|
|
46
|
+
: 'Not accepted before the link expired'}
|
|
47
|
+
</p>
|
|
48
|
+
)}
|
|
49
|
+
{user.banned && user.bannedReason && (
|
|
50
|
+
<p className="text-sm text-gray-600 dark:text-gray-400 mt-1">
|
|
51
|
+
{user.bannedReason}
|
|
52
|
+
</p>
|
|
53
|
+
)}
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
{user.invitedAt && (
|
|
57
|
+
<>
|
|
58
|
+
<Separator />
|
|
59
|
+
<div>
|
|
60
|
+
<p className="text-sm font-medium text-gray-600">Invite</p>
|
|
61
|
+
<p className="text-base">Sent {formatDateTime(user.invitedAt)}</p>
|
|
62
|
+
<p className="text-base">
|
|
63
|
+
{user.acceptedAt ? `Accepted ${formatDateTime(user.acceptedAt)}` : 'Not accepted yet'}
|
|
64
|
+
</p>
|
|
65
|
+
</div>
|
|
66
|
+
</>
|
|
67
|
+
)}
|
|
68
|
+
|
|
69
|
+
<Separator />
|
|
70
|
+
|
|
71
|
+
<div>
|
|
72
|
+
<p className="text-sm font-medium text-gray-600">Last Login</p>
|
|
73
|
+
<p className="text-base">
|
|
74
|
+
{user.lastLoginAt ? formatDateTime(user.lastLoginAt) : 'Never'}
|
|
75
|
+
</p>
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
<Separator />
|
|
79
|
+
|
|
80
|
+
<div>
|
|
81
|
+
<p className="text-sm font-medium text-gray-600">Last Active</p>
|
|
82
|
+
<p className="text-base">
|
|
83
|
+
{user.lastActiveAt ? formatDateTime(user.lastActiveAt) : 'Never'}
|
|
84
|
+
</p>
|
|
85
|
+
</div>
|
|
86
|
+
</CardContent>
|
|
87
|
+
</Card>
|
|
88
|
+
)
|
|
89
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import { useState, useEffect, useRef, type ReactNode } from 'react'
|
|
4
|
-
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from '
|
|
5
|
-
import { Button } from '
|
|
6
|
-
import { Input } from '
|
|
7
|
-
import { Badge } from '
|
|
8
|
-
import { Skeleton } from '
|
|
9
|
-
import { Checkbox } from '
|
|
10
|
-
import { Label } from '
|
|
11
|
-
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '
|
|
12
|
-
import { DataTable, DataTablePagination, type Column } from '
|
|
4
|
+
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from '../../../ui/card'
|
|
5
|
+
import { Button } from '../../../ui/button'
|
|
6
|
+
import { Input } from '../../../ui/input'
|
|
7
|
+
import { Badge } from '../../../ui/badge'
|
|
8
|
+
import { Skeleton } from '../../../ui/skeleton'
|
|
9
|
+
import { Checkbox } from '../../../ui/checkbox'
|
|
10
|
+
import { Label } from '../../../ui/label'
|
|
11
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../../../ui/select'
|
|
12
|
+
import { DataTable, DataTablePagination, type Column } from '../../../ui/data-table'
|
|
13
13
|
import {
|
|
14
14
|
AlertDialog,
|
|
15
15
|
AlertDialogAction,
|
|
@@ -19,12 +19,14 @@ import {
|
|
|
19
19
|
AlertDialogFooter,
|
|
20
20
|
AlertDialogHeader,
|
|
21
21
|
AlertDialogTitle,
|
|
22
|
-
} from '
|
|
22
|
+
} from '../../../ui/alert-dialog'
|
|
23
23
|
import { toast } from 'sonner'
|
|
24
24
|
import { useRouter } from 'next/navigation'
|
|
25
25
|
import Link from 'next/link'
|
|
26
26
|
import { formatDate, formatDateTime } from '@xk2800/nextjs-template/lib/formatters'
|
|
27
|
-
import { Download } from 'lucide-react'
|
|
27
|
+
import { Download, MoreHorizontal } from 'lucide-react'
|
|
28
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from '../../../ui/dropdown-menu'
|
|
29
|
+
import InviteUserDialog from './invite-user-dialog'
|
|
28
30
|
import { authClient, useSession } from '@xk2800/nextjs-template/auth-client'
|
|
29
31
|
|
|
30
32
|
export interface AdminUser {
|
|
@@ -42,6 +44,8 @@ export interface AdminUser {
|
|
|
42
44
|
lastLoginAt: Date | null
|
|
43
45
|
lastActiveAt: Date | null
|
|
44
46
|
createdAt: Date
|
|
47
|
+
/** Expiry of the user's outstanding password/invite link, if any. */
|
|
48
|
+
inviteExpiresAt?: Date | string | null
|
|
45
49
|
}
|
|
46
50
|
|
|
47
51
|
export type AdminUserPlans<TUser extends AdminUser = AdminUser> = {
|
|
@@ -101,6 +105,8 @@ export default function AdminUsersTable<TUser extends AdminUser = AdminUser>({
|
|
|
101
105
|
const [updatingPlanFor, setUpdatingPlanFor] = useState<string | null>(null)
|
|
102
106
|
const [loading, setLoading] = useState(false)
|
|
103
107
|
const [search, setSearch] = useState('')
|
|
108
|
+
const [roleFilter, setRoleFilter] = useState('all')
|
|
109
|
+
const [statusFilter, setStatusFilter] = useState('all')
|
|
104
110
|
const [page, setPage] = useState(1)
|
|
105
111
|
const [pagination, setPagination] = useState<PaginationData | null>(initialPagination)
|
|
106
112
|
const [actionUserId, setActionUserId] = useState<string | null>(null)
|
|
@@ -139,6 +145,8 @@ export default function AdminUsersTable<TUser extends AdminUser = AdminUser>({
|
|
|
139
145
|
page: pageNum.toString(),
|
|
140
146
|
limit: '10',
|
|
141
147
|
search: searchQuery,
|
|
148
|
+
...(roleFilter !== 'all' && { role: roleFilter }),
|
|
149
|
+
...(statusFilter !== 'all' && { status: statusFilter }),
|
|
142
150
|
})
|
|
143
151
|
const response = await fetch(`/api/admin/users?${params}`)
|
|
144
152
|
if (!response.ok) throw new Error('Failed to fetch users')
|
|
@@ -167,7 +175,7 @@ export default function AdminUsersTable<TUser extends AdminUser = AdminUser>({
|
|
|
167
175
|
}, 300)
|
|
168
176
|
return () => clearTimeout(timer)
|
|
169
177
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
170
|
-
}, [search])
|
|
178
|
+
}, [search, roleFilter, statusFilter])
|
|
171
179
|
|
|
172
180
|
// Keep online status fresh without a full-page reload.
|
|
173
181
|
useEffect(() => {
|
|
@@ -175,12 +183,16 @@ export default function AdminUsersTable<TUser extends AdminUser = AdminUser>({
|
|
|
175
183
|
fetchUsers(page, search, true)
|
|
176
184
|
}, 30_000)
|
|
177
185
|
return () => clearInterval(interval)
|
|
178
|
-
}, [page, search])
|
|
186
|
+
}, [page, search, roleFilter, statusFilter])
|
|
179
187
|
|
|
180
188
|
const handleExport = async () => {
|
|
181
189
|
setIsExporting(true)
|
|
182
190
|
try {
|
|
183
|
-
const params = new URLSearchParams({
|
|
191
|
+
const params = new URLSearchParams({
|
|
192
|
+
search,
|
|
193
|
+
...(roleFilter !== 'all' && { role: roleFilter }),
|
|
194
|
+
...(statusFilter !== 'all' && { status: statusFilter }),
|
|
195
|
+
})
|
|
184
196
|
const response = await fetch(`/api/admin/users/export?${params}`)
|
|
185
197
|
if (!response.ok) throw new Error('Failed to export users')
|
|
186
198
|
const blob = await response.blob()
|
|
@@ -358,37 +370,53 @@ export default function AdminUsersTable<TUser extends AdminUser = AdminUser>({
|
|
|
358
370
|
return (
|
|
359
371
|
<>
|
|
360
372
|
<Card>
|
|
361
|
-
<CardHeader>
|
|
362
|
-
<
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
373
|
+
<CardHeader className="space-y-4">
|
|
374
|
+
<div className="flex flex-row items-start justify-between gap-4">
|
|
375
|
+
<div>
|
|
376
|
+
<CardTitle>Users List</CardTitle>
|
|
377
|
+
<CardDescription>
|
|
378
|
+
{pagination ? `Showing ${users.length} of ${pagination.total} users` : 'Loading...'}
|
|
379
|
+
</CardDescription>
|
|
380
|
+
</div>
|
|
381
|
+
<div className="flex items-center gap-2">
|
|
382
|
+
<InviteUserDialog onInvited={() => fetchUsers(page, search, true)} />
|
|
383
|
+
<Button
|
|
384
|
+
variant="outline"
|
|
385
|
+
size="sm"
|
|
386
|
+
onClick={handleExport}
|
|
387
|
+
disabled={isExporting || users.length === 0}
|
|
388
|
+
>
|
|
389
|
+
<Download />
|
|
390
|
+
{isExporting ? 'Exporting...' : 'Export CSV'}
|
|
391
|
+
</Button>
|
|
392
|
+
</div>
|
|
393
|
+
</div>
|
|
394
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
395
|
+
<Input
|
|
396
|
+
placeholder="Search by name or email..."
|
|
397
|
+
value={search}
|
|
398
|
+
onChange={(e) => setSearch(e.target.value)}
|
|
399
|
+
className="max-w-sm"
|
|
400
|
+
/>
|
|
401
|
+
<Select value={roleFilter} onValueChange={setRoleFilter}>
|
|
402
|
+
<SelectTrigger className="w-[130px]"><SelectValue /></SelectTrigger>
|
|
403
|
+
<SelectContent>
|
|
404
|
+
<SelectItem value="all">Role: All</SelectItem>
|
|
405
|
+
<SelectItem value="admin">Admin</SelectItem>
|
|
406
|
+
<SelectItem value="tester">Tester</SelectItem>
|
|
407
|
+
<SelectItem value="user">User</SelectItem>
|
|
408
|
+
</SelectContent>
|
|
409
|
+
</Select>
|
|
410
|
+
<Select value={statusFilter} onValueChange={setStatusFilter}>
|
|
411
|
+
<SelectTrigger className="w-[140px]"><SelectValue /></SelectTrigger>
|
|
412
|
+
<SelectContent>
|
|
413
|
+
<SelectItem value="all">Status: All</SelectItem>
|
|
414
|
+
<SelectItem value="active">Active</SelectItem>
|
|
415
|
+
<SelectItem value="invited">Invited</SelectItem>
|
|
416
|
+
<SelectItem value="banned">Banned</SelectItem>
|
|
417
|
+
</SelectContent>
|
|
418
|
+
</Select>
|
|
382
419
|
</div>
|
|
383
|
-
<Button
|
|
384
|
-
variant="outline"
|
|
385
|
-
size="sm"
|
|
386
|
-
onClick={handleExport}
|
|
387
|
-
disabled={isExporting || users.length === 0}
|
|
388
|
-
>
|
|
389
|
-
<Download />
|
|
390
|
-
{isExporting ? 'Exporting...' : 'Export CSV'}
|
|
391
|
-
</Button>
|
|
392
420
|
</CardHeader>
|
|
393
421
|
<CardContent>
|
|
394
422
|
{selectedIds.size > 0 && (
|
|
@@ -519,6 +547,20 @@ export default function AdminUsersTable<TUser extends AdminUser = AdminUser>({
|
|
|
519
547
|
<p className="text-xs italic text-muted-foreground">“{user.bannedReason}”</p>
|
|
520
548
|
)}
|
|
521
549
|
</div>
|
|
550
|
+
) : !user.lastLoginAt && user.inviteExpiresAt ? (
|
|
551
|
+
new Date(user.inviteExpiresAt) > new Date() ? (
|
|
552
|
+
<div className="space-y-1">
|
|
553
|
+
<Badge variant="secondary">Invited</Badge>
|
|
554
|
+
<p className="text-xs text-muted-foreground">
|
|
555
|
+
Invite sent, awaiting acceptance (expires {formatDate(user.inviteExpiresAt)})
|
|
556
|
+
</p>
|
|
557
|
+
</div>
|
|
558
|
+
) : (
|
|
559
|
+
<div className="space-y-1">
|
|
560
|
+
<Badge variant="outline">Invite expired</Badge>
|
|
561
|
+
<p className="text-xs text-muted-foreground">Not accepted before the link expired</p>
|
|
562
|
+
</div>
|
|
563
|
+
)
|
|
522
564
|
) : (
|
|
523
565
|
<Badge variant="outline">Active</Badge>
|
|
524
566
|
),
|
|
@@ -539,94 +581,49 @@ export default function AdminUsersTable<TUser extends AdminUser = AdminUser>({
|
|
|
539
581
|
},
|
|
540
582
|
{
|
|
541
583
|
name: 'actions',
|
|
542
|
-
title: '
|
|
543
|
-
minWidth:
|
|
544
|
-
renderer: (user) =>
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
</
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
variant="outline"
|
|
586
|
-
size="sm"
|
|
587
|
-
onClick={() => {
|
|
588
|
-
setActionUserId(user.id)
|
|
589
|
-
setActionType(user.role === 'tester' ? 'untester' : 'tester')
|
|
590
|
-
}}
|
|
591
|
-
>
|
|
592
|
-
{user.role === 'tester' ? 'Remove Tester' : 'Make Tester'}
|
|
593
|
-
</Button>
|
|
594
|
-
)}
|
|
595
|
-
{user.banned ? (
|
|
596
|
-
<Button
|
|
597
|
-
variant="outline"
|
|
598
|
-
size="sm"
|
|
599
|
-
onClick={() => {
|
|
600
|
-
setActionUserId(user.id)
|
|
601
|
-
setActionType('unban')
|
|
602
|
-
}}
|
|
603
|
-
>
|
|
604
|
-
Unban
|
|
605
|
-
</Button>
|
|
606
|
-
) : (
|
|
607
|
-
<Button
|
|
608
|
-
variant="outline"
|
|
609
|
-
size="sm"
|
|
610
|
-
onClick={() => {
|
|
611
|
-
setActionUserId(user.id)
|
|
612
|
-
setActionType('ban')
|
|
613
|
-
}}
|
|
614
|
-
>
|
|
615
|
-
Ban
|
|
616
|
-
</Button>
|
|
617
|
-
)}
|
|
618
|
-
<Button
|
|
619
|
-
variant="destructive"
|
|
620
|
-
size="sm"
|
|
621
|
-
onClick={() => {
|
|
622
|
-
setActionUserId(user.id)
|
|
623
|
-
setActionType('delete')
|
|
624
|
-
}}
|
|
625
|
-
>
|
|
626
|
-
Delete
|
|
627
|
-
</Button>
|
|
628
|
-
</div>
|
|
629
|
-
),
|
|
584
|
+
title: '',
|
|
585
|
+
minWidth: 56,
|
|
586
|
+
renderer: (user) => {
|
|
587
|
+
const act = (type: NonNullable<typeof actionType>) => () => {
|
|
588
|
+
setActionUserId(user.id)
|
|
589
|
+
setActionType(type)
|
|
590
|
+
}
|
|
591
|
+
return (
|
|
592
|
+
<div className="flex justify-end">
|
|
593
|
+
<DropdownMenu>
|
|
594
|
+
<DropdownMenuTrigger asChild>
|
|
595
|
+
<Button variant="ghost" size="icon" aria-label={`Actions for ${user.email}`}>
|
|
596
|
+
<MoreHorizontal />
|
|
597
|
+
</Button>
|
|
598
|
+
</DropdownMenuTrigger>
|
|
599
|
+
<DropdownMenuContent align="end">
|
|
600
|
+
{impersonation && (
|
|
601
|
+
<DropdownMenuItem disabled={user.id === currentUserId || user.banned} onSelect={act('impersonate')}>
|
|
602
|
+
Impersonate
|
|
603
|
+
</DropdownMenuItem>
|
|
604
|
+
)}
|
|
605
|
+
{user.role === 'admin' ? (
|
|
606
|
+
<DropdownMenuItem onSelect={act('demote')}>Remove Admin</DropdownMenuItem>
|
|
607
|
+
) : (
|
|
608
|
+
<DropdownMenuItem onSelect={act('promote')}>Make Admin</DropdownMenuItem>
|
|
609
|
+
)}
|
|
610
|
+
{user.role !== 'admin' && (
|
|
611
|
+
<DropdownMenuItem onSelect={act(user.role === 'tester' ? 'untester' : 'tester')}>
|
|
612
|
+
{user.role === 'tester' ? 'Remove Tester' : 'Make Tester'}
|
|
613
|
+
</DropdownMenuItem>
|
|
614
|
+
)}
|
|
615
|
+
<DropdownMenuItem onSelect={act(user.banned ? 'unban' : 'ban')}>
|
|
616
|
+
{user.banned ? 'Unban' : 'Ban'}
|
|
617
|
+
</DropdownMenuItem>
|
|
618
|
+
<DropdownMenuSeparator />
|
|
619
|
+
<DropdownMenuItem className="text-destructive focus:text-destructive" onSelect={act('delete')}>
|
|
620
|
+
Delete
|
|
621
|
+
</DropdownMenuItem>
|
|
622
|
+
</DropdownMenuContent>
|
|
623
|
+
</DropdownMenu>
|
|
624
|
+
</div>
|
|
625
|
+
)
|
|
626
|
+
},
|
|
630
627
|
},
|
|
631
628
|
] satisfies Column<TUser>[]}
|
|
632
629
|
data={users}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "
|
|
2
|
-
import { parseUserAgent, lookupGeoLocation, formatDeviceInfo, formatLocation } from "
|
|
3
|
-
import AdminUserActivityLogTable from "./
|
|
1
|
+
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "../../../../ui/card"
|
|
2
|
+
import { parseUserAgent, lookupGeoLocation, formatDeviceInfo, formatLocation } from "../../../../../lib/utils/request-info"
|
|
3
|
+
import AdminUserActivityLogTable from "./admin-user-activity-log-table"
|
|
4
4
|
|
|
5
5
|
interface ActivityLog {
|
|
6
6
|
id: string
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
-
import { Badge } from "
|
|
4
|
-
import { DataTable, type Column } from "
|
|
5
|
-
import { formatDateTime, actionBadgeVariant } from "
|
|
3
|
+
import { Badge } from "../../../../ui/badge"
|
|
4
|
+
import { DataTable, type Column } from "../../../../ui/data-table"
|
|
5
|
+
import { formatDateTime, actionBadgeVariant } from "../../../../../lib/utils/formatters"
|
|
6
6
|
|
|
7
7
|
export type ActivityLogRow = {
|
|
8
8
|
id: string
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "
|
|
2
|
-
import { Badge } from "
|
|
3
|
-
import { CONSENT_PURPOSES, consentAllows, type ConsentPurpose } from "
|
|
4
|
-
import { formatDateTime } from "
|
|
1
|
+
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "../../../../ui/card"
|
|
2
|
+
import { Badge } from "../../../../ui/badge"
|
|
3
|
+
import { CONSENT_PURPOSES, consentAllows, type ConsentPurpose } from "../../../../../lib/security/cookie-names"
|
|
4
|
+
import { formatDateTime } from "../../../../../lib/utils/formatters"
|
|
5
5
|
|
|
6
6
|
interface ConsentRecord {
|
|
7
7
|
id: string
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "
|
|
2
|
-
import { formatLocation } from "
|
|
1
|
+
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "../../../../ui/card"
|
|
2
|
+
import { formatLocation } from "../../../../../lib/utils/request-info"
|
|
3
3
|
|
|
4
4
|
interface UserDevice {
|
|
5
5
|
id: string
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "
|
|
2
|
-
import { formatDeviceInfo, formatLocation, type DeviceType } from "
|
|
3
|
-
import AdminUserLoginInfoTable from "./
|
|
1
|
+
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "../../../../ui/card"
|
|
2
|
+
import { formatDeviceInfo, formatLocation, type DeviceType } from "../../../../../lib/utils/request-info"
|
|
3
|
+
import AdminUserLoginInfoTable from "./admin-user-login-info-table"
|
|
4
4
|
|
|
5
5
|
interface LoginEvent {
|
|
6
6
|
id: string
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
-
import { Badge } from "
|
|
4
|
-
import { DataTable, type Column } from "
|
|
5
|
-
import { formatDateTime } from "
|
|
3
|
+
import { Badge } from "../../../../ui/badge"
|
|
4
|
+
import { DataTable, type Column } from "../../../../ui/data-table"
|
|
5
|
+
import { formatDateTime } from "../../../../../lib/utils/formatters"
|
|
6
6
|
|
|
7
7
|
export type LoginInfoRow = {
|
|
8
8
|
id: string
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import { useState } from "react"
|
|
4
|
-
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "
|
|
5
|
-
import { Button } from "
|
|
6
|
-
import { DataTable, type Column } from "
|
|
4
|
+
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "../../../../ui/card"
|
|
5
|
+
import { Button } from "../../../../ui/button"
|
|
6
|
+
import { DataTable, type Column } from "../../../../ui/data-table"
|
|
7
7
|
import {
|
|
8
8
|
AlertDialog,
|
|
9
9
|
AlertDialogAction,
|
|
@@ -13,8 +13,8 @@ import {
|
|
|
13
13
|
AlertDialogFooter,
|
|
14
14
|
AlertDialogHeader,
|
|
15
15
|
AlertDialogTitle,
|
|
16
|
-
} from "
|
|
17
|
-
import { formatDateTime } from "
|
|
16
|
+
} from "../../../../ui/alert-dialog"
|
|
17
|
+
import { formatDateTime } from "../../../../../lib/utils/formatters"
|
|
18
18
|
import { useRouter } from "next/navigation"
|
|
19
19
|
import { toast } from "sonner"
|
|
20
20
|
|
package/components/dashboard/admin/{impersonationLogCard.tsx → users/impersonation-log-card.tsx}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import Link from "next/link"
|
|
2
2
|
import { ShieldAlert } from "lucide-react"
|
|
3
3
|
import { getRecentImpersonationEvents } from "@xk2800/nextjs-template/activity/queries"
|
|
4
|
-
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "
|
|
5
|
-
import { Badge } from "
|
|
6
|
-
import { formatDateTime } from "
|
|
4
|
+
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "../../../ui/card"
|
|
5
|
+
import { Badge } from "../../../ui/badge"
|
|
6
|
+
import { formatDateTime } from "../../../../lib/utils/formatters"
|
|
7
7
|
|
|
8
8
|
// Dedicated, always-visible feed of who's been logging in as whom — so an
|
|
9
9
|
// admin can see this at a glance instead of having to remember to filter the
|
|
@@ -44,9 +44,14 @@ export default async function ImpersonationLogCard({ showViewAllLink = true }: I
|
|
|
44
44
|
{event.action === 'impersonation_started' ? 'Started' : 'Stopped'}
|
|
45
45
|
</Badge>
|
|
46
46
|
<div>
|
|
47
|
-
<p className="text-sm">
|
|
47
|
+
<p className="text-sm">
|
|
48
|
+
{event.adminName || event.adminEmail || 'Unknown admin'}
|
|
49
|
+
{' → '}
|
|
50
|
+
{event.targetName || event.targetEmail || 'a deleted account'}
|
|
51
|
+
</p>
|
|
48
52
|
<p className="text-xs text-gray-500 dark:text-gray-400">
|
|
49
|
-
|
|
53
|
+
{event.action === 'impersonation_started' ? 'Started' : 'Stopped'} impersonating
|
|
54
|
+
{event.targetEmail ? ` ${event.targetEmail}` : ''}
|
|
50
55
|
</p>
|
|
51
56
|
</div>
|
|
52
57
|
</div>
|