Comments - TS | NextJS | trpc | prisma | mySQL | zustand | NextAuth
Design comparison
Solution retrospective
Fully working comments section with CRUD functionality based on NextJS with TS.
- Ability to add, edit, delete comments, reply to comments
- Change ratings on comments that are not yours. Changed approach with rating functionality: you can rate
+1
or-1
now. - All changes go to DB, such as comments, users, and rates through Prisma and trpc on the backend
- Used Zustand for global storage
- Added NextAuth authentication with Google and GitHub providers and the information of the user also goes to DB.
Very interesting project, with many new tools, which took a lot of time exploring documentation and examples. This was my first experience working with the database. And I've learned so many things.
Question:
- When trpc SSR is true, can't get user and that broke render flow. Should I get user in getServerSideProps?
Community feedback
- @Dr-Wrong-MoPosted over 2 years ago
I'm not seeing any interaction with the voting components. I can't vote up or down on anything.
I also don't get any mouse interaction with the voting buttons. The cursor doesn't change when I hover and the color of the icons don't change. I think you may have imported the icons as images. You may look into embedding the svg data in your html so you can use CSS to alter the path and fill. If you look at my version of this project, you should be able to find how I did that.
I see you used MySQL for your database and that you did hide your database credentials in your environment variables. Great work!
0@maximkatutPosted over 2 years ago@Dr-Wrong-Mo Hey Jon! You don't see any interaction with the voting components because the logic was that you can't vote twice and somebody before you already voted(and info about the vote goes to DB). And also you can not vote on comments that you posted, that's why all buttons are disabled => no hover and no changing of the cursor. I have already changed that approach, now you can vote +-1!
About the "embedding the svg data in your html". It's one of many ways to do that.
Thanks very much for your response! You can find my other projects on my portfolio page, feel free to check them out and comment them as well!
0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord