From a91eb808c4351ba6ddb296a032883a303f0a05f0 Mon Sep 17 00:00:00 2001 From: Vanessa Lai Date: Mon, 24 Jun 2024 23:38:30 +0800 Subject: [PATCH] resolve merge --- package-lock.json | 23 +++-- src/App.jsx | 51 +++++------ src/components/header/Header.jsx | 4 +- src/pages/chatapp/ChatApp.jsx | 86 ++++++++++--------- src/pages/notificaiton/Notificaitons.jsx | 2 +- src/pages/registration/LoginSignupForm.jsx | 7 +- src/pages/review/Review.jsx | 2 +- src/pages/userprofile/UserProfile.css | 17 ++-- src/pages/userprofile/UserProfile.jsx | 3 - .../userprofile/userReviews/UserReviews.jsx | 2 +- .../viewproduct/offerPopup/offerPopup.jsx | 2 +- .../viewproduct/viewOffers/viewOffers.jsx | 2 +- 12 files changed, 98 insertions(+), 103 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5d5c0d1..aa10319 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,9 +8,9 @@ "name": "orbital-mechhub", "version": "0.0.0", "dependencies": { + "@sendgrid/mail": "^8.1.3", "date-fns": "^3.6.0", "emoji-picker-react": "^4.9.4", - "@sendgrid/mail": "^8.1.3", "firebase": "^10.12.2", "firebase-admin": "^12.1.1", "node-mailjet": "^6.0.5", @@ -1429,9 +1429,6 @@ } }, "node_modules/@grpc/grpc-js": { - "version": "1.9.15", - "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.9.15.tgz", - "integrity": "sha512-nqE7Hc0AzI+euzUwDAy0aY5hCp10r734gMGRdU+qOPX0XSceI2ULrcXB5U2xSc5VkWwalCj4M7GzCAygZl2KoQ==", "version": "1.9.15", "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.9.15.tgz", "integrity": "sha512-nqE7Hc0AzI+euzUwDAy0aY5hCp10r734gMGRdU+qOPX0XSceI2ULrcXB5U2xSc5VkWwalCj4M7GzCAygZl2KoQ==", @@ -2028,7 +2025,7 @@ "version": "15.7.12", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.12.tgz", "integrity": "sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==", - "dev": true + "devOptional": true }, "node_modules/@types/qs": { "version": "6.9.15", @@ -6567,6 +6564,14 @@ "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==" }, + "node_modules/use-sync-external-store": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz", + "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -6584,14 +6589,6 @@ "uuid": "dist/bin/uuid" } }, - "node_modules/use-sync-external-store": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz", - "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==", - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0" - } - }, "node_modules/vite": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/vite/-/vite-5.3.1.tgz", diff --git a/src/App.jsx b/src/App.jsx index 1f58e52..658efd5 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -11,32 +11,35 @@ import ListingPage from "./pages/listing/Listing"; import Chat from "./pages/chatapp/ChatApp"; import ReviewPage from "./pages/review/Review"; import NotificationsPage from "./pages/notificaiton/Notificaitons"; +import ProductPage from "./pages/viewproduct/ViewProduct"; +import LikesPage from "./pages/likes/Likes"; const App = () => { - return ( - - - - - - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - - - - - ); +return ( + + + + + + + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + + + + +); } export default App; \ No newline at end of file diff --git a/src/components/header/Header.jsx b/src/components/header/Header.jsx index e5d1b24..ec5748d 100644 --- a/src/components/header/Header.jsx +++ b/src/components/header/Header.jsx @@ -4,7 +4,7 @@ import { Link, useNavigate } from 'react-router-dom'; import { useLikes } from './likecounter/LikeCounter'; import { FaComment, FaHeart, FaUserAlt, FaBell } from 'react-icons/fa'; import { query, collection, where, getDocs } from 'firebase/firestore'; -import { db } from '../../firebase/firebaseConfig'; +import { db } from '../../lib/firebaseConfig'; import SearchBar from '../searchbar/Searchbar'; import MechHub_Logo from "../../assets/Logo/MechHub_logo.png"; @@ -54,7 +54,7 @@ function Header() { }; const handleChats = () => { - navigate(`/`); + window.location.href = `/chat/${currentUser.uid}`; }; const handleNotifs = () => { diff --git a/src/pages/chatapp/ChatApp.jsx b/src/pages/chatapp/ChatApp.jsx index 7492318..df58161 100644 --- a/src/pages/chatapp/ChatApp.jsx +++ b/src/pages/chatapp/ChatApp.jsx @@ -12,48 +12,50 @@ import LoginSignupForm from "../../pages/registration/LoginSignupForm.jsx"; import { useChatStore } from '../../lib/chatStore.js'; const ChatApp = () => { - const { currentUser, isLoading, fetchUserInfo } = useUserStore(); - const { chatId } = useChatStore(); - - useEffect(() => { - const unSub = onAuthStateChanged(auth, (user) => { - if (user) { - fetchUserInfo(user.uid); - } else { - fetchUserInfo(null); - } - }); - - return () => { - unSub(); - }; - }, [fetchUserInfo]); - - console.log(currentUser); - - if (isLoading) { - // return ; - return
Loading...
- } - - return ( -
- {currentUser ? ( - <> -
-
-
- - {chatId && } - {chatId && } -
-
- - ) : ( - - )} -
- ); + const { currentUser, isLoading, fetchUserInfo } = useUserStore(); + const { chatId } = useChatStore(); + + useEffect(() => { + const unSub = onAuthStateChanged(auth, (user) => { + if (user) { + fetchUserInfo(user.uid); + } else { + fetchUserInfo(null); + } + }); + + return () => { + unSub(); + }; + }, [fetchUserInfo]); + + console.log(currentUser); + + if (isLoading) { + // return ; + return
Loading...
+ } + + return ( + <> +
+
+ {currentUser ? ( + <> +
+
+ + {chatId && } + {chatId && } +
+
+ + ) : ( + + )} +
+ + );`` }; export default ChatApp; diff --git a/src/pages/notificaiton/Notificaitons.jsx b/src/pages/notificaiton/Notificaitons.jsx index d2613b2..9c67667 100644 --- a/src/pages/notificaiton/Notificaitons.jsx +++ b/src/pages/notificaiton/Notificaitons.jsx @@ -1,6 +1,6 @@ import React, { useEffect, useState } from 'react'; import { collection, query, where, getDocs, updateDoc, doc, getDoc, deleteDoc } from 'firebase/firestore'; -import { db } from '../../firebase/firebaseConfig'; +import { db } from '../../lib/firebaseConfig'; import { useAuth } from '../../Auth'; import Header from '../../components/header/Header'; diff --git a/src/pages/registration/LoginSignupForm.jsx b/src/pages/registration/LoginSignupForm.jsx index 5919a0e..662d452 100644 --- a/src/pages/registration/LoginSignupForm.jsx +++ b/src/pages/registration/LoginSignupForm.jsx @@ -3,16 +3,13 @@ import GoogleLogo from '../../assets/google-logo.png'; import defaultProfile from '../../assets/defaultProfile.jpg'; import { useNavigate } from 'react-router-dom'; import { toast } from 'react-hot-toast'; - -import './LoginSignupForm.css'; -import Header from '../../components/header/Header'; - import { auth, db } from "../../lib/firebaseConfig"; import { signInWithEmailAndPassword, createUserWithEmailAndPassword } from "firebase/auth"; import { query, collection, where, getDocs, doc, setDoc } from "firebase/firestore"; import { signInWithGoogle } from './GoogleAuth'; -import Header from "../../components/header/Header"; +import './LoginSignupForm.css'; +import Header from '../../components/header/Header'; function LoginSignUpForm() { const [rightPanelActive, setRightPanelActive] = useState(false); diff --git a/src/pages/review/Review.jsx b/src/pages/review/Review.jsx index d218151..150e5bd 100644 --- a/src/pages/review/Review.jsx +++ b/src/pages/review/Review.jsx @@ -1,5 +1,5 @@ import React, { useState, useEffect } from 'react'; -import { db } from '../../firebase/firebaseConfig'; +import { db } from '../../lib/firebaseConfig'; import { useParams, useNavigate } from 'react-router-dom'; import { collection, doc, getDoc, addDoc } from 'firebase/firestore'; import { useAuth } from '../../Auth'; diff --git a/src/pages/userprofile/UserProfile.css b/src/pages/userprofile/UserProfile.css index 9440344..ca59ad6 100644 --- a/src/pages/userprofile/UserProfile.css +++ b/src/pages/userprofile/UserProfile.css @@ -112,17 +112,16 @@ } .logout, .edit-profile { - width: 240px; + max-width: 200px; + width: 180px; + min-width: 120px; margin: 12px 0; - background-color: rgb(8, 8, 112); - border: 1px solid rgb(8, 8, 112); } - - .chat-button { - width: 240px; + .follow, .unfollow { + max-width: 240px; + width: 180px; + min-width: 120px; margin: 12px 0; - background-color: rgb(8, 8, 112); - border: 1px solid rgb(8, 8, 112); } } @@ -205,4 +204,4 @@ } } } -} +} \ No newline at end of file diff --git a/src/pages/userprofile/UserProfile.jsx b/src/pages/userprofile/UserProfile.jsx index e5f33cf..5fcdf10 100644 --- a/src/pages/userprofile/UserProfile.jsx +++ b/src/pages/userprofile/UserProfile.jsx @@ -251,9 +251,6 @@ function UserProfile() { Edit Profile {isPopupOpen && } - diff --git a/src/pages/userprofile/userReviews/UserReviews.jsx b/src/pages/userprofile/userReviews/UserReviews.jsx index b87d152..6445be4 100644 --- a/src/pages/userprofile/userReviews/UserReviews.jsx +++ b/src/pages/userprofile/userReviews/UserReviews.jsx @@ -1,7 +1,7 @@ import React, { useEffect, useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { doc, getDoc } from 'firebase/firestore'; -import { db } from '../../../firebase/firebaseConfig'; +import { db } from '../../../lib/firebaseConfig'; import { FaStar } from 'react-icons/fa'; import './UserReviews.css'; diff --git a/src/pages/viewproduct/offerPopup/offerPopup.jsx b/src/pages/viewproduct/offerPopup/offerPopup.jsx index 7aee2c0..9c675c4 100644 --- a/src/pages/viewproduct/offerPopup/offerPopup.jsx +++ b/src/pages/viewproduct/offerPopup/offerPopup.jsx @@ -1,5 +1,5 @@ import React, { useState } from "react"; -import { auth, db } from "../../../firebase/firebaseConfig"; +import { auth, db } from "../../../lib/firebaseConfig"; import { doc, addDoc, collection } from "firebase/firestore"; import { toast } from 'react-hot-toast'; diff --git a/src/pages/viewproduct/viewOffers/viewOffers.jsx b/src/pages/viewproduct/viewOffers/viewOffers.jsx index 7a76fb9..43dbeaa 100644 --- a/src/pages/viewproduct/viewOffers/viewOffers.jsx +++ b/src/pages/viewproduct/viewOffers/viewOffers.jsx @@ -1,6 +1,6 @@ import React, { useEffect, useState } from 'react'; import { doc, updateDoc, collection, deleteDoc, addDoc, getDoc } from 'firebase/firestore'; -import { db } from '../../../firebase/firebaseConfig'; +import { db } from '../../../lib/firebaseConfig'; import { useNavigate } from 'react-router-dom'; import { toast } from 'react-hot-toast'; import { useAuth } from '../../../Auth';