From 2e8c885241f47d22b2c4ef318ad2bc04b6c41514 Mon Sep 17 00:00:00 2001 From: Or Chen Date: Sun, 21 Dec 2025 08:03:04 +0200 Subject: [PATCH 1/2] finish App.tsx --- src/App.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/App.tsx b/src/App.tsx index b16f189..e2a818c 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -56,7 +56,10 @@ export default function App() {
- {/* TODO - shows.map((show)=>{ return })*/} + {shows.map((show) => { + return + })}
From 67e08939f6d2371b26d8f0b7b8047baba5c493a2 Mon Sep 17 00:00:00 2001 From: Or Chen Date: Sun, 21 Dec 2025 08:03:35 +0200 Subject: [PATCH 2/2] finish showCard.tsx --- src/components/showCard/ShowCard.tsx | 65 +++++++++++++++------------- 1 file changed, 36 insertions(+), 29 deletions(-) diff --git a/src/components/showCard/ShowCard.tsx b/src/components/showCard/ShowCard.tsx index 7e18a47..9910035 100644 --- a/src/components/showCard/ShowCard.tsx +++ b/src/components/showCard/ShowCard.tsx @@ -10,63 +10,70 @@ export interface ShowCardProps { } export default function ShowCard( - /* TODO 1: Accept props with ShowCardProps type here */ + { + artist, + stage, + day, + hour, + ticketsLeft, + image, + }: ShowCardProps ) { - // TODO 2: Create state called isInterested of type boolean (default false) - // const [isInterested, setIsInterested] = ... - // TODO 3: Function that toggles true/false in isInterested - // function handleToggleInterested() {} + const [isInterested, setIsInterested] = useState(false); - // TODO 4: Create ticketsStatusText (string): - // 0 → "SOLD OUT" - // 1–30 → "Last tickets – hurry up!" - // >30 → "Tickets available" + const handleToggleInterested = (): void => { + setIsInterested(!isInterested) + } - // TODO 5: Create text for interest status based on isInterested: - // false → "You haven't added this show yet" - // true → "This show is in your interested list 🎟️" + const ticketsStatusText = (): string => { + if (ticketsLeft == 0) { + return "SOLD OUT" + } + else if (ticketsLeft > 1 && ticketsLeft < 30) { + return "Last tickets – hurry up!" + } + else { + return "Tickets available" + } + } + + const interestText=isInterested ? "This show is in your interested list 🎟️":"You haven't added this show yet" return (
- {/* TODO 6: Replace placeholder with real from props */} - {/* {artist} */} -
Image goes here
+
+ {artist} +

- {/* TODO 7: If isInterested → show ⭐ before artist name */} - "Artist name here" + {isInterested ? "⭐" : ""} + {artist}

- {/* TODO 8: Display stage, day, hour from props */} - "Stage · Day · Hour" + {stage} · {day} · {hour}

- {/* TODO 9: Display the ticketsStatusText */} - "Tickets status text" + {ticketsStatusText()} +

- {/* TODO 10: Display the interestedText */} - "Interested status text" + {interestText}

);