Skip to content

Commit ed7d93d

Browse files
authored
Merge pull request #679 from Merit-Systems/br/fix-user-display
fix user display
2 parents e04e301 + 839fccb commit ed7d93d

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

packages/app/control/src/app/(app)/app/[id]/transactions/_components/transactions.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ interface Transaction {
2626
user?: {
2727
id: string | null;
2828
name: string | null;
29+
email: string | null;
2930
image: string | null;
3031
};
3132
date: Date;
@@ -111,7 +112,10 @@ const TransactionRow = ({ transaction }: { transaction: Transaction }) => {
111112
<div className="flex flex-col items-start">
112113
<p className="text-sm leading-tight">
113114
<span className="font-medium">
114-
{transaction.user?.name ?? 'x402 Users'}
115+
{transaction.user?.name ??
116+
(transaction.user?.email
117+
? `${transaction.user.id}`
118+
: 'Unknown User')}
115119
</span>{' '}
116120
made {transaction.callCount} requests
117121
</p>

packages/app/control/src/app/(app)/app/[id]/users/_components/users.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export const UsersTable: React.FC<Props> = ({ appId }) => {
5656
...rows.map(row =>
5757
[
5858
`"${row.name ?? ''}"`,
59-
`"${row.email || ''}"`,
59+
`"${row.email ?? ''}"`,
6060
row.usage.totalTransactions,
6161
row.usage.rawCost,
6262
row.usage.markupProfit,
@@ -187,7 +187,9 @@ const UserRow = ({ user, showEmail }: { user: User; showEmail: boolean }) => {
187187
<TableCell className="pl-4">
188188
<div className="flex flex-row items-center gap-2">
189189
<UserAvatar src={user.image} className="size-6" />
190-
<p className="text-sm font-medium">{user.name}</p>
190+
<p className="text-sm font-medium">
191+
{user.name ?? (user.email ? `${user.id}` : 'Unknown User')}
192+
</p>
191193
</div>
192194
</TableCell>
193195
{showEmail && (

packages/app/control/src/services/db/apps/transactions.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export const listAppTransactions = async (
4949
select: {
5050
id: true,
5151
name: true,
52+
email: true,
5253
image: true,
5354
},
5455
},
@@ -69,6 +70,7 @@ export const listAppTransactions = async (
6970
user: {
7071
id: string | null;
7172
name: string | null;
73+
email: string | null;
7274
image: string | null;
7375
};
7476
date: Date;
@@ -93,6 +95,7 @@ export const listAppTransactions = async (
9395
id: transaction.id,
9496
user: {
9597
id: transaction.userId,
98+
email: transaction.user?.email ?? null,
9699
name:
97100
transaction.user?.name ??
98101
(transaction.userId === null ? 'x402 Users' : null),

0 commit comments

Comments
 (0)