diff --git a/src/api/calculator-types-v1.ts b/src/api/calculator-types-v1.ts index 10326fc..56ecc7a 100644 --- a/src/api/calculator-types-v1.ts +++ b/src/api/calculator-types-v1.ts @@ -89,6 +89,16 @@ export interface APIResponse { state: string | null; utility: string | null; }; + data_partners: { + [id: string]: { + name: string; + logo?: { + src: string; + width: number; + height: number; + }; + }; + }; location: APILocation; incentives: Incentive[]; } diff --git a/src/authority-logos.tsx b/src/partner-logos.tsx similarity index 68% rename from src/authority-logos.tsx rename to src/partner-logos.tsx index a6034b8..f892631 100644 --- a/src/authority-logos.tsx +++ b/src/partner-logos.tsx @@ -7,22 +7,26 @@ type Props = { response: APIResponse }; * Displays the white area at the bottom of the calculator results with logos * of the authorities whose incentives are displayed. */ -export const AuthorityLogos = ({ response }: Props) => { +export const PartnerLogos = ({ response }: Props) => { const { msg } = useTranslated(); const authoritiesWithLogo = Object.entries(response.authorities).filter( ([, auth]) => !!auth.logo, ); - if (authoritiesWithLogo.length === 0) { + const partnersWithLogo = Object.entries(response.data_partners).filter( + ([, partner]) => !!partner.logo, + ); + const allLogos = [...authoritiesWithLogo, ...partnersWithLogo]; + if (allLogos.length === 0) { return <>; } - const logos = authoritiesWithLogo.map(([id, auth]) => ( + const logos = allLogos.map(([id, partner]) => ( {auth.name} )); diff --git a/src/state-incentive-details.tsx b/src/state-incentive-details.tsx index 26add2a..d0a6df2 100644 --- a/src/state-incentive-details.tsx +++ b/src/state-incentive-details.tsx @@ -7,7 +7,6 @@ import { Incentive, ItemType, } from './api/calculator-types-v1'; -import { AuthorityLogos } from './authority-logos'; import { PrimaryButton, TextButton } from './buttons'; import { Card } from './card'; import { TextInput } from './components/text-input'; @@ -16,6 +15,7 @@ import { str } from './i18n/str'; import { MsgFn, useTranslated } from './i18n/use-translated'; import { IconTabBar } from './icon-tab-bar'; import { ExclamationPoint, UpRightArrow } from './icons'; +import { PartnerLogos } from './partner-logos'; import { PROJECTS, Project, shortLabel } from './projects'; import { Separator } from './separator'; @@ -446,7 +446,7 @@ export const StateIncentives: FC = ({ // We won't show the empty state in this seciton, so no email submission emailSubmitter={null} /> - + ); };