Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
.App {
text-align: center;
}
body {
@apply bg-white text-black;
}

.dark body {
@apply bg-gray-900 text-white;
}

.App-logo {
height: 40vmin;
Expand Down
64 changes: 34 additions & 30 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Provider, useSelector, useDispatch } from 'react-redux';
import { store } from './Store/index';
import { getCurrentUser } from './Store/authSlice';
import styled from 'styled-components';
import { useState } from "react";

import Navbar from './componets/Navbar';
import Footer from './componets/footer';
Expand Down Expand Up @@ -42,14 +43,17 @@ import Reviews from './componets/Reviews';
import AnimatedCursor from 'react-animated-cursor';

import Chatbot from "./componets/Chatbot";
<div className="min-h-screen bg-white dark:bg-black text-black dark:text-white"></div>;

// Styled Containers
const AppContainer = styled.div`
display: flex;
flex-direction: column;
min-height: 100vh;
color: #7c2214;
`;
`

;

const ContentContainer = styled.div`
flex: 1;
Expand Down Expand Up @@ -97,16 +101,10 @@ const AppContent = () => {
const dispatch = useDispatch();
const { token, user } = useSelector((state) => state.auth);

useEffect(() => {
if (token && !user) {
dispatch(getCurrentUser());
}
}, [token, user, dispatch]);

return (
<AppContainer>
<Navbar />

<AnimatedCursor
innerSize={20}
outerSize={20}
Expand All @@ -116,8 +114,8 @@ const AppContent = () => {
outerScale={4}
/>

<ToastContainer
position="top-right"
<ToastContainer
position="top-right"
autoClose={3000}
hideProgressBar={false}
newestOnTop={false}
Expand Down Expand Up @@ -156,41 +154,41 @@ const AppContent = () => {

{/* Protected Routes */}
<Route path="/profile" element={<SafeProfileRoute />} />
<Route
path="/cart"
<Route
path="/cart"
element={
<ProtectedRoute>
<Cart />
</ProtectedRoute>
}
}
/>
<Route
path="/checkout"
<Route
path="/checkout"
element={
<ProtectedRoute>
<Checkout />
</ProtectedRoute>
}
}
/>
<Route
path="/favorites"
<Route
path="/favorites"
element={
<ProtectedRoute>
<Favorites />
</ProtectedRoute>
}
}
/>
<Route
path="/feedback"
<Route
path="/feedback"
element={
<ProtectedRoute>
<Feedback />
</ProtectedRoute>
}
}
/>
</Routes>
</ContentContainer>

{/* </div> */}
<Reviews />

{/* Add Chatbot so it floats on every page */}
Expand Down Expand Up @@ -242,15 +240,21 @@ const AppContent = () => {
// ✅ Main App Component with Google OAuth Provider
function App() {
return (
<GoogleOAuthProvider clientId={process.env.REACT_APP_GOOGLE_CLIENT_ID}>
<Provider store={store}>
<Router>
<ScrollToTop />
<AppContent />
</Router>
</Provider>
</GoogleOAuthProvider>
<div>
<GoogleOAuthProvider clientId={process.env.REACT_APP_GOOGLE_CLIENT_ID}>
<Provider store={store}>
<Router>
<ScrollToTop />
<AppContent />
</Router>
</Provider>
</GoogleOAuthProvider>


</div>

);
}


export default App;
Loading