-
Notifications
You must be signed in to change notification settings - Fork 249
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
added the searchbar, filters, and sort by dropdown box #215
base: develop
Are you sure you want to change the base?
Conversation
…zed them correctly
…anything but removes the tools when filtering
…it makes a star off to the side for some reason
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.
Hey @0Jsnipes, left some comments down below. Please take a look when you get a chance and ask any questions that you may have.
Also would be great if you could provide a short video of you going through the features.
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.
Please remove 'React' from the import statement. Latest React versions no longer require this
const [currentTab, setCurrentTab] = useState('All'); | ||
const [searchQuery, setSearchQuery] = useState(''); | ||
const [sortOption, setSortOption] = useState('Most Popular'); | ||
const [favorites, setFavorites] = useState([]); // State to track favorite tool IDs |
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.
Lets also remove these unnecessary comments
const handleToggleFavorite = (id) => { | ||
setFavorites((prevFavorites) => | ||
prevFavorites.includes(id) | ||
? prevFavorites.filter((favId) => favId !== id) // Remove if already in favorites |
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.
Remove these comments
// Filters and Search | ||
const renderFilters = () => ( | ||
<Grid container direction="column" spacing={2}> | ||
<Grid |
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.
Some of these components should have their styling attributes abstracted over onto the styles.js page. Lets emphasize seperation of concerns and follow what other files are doing as well.
key={tab} | ||
/> | ||
))} | ||
// Filters and Search |
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.
Remove this comment
const ToolCard = (props) => { | ||
const { id, maskedToolUrl, backgroundImgURL, name, description } = props; | ||
|
||
const ToolCard = ({ id, name, description, maskedToolUrl, backgroundImgURL, favorites = [], handleToggleFavorite }) => { |
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.
move new and existing props into its own line for better readability. Have the argument of this component as 'props' as before, but underneath, have a line of code that follows:
const ToolCard = (props) => {
const { id, name, description, etc...} = props
</Typography> | ||
<IconButton | ||
onClick={(e) => { | ||
e.stopPropagation(); // Prevent the click from propagating to the card |
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.
remove this comment
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.
Let's ensure we keep spelling in check as well. Rename this to RecommendedForYou.jsx, as well as the folder.
); | ||
}; | ||
|
||
ReccomendedForYou.propTypes = { |
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.
This is not necessary. It would be better to use JSDocs for this case.
</Grid> | ||
); | ||
}; | ||
const ToolsListingContainer = ({ |
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.
Rework all the props to be destructured into its own variable called props, similar to how it was before, but with the new props you've added as well.
updated userSlice.js for adding pending, fulfilled and rejected slices for the updateUserFavorite function. updated user.js by adding updateUserFavorite Async function writing to firestore. updated HomePage.jsx to dispatch updateUserFavorite action, and update local 'favorites' state variable, and useEffect to update current state if user-state in redux store changes.
added user favorite tools functionality
… disappear when there are none
Description
Provide a concise summary of the changes in this PR. Include the motivation behind these changes and any relevant context.
I added the search bar, filter buttons, and sort by drop-down box. these were asked to be added in the #196 issue
I also added the favorites section and recommended tools section but did not implement them yet I was unsure of the functionality of the favorites and just started working with another collaborator on the issue.
Related Issue
#196
If this PR addresses an issue, link to it here.
#196
Type of Change
Please select the type(s) of change that apply and delete those that do not.
Proposed Solution
Describe your code changes in detail. Explain how you implemented your solution and any design decisions you made.
How to Test
Provide instructions on how to test these changes. Include details on test configurations, test cases, and expected outcomes.
Unit Tests
List the unit tests added or modified to verify your changes.
added 3 tests to ensure the functionality of the features
filter.test.jsx
searchbar.test.jsx
sortdropdown.jsx
Documentation Updates
Indicate whether documentation needs to be updated due to this PR.
If yes, describe what documentation updates are needed and link to the relevant documentation.
Checklist
Additional Information
Add any other information that might be useful for the reviewers.
![Screenshot 2025-01-03 173227](https://private-user-images.githubusercontent.com/153330843/400087405-f869b1cd-b9b2-479d-a929-69fa42c482ff.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0MTIxMTcsIm5iZiI6MTczOTQxMTgxNywicGF0aCI6Ii8xNTMzMzA4NDMvNDAwMDg3NDA1LWY4NjliMWNkLWI5YjItNDc5ZC1hOTI5LTY5ZmE0MmM0ODJmZi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxM1QwMTU2NTdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0zNDljZWFkMmM1MmYzZTIyMTM3YWQ2MzExN2E5MDMyOGE1ZjUxNGNmMmRkMjgyNzBkNmIyNzEwMDE5MTlmNTE5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.QjaDD7bsZHHopAb-9bFILIm166SvqPKucun2PCO7LdU)