Skip to content

Asaf Axelrod ShowCard integration (useState exercise)#6

Open
AxelrodAsaf wants to merge 1 commit intoColmanDevClubORG:mainfrom
AxelrodAsaf:feature/showcard
Open

Asaf Axelrod ShowCard integration (useState exercise)#6
AxelrodAsaf wants to merge 1 commit intoColmanDevClubORG:mainfrom
AxelrodAsaf:feature/showcard

Conversation

@AxelrodAsaf
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown
Member

@Tamir198 Tamir198 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left you some comments

// true → "This show is in your interested list 🎟️"
if (props.ticketsLeft === 0) {
ticketsStatusText = "SOLD OUT";
} else if (props.ticketsLeft <= 30) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we have number hardcoded inside the code like this ("magic number") its very confusing to the next developer.
So save all of you numbers inside constant variables

if (props.ticketsLeft === 0) {
ticketsStatusText = "SOLD OUT";
} else if (props.ticketsLeft <= 30) {
ticketsStatusText = "Last tickets – hurry up!";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use ternary in here, also save your hardcoded strings into constant file

{/* TODO 7: If isInterested → show ⭐ before artist name */}
"Artist name here"
{isInterested ? "⭐ " : ""}
{props.artist}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can destruct props

Comment thread src/App.tsx
<div className="shows-grid">
{/* TODO - shows.map((show)=>{ return <ShowCard id={show.id} .../> })*/}
{shows.map((show) => {
return <ShowCard key={show.id} {...show} />;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants