Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new ui integrated with backend #1931

Merged
merged 1 commit into from
Jul 21, 2024
Merged
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
4 changes: 2 additions & 2 deletions package-lock.json

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

8 changes: 4 additions & 4 deletions src/Admin/AdminLayout.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react';
import { Outlet } from 'react-router-dom';
import AdminNavbar from './components/AdminNavbar/AdminNavbar';
import React from "react";
import { Outlet } from "react-router-dom";
import AdminNavbar from "./components/AdminNavbar/AdminNavbar";
// import AdminFooter from './components/AdminFooter';

const AdminLayout = () => {
return (
<div>
<AdminNavbar />
{/* <AdminNavbar /> */}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ise layout se ku hta diya

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kyuki sir abhi isko bahar rkha hein means ki load ke time aajayega at the home page and baaki changes krne the tbhi

<Outlet />
{/* <AdminFooter /> */}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/components/AdminNavbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const AdminNavbar = () => {
localStorage.removeItem("isLoggedIn");
localStorage.removeItem("username");
alert("Logout Successful.");
navigate("/login");
navigate("/auth");
}
};
return (
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/components/AdminNavbar/AdminNavbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const AdminNavbar = () => {
localStorage.removeItem("isLoggedIn");
localStorage.removeItem("username");
alert("Logout Successful.");
navigate("/login");
navigate("/auth");
}
};

Expand Down
12 changes: 8 additions & 4 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,14 @@ import PrintingStationery from "./User/pages/Popular_Categories/Printing-Station

import { Helmet } from "react-helmet";


export default function App() {
return (
<AuthProvider>
<CookieConsentBanner /> {/* CookieConsentBanner component */}
<CookieConsentBanner /> {/* CookieConsentBanner component */}
<Helmet>
<script src="https://cdn.botpress.cloud/webchat/v2/inject.js"></script>
<script src="https://mediafiles.botpress.cloud/f910a06e-f7d4-4424-8642-e3cdffe933b5/webchat/v2/config.js"></script>
</Helmet>

<Routes>
<Route path="/" element={<UserLayout />}>
<Route index element={<Home />} />
Expand Down Expand Up @@ -154,7 +152,7 @@ export default function App() {
/>

<Route path="team" element={<Team />} />
<Route path="auth" element={<UserAuth />} />
<Route path="auth" element={<UserAuth />} />
<Route path="faq" element={<FAQ />} />
<Route path="termsAndCondition" element={<TermsAndConditions />} />
<Route path="feedback" element={<FeedbackModal />} />
Expand All @@ -165,6 +163,12 @@ export default function App() {
<Route path="EPR_Page" element={<EPRPage />} />

<Route element={<PrivateRoute />}>
<Route path="/admin" element={<AdminLayout />}>
<Route index element={<AdminPanel />} />
{/* <Route path="dashboard" element={<AdminDashboard />} /> */}
<Route path="vigy_form" element={<VigyForm />} />
<Route path="product_form" element={<ProductForm />} />
</Route>
<Route path="dashboard" element={<Dashboard />} />
<Route path="confirm" element={<Confirmation />} />
<Route
Expand Down
2 changes: 1 addition & 1 deletion src/PrivateRoute.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Navigate, Outlet } from "react-router-dom";

const PrivateRoute = () => {
const isLoggedIn = localStorage.getItem("isLoggedIn") === "true";
return isLoggedIn ? <Outlet /> : <Navigate to="/login" />;
return isLoggedIn ? <Outlet /> : <Navigate to="/auth" />;
};

export default PrivateRoute;
53 changes: 35 additions & 18 deletions src/User/components/Aside/Aside.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const Aside = () => {
if (result.isConfirmed) {
localStorage.setItem("isLoggedIn", false);
localStorage.removeItem("username");
navigate("/login");
navigate("/auth");

Swal.fire({
title: "Logout successfully!",
Expand All @@ -78,7 +78,8 @@ const Aside = () => {
<>
<aside
className="w-64 bg-[#2d4031] text-white flex flex-col fixed top-0 mt-20 index-"
style={{ position: "sticky" }}>
style={{ position: "sticky" }}
>
<div className="flex items-center space-x-4 mt-10 ml-5">
<div className="h-10 bg-green-700 flex items-center justify-center p-8 rounded-lg gap-2">
<lord-icon
Expand All @@ -88,50 +89,57 @@ const Aside = () => {
}}
src="https://cdn.lordicon.com/hrjifpbq.json"
trigger="hover"
colors="primary:#ffffff"></lord-icon>
colors="primary:#ffffff"
></lord-icon>
<span className="text-white">{username}</span>
</div>
</div>
<nav className="flex-1 px-4 py-8 space-y-2">
<Link
to="#"
className="flex items-center space-x-2 p-2 hover:bg-green-700 rounded-md">
className="flex items-center space-x-2 p-2 hover:bg-green-700 rounded-md"
>
<lord-icon
style={{
height: "20px",
width: "20px",
}}
src="https://cdn.lordicon.com/hrjifpbq.json"
trigger="hover"
colors="primary:#ffffff"></lord-icon>
colors="primary:#ffffff"
></lord-icon>
<span>My Profile</span>
</Link>

<Link
to="/dashboard_order"
className="flex items-center space-x-2 p-2 hover:bg-green-700 rounded-md">
className="flex items-center space-x-2 p-2 hover:bg-green-700 rounded-md"
>
<lord-icon
style={{
height: "20px",
width: "20px",
}}
src="https://cdn.lordicon.com/xljvqlng.json"
trigger="hover"
colors="primary:#ffffff"></lord-icon>
colors="primary:#ffffff"
></lord-icon>
<span>Orders</span>
</Link>

<Link
to="/dashboard_cart"
className="flex items-center space-x-2 p-2 hover:bg-green-700 rounded-md relative">
className="flex items-center space-x-2 p-2 hover:bg-green-700 rounded-md relative"
>
<lord-icon
style={{
height: "20px",
width: "20px",
}}
src="https://cdn.lordicon.com/pbrgppbb.json"
trigger="hover"
colors="primary:#ffffff"></lord-icon>
colors="primary:#ffffff"
></lord-icon>
<span>Cart</span>
<span className="absolute right-2 top-1 bg-red-500 text-xs text-white rounded-full w-5 h-5 flex items-center justify-center mt-1">
5
Expand All @@ -140,29 +148,33 @@ const Aside = () => {

<Link
to="#"
className="flex items-center space-x-2 p-2 hover:bg-green-700 rounded-md">
className="flex items-center space-x-2 p-2 hover:bg-green-700 rounded-md"
>
<lord-icon
style={{
height: "20px",
width: "20px",
}}
src="https://cdn.lordicon.com/ulnswmkk.json"
trigger="hover"
colors="primary:#ffffff"></lord-icon>
colors="primary:#ffffff"
></lord-icon>
<span>Wishlist</span>
</Link>

<Link
to="#"
className="flex items-center space-x-2 p-2 hover:bg-green-700 rounded-md relative">
className="flex items-center space-x-2 p-2 hover:bg-green-700 rounded-md relative"
>
<lord-icon
style={{
height: "20px",
width: "20px",
}}
src="https://cdn.lordicon.com/lznlxwtc.json"
trigger="hover"
colors="primary:#ffffff"></lord-icon>
colors="primary:#ffffff"
></lord-icon>
<span>Notifications</span>
<span className="absolute right-2 top-1 bg-red-500 text-xs text-white rounded-full w-5 h-5 flex items-center justify-center mt-1">
2
Expand All @@ -171,28 +183,32 @@ const Aside = () => {

<Link
to="/Help"
className="flex items-center space-x-2 p-2 hover:bg-green-700 rounded-md">
className="flex items-center space-x-2 p-2 hover:bg-green-700 rounded-md"
>
<lord-icon
style={{
height: "20px",
width: "20px",
}}
src="https://cdn.lordicon.com/ojnjgkun.json"
trigger="hover"
colors="primary:#ffffff"></lord-icon>
colors="primary:#ffffff"
></lord-icon>
<span>Help</span>
</Link>
<Link
to="/contact"
className="flex items-center space-x-2 p-2 hover:bg-green-700 rounded-md">
className="flex items-center space-x-2 p-2 hover:bg-green-700 rounded-md"
>
<lord-icon
style={{
height: "20px",
width: "20px",
}}
src="https://cdn.lordicon.com/srsgifqc.json"
trigger="hover"
colors="primary:#ffffff"></lord-icon>
colors="primary:#ffffff"
></lord-icon>
<span>Contact Us</span>
</Link>

Expand All @@ -205,7 +221,8 @@ const Aside = () => {
padding: "12px 30px",
borderRadius: "8px",
border: "1px solid #98bf8cff",
}}>
}}
>
Logout
</button>
</div>
Expand Down
5 changes: 3 additions & 2 deletions src/User/components/Buttons/Logout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function Logout() {
if (confirmed) {
localStorage.setItem("isLoggedIn", false);
localStorage.removeItem("username");
navigate("/login");
navigate("/auth");
alert("Logout Successful.");
}
};
Expand All @@ -23,7 +23,8 @@ function Logout() {
padding: "12px 30px",
borderRadius: "8px",
border: "1px solid #98bf8cff",
}}>
}}
>
Logout
</button>
</>
Expand Down
2 changes: 1 addition & 1 deletion src/User/components/Navbar/AuthButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const AuthButton = ({ isLoggedIn, handleLogout }) =>
</button>
) : (
<Link
to="/login"
to="/auth"
className="ml-4 text-green-800 hover:text-gray-600 flex items-center">
<button
type="button"
Expand Down
26 changes: 17 additions & 9 deletions src/User/components/Navbar/MobileMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,46 +15,54 @@ const MobileMenu = ({ isOpen, isLoggedIn, username }) => (
</div>
) : (
<Link
to="/login"
className="text-black hover:text-gray-600 px-3 py-2 rounded-md text-lg font-medium flex items-center">
to="/auth"
className="text-black hover:text-gray-600 px-3 py-2 rounded-md text-lg font-medium flex items-center"
>
<FaUserCircle className="mr-2" />
Login
</Link>
)}
<Link
to="Dashboard"
className="text-black hover:text-gray-600 block px-4 py-2 text-sm">
className="text-black hover:text-gray-600 block px-4 py-2 text-sm"
>
Dashboard
</Link>
<Link
to="popularCategories/fashionAccessories"
className="text-black hover:text-gray-600 block px-4 py-2 text-sm">
className="text-black hover:text-gray-600 block px-4 py-2 text-sm"
>
Fashion
</Link>
<Link
to="popularCategories/customizedGifts"
className="text-black hover:text-gray-600 block px-4 py-2 text-sm">
className="text-black hover:text-gray-600 block px-4 py-2 text-sm"
>
Gifts
</Link>
<Link
to="popularCategories/furnitureDecor"
className="text-black hover:text-gray-600 block px-4 py-2 text-sm">
className="text-black hover:text-gray-600 block px-4 py-2 text-sm"
>
Furniture
</Link>
<Link
to="popularCategories/printingStationery"
className="text-black hover:text-gray-600 block px-4 py-2 text-sm">
className="text-black hover:text-gray-600 block px-4 py-2 text-sm"
>
Stationary
</Link>
<Link
to="popularCategories/bodyCare"
className="text-black hover:text-gray-600 block px-4 py-2 text-sm">
className="text-black hover:text-gray-600 block px-4 py-2 text-sm"
>
Body-Care
</Link>
</div>
<Link
to="/cart"
className="text-black hover:text-gray-600 px-3 py-2 rounded-md text-lg font-medium flex items-center">
className="text-black hover:text-gray-600 px-3 py-2 rounded-md text-lg font-medium flex items-center"
>
<FaShoppingCart className="mr-2" />
Cart
</Link>
Expand Down
Loading