From 1fe4e486ff8b09b496a652ce4ff16de5a4cfd251 Mon Sep 17 00:00:00 2001 From: meet Date: Fri, 2 Aug 2024 17:07:01 +0530 Subject: [PATCH 1/6] Added download report feature in Users, Posts and Contact Messages --- admin/src/pages/ContactMessages.tsx | 29 ++++ admin/src/pages/Posts.tsx | 29 ++++ admin/src/pages/Users.tsx | 29 ++++ backend/src/routes/admin/controller.ts | 184 +++++++++++++++++++++++++ backend/src/routes/admin/route.ts | 8 +- 5 files changed, 278 insertions(+), 1 deletion(-) diff --git a/admin/src/pages/ContactMessages.tsx b/admin/src/pages/ContactMessages.tsx index 66fbf306..9c746629 100644 --- a/admin/src/pages/ContactMessages.tsx +++ b/admin/src/pages/ContactMessages.tsx @@ -8,6 +8,7 @@ import 'react-responsive-modal/styles.css'; import '../styles/Model.css' import { ColorRing } from 'react-loader-spinner'; import { MdMessage } from "react-icons/md"; +import { TbReportAnalytics } from "react-icons/tb"; const ContactMessages = () => { const [contactMessages, setContactMessages] = useState([]); @@ -37,6 +38,27 @@ const ContactMessages = () => { fetchMessages(); }, [token]); + const downloadContactMessagesReport = async () => { + try { + const response = await axios.get('/api/v1/admin/downloadcontactmessagereport', { + headers: { + Authorization: `Bearer ${token}`, + }, + responseType: 'blob', + }); + + const url = window.URL.createObjectURL(new Blob([response.data])); + const link = document.createElement('a'); + link.href = url; + link.setAttribute('download', 'StyleShare_Contact_Messages_Report.pdf'); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + } catch (error) { + console.error('Error downloading the Contact Messages report:', error); + } + }; + const handleOpenModal = (message: IContactMessage) => { setSelectedMessage(message); setOpen(true); @@ -68,6 +90,7 @@ const ContactMessages = () => { /> : + <>
@@ -112,6 +135,12 @@ const ContactMessages = () => {
+
+ +
+ } diff --git a/admin/src/pages/Posts.tsx b/admin/src/pages/Posts.tsx index 5ed51183..f2cdc2d1 100644 --- a/admin/src/pages/Posts.tsx +++ b/admin/src/pages/Posts.tsx @@ -7,6 +7,7 @@ import toast from "react-hot-toast"; import { Link } from "react-router-dom"; import { ColorRing } from 'react-loader-spinner'; import { BsFillPostcardFill } from "react-icons/bs"; +import { TbReportAnalytics } from "react-icons/tb"; const Posts = () => { const [posts, setPosts] = useState([]); @@ -48,6 +49,27 @@ const Posts = () => { } }; + const downloadPostsReport = async () => { + try { + const response = await axios.get('/api/v1/admin/downloadpostsreport', { + headers: { + Authorization: `Bearer ${token}`, + }, + responseType: 'blob', + }); + + const url = window.URL.createObjectURL(new Blob([response.data])); + const link = document.createElement('a'); + link.href = url; + link.setAttribute('download', 'StyleShare_Posts_Report.pdf'); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + } catch (error) { + console.error('Error downloading the Posts report:', error); + } + }; + return (
@@ -69,6 +91,7 @@ const Posts = () => { />
: + <>
@@ -107,6 +130,12 @@ const Posts = () => {
+
+ +
+ }
diff --git a/admin/src/pages/Users.tsx b/admin/src/pages/Users.tsx index 431efd13..257e100a 100644 --- a/admin/src/pages/Users.tsx +++ b/admin/src/pages/Users.tsx @@ -6,6 +6,7 @@ import toast from "react-hot-toast"; import { IUser } from "../types"; import { ColorRing } from 'react-loader-spinner'; import { FaUsers } from "react-icons/fa"; +import { TbReportAnalytics } from "react-icons/tb"; const Users = () => { const [allUsers, setAllUsers] = useState([]); @@ -71,6 +72,27 @@ const Users = () => { } }; + const downloadUsersReport = async () => { + try { + const response = await axios.get('/api/v1/admin/downloadusersreport', { + headers: { + Authorization: `Bearer ${token}`, + }, + responseType: 'blob', + }); + + const url = window.URL.createObjectURL(new Blob([response.data])); + const link = document.createElement('a'); + link.href = url; + link.setAttribute('download', 'StyleShare_Users_Report.pdf'); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + } catch (error) { + console.error('Error downloading the Users report:', error); + } + }; + return (
@@ -92,6 +114,7 @@ const Users = () => { />
: + <>
@@ -135,6 +158,12 @@ const Users = () => {
+
+ +
+ }
diff --git a/backend/src/routes/admin/controller.ts b/backend/src/routes/admin/controller.ts index f4d59bf6..75e3918e 100644 --- a/backend/src/routes/admin/controller.ts +++ b/backend/src/routes/admin/controller.ts @@ -633,6 +633,190 @@ export const downloadReportController = async (req: UserAuthRequest, res: Respon doc.fontSize(12).text(`${index + 1}. ${post.title}`); }); + doc.end(); + } catch (error) { + console.error(error); + res.status(500).json({ + error: "An unexpected exception occurred!", + }); + } +}; + +export const downloadUsersReportController = async (req: Request, res: Response) => { + try { + const currentDate = new Date().toLocaleDateString(); + + const users = await prisma.user.findMany({ + select: { + username: true, + email: true, + createdAt: true, + blocked: true, + }, + }); + + const totalUsers = users.length; + + const doc = new PDFDocument(); + let filename = `StyleShare_Users_Report.pdf`; + filename = encodeURIComponent(filename); + + res.setHeader('Content-disposition', `attachment; filename="${filename}"`); + res.setHeader('Content-type', 'application/pdf'); + + doc.pipe(res); + + doc.fontSize(25).text('StyleShare Users Report', { + align: 'center' + }); + + doc.moveDown(); + doc.fontSize(20).text('Overview', { + align: 'center' + }); + doc.moveDown(); + doc.fontSize(15).text(`Date: ${currentDate}`); + doc.moveDown(); + + doc.fontSize(12).text(`Total Users: ${totalUsers}`); + doc.moveDown(); + + doc.fontSize(15).text('User Details:'); + doc.moveDown(); + + users.forEach(user => { + doc.text(`Username: ${user.username}`); + doc.text(`Email: ${user.email}`); + doc.text(`Created At: ${user.createdAt.toLocaleDateString()}`); + doc.text(`Blocked: ${user.blocked ? 'Yes' : 'No'}`); + doc.moveDown(); + }); + + doc.end(); + } catch (error) { + console.error(error); + res.status(500).json({ + error: "An unexpected exception occurred!", + }); + } +}; + +export const downloadPostsReportController = async (req: Request, res: Response) => { + try { + const currentDate = new Date().toLocaleDateString(); + + const posts = await prisma.post.findMany({ + select: { + title: true, + description: true, + createdAt: true, + author: { + select: { + username: true, + email: true, + }, + }, + }, + }); + + const totalPosts = posts.length; + + const doc = new PDFDocument(); + let filename = `StyleShare_Posts_Report.pdf`; + filename = encodeURIComponent(filename); + + res.setHeader('Content-disposition', `attachment; filename="${filename}"`); + res.setHeader('Content-type', 'application/pdf'); + + doc.pipe(res); + + doc.fontSize(25).text('StyleShare Posts Report', { + align: 'center' + }); + + doc.moveDown(); + doc.fontSize(20).text('Overview', { + align: 'center' + }); + doc.moveDown(); + doc.fontSize(15).text(`Date: ${currentDate}`); + doc.moveDown(); + + doc.fontSize(12).text(`Total Posts: ${totalPosts}`); + doc.moveDown(); + + doc.fontSize(15).text('Post Details:'); + doc.moveDown(); + + posts.forEach(post => { + doc.text(`Title: ${post.title}`); + doc.text(`Description: ${post.description}`); + doc.text(`Created At: ${post.createdAt.toLocaleDateString()}`); + doc.text(`Author: ${post.author.username} (${post.author.email})`); + doc.moveDown(); + }); + + doc.end(); + } catch (error) { + console.error(error); + res.status(500).json({ + error: "An unexpected exception occurred!", + }); + } +}; + +export const downloadContactMessagesReportController = async (req: Request, res: Response) => { + try { + const currentDate = new Date().toLocaleDateString(); + + const contactMessages = await prisma.contactMessage.findMany({ + select: { + name: true, + email: true, + subject: true, + message: true, + createdAt: true, + }, + }); + + const totalContactMessages = contactMessages.length; + + const doc = new PDFDocument(); + let filename = `StyleShare_Contact_Messages_Report.pdf`; + filename = encodeURIComponent(filename); + + res.setHeader('Content-disposition', `attachment; filename="${filename}"`); + res.setHeader('Content-type', 'application/pdf'); + + doc.pipe(res); + + doc.fontSize(25).text('StyleShare Contact Messages Report', { + align: 'center' + }); + + doc.moveDown(); + doc.fontSize(20).text('Overview', { + align: 'center' + }); + doc.moveDown(); + doc.fontSize(15).text(`Date: ${currentDate}`); + doc.moveDown(); + + doc.fontSize(12).text(`Total Contact Messages: ${totalContactMessages}`); + doc.moveDown(); + + doc.fontSize(15).text('Contact Message Details:'); + doc.moveDown(); + + contactMessages.forEach(message => { + doc.text(`Name: ${message.name}`); + doc.text(`Email: ${message.email}`); + doc.text(`Subject: ${message.subject}`); + doc.text(`Message: ${message.message}`); + doc.text(`Created At: ${message.createdAt.toLocaleDateString()}`); + doc.moveDown(); + }); + doc.end(); } catch (error) { console.error(error); diff --git a/backend/src/routes/admin/route.ts b/backend/src/routes/admin/route.ts index 0dbbf246..88fcc792 100644 --- a/backend/src/routes/admin/route.ts +++ b/backend/src/routes/admin/route.ts @@ -1,5 +1,5 @@ import {Router} from 'express'; -import { getPostReactionsController,getFavoritesController,adminLoginController, adminProfileController, allUserForAdmin, blockUserController, unblockUserController, getAdminPostsController, getAdminTrendingPostsController, getAdminStatsController, getGraphsStatsController, updatePostController, deletePostController, getPostByIdController, getAllContactMessages, deleteCommentController, downloadReportController } from './controller'; +import { getPostReactionsController,getFavoritesController,adminLoginController, adminProfileController, allUserForAdmin, blockUserController, unblockUserController, getAdminPostsController, getAdminTrendingPostsController, getAdminStatsController, getGraphsStatsController, updatePostController, deletePostController, getPostByIdController, getAllContactMessages, deleteCommentController, downloadReportController, downloadUsersReportController, downloadContactMessagesReportController, downloadPostsReportController } from './controller'; import { isAdmin } from '../../middleware/adminAuth'; const adminRouter = Router(); @@ -38,4 +38,10 @@ adminRouter.get('/favorites', isAdmin, getFavoritesController); adminRouter.get('/downloadReport',isAdmin, downloadReportController); +adminRouter.get('/downloadusersreport',isAdmin, downloadUsersReportController); + +adminRouter.get('/downloadpostsreport',isAdmin, downloadPostsReportController); + +adminRouter.get('/downloadcontactmessagereport',isAdmin, downloadContactMessagesReportController); + export default adminRouter; \ No newline at end of file From 7fada34410c16bf31fb797fb38cefccf6667bd87 Mon Sep 17 00:00:00 2001 From: meet Date: Fri, 2 Aug 2024 17:47:08 +0530 Subject: [PATCH 2/6] Added download report feature in comments, reactions and favorite for admin successfully --- admin/src/pages/Comments.tsx | 29 ++++ admin/src/pages/Favorites.tsx | 29 ++++ admin/src/pages/Reactions.tsx | 29 ++++ backend/src/routes/admin/controller.ts | 216 +++++++++++++++++++++++++ backend/src/routes/admin/route.ts | 8 +- 5 files changed, 310 insertions(+), 1 deletion(-) diff --git a/admin/src/pages/Comments.tsx b/admin/src/pages/Comments.tsx index 0717b62d..b67df3e0 100644 --- a/admin/src/pages/Comments.tsx +++ b/admin/src/pages/Comments.tsx @@ -6,6 +6,7 @@ import { tokenState } from "../store/atoms/auth"; import toast from "react-hot-toast"; import { ColorRing } from 'react-loader-spinner'; import { FaComments } from "react-icons/fa"; +import { TbReportAnalytics } from "react-icons/tb"; const Comments = () => { const [posts, setPosts] = useState([]); @@ -47,6 +48,27 @@ const Comments = () => { } }; + const downloadUsersCommentsReport = async () => { + try { + const response = await axios.get('/api/v1/admin/downloaduserscommentsreport', { + headers: { + Authorization: `Bearer ${token}`, + }, + responseType: 'blob', + }); + + const url = window.URL.createObjectURL(new Blob([response.data])); + const link = document.createElement('a'); + link.href = url; + link.setAttribute('download', 'StyleShare_Comments_Report.pdf'); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + } catch (error) { + console.error('Error downloading users comments report:', error); + } + }; + return (
@@ -68,6 +90,7 @@ const Comments = () => { />
: + <>
@@ -123,6 +146,12 @@ const Comments = () => {
+
+ +
+ }
diff --git a/admin/src/pages/Favorites.tsx b/admin/src/pages/Favorites.tsx index 7677a19a..bb2b3b76 100644 --- a/admin/src/pages/Favorites.tsx +++ b/admin/src/pages/Favorites.tsx @@ -5,6 +5,7 @@ import { tokenState } from "../store/atoms/auth"; import { IFavoritePost } from "../types"; import { ColorRing } from 'react-loader-spinner'; import { RiHeartsFill } from "react-icons/ri"; +import { TbReportAnalytics } from "react-icons/tb"; const Favorites = () => { const [favoritePosts, setFavoritePosts] = useState([]); @@ -32,6 +33,27 @@ const Favorites = () => { fetchFavoritePosts(); }, [token]); + const downloadUsersFavoritesReport = async () => { + try { + const response = await axios.get('/api/v1/admin/downloadusersfavoritesreport', { + headers: { + Authorization: `Bearer ${token}`, + }, + responseType: 'blob', + }); + + const url = window.URL.createObjectURL(new Blob([response.data])); + const link = document.createElement('a'); + link.href = url; + link.setAttribute('download', 'StyleShare_Favorites_Report.pdf'); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + } catch (error) { + console.error('Error downloading users favorites report:', error); + } + }; + return (
@@ -53,6 +75,7 @@ const Favorites = () => { />
: + <>
@@ -82,6 +105,12 @@ const Favorites = () => {
+
+ +
+ }
diff --git a/admin/src/pages/Reactions.tsx b/admin/src/pages/Reactions.tsx index b007dcdd..90e303e3 100644 --- a/admin/src/pages/Reactions.tsx +++ b/admin/src/pages/Reactions.tsx @@ -5,6 +5,7 @@ import { tokenState } from "../store/atoms/auth"; import { ColorRing } from 'react-loader-spinner'; import { MdAddReaction } from "react-icons/md"; import { IReaction} from "../types"; +import { TbReportAnalytics } from "react-icons/tb"; const Reactions = () => { const [reactions, setReactions] = useState([]); @@ -32,6 +33,27 @@ const Reactions = () => { fetchReactions(); }, [token]); + const downloadUsersReactionsReport = async () => { + try { + const response = await axios.get('/api/v1/admin/downloadusersreactionreport', { + headers: { + Authorization: `Bearer ${token}`, + }, + responseType: 'blob', + }); + + const url = window.URL.createObjectURL(new Blob([response.data])); + const link = document.createElement('a'); + link.href = url; + link.setAttribute('download', 'StyleShare_Reactions_Report.pdf'); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + } catch (error) { + console.error('Error downloading users reactions report:', error); + } + }; + return (
@@ -53,6 +75,7 @@ const Reactions = () => { />
: + <>
@@ -86,6 +109,12 @@ const Reactions = () => {
+
+ +
+ }
diff --git a/backend/src/routes/admin/controller.ts b/backend/src/routes/admin/controller.ts index f4d59bf6..a6e50fe5 100644 --- a/backend/src/routes/admin/controller.ts +++ b/backend/src/routes/admin/controller.ts @@ -633,6 +633,222 @@ export const downloadReportController = async (req: UserAuthRequest, res: Respon doc.fontSize(12).text(`${index + 1}. ${post.title}`); }); + doc.end(); + } catch (error) { + console.error(error); + res.status(500).json({ + error: "An unexpected exception occurred!", + }); + } +}; + +export const downloadCommentsReportController = async (req: Request, res: Response) => { + try { + const currentDate = new Date().toLocaleDateString(); + + const comments = await prisma.comment.findMany({ + select: { + content: true, + createdAt: true, + user: { + select: { + username: true, + email: true, + }, + }, + post: { + select: { + title: true, + }, + }, + }, + }); + + const totalComments = comments.length; + + const doc = new PDFDocument(); + let filename = `StyleShare_Comments_Report.pdf`; + filename = encodeURIComponent(filename); + + res.setHeader('Content-disposition', `attachment; filename="${filename}"`); + res.setHeader('Content-type', 'application/pdf'); + + doc.pipe(res); + + doc.fontSize(25).text('StyleShare Comments Report', { + align: 'center' + }); + + doc.moveDown(); + doc.fontSize(20).text('Overview', { + align: 'center' + }); + doc.moveDown(); + doc.fontSize(15).text(`Date: ${currentDate}`); + doc.moveDown(); + + doc.fontSize(12).text(`Total Comments: ${totalComments}`); + doc.moveDown(); + + doc.fontSize(15).text('Comment Details:'); + doc.moveDown(); + + comments.forEach(comment => { + doc.text(`Content: ${comment.content}`); + doc.text(`Created At: ${comment.createdAt.toLocaleDateString()}`); + doc.text(`User: ${comment.user.username} (${comment.user.email})`); + doc.text(`Post: ${comment.post.title}`); + doc.moveDown(); + }); + + doc.end(); + } catch (error) { + console.error(error); + res.status(500).json({ + error: "An unexpected exception occurred!", + }); + } +}; + +export const downloadReactionsReportController = async (req: Request, res: Response) => { + try { + const currentDate = new Date().toLocaleDateString(); + + const reactions = await prisma.reaction.findMany({ + select: { + type: true, + createdAt: true, + user: { + select: { + username: true, + email: true, + }, + }, + post: { + select: { + title: true, + description: true, + author: { + select: { + username: true, + email: true, + }, + }, + }, + }, + }, + }); + + const totalReactions = reactions.length; + + const doc = new PDFDocument(); + let filename = `StyleShare_Reactions_Report.pdf`; + filename = encodeURIComponent(filename); + + res.setHeader('Content-disposition', `attachment; filename="${filename}"`); + res.setHeader('Content-type', 'application/pdf'); + + doc.pipe(res); + + doc.fontSize(25).text('StyleShare Reactions Report', { + align: 'center' + }); + + doc.moveDown(); + doc.fontSize(20).text('Overview', { + align: 'center' + }); + doc.moveDown(); + doc.fontSize(15).text(`Date: ${currentDate}`); + doc.moveDown(); + + doc.fontSize(12).text(`Total Reactions: ${totalReactions}`); + doc.moveDown(); + + doc.fontSize(15).text('Reaction Details:'); + doc.moveDown(); + + reactions.forEach(reaction => { + doc.fontSize(12).text(`Type: ${reaction.type}`); + doc.text(`Created At: ${reaction.createdAt.toLocaleDateString()}`); + doc.text(`User: ${reaction.user.username} (${reaction.user.email})`); + doc.text(`Post: ${reaction.post.title}`); + doc.text(`Post Description: ${reaction.post.description}`); + doc.text(`Post Author: ${reaction.post.author.username} (${reaction.post.author.email})`); + doc.moveDown(); + }); + + doc.end(); + } catch (error) { + console.error(error); + res.status(500).json({ + error: "An unexpected exception occurred!", + }); + } +}; + +export const downloadFavoritesReportController = async (req: Request, res: Response) => { + try { + const currentDate = new Date().toLocaleDateString(); + + const favorites = await prisma.favorite.findMany({ + select: { + createdAt: true, + user: { + select: { + username: true, + email: true + } + }, + post: { + select: { + title: true, + description: true + } + } + }, + orderBy: { + createdAt: 'desc' + } + }); + + const totalFavorites = favorites.length; + + const doc = new PDFDocument(); + let filename = `StyleShare_Favorites_Report.pdf`; + filename = encodeURIComponent(filename); + + res.setHeader('Content-disposition', `attachment; filename="${filename}"`); + res.setHeader('Content-type', 'application/pdf'); + + doc.pipe(res); + + doc.fontSize(25).text('StyleShare Favorites Report', { + align: 'center' + }); + + doc.moveDown(); + doc.fontSize(20).text('Overview', { + align: 'center' + }); + doc.moveDown(); + doc.fontSize(15).text(`Date: ${currentDate}`); + doc.moveDown(); + + doc.fontSize(12).text(`Total Favorites: ${totalFavorites}`); + doc.moveDown(); + + doc.fontSize(15).text('Favorite Details:'); + doc.moveDown(); + + favorites.forEach(favorite => { + doc.text(`Created At: ${favorite.createdAt.toLocaleDateString()}`); + doc.text(`User: ${favorite.user.username} (${favorite.user.email})`); + doc.text(`Post: ${favorite.post.title}`); + doc.text(`Post Description: ${favorite.post.description}`); + doc.moveDown(); + }); + doc.end(); } catch (error) { console.error(error); diff --git a/backend/src/routes/admin/route.ts b/backend/src/routes/admin/route.ts index 0dbbf246..43fad171 100644 --- a/backend/src/routes/admin/route.ts +++ b/backend/src/routes/admin/route.ts @@ -1,5 +1,5 @@ import {Router} from 'express'; -import { getPostReactionsController,getFavoritesController,adminLoginController, adminProfileController, allUserForAdmin, blockUserController, unblockUserController, getAdminPostsController, getAdminTrendingPostsController, getAdminStatsController, getGraphsStatsController, updatePostController, deletePostController, getPostByIdController, getAllContactMessages, deleteCommentController, downloadReportController } from './controller'; +import { getPostReactionsController,getFavoritesController,adminLoginController, adminProfileController, allUserForAdmin, blockUserController, unblockUserController, getAdminPostsController, getAdminTrendingPostsController, getAdminStatsController, getGraphsStatsController, updatePostController, deletePostController, getPostByIdController, getAllContactMessages, deleteCommentController, downloadReportController, downloadCommentsReportController, downloadFavoritesReportController, downloadReactionsReportController } from './controller'; import { isAdmin } from '../../middleware/adminAuth'; const adminRouter = Router(); @@ -38,4 +38,10 @@ adminRouter.get('/favorites', isAdmin, getFavoritesController); adminRouter.get('/downloadReport',isAdmin, downloadReportController); +adminRouter.get("/downloaduserscommentsreport", downloadCommentsReportController); + +adminRouter.get("/downloadusersfavoritesreport", downloadFavoritesReportController); + +adminRouter.get("/downloadusersreactionreport", downloadReactionsReportController); + export default adminRouter; \ No newline at end of file From 9f22f37f8f2e8232c3039868f021356d92b1351f Mon Sep 17 00:00:00 2001 From: Sourabh782 Date: Sat, 3 Aug 2024 22:23:06 +0530 Subject: [PATCH 3/6] Added Enter to search functionality in posts page --- frontend/src/pages/Posts.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/src/pages/Posts.tsx b/frontend/src/pages/Posts.tsx index 5a94df8b..10895baf 100644 --- a/frontend/src/pages/Posts.tsx +++ b/frontend/src/pages/Posts.tsx @@ -77,6 +77,7 @@ const Posts = () => { const handleSearch = () => { fetchPosts(page, 12, searchQuery, filterTags); + // console.log(searchQuery) }; if (loading) { @@ -165,7 +166,12 @@ const Posts = () => { onChange={(e) => setSearchQuery(e.target.value)} placeholder="🔍 Search anything" className="p-2 w-full max-w-xs rounded-md text-[#000435] bg-white dark:text-white dark:bg-[#000435] border border-sky-400 focus:outline-none focus:ring-2 focus:ring-blue-500" - /> + onKeyDown={(event)=>{ + if(event.key == "Enter"){ + handleSearch() + } + }} + /> )} @@ -227,7 +229,7 @@ const Navbar: React.FC = ({ theme, toggleTheme }) => {
@@ -258,6 +260,7 @@ const Navbar: React.FC = ({ theme, toggleTheme }) => { New Post From 44174d4cc04445560f3034da36c7d1b593b26091 Mon Sep 17 00:00:00 2001 From: Sourabh782 Date: Sun, 4 Aug 2024 17:59:56 +0530 Subject: [PATCH 5/6] removed console comment as instructed --- frontend/src/pages/Posts.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/src/pages/Posts.tsx b/frontend/src/pages/Posts.tsx index 10895baf..d55de4af 100644 --- a/frontend/src/pages/Posts.tsx +++ b/frontend/src/pages/Posts.tsx @@ -77,7 +77,6 @@ const Posts = () => { const handleSearch = () => { fetchPosts(page, 12, searchQuery, filterTags); - // console.log(searchQuery) }; if (loading) { From 10c4b8827b0d1f2f22d7aba4225204701a7051a6 Mon Sep 17 00:00:00 2001 From: Haseeb Zaki <147314463+haseebzaki-07@users.noreply.github.com> Date: Sun, 4 Aug 2024 20:15:28 +0530 Subject: [PATCH 6/6] Update .env.example --- backend/.env.example | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/.env.example b/backend/.env.example index aaf8e099..5c59ad02 100644 --- a/backend/.env.example +++ b/backend/.env.example @@ -1,7 +1,7 @@ -DATABASE_URL="mongodb+srv://username:pass@cluster0.k7v9clo.mongodb.net/styleshare" +DATABASE_URL="mongodb+srv://:@/syleshare" JWT_SECRET="secret" PORT=3001 # EMAIL_USER=user_email_id # EMAIL_PASS=16char_app_password # SEND_EMAIL=true # Uncomment this to turn on email functionality on development -# API_KEY="your google gemini api key" \ No newline at end of file +# API_KEY="your google gemini api key"