-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ssh inspiration board - Shelby, Shayla, and Hope #35
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Shayla L <[email protected]> Co-authored-by: Hope Olaidé <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last 🎉 Project 🎊 DONE!!! 🥳
Great work y'all! Feedback is going to be very light on this project, but I've left a couple suggestions on things you may want to take forward 😊.
|
||
const kBaseUrl = "https://ssh-back-end-inspiration-board.herokuapp.com"; | ||
|
||
const boardApiToJson = (board) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice function to convert the network response!
if (sortType === "idDown") { | ||
const idDescending = unsortedCardDataCopy.sort( | ||
(a, b) => b.cardId - a.cardId | ||
); | ||
return idDescending; | ||
} else if (sortType === "idUp") { | ||
const idAscending = unsortedCardDataCopy.sort( | ||
(a, b) => a.cardId - b.cardId | ||
); | ||
return idAscending; | ||
} else if (sortType === "messageDown") { | ||
const msgDescending = unsortedCardDataCopy.sort((a, b) => | ||
a.message > b.message ? -1 : 1 | ||
); | ||
return msgDescending; | ||
} else if (sortType === "messageUp") { | ||
const msgAscending = unsortedCardDataCopy.sort((a, b) => | ||
a.message > b.message ? 1 : -1 | ||
); | ||
return msgAscending; | ||
} else if (sortType === "plusOneDown") { | ||
const likesDescending = unsortedCardDataCopy.sort( | ||
(a, b) => b.likesCount - a.likesCount | ||
); | ||
return likesDescending; | ||
} else if (sortType === "plusOneUp") { | ||
const likesAscending = unsortedCardDataCopy.sort( | ||
(a, b) => a.likesCount - b.likesCount | ||
); | ||
return likesAscending; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you have long if/else trees whose conditions are looking to match something particular, a switch
statement can be a good replacement: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch
No description provided.