From d84c27b73c4ca9522cd3510a0aa1228236420bac Mon Sep 17 00:00:00 2001 From: Christel Westerberg Date: Tue, 4 Jun 2024 13:37:17 +0200 Subject: [PATCH] fix: add keys on mapped components --- components/Current/Aside/Contacts/Contact.tsx | 17 ++++++++++++----- components/Current/Blocks/index.tsx | 8 ++++---- .../OverviewTable/BenefitCard/index.tsx | 5 ++++- .../OverviewTable/BenefitList/index.tsx | 3 ++- components/Loyalty/Blocks/WebView/index.tsx | 11 +++++++++-- components/Loyalty/Blocks/index.tsx | 11 +++++++++-- components/Loyalty/Sidebar/index.tsx | 10 +++++++--- components/MyPages/AccountPage/Content.tsx | 6 ++++-- .../MyPages/AccountPage/Webview/Content.tsx | 6 ++++-- 9 files changed, 55 insertions(+), 22 deletions(-) diff --git a/components/Current/Aside/Contacts/Contact.tsx b/components/Current/Aside/Contacts/Contact.tsx index f56260741..39232af72 100644 --- a/components/Current/Aside/Contacts/Contact.tsx +++ b/components/Current/Aside/Contacts/Contact.tsx @@ -12,13 +12,13 @@ export default function Contact({ sections, system: { locale } }: ContactNode) { const visitingAddressMessage = getVisitingAddressMessage(locale) return (
- {sections.map((section) => { + {sections.map((section, idx) => { switch (section.__typename) { case Section.ContactBlockSectionsExtraInfo: return

{section.extra_info.text}

case Section.ContactBlockSectionsMailingAddress: return ( -

+

{section.mailing_address.name}
{section.mailing_address.street} @@ -30,7 +30,10 @@ export default function Contact({ sections, system: { locale } }: ContactNode) { ) case Section.ContactBlockSectionsPhone: return ( -

+

{section.phone.title}

) case Section.ContactBlockSectionsTitle: - return

{section.title.text}

+ return ( +

+ {section.title.text} +

+ ) case Section.ContactBlockSectionsVisitingAddress: return ( -

+

{visitingAddressMessage}: {section.visiting_address.street}{" "}

) diff --git a/components/Current/Blocks/index.tsx b/components/Current/Blocks/index.tsx index 9f269813b..dfb21f55b 100644 --- a/components/Current/Blocks/index.tsx +++ b/components/Current/Blocks/index.tsx @@ -14,15 +14,15 @@ export default function Blocks({ blocks }: BlocksProps) { return (
- {blocks.map((block) => { + {blocks.map((block, idx) => { const type = block.__typename switch (type) { case BlocksTypenameEnum.CurrentBlocksPageBlocksList: - return + return case BlocksTypenameEnum.CurrentBlocksPageBlocksPuffs: - return + return case BlocksTypenameEnum.CurrentBlocksPageBlocksText: - return + return default: console.log(`Unknown type: (${type})`) return null diff --git a/components/Loyalty/Blocks/DynamicContent/OverviewTable/BenefitCard/index.tsx b/components/Loyalty/Blocks/DynamicContent/OverviewTable/BenefitCard/index.tsx index 0e655233d..3ba7c1f85 100644 --- a/components/Loyalty/Blocks/DynamicContent/OverviewTable/BenefitCard/index.tsx +++ b/components/Loyalty/Blocks/DynamicContent/OverviewTable/BenefitCard/index.tsx @@ -37,7 +37,10 @@ export default function BenefitCard({
{comparedValues.map((benefit, idx) => ( -
+
))} diff --git a/components/Loyalty/Blocks/DynamicContent/OverviewTable/BenefitList/index.tsx b/components/Loyalty/Blocks/DynamicContent/OverviewTable/BenefitList/index.tsx index d5f6a6a22..6e3fb3c86 100644 --- a/components/Loyalty/Blocks/DynamicContent/OverviewTable/BenefitList/index.tsx +++ b/components/Loyalty/Blocks/DynamicContent/OverviewTable/BenefitList/index.tsx @@ -29,8 +29,9 @@ export default function BenefitList({ levels }: BenefitListProps) { { + comparedValues={levelBenefits.map((benefit, idx) => { return { + key: `${benefit.name}-${idx}`, value: benefit.value, unlocked: benefit.unlocked, valueDetails: benefit.valueDetails, diff --git a/components/Loyalty/Blocks/WebView/index.tsx b/components/Loyalty/Blocks/WebView/index.tsx index 354b04078..85a881142 100644 --- a/components/Loyalty/Blocks/WebView/index.tsx +++ b/components/Loyalty/Blocks/WebView/index.tsx @@ -14,10 +14,15 @@ export function Blocks({ lang, blocks }: BlocksProps & LangParams) { const firstItem = idx === 0 switch (block.__typename) { case LoyaltyBlocksTypenameEnum.LoyaltyPageBlocksCardsGrid: - return + return ( + + ) case LoyaltyBlocksTypenameEnum.LoyaltyPageBlocksContent: return ( -
+
) case LoyaltyBlocksTypenameEnum.LoyaltyPageBlocksShortcuts: @@ -49,6 +55,7 @@ export function Blocks({ lang, blocks }: BlocksProps & LangParams) { return ( +
) case LoyaltyBlocksTypenameEnum.LoyaltyPageBlocksShortcuts: return ( ) case LoyaltyBlocksTypenameEnum.LoyaltyPageBlocksCardsGrid: - return + return ( + + ) default: return null } diff --git a/components/Loyalty/Sidebar/index.tsx b/components/Loyalty/Sidebar/index.tsx index 6ffc56b34..2cc4d4c23 100644 --- a/components/Loyalty/Sidebar/index.tsx +++ b/components/Loyalty/Sidebar/index.tsx @@ -9,12 +9,15 @@ import { SidebarProps } from "@/types/components/loyalty/sidebar" export default function SidebarLoyalty({ blocks, lang }: SidebarProps) { return ( -