Skip to content
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

Open
wants to merge 43 commits into
base: main
Choose a base branch
from

Conversation

hopeolaide
Copy link

No description provided.

Copy link

@kelsey-steven-ada kelsey-steven-ada left a 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) => {

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!

Comment on lines +46 to +76
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;
}

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

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.

4 participants