Skip to content

Add providers management page - #40

Open
vontell wants to merge 3 commits into
mainfrom
claude/gifted-noether-7wb82h
Open

Add providers management page#40
vontell wants to merge 3 commits into
mainfrom
claude/gifted-noether-7wb82h

Conversation

@vontell

@vontell vontell commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Problem

The map credits organizations beneath a resource via ProvidedBy, which reads the providers table — but there's no way to manage that list. Adding, editing, or removing a provider means editing rows directly in Supabase. Production has just 2 provider rows today, one a leftover "Test Provider" with no logo.

Solution

Adds a /providers page to the admin dashboard:

  • List — logo, name, website, and a count of how many resources each provider is attributed to
  • Add / Edit — name (required), website URL, logo URL
  • Remove — with a warning when the provider is still attributed to resources

Files:

  • app/types/Provider.tsProvider / ProviderInput types
  • app/api/providers/methods.ts — CRUD client + per-provider resource counts
  • app/routes/authenticated/providers/index.tsx — page, dialogs, and action
  • Sidebar nav entry + route wiring

Also included: an RLS migration

providers has RLS enabled with no write policy, so inserts fail with 42501: new row violates row-level security policy — even for a signed-in user. supabase/migrations/20260722010000_providers_rls.sql grants insert/update/delete to authenticated and keeps reads public, since phlask-map fetches providers with the anon key.

This migration must be applied for the page's save actions to work.

Screenshots

Providers list, with live production data:

Providers list

Add provider dialog:

Add provider dialog

Reference

Closes #39.

Checklist

  • Changes have been tested locally
  • Changes have been self-reviewed

Testing notes

pnpm run typecheck and biome check both pass. The pages above were captured running against the live Supabase project.

Two honest caveats:

  • Screenshots were taken with the auth middleware temporarily bypassed locally (signups are disabled on the project, so I had no account to sign in with). That bypass was reverted and is not part of this diff — only the real authMiddleware is committed.
  • Because the RLS policy isn't applied yet, a successful create/update/delete has not been exercised end to end. The read path, dialogs, validation, and error handling are verified; the write path needs the migration applied plus a manual pass by someone with an account.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DQCnNexihkvzxUYee3NUa1


Generated by Claude Code

claude added 3 commits July 27, 2026 21:07
Adds a /providers page so maintainers can add, edit, and remove the
organizations credited as "Provided by" on the map. Previously the providers
list could only be changed directly in Supabase.

- app/types/Provider.ts: Provider + ProviderInput types
- app/api/providers/methods.ts: CRUD client, plus per-provider resource counts
  so the UI can warn before removing one that is still attributed
- app/routes/authenticated/providers/index.tsx: list with add/edit dialogs and
  a delete confirmation
- Sidebar nav entry + route wiring

Also adds an RLS migration: providers had RLS enabled with no write policy, so
inserts failed with 42501 even for signed-in users. Adds insert/update/delete
for `authenticated` while keeping reads public (phlask-map's ProvidedBy
component reads providers with the anon key).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DQCnNexihkvzxUYee3NUa1
Provider logos are wide wordmarks (Share Food Program's is 702x242), but they
were rendered in a square 40x40 Avatar, which crops to fill — only "Sh" was
visible. Scale to fit instead (height-constrained, object-fit: contain), and
fall back to the initial when a logo is missing or fails to load, matching the
map's ProvidedBy behaviour.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DQCnNexihkvzxUYee3NUa1
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DQCnNexihkvzxUYee3NUa1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Manage resource providers from the admin dashboard

2 participants