Fix admin roles dropdown, rewrite MOPC-specific expertise tags

- Refactor role selector to use computed availableRoles array instead of
  conditional JSX fragments, fixing Radix Select not re-rendering admin
  options when async user data loads
- Rewrite 38 generic expertise tags to 44 MOPC-specific tags across 8
  categories aligned with OceanIssue enum: Pollution & Waste, Climate &
  Carbon, Seafood & Aquaculture, Biodiversity & Habitat, Ocean Technology,
  Shipping & Ports, Community & Education, Business & Investment

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Matt
2026-02-14 13:25:41 +01:00
parent 2a374195c4
commit 0afd4d97c6
2 changed files with 63 additions and 63 deletions

View File

@@ -279,6 +279,16 @@ export default function MemberInvitePage() {
const isSuperAdmin = currentUser?.role === 'SUPER_ADMIN'
const isAdmin = isSuperAdmin || currentUser?.role === 'PROGRAM_ADMIN'
// Compute available roles as a stable list — avoids Radix Select
// not re-rendering conditional children when async data loads
const availableRoles = useMemo((): Role[] => {
const roles: Role[] = []
if (isSuperAdmin) roles.push('SUPER_ADMIN')
if (isAdmin) roles.push('PROGRAM_ADMIN', 'AWARD_MASTER')
roles.push('JURY_MEMBER', 'MENTOR', 'OBSERVER')
return roles
}, [isSuperAdmin, isAdmin])
const bulkCreate = trpc.user.bulkCreate.useMutation({
onSuccess: () => {
// Invalidate user list to refresh the members table when navigating back
@@ -657,26 +667,11 @@ export default function MemberInvitePage() {
<SelectValue />
</SelectTrigger>
<SelectContent>
{isSuperAdmin && (
<SelectItem value="SUPER_ADMIN">
Super Admin
{availableRoles.map((role) => (
<SelectItem key={role} value={role}>
{ROLE_LABELS[role]}
</SelectItem>
)}
{isAdmin && (
<SelectItem value="PROGRAM_ADMIN">
Program Admin
</SelectItem>
)}
{isAdmin && (
<SelectItem value="AWARD_MASTER">
Award Master
</SelectItem>
)}
<SelectItem value="JURY_MEMBER">
Jury Member
</SelectItem>
<SelectItem value="MENTOR">Mentor</SelectItem>
<SelectItem value="OBSERVER">Observer</SelectItem>
))}
</SelectContent>
</Select>
</div>