feat(leaderboard): add Stripe subscription link to customer names

This commit enhances the leaderboard by adding a clickable link to each
customer's name, which directs to their Stripe subscription page. It also
removes the ID column and includes the planId in the signing volume data
for improved user experience and easier access to subscription details.
This commit is contained in:
Ephraim Atta-Duncan
2024-09-26 11:26:31 +00:00
parent 89154e6230
commit a274e9b75a
5 changed files with 38 additions and 15 deletions

View File

@ -18,6 +18,7 @@ export type SigningVolume = {
name: string;
signingVolume: number;
createdAt: Date;
planId: string;
};
type LeaderboardTableProps = {
@ -46,12 +47,6 @@ export const LeaderboardTable = ({
const columns = useMemo(() => {
return [
{
header: 'ID',
accessorKey: 'id',
cell: ({ row }) => <div>{row.original.id}</div>,
size: 60,
},
{
header: () => (
<div
@ -63,7 +58,21 @@ export const LeaderboardTable = ({
</div>
),
accessorKey: 'name',
cell: ({ row }) => <div>{row.getValue('name')}</div>,
cell: ({ row }) => {
console.log('row.original', row.original);
return (
<div>
<a
className="text-primary underline"
href={`https://dashboard.stripe.com/subscriptions/${row.original.planId}`}
target="_blank"
>
{row.getValue('name')}
</a>
</div>
);
},
size: 250,
},
{

View File

@ -21,5 +21,7 @@ export async function search({ search, page, perPage, sortBy, sortOrder }: Searc
const results = await getSigningVolume({ search, page, perPage, sortBy, sortOrder });
console.log('results', results);
return results;
}

View File

@ -64,6 +64,11 @@ export async function getSigningVolume({
id: true,
},
},
Subscription: {
select: {
planId: true,
},
},
},
},
team: {
@ -79,6 +84,11 @@ export async function getSigningVolume({
id: true,
},
},
subscription: {
select: {
planId: true,
},
},
},
},
},
@ -102,6 +112,8 @@ export async function getSigningVolume({
name,
signingVolume,
createdAt: subscription.createdAt,
planId:
subscription.User?.Subscription?.[0]?.planId || subscription.team?.subscription?.planId,
};
});

View File

@ -961,7 +961,7 @@ msgid "Create your account and start using state-of-the-art document signing. Op
msgstr ""
#: apps/web/src/app/(dashboard)/admin/documents/document-results.tsx:62
#: apps/web/src/app/(dashboard)/admin/leaderboard/data-table-leaderboard.tsx:89
#: apps/web/src/app/(dashboard)/admin/leaderboard/data-table-leaderboard.tsx:98
#: apps/web/src/app/(dashboard)/documents/[id]/document-page-view-information.tsx:35
#: apps/web/src/app/(dashboard)/documents/data-table.tsx:54
#: apps/web/src/app/(dashboard)/settings/security/passkeys/user-passkeys-data-table.tsx:65
@ -1989,7 +1989,7 @@ msgid "My templates"
msgstr ""
#: apps/web/src/app/(dashboard)/admin/documents/[id]/recipient-item.tsx:148
#: apps/web/src/app/(dashboard)/admin/leaderboard/data-table-leaderboard.tsx:61
#: apps/web/src/app/(dashboard)/admin/leaderboard/data-table-leaderboard.tsx:56
#: apps/web/src/app/(dashboard)/admin/users/[id]/page.tsx:99
#: apps/web/src/app/(dashboard)/admin/users/data-table-users.tsx:66
#: apps/web/src/app/(dashboard)/settings/security/passkeys/user-passkeys-data-table-actions.tsx:144
@ -2594,7 +2594,7 @@ msgstr ""
msgid "Search by document title"
msgstr ""
#: apps/web/src/app/(dashboard)/admin/leaderboard/data-table-leaderboard.tsx:140
#: apps/web/src/app/(dashboard)/admin/leaderboard/data-table-leaderboard.tsx:149
#: apps/web/src/app/(dashboard)/admin/users/data-table-users.tsx:144
msgid "Search by name or email"
msgstr ""
@ -2816,7 +2816,7 @@ msgstr ""
msgid "Signing up..."
msgstr ""
#: apps/web/src/app/(dashboard)/admin/leaderboard/data-table-leaderboard.tsx:75
#: apps/web/src/app/(dashboard)/admin/leaderboard/data-table-leaderboard.tsx:84
#: apps/web/src/app/(dashboard)/admin/leaderboard/page.tsx:46
msgid "Signing Volume"
msgstr ""

View File

@ -956,7 +956,7 @@ msgid "Create your account and start using state-of-the-art document signing. Op
msgstr "Create your account and start using state-of-the-art document signing. Open and beautiful signing is within your grasp."
#: apps/web/src/app/(dashboard)/admin/documents/document-results.tsx:62
#: apps/web/src/app/(dashboard)/admin/leaderboard/data-table-leaderboard.tsx:89
#: apps/web/src/app/(dashboard)/admin/leaderboard/data-table-leaderboard.tsx:98
#: apps/web/src/app/(dashboard)/documents/[id]/document-page-view-information.tsx:35
#: apps/web/src/app/(dashboard)/documents/data-table.tsx:54
#: apps/web/src/app/(dashboard)/settings/security/passkeys/user-passkeys-data-table.tsx:65
@ -2007,7 +2007,7 @@ msgid "My templates"
msgstr "My templates"
#: apps/web/src/app/(dashboard)/admin/documents/[id]/recipient-item.tsx:148
#: apps/web/src/app/(dashboard)/admin/leaderboard/data-table-leaderboard.tsx:61
#: apps/web/src/app/(dashboard)/admin/leaderboard/data-table-leaderboard.tsx:56
#: apps/web/src/app/(dashboard)/admin/users/[id]/page.tsx:99
#: apps/web/src/app/(dashboard)/admin/users/data-table-users.tsx:66
#: apps/web/src/app/(dashboard)/settings/security/passkeys/user-passkeys-data-table-actions.tsx:144
@ -2612,7 +2612,7 @@ msgstr "Search"
msgid "Search by document title"
msgstr "Search by document title"
#: apps/web/src/app/(dashboard)/admin/leaderboard/data-table-leaderboard.tsx:140
#: apps/web/src/app/(dashboard)/admin/leaderboard/data-table-leaderboard.tsx:149
#: apps/web/src/app/(dashboard)/admin/users/data-table-users.tsx:144
msgid "Search by name or email"
msgstr "Search by name or email"
@ -2838,7 +2838,7 @@ msgstr "Signing in..."
msgid "Signing up..."
msgstr "Signing up..."
#: apps/web/src/app/(dashboard)/admin/leaderboard/data-table-leaderboard.tsx:75
#: apps/web/src/app/(dashboard)/admin/leaderboard/data-table-leaderboard.tsx:84
#: apps/web/src/app/(dashboard)/admin/leaderboard/page.tsx:46
msgid "Signing Volume"
msgstr "Signing Volume"