Skip to content

feat: add ProvidedBy component for resource attribution#692

Open
icycoldveins wants to merge 6 commits intodevelopfrom
feature/provided-by
Open

feat: add ProvidedBy component for resource attribution#692
icycoldveins wants to merge 6 commits intodevelopfrom
feature/provided-by

Conversation

@icycoldveins
Copy link
Collaborator

@icycoldveins icycoldveins commented Jan 21, 2026

Summary

Adds "Provided By" feature to display organization attribution when viewing a resource.

  • Display provider logo and/or name below "Last Modified" section
  • Support multiple providers with "+X more" overflow and popover
  • Logo mapping utility for local assets by provider name
  • Avatar fallback (first letter) when no logo available

Screenshot

providedby_ui

Changes

  • src/types/ResourceEntry.ts - Added Provider type
  • src/components/ProvidedBy/ProvidedBy.tsx - New component with extracted ProviderAvatar and ProviderLink subcomponents
  • src/utils/providerLogos.ts - Logo mapping utility
  • src/assets/logos/share-food-program.png - Share Food Program logo
  • src/components/SelectedResourceDetails/SelectedResourceDetails.tsx - Integration

Refactoring

  • Extracted ProviderAvatar component to handle logo/fallback avatar rendering
  • Extracted ProviderLink component for conditional URL wrapping
  • Removed redundant helper functions and inlined simple handlers
  • Reduced component from 232 to 192 lines

Closes #691

Co-authored-by: Claude claude@anthropic.com

Add Provider type to ResourceEntry and create ProvidedBy component
that displays organization attribution with logo/name support.
Supports multiple providers with "+X more" overflow handling.
- Add Share Food Program logo as local asset for testing
- Implement image fallback to Avatar when logo fails to load
- Increase logo size to 40x40 for better visibility
- Position ProvidedBy below Last Modified section
Logo resolution now checks both provider.logo_url and a local mapping
by provider name. This allows storing logos as local assets while
keeping provider data simple (just name and url).
Component now only displays when resource.providers has actual data.
@icycoldveins icycoldveins marked this pull request as ready for review January 21, 2026 01:10
@marcbachan
Copy link

@vontell FYI on the discussion above:

  • We need to add a provider column (or table, given that we need to support multiple providers per resource where needed) for resources
  • We also need to either store the image for the provider logo in the database, or a URL to the publicly available resource

return (
<ListItem key={`${provider.name}-${index}`}>
<ListItemAvatar sx={{ minWidth: 48 }}>
{shouldShowImage(logoUrl) ? (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: The usage of box wrapping an img element is a bit non-standard, but it might make more sense as an implementation detail for an ImageWithInitialsAvatarFallback component

<Stack gap={1}>
{visibleProviders.map((provider, index) => (
<div key={`${provider.name}-${index}`}>
{renderProviderItem(provider)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

once this is a separate component, call this as a JSX element instead of a function

Reviewers flagged that provider logos should come from the database, not
static assets. This removes the hardcoded logo file and providerLogos
utility. Also extracts ProviderItem and ProviderLogo as separate
components, uses optional Provider[] prop with default, and replaces
deprecated primaryTypographyProps with slotProps.primary.
MUI codemod flagged TextField's inputProps as deprecated. Migrating to
slotProps.htmlInput aligns with the current MUI API.
</Typography>
</Stack>
) : null}
<ProvidedBy providers={resource.providers} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to make this work with the data structure we set up this week in Supabase, we'll look into making the following changes to this branch next week (if you're around to join the fun @icycoldveins !)

  • Update this line to reference a providers variable
  • Add a const providers variable as this component is initializing that references a new database-querying export in src/services/db.ts.
  • Add a database query that does a join across the resource and providers Tables using a many-to-many join and return a list of Provider-type objects: https://supabase.com/docs/guides/database/joins-and-nesting#many-to-many-joins

Then we can give this a test with the test datapoint we added to the beta site 🤞

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im ready sounds good! @gcardonag

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.

Display 'Provided By' organization when viewing a resource

5 participants