Add providers management page - #40
Open
vontell wants to merge 3 commits into
Open
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The map credits organizations beneath a resource via
ProvidedBy, which reads theproviderstable — 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
/providerspage to the admin dashboard:Files:
app/types/Provider.ts—Provider/ProviderInputtypesapp/api/providers/methods.ts— CRUD client + per-provider resource countsapp/routes/authenticated/providers/index.tsx— page, dialogs, and actionAlso included: an RLS migration
providershas RLS enabled with no write policy, so inserts fail with42501: new row violates row-level security policy— even for a signed-in user.supabase/migrations/20260722010000_providers_rls.sqlgrants insert/update/delete toauthenticatedand 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:
Add provider dialog:
Reference
Closes #39.
Checklist
Testing notes
pnpm run typecheckandbiome checkboth pass. The pages above were captured running against the live Supabase project.Two honest caveats:
authMiddlewareis committed.🤖 Generated with Claude Code
https://claude.ai/code/session_01DQCnNexihkvzxUYee3NUa1
Generated by Claude Code