VaibhavArora314 / StyleShare

A simple web based platform where users can easily create, explore, and share Tailwind CSS components and designs with fellow users.
https://style-share.vercel.app
MIT License
33 stars 54 forks source link

feat: Added category tags posts pages and filtered with tags successfully Issue 270 #286

Closed MeetDOD closed 2 days ago

MeetDOD commented 5 days ago

Pull Request Resolves [#270 ]

Title: Added category tags posts pages and filtered with tags successfully.

Description

  1. Created Category API controller and routes to fetch all the tags.
  2. Created TagPosts.tsx in which routing is done when click on postcard tags as well as post tags, it will redirect user to /post/tag/:tag and he/she will see the post of that tag only.
  3. Changed the design of the tags and also adjust in light/dark mode.

Related Issues

Fixes #270

Changes Made

New features: Added category tags posts pages and filtered with tags.

Screenshots

image

image

image

I certify that I have carried out the relevant code of conduct and provided the requisite screenshot for validation by submitting this pull request.

Thank You for this contribution.

vercel[bot] commented 5 days ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
style-share ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 26, 2024 5:14pm
github-actions[bot] commented 5 days ago

Thank you for submitting your pull request! 🙌 We'll review it as soon as possible. In the meantime, please ensure that your changes align with our CONTRIBUTING.md. If there are any specific instructions or feedback regarding your PR, we'll provide them here. Thanks again for your contribution! 😊

MeetDOD commented 5 days ago

@VaibhavArora314 Thanks for solving usePosts error 😀

VaibhavArora314 commented 4 days ago

also if I am not wrong the all tags route is used for displaying tags at homepage?

MeetDOD commented 4 days ago

also if I am not wrong the all tags route is used for displaying tags at homepage?

Yes I created the backend in this pr only and in #271 i fetched it and created frontend 👍

MeetDOD commented 4 days ago

instead of creating a separate page maybe we can use query parameters to pass the initial tags list to usePost hook and we can update query parameter as we add or remove tags

So, you don't want to create the new page instead i should do it in the Postcard and posts ?

MeetDOD commented 4 days ago

But it should navigate to some end point some route to show the tag posts like some conditional route for navigation also in above code no extra api call is happening it is only navigating like not hitting any api, so can you explain your approach in details If you don't mind ?

VaibhavArora314 commented 4 days ago

so basically, I was thinking that you add a tag "test" and "nav" the route becomes something like /app/posts?tags=test,nav so that tags are separated by the comma and can be split easily. In case the user clicks on a specific card tag, we can add it at this end of the URL and update the state.

MeetDOD commented 4 days ago

@VaibhavArora314 I got your approach but it is not applying also user click multiple times the same tag it will mess the whole url also when reload it can give page not found that's why i created a fresh route, I think that you will understand it else we can do some other methods 🙂

VaibhavArora314 commented 2 days ago

@VaibhavArora314 I got your approach but it is not applying also user click multiple times the same tag it will mess the whole url also when reload it can give page not found that's why i created a fresh route, I think that you will understand it else we can do some other methods 🙂

why will it give page not found? the benefit of query parameters is that the results are the same across page reloads

MeetDOD commented 2 days ago

@VaibhavArora314 see now i did according to what you told me, with params instead of component 🙂

github-actions[bot] commented 2 days ago

🎉 Your pull request has been successfully merged! 🎉 Thank you for your valuable contribution to our project. Your efforts are greatly appreciated. Feel free to reach out if you have any more contributions or if there's anything else we can assist you with. Keep up the fantastic work! 🚀