From c9ff4492ba551895055d8a5420dba8c7ec70365b Mon Sep 17 00:00:00 2001 From: mattcasey Date: Fri, 1 Nov 2024 13:29:50 -0600 Subject: [PATCH 1/3] show email column in the scout admin --- .../users/UserActionButton/AddBuilderModal.tsx | 10 ++++++++++ .../users/UserActionButton/UserActionButton.tsx | 15 +++------------ .../components/users/UsersDashboard.tsx | 4 ++-- apps/scoutgameadmin/lib/users/getUsers.ts | 10 +++++++++- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/apps/scoutgameadmin/components/users/UserActionButton/AddBuilderModal.tsx b/apps/scoutgameadmin/components/users/UserActionButton/AddBuilderModal.tsx index 3ecb666c0b..27c9e4f216 100644 --- a/apps/scoutgameadmin/components/users/UserActionButton/AddBuilderModal.tsx +++ b/apps/scoutgameadmin/components/users/UserActionButton/AddBuilderModal.tsx @@ -50,6 +50,8 @@ export function AddBuilderModal({ user, open, onClose, onAdd }: Props) { const action = didApply ? 'Approve' : 'Add'; const requireGithubLogin = !user.githubLogin; + const githubLoginDisplayed = githubLogin || user.githubLogin; + return ( @@ -71,6 +73,14 @@ export function AddBuilderModal({ user, open, onClose, onAdd }: Props) { required /> )} + {githubLoginDisplayed && ( + + Github profile + + https://github.com/{githubLoginDisplayed} + + + )} {createBuilderError && ( diff --git a/apps/scoutgameadmin/components/users/UserActionButton/UserActionButton.tsx b/apps/scoutgameadmin/components/users/UserActionButton/UserActionButton.tsx index 068de2d148..24a64bde2b 100644 --- a/apps/scoutgameadmin/components/users/UserActionButton/UserActionButton.tsx +++ b/apps/scoutgameadmin/components/users/UserActionButton/UserActionButton.tsx @@ -33,22 +33,13 @@ export function UserActionButton({ user }: { user: ScoutGameUser }) { > - + {(user.builderStatus === 'applied' || user.builderStatus === 'rejected') && ( - setIsBuilderModalOpen(true)}>Approve builder profile + setIsBuilderModalOpen(true)}>Review builder profile )} {!user.builderStatus && setIsBuilderModalOpen(true)}>Add builder profile} setIsTransactionsModalOpen(true)}>View NFT transactions + Id: {user.id} handleSort('displayName')} > - ID + Email - {user.id} + {user.email} {user.nftsPurchased} {user.currentBalance} {new Date(user.createdAt).toLocaleDateString()} diff --git a/apps/scoutgameadmin/lib/users/getUsers.ts b/apps/scoutgameadmin/lib/users/getUsers.ts index 48f356c495..fc9beb51b8 100644 --- a/apps/scoutgameadmin/lib/users/getUsers.ts +++ b/apps/scoutgameadmin/lib/users/getUsers.ts @@ -4,7 +4,15 @@ import { validate } from 'uuid'; export type ScoutGameUser = Pick< Scout, - 'builderStatus' | 'path' | 'id' | 'avatar' | 'displayName' | 'createdAt' | 'farcasterName' | 'currentBalance' + | 'builderStatus' + | 'path' + | 'id' + | 'avatar' + | 'displayName' + | 'createdAt' + | 'farcasterName' + | 'currentBalance' + | 'email' > & { githubLogin: string | null; nftsPurchased: number }; export type UserFilter = 'only-builders'; From f1215acd991c906df010025ae53c47ea61864325 Mon Sep 17 00:00:00 2001 From: mattcasey Date: Fri, 1 Nov 2024 13:41:02 -0600 Subject: [PATCH 2/3] add metadata to dropdown --- .../UserActionButton/AddBuilderModal.tsx | 12 ++++++-- .../UserActionButton/UserActionButton.tsx | 28 +++++++++++++++++-- apps/scoutgameadmin/lib/users/getUsers.ts | 1 + 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/apps/scoutgameadmin/components/users/UserActionButton/AddBuilderModal.tsx b/apps/scoutgameadmin/components/users/UserActionButton/AddBuilderModal.tsx index 27c9e4f216..2008d08390 100644 --- a/apps/scoutgameadmin/components/users/UserActionButton/AddBuilderModal.tsx +++ b/apps/scoutgameadmin/components/users/UserActionButton/AddBuilderModal.tsx @@ -22,7 +22,7 @@ import type { ScoutGameUser } from 'lib/users/getUsers'; type Props = { open: boolean; - user: Pick; + user: Pick; onClose: () => void; onAdd: () => void; }; @@ -47,7 +47,7 @@ export function AddBuilderModal({ user, open, onClose, onAdd }: Props) { }; const didApply = user?.builderStatus === 'applied'; - const action = didApply ? 'Approve' : 'Add'; + const action = didApply ? 'Review' : 'Register'; const requireGithubLogin = !user.githubLogin; const githubLoginDisplayed = githubLogin || user.githubLogin; @@ -81,6 +81,14 @@ export function AddBuilderModal({ user, open, onClose, onAdd }: Props) { )} + {user.farcasterName && ( + + Farcaster profile + + https://warpcast.com/{githubLoginDisplayed} + + + )} {createBuilderError && ( diff --git a/apps/scoutgameadmin/components/users/UserActionButton/UserActionButton.tsx b/apps/scoutgameadmin/components/users/UserActionButton/UserActionButton.tsx index 24a64bde2b..1535d0d8c3 100644 --- a/apps/scoutgameadmin/components/users/UserActionButton/UserActionButton.tsx +++ b/apps/scoutgameadmin/components/users/UserActionButton/UserActionButton.tsx @@ -1,5 +1,6 @@ import { MoreHoriz as MoreHorizIcon } from '@mui/icons-material'; -import { Menu, MenuItem, IconButton } from '@mui/material'; +import type { TypographyProps } from '@mui/material'; +import { Menu, ListItem, Divider, Typography, MenuItem, IconButton } from '@mui/material'; import { useState } from 'react'; import type { ScoutGameUser } from 'lib/users/getUsers'; @@ -37,9 +38,20 @@ export function UserActionButton({ user }: { user: ScoutGameUser }) { {(user.builderStatus === 'applied' || user.builderStatus === 'rejected') && ( setIsBuilderModalOpen(true)}>Review builder profile )} - {!user.builderStatus && setIsBuilderModalOpen(true)}>Add builder profile} + {!user.builderStatus && ( + setIsBuilderModalOpen(true)}>Register builder profile + )} setIsTransactionsModalOpen(true)}>View NFT transactions - Id: {user.id} + + + Scout Id: {user.id} + + + Fid: {user.farcasterId || '--'} + + + Github: {user.githubLogin || '--'} + ); } + +function MenuItemNoAction({ children, ...props }: { children: React.ReactNode } & TypographyProps) { + return ( + e.stopPropagation()}> + + {children} + + + ); +} diff --git a/apps/scoutgameadmin/lib/users/getUsers.ts b/apps/scoutgameadmin/lib/users/getUsers.ts index fc9beb51b8..62771e8765 100644 --- a/apps/scoutgameadmin/lib/users/getUsers.ts +++ b/apps/scoutgameadmin/lib/users/getUsers.ts @@ -13,6 +13,7 @@ export type ScoutGameUser = Pick< | 'farcasterName' | 'currentBalance' | 'email' + | 'farcasterId' > & { githubLogin: string | null; nftsPurchased: number }; export type UserFilter = 'only-builders'; From 2baad6e2788a01534ea734a16e20b96c042c0e0d Mon Sep 17 00:00:00 2001 From: mattcasey Date: Fri, 1 Nov 2024 13:42:58 -0600 Subject: [PATCH 3/3] . --- .../users/UserActionButton/UserActionButton.tsx | 3 +++ apps/scoutgameadmin/lib/users/getUsers.ts | 12 +++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/apps/scoutgameadmin/components/users/UserActionButton/UserActionButton.tsx b/apps/scoutgameadmin/components/users/UserActionButton/UserActionButton.tsx index 1535d0d8c3..31262e6947 100644 --- a/apps/scoutgameadmin/components/users/UserActionButton/UserActionButton.tsx +++ b/apps/scoutgameadmin/components/users/UserActionButton/UserActionButton.tsx @@ -52,6 +52,9 @@ export function UserActionButton({ user }: { user: ScoutGameUser }) { Github: {user.githubLogin || '--'} + + Wallets: {user.wallets.join(', ')} + & { githubLogin: string | null; nftsPurchased: number }; +> & { githubLogin: string | null; nftsPurchased: number; wallets: string[] }; export type UserFilter = 'only-builders'; @@ -70,13 +70,15 @@ export async function getUsers({ : undefined, include: { githubUser: true, - userSeasonStats: true + userSeasonStats: true, + scoutWallet: true } }); - return users.map((user) => ({ + return users.map(({ githubUser, userSeasonStats, scoutWallet, ...user }) => ({ ...user, - githubLogin: user.githubUser[0]?.login || null, - nftsPurchased: user.userSeasonStats.find(({ season }) => season === '2024-W41')?.nftsPurchased || 0 + githubLogin: githubUser[0]?.login || null, + nftsPurchased: userSeasonStats.find(({ season }) => season === '2024-W41')?.nftsPurchased || 0, + wallets: scoutWallet.map((wallet) => wallet.address) })); }