Skip to content

Replace NEXT_PUBLIC_MOCK_MAINTAINER env flag with useUserRole hook #274

Description

@Benjtalkshow

components/bounty/bounty-sidebar.tsx:32 gates maintainer-only UI on the NEXT_PUBLIC_MOCK_MAINTAINER env var:

const IS_MAINTAINER = process.env.NEXT_PUBLIC_MOCK_MAINTAINER === "true";

PR #254 added a real useUserRole() hook at hooks/use-user-role.ts that returns "sponsor" | "contributor" | undefined from the session. The env var bypasses this entirely, and the console.warn block at lines 36-43 even acknowledges the env var is a dev shim that should not be enabled in production.

What to do

  • Remove the IS_MAINTAINER env-based constant and the console.warn block
  • Import useUserRole from @/hooks/use-user-role
  • Replace IS_MAINTAINER references with the role check that matches the maintainer-gated UI (likely role === "sponsor" based on the PR Add sponsor role feature - gate Create access to sponsors #254 contract)

Acceptance criteria

  • No reference to NEXT_PUBLIC_MOCK_MAINTAINER remains in bounty-sidebar.tsx
  • The same maintainer-only UI now appears for users with the sponsor role and is hidden for contributors
  • No new env vars required
  • console.warn block removed

Files

  • components/bounty/bounty-sidebar.tsx
  • hooks/use-user-role.ts (reference)

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbugSomething isn't workingcomponentfrontendFrontend development

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions