Skip to content

Commit

Permalink
Merge branch 'main' of github.com:feliciahmq/orbital-mechhub
Browse files Browse the repository at this point in the history
  • Loading branch information
feliciahmq committed Jun 24, 2024
2 parents ec3e36d + 24cab50 commit 274d54d
Show file tree
Hide file tree
Showing 59 changed files with 1,476 additions and 67 deletions.
72 changes: 69 additions & 3 deletions package-lock.json

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

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
},
"dependencies": {
"@sendgrid/mail": "^8.1.3",
"date-fns": "^3.6.0",
"emoji-picker-react": "^4.9.4",
"firebase": "^10.12.2",
"firebase-admin": "^12.1.1",
"node-mailjet": "^6.0.5",
Expand All @@ -24,7 +26,8 @@
"react-router-dom": "^6.23.1",
"react-slider": "^2.0.6",
"s": "^1.0.0",
"styled-components": "^6.1.11"
"styled-components": "^6.1.11",
"zustand": "^4.5.2"
},
"devDependencies": {
"@types/react": "^18.2.66",
Expand Down
52 changes: 28 additions & 24 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,38 @@ import LoginSignupForm from "./pages/registration/LoginSignupForm";
import UserProfile from "./pages/userprofile/UserProfile";
import SearchPage from "./pages/search/SearchPage";
import ListingPage from "./pages/listing/Listing";
import ProductPage from "./pages/viewproduct/ViewProduct";
import LikesPage from "./pages/likes/Likes";
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 (
<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 />} />
</Routes>
</Router>
</LikeCountProvider>
</AuthProvider>
);
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;
16 changes: 12 additions & 4 deletions src/Auth.jsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
import React, { createContext, useState, useEffect, useContext } from 'react';
import { onAuthStateChanged } from 'firebase/auth';
import { auth } from './firebase/firebaseConfig';
import { auth } from './lib/firebaseConfig';
import { useUserStore } from '/src/lib/userStore';

const AuthContext = createContext();

export const useAuth = () => useContext(AuthContext);

export const AuthProvider = ({ children }) => {
const { fetchUserInfo } = useUserStore();
const [currentUser, setCurrentUser] = useState(null);

useEffect(() => {
const unsubscribe = onAuthStateChanged(auth, (user) => {
setCurrentUser(user);
if (user) {
setCurrentUser(user);
fetchUserInfo(user.uid);
} else {
setCurrentUser(null);
fetchUserInfo(null);
}
});
return unsubscribe;
}, []);
}, [fetchUserInfo]);

return (
<AuthContext.Provider value={{ currentUser }}>
<AuthContext.Provider value={{ currentUser, useUserStore }}>
{children}
</AuthContext.Provider>
);
Expand Down
Binary file added src/assets/chat-icons/arrowDown.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/chat-icons/arrowUp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/chat-icons/avatar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/chat-icons/camera.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/chat-icons/download.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/chat-icons/edit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/chat-icons/emoji.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/chat-icons/img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/chat-icons/info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/chat-icons/mic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/chat-icons/minus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/chat-icons/more.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/chat-icons/phone.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/chat-icons/plus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/chat-icons/search.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/chat-icons/theme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/chat-icons/video.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 274d54d

Please sign in to comment.