Skip to content

square up providers page - #49

Merged
AnilKumar3494 merged 1 commit into
claude/gifted-noether-7wb82hfrom
fix/providers-url-and-counts
Sep 8, 2026
Merged

AnilKumar3494 merged 1 commit into
claude/gifted-noether-7wb82hfrom
fix/providers-url-and-counts

Conversation

@AnilKumar3494

Copy link
Copy Markdown
Member

Problem

Follow-up to #40,

  • Optional URL fields refused to submit. Both URL fields are type="url", which rejects any value without a scheme. Typing example.org/logo.svg made the browser silently refuse to submit.
  • Resource counts truncate silently. getResourceCounts selected every resource_providers row and tallied them in JS. PostgREST caps a response at max-rows (1000 by default) and returns the first page without an error, so the tally under-reports once the join table outgrows the cap.
  • The delete id guard doesn't guard. Number.isInteger(Number(formData.get("id"))) passes for a missing field, because Number(null) and Number("") are both 0
  • One bad row crashed the whole table. new URL(provider.website_url).hostname was unguarded, so any stored value that isn't an absolute URL throws during render and takes down the entire list.

Also,
Two Migrations were applied manually in Supabase

@AnilKumar3494
AnilKumar3494 merged commit 8bf7a17 into claude/gifted-noether-7wb82h Sep 8, 2026
1 check passed
AnilKumar3494 added a commit that referenced this pull request Sep 8, 2026
* Add providers management page

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

* Render provider logos uncropped

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

* Add providers page screenshots for PR reference

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DQCnNexihkvzxUYee3NUa1

* square up providers page (#49)

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Anil Kumar Karapa <90452951+AnilKumar3494@users.noreply.github.com>
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.

1 participant