diff --git a/src/app/admin/funds/AdminFundApplications.tsx b/src/app/admin/funds/AdminFundApplications.tsx index 3ba8947..1a290cd 100644 --- a/src/app/admin/funds/AdminFundApplications.tsx +++ b/src/app/admin/funds/AdminFundApplications.tsx @@ -8,6 +8,7 @@ interface Applicant { id: string username: string displayUsername: string | null + managedFunds: { fund: { name: string; slug: string } }[] } interface Application { @@ -23,7 +24,7 @@ export default function AdminFundApplications({ applications: initial }: { appli const [applications, setApplications] = useState(initial) const [expanded, setExpanded] = useState(null) const [approveId, setApproveId] = useState(null) - const [startingBalance, setStartingBalance] = useState('0') + const [startingBalance, setStartingBalance] = useState('10000') const [error, setError] = useState('') const [loading, setLoading] = useState(false) @@ -122,6 +123,25 @@ export default function AdminFundApplications({ applications: initial }: { appli

Approve {app.fundName} for{' '} {app.user.displayUsername ?? app.user.username} + {app.user.managedFunds.length > 0 && ( + + {' '}(also manages{' '} + {app.user.managedFunds.map((m, i) => ( + + {i > 0 && ', '} + + {m.fund.name} + + + ))} + ) + + )}

diff --git a/src/app/admin/funds/page.tsx b/src/app/admin/funds/page.tsx index 8646da7..5bf4073 100644 --- a/src/app/admin/funds/page.tsx +++ b/src/app/admin/funds/page.tsx @@ -18,7 +18,16 @@ export default async function AdminFundsPage() { }), prisma.fundApplication.findMany({ orderBy: { createdAt: 'asc' }, - include: { user: { select: { id: true, username: true, displayUsername: true } } }, + include: { + user: { + select: { + id: true, + username: true, + displayUsername: true, + managedFunds: { select: { fund: { select: { name: true, slug: true } } } }, + }, + }, + }, }), ]) diff --git a/src/app/fund/apply/FundApplicationClient.tsx b/src/app/fund/apply/FundApplicationClient.tsx index 75ab8d3..bb2e287 100644 --- a/src/app/fund/apply/FundApplicationClient.tsx +++ b/src/app/fund/apply/FundApplicationClient.tsx @@ -18,25 +18,6 @@ export default function FundApplicationClient({ existing, managedFund }: Props) const [loading, setLoading] = useState(false) const [withdrawing, setWithdrawing] = useState(false) - // Already a fund manager - if (managedFund) { - return ( -
-
- -

You already manage a fund

-
-

- You are a manager of{' '} - - {managedFund.name} - - . -

-
- ) - } - // Pending application if (existing) { async function withdraw() { @@ -47,31 +28,45 @@ export default function FundApplicationClient({ existing, managedFund }: Props) } return ( -
-
- -

Application pending review

-
-
-
- Fund Name -

{existing.fundName}

+
+ {managedFund && ( +
+ +

+ You already manage{' '} + + {managedFund.name} + + . You can still apply for an additional fund. +

-
- Reason -

{existing.reason}

+ )} +
+
+ +

Application pending review

-

- Submitted {new Date(existing.createdAt).toLocaleDateString()} -

+
+
+ Fund Name +

{existing.fundName}

+
+
+ Reason +

{existing.reason}

+
+

+ Submitted {new Date(existing.createdAt).toLocaleDateString()} +

+
+
-
) } @@ -94,54 +89,68 @@ export default function FundApplicationClient({ existing, managedFund }: Props) } return ( -
-
- - New Fund Application -
- - {error && ( -

{error}

+
+ {managedFund && ( +
+ +

+ You already manage{' '} + + {managedFund.name} + + . You can still apply for an additional fund below. +

+
)} + +
+ + New Fund Application +
-
- - setFundName(e.target.value)} - maxLength={60} - placeholder="TechAlpha Capital" - required - className="w-full bg-surface border border-surface-border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500" - /> -
+ {error && ( +

{error}

+ )} -
- -