feat: enhance fund application process by displaying managed funds for applicants
Build Images and Deploy / Update-PROD-Stack (push) Successful in 1m21s
Build Images and Deploy / Update-PROD-Stack (push) Successful in 1m21s
This commit is contained in:
@@ -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<Application[]>(initial)
|
||||
const [expanded, setExpanded] = useState<string | null>(null)
|
||||
const [approveId, setApproveId] = useState<string | null>(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
|
||||
<p className="text-xs text-slate-400">
|
||||
Approve <span className="text-white font-medium">{app.fundName}</span> for{' '}
|
||||
<span className="text-slate-200">{app.user.displayUsername ?? app.user.username}</span>
|
||||
{app.user.managedFunds.length > 0 && (
|
||||
<span className="text-slate-500">
|
||||
{' '}(also manages{' '}
|
||||
{app.user.managedFunds.map((m, i) => (
|
||||
<span key={m.fund.slug}>
|
||||
{i > 0 && ', '}
|
||||
<a
|
||||
href={`/fund/${m.fund.slug}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-indigo-400 hover:text-indigo-300 underline underline-offset-2"
|
||||
>
|
||||
{m.fund.name}
|
||||
</a>
|
||||
</span>
|
||||
))}
|
||||
)
|
||||
</span>
|
||||
)}
|
||||
</p>
|
||||
<div className="flex items-center gap-3">
|
||||
<div>
|
||||
|
||||
@@ -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 } } } },
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
])
|
||||
|
||||
|
||||
@@ -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 (
|
||||
<div className="bg-surface-card border border-surface-border rounded-xl p-6 space-y-3">
|
||||
<div className="flex items-center gap-3">
|
||||
<CheckCircle className="h-5 w-5 text-green-400" />
|
||||
<p className="font-medium">You already manage a fund</p>
|
||||
</div>
|
||||
<p className="text-sm text-slate-400">
|
||||
You are a manager of{' '}
|
||||
<Link href={`/fund/${managedFund.slug}`} className="text-indigo-400 hover:text-indigo-300 underline underline-offset-2">
|
||||
{managedFund.name}
|
||||
</Link>
|
||||
.
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
// Pending application
|
||||
if (existing) {
|
||||
async function withdraw() {
|
||||
@@ -47,6 +28,19 @@ export default function FundApplicationClient({ existing, managedFund }: Props)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
{managedFund && (
|
||||
<div className="bg-surface-card border border-surface-border rounded-xl p-4 flex items-start gap-3">
|
||||
<CheckCircle className="h-4 w-4 text-green-400 mt-0.5 shrink-0" />
|
||||
<p className="text-sm text-slate-400">
|
||||
You already manage{' '}
|
||||
<Link href={`/fund/${managedFund.slug}`} className="text-indigo-400 hover:text-indigo-300 underline underline-offset-2">
|
||||
{managedFund.name}
|
||||
</Link>
|
||||
. You can still apply for an additional fund.
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
<div className="bg-surface-card border border-indigo-500/30 rounded-xl p-6 space-y-4">
|
||||
<div className="flex items-center gap-3">
|
||||
<Clock className="h-5 w-5 text-amber-400" />
|
||||
@@ -73,6 +67,7 @@ export default function FundApplicationClient({ existing, managedFund }: Props)
|
||||
{withdrawing ? 'Withdrawing…' : 'Withdraw application'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -94,6 +89,19 @@ export default function FundApplicationClient({ existing, managedFund }: Props)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
{managedFund && (
|
||||
<div className="bg-surface-card border border-surface-border rounded-xl p-4 flex items-start gap-3">
|
||||
<CheckCircle className="h-4 w-4 text-green-400 mt-0.5 shrink-0" />
|
||||
<p className="text-sm text-slate-400">
|
||||
You already manage{' '}
|
||||
<Link href={`/fund/${managedFund.slug}`} className="text-indigo-400 hover:text-indigo-300 underline underline-offset-2">
|
||||
{managedFund.name}
|
||||
</Link>
|
||||
. You can still apply for an additional fund below.
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
<form onSubmit={handleSubmit} className="bg-surface-card border border-surface-border rounded-xl p-6 space-y-4">
|
||||
<div className="flex items-center gap-2 text-slate-300">
|
||||
<Building2 className="h-5 w-5 text-indigo-400" />
|
||||
@@ -143,5 +151,6 @@ export default function FundApplicationClient({ existing, managedFund }: Props)
|
||||
{loading ? 'Submitting…' : 'Submit Application'}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user