Skip to content

Commit

Permalink
Support multiple tshirts products (#4273)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoacierno authored Dec 23, 2024
1 parent c28960a commit 2617a8c
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions frontend/src/components/products-list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const ProductsList = ({
const membership = products.filter(
(product) => product.type === TicketType.Association,
)[0];
const tshirt = products.filter((product) => product.category === "Gadget")[0];
const tshirts = products.filter((product) => product.category === "Gadget");
const socialEvents = products.filter(
(product) => product.type === TicketType.SocialEvent,
);
Expand Down Expand Up @@ -90,22 +90,27 @@ export const ProductsList = ({
</>
)}

{visibleCategories.includes(CheckoutCategory.Gadgets) && tshirt && (
<>
{showHeadings && (
<GroupHeading>
<FormattedMessage id="tickets.productsList.tshirtTitle" />
</GroupHeading>
)}
<TicketRow
key={tshirt.id}
icon="tshirt"
iconBackground="yellow"
ticket={tshirt}
/>
<Spacer size="small" />
</>
)}
{visibleCategories.includes(CheckoutCategory.Gadgets) &&
tshirts.length > 0 && (
<>
{showHeadings && (
<GroupHeading>
<FormattedMessage id="tickets.productsList.tshirtTitle" />
</GroupHeading>
)}
{tshirts.map((tshirt) => (
<Fragment key={tshirt.id}>
<TicketRow
key={tshirt.id}
icon="tshirt"
iconBackground="yellow"
ticket={tshirt}
/>
<Spacer size="small" />
</Fragment>
))}
</>
)}

{visibleCategories.includes(CheckoutCategory.SocialEvents) &&
socialEvents.length > 0 && (
Expand Down

0 comments on commit 2617a8c

Please sign in to comment.