From a5c6c8b493bf535d44b8e1d9e17d596ad34bec6f Mon Sep 17 00:00:00 2001 From: javayhu Date: Sat, 12 Jul 2025 08:10:31 +0800 Subject: [PATCH] feat: display user email and customer ID in UserDetailViewer --- src/components/admin/user-detail-viewer.tsx | 52 ++++++++++++++++++--- src/credits/credits.ts | 1 + 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/src/components/admin/user-detail-viewer.tsx b/src/components/admin/user-detail-viewer.tsx index f10cc0e..392ccf9 100644 --- a/src/components/admin/user-detail-viewer.tsx +++ b/src/components/admin/user-detail-viewer.tsx @@ -24,6 +24,7 @@ import { useIsMobile } from '@/hooks/use-mobile'; import { authClient } from '@/lib/auth-client'; import type { User } from '@/lib/auth-types'; import { formatDate } from '@/lib/formatter'; +import { getStripeDashboardCustomerUrl } from '@/lib/urls/urls'; import { cn } from '@/lib/utils'; import { useUsersStore } from '@/stores/users-store'; import { @@ -149,7 +150,7 @@ export function UserDetailViewer({ user }: UserDetailViewerProps) { />
{user.name} - {user.email} + {/* {user.email} */}
@@ -188,12 +189,51 @@ export function UserDetailViewer({ user }: UserDetailViewerProps) { - {/* information */} -
- {t('joined')}: {formatDate(user.createdAt)} + {/* email */} + {user.email && ( +
+ + {t('columns.email')}: + + { + navigator.clipboard.writeText(user.email!); + toast.success(t('emailCopied')); + }} + > + {user.email} + +
+ )} + + {/* customerId */} + {user.customerId && ( +
+ + {t('columns.customerId')}: + + + {user.customerId} + +
+ )} +
+ + {/* Timestamps */} +
+
+ {t('joined')}: + {formatDate(user.createdAt)}
-
- {t('updated')}: {formatDate(user.updatedAt)} +
+ {t('updated')}: + {formatDate(user.updatedAt)}
diff --git a/src/credits/credits.ts b/src/credits/credits.ts index 9a4fb92..8f96a6b 100644 --- a/src/credits/credits.ts +++ b/src/credits/credits.ts @@ -575,6 +575,7 @@ export async function distributeCreditsToAllUsers() { }) .from(user) .where(eq(user.banned, false)); // Only active users + console.log('distributing credits to all users, users count:', users.length); let processedCount = 0; let errorCount = 0;