Skip to content

Commit 2617a8c

Browse files
authored
Support multiple tshirts products (#4273)
1 parent c28960a commit 2617a8c

File tree

1 file changed

+22
-17
lines changed
  • frontend/src/components/products-list

1 file changed

+22
-17
lines changed

frontend/src/components/products-list/index.tsx

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const ProductsList = ({
4646
const membership = products.filter(
4747
(product) => product.type === TicketType.Association,
4848
)[0];
49-
const tshirt = products.filter((product) => product.category === "Gadget")[0];
49+
const tshirts = products.filter((product) => product.category === "Gadget");
5050
const socialEvents = products.filter(
5151
(product) => product.type === TicketType.SocialEvent,
5252
);
@@ -90,22 +90,27 @@ export const ProductsList = ({
9090
</>
9191
)}
9292

93-
{visibleCategories.includes(CheckoutCategory.Gadgets) && tshirt && (
94-
<>
95-
{showHeadings && (
96-
<GroupHeading>
97-
<FormattedMessage id="tickets.productsList.tshirtTitle" />
98-
</GroupHeading>
99-
)}
100-
<TicketRow
101-
key={tshirt.id}
102-
icon="tshirt"
103-
iconBackground="yellow"
104-
ticket={tshirt}
105-
/>
106-
<Spacer size="small" />
107-
</>
108-
)}
93+
{visibleCategories.includes(CheckoutCategory.Gadgets) &&
94+
tshirts.length > 0 && (
95+
<>
96+
{showHeadings && (
97+
<GroupHeading>
98+
<FormattedMessage id="tickets.productsList.tshirtTitle" />
99+
</GroupHeading>
100+
)}
101+
{tshirts.map((tshirt) => (
102+
<Fragment key={tshirt.id}>
103+
<TicketRow
104+
key={tshirt.id}
105+
icon="tshirt"
106+
iconBackground="yellow"
107+
ticket={tshirt}
108+
/>
109+
<Spacer size="small" />
110+
</Fragment>
111+
))}
112+
</>
113+
)}
109114

110115
{visibleCategories.includes(CheckoutCategory.SocialEvents) &&
111116
socialEvents.length > 0 && (

0 commit comments

Comments
 (0)