Skip to content

Commit

Permalink
resolve merge
Browse files Browse the repository at this point in the history
  • Loading branch information
vanesssalai committed Jun 24, 2024
1 parent e92da5a commit a91eb80
Show file tree
Hide file tree
Showing 12 changed files with 98 additions and 103 deletions.
23 changes: 10 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 27 additions & 24 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<LikeCountProvider>
<AuthProvider>
<Toaster />
<Router>
<Routes>
<Route path="/" element={<LandingPage />} />
<Route path="/account" element={<LoginSignupForm />} />
<Route path="/profile" element={<UserProfile />} />
<Route path="/profile/:userID" element={<UserProfile />} />
<Route path="/search" element={<SearchPage />} />
<Route path="/listing" element={<ListingPage />} />
<Route path="/listing/:listingID" element={<ListingPage />} />
<Route path="/product/:listingID" element={<ProductPage />} />
<Route path="/likes/:userID" element={<LikesPage />} />
<Route path="/review/:userID" element={<ReviewPage />} />
<Route path="/notifications/:userID" element={<NotificationsPage />} />
<Route path="/chat" element={<Chat />} />
<Route path="/chat/:userID" element={<Chat />} />
</Routes>
</Router>
</AuthProvider>
</LikeCountProvider>
);
return (
<AuthProvider>
<LikeCountProvider>

<Toaster />
<Router>
<Routes>
<Route path="/" element={<LandingPage />} />
<Route path="/account" element={<LoginSignupForm />} />
<Route path="/profile" element={<UserProfile />} />
<Route path="/profile/:userID" element={<UserProfile />} />
<Route path="/search" element={<SearchPage />} />
<Route path="/listing" element={<ListingPage />} />
<Route path="/listing/:listingID" element={<ListingPage />} />
<Route path="/product/:listingID" element={<ProductPage />} />
<Route path="/likes/:userID" element={<LikesPage />} />
<Route path="/review/:userID" element={<ReviewPage />} />
<Route path="/notifications/:userID" element={<NotificationsPage />} />
<Route path="/chat" element={<Chat />} />
<Route path="/chat/:userID" element={<Chat />} />
</Routes>
</Router>
</LikeCountProvider>
</AuthProvider>
);
}

export default App;
4 changes: 2 additions & 2 deletions src/components/header/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -54,7 +54,7 @@ function Header() {
};

const handleChats = () => {
navigate(`/`);
window.location.href = `/chat/${currentUser.uid}`;
};

const handleNotifs = () => {
Expand Down
86 changes: 44 additions & 42 deletions src/pages/chatapp/ChatApp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 <LoadingPage />;
return <div className='loading'>Loading...</div>
}

return (
<div className='chat-page'>
{currentUser ? (
<>
<Header className='chat-header'/>
<div className='chat-container'>
<div className='inner-container'>
<List/>
{chatId && <Chat/>}
{chatId && <Detail/>}
</div>
</div>
</>
) : (
<LoginSignupForm />
)}
</div>
);
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 <LoadingPage />;
return <div className='loading'>Loading...</div>
}

return (
<>
<Header className='chat-header'/>
<div className='chat-page'>
{currentUser ? (
<>
<div className='chat-container'>
<div className='inner-container'>
<List/>
{chatId && <Chat/>}
{chatId && <Detail/>}
</div>
</div>
</>
) : (
<LoginSignupForm />
)}
</div>
</>
);``
};

export default ChatApp;
2 changes: 1 addition & 1 deletion src/pages/notificaiton/Notificaitons.jsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
7 changes: 2 additions & 5 deletions src/pages/registration/LoginSignupForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/review/Review.jsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
17 changes: 8 additions & 9 deletions src/pages/userprofile/UserProfile.css
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -205,4 +204,4 @@
}
}
}
}
}
3 changes: 0 additions & 3 deletions src/pages/userprofile/UserProfile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,6 @@ function UserProfile() {
Edit Profile
</button>
{isPopupOpen && <EditPopup onClose={handleClosePopup} onSubmit={handleSubmit} />}
<button className="chat-button" onClick={handleChatNavigation}>
Chat
</button>
<button className="logout" onClick={handleLogout}>
Logout
</button>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/userprofile/userReviews/UserReviews.jsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion src/pages/viewproduct/offerPopup/offerPopup.jsx
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
2 changes: 1 addition & 1 deletion src/pages/viewproduct/viewOffers/viewOffers.jsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down

0 comments on commit a91eb80

Please sign in to comment.