Skip to content

Commit 7f6f81f

Browse files
authored
Merge pull request #35 from InternPulse/feature-base
Feature base
2 parents 1ef3971 + 207299c commit 7f6f81f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+2383
-2636
lines changed

package-lock.json

Lines changed: 520 additions & 1371 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"@radix-ui/react-slot": "^1.1.0",
2525
"@radix-ui/react-switch": "^1.1.1",
2626
"@radix-ui/react-tabs": "^1.1.1",
27+
"@radix-ui/react-toast": "^1.2.3",
2728
"admin-controls": "file:",
2829
"axios": "^1.7.8",
2930
"class-variance-authority": "^0.7.0",
@@ -33,6 +34,7 @@
3334
"lucide": "^0.468.0",
3435
"lucide-react": "^0.460.0",
3536
"motion": "^11.11.17",
37+
"next-themes": "^0.4.4",
3638
"react": "^18.3.1",
3739
"react-custom-scrollbars-2": "^4.5.0",
3840
"react-dom": "^18.3.1",
@@ -42,6 +44,7 @@
4244
"react-toastify": "^10.0.6",
4345
"react-world-flags": "^1.6.0",
4446
"recharts": "^2.14.1",
47+
"sonner": "^1.7.1",
4548
"swiper": "^11.1.15",
4649
"tailwind-merge": "^2.5.4",
4750
"tailwindcss-animate": "^1.0.7",

pnpm-lock.yaml

Lines changed: 275 additions & 81 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/greenpanel.png

39.4 KB
Loading

public/panel.png

15 KB
Loading

src/App.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,20 @@ import ContactUs from "./pages/ContactUs";
1717
import RenergyBlog from "./pages/RenergyBlog";
1818
import BlogDetail from "./pages/BlogDetail";
1919
import ProductList from "./shoppingcart/ProductList";
20-
import BuyerDashboard from "./buyer-dashboard/BuyerDashboard";
2120
//import AdminDashboard from "./components/AdminDashboard/AdminDashboard"; // From oo-branch
22-
21+
import { Toaster } from "sonner";
22+
import BuyerDashboard from "./buyer-dashboard/BuyerDashboard";
2323
function App() {
2424
return (
2525
<div className="overflow-x-hidden w-full max-w-full">
2626
<Routes>
27+
2728
<Route path="/" element={<LandingPage />} />
2829
<Route path="/about" element={<AboutUs />} />
2930
<Route path="/contact_us" element={<ContactUs />} />
3031
<Route path="/blog" element={<RenergyBlog />} />
3132
<Route path="/blog-detail" element={<BlogDetail />} />
33+
3234
<Route path="/vendor-dashboard/*" element={<VendorDashboard />} />
3335
{/* <Route path="/admin-dashboard" element={<AdminDashboard />} /> */}
3436

@@ -40,6 +42,7 @@ function App() {
4042
<Route path="/authentication/*" element={<Auth />} />
4143
<Route path="/*" element={<Vendor />} />
4244
<Route path="/product/*" element={<Product />} />
45+
4346
<Route path="/settings/*" element={<SettingsRoutes />} />
4447
<Route
4548
path="/security-compliance"
@@ -55,7 +58,9 @@ function App() {
5558
<Route path="/shopping-cart" element={<ProductList />} />
5659
<Route path="/admin/*" element={<AdminDashboardRoutes />} />{" "}
5760
{/* From oo-branch */}
61+
5862
</Routes>
63+
<Toaster/>
5964
</div>
6065
);
6166
}

src/authentication/buyerSignup.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,7 @@ const BuyerSignup: React.FC = () => {
170170
<div className="flex flex-col items-center space-y-4 lg:space-y-0 lg:space-x-4">
171171
<button
172172
className="flex items-center justify-center w-full px-6 py-2 border-2 border-gray-100 rounded-md hover:bg-green-800 transition"
173-
onClick={() =>
174-
(window.location.href =
175-
"https://renergy-hub-express-backend.onrender.com/api/v1/auth/google")
176-
}
173+
177174
>
178175
<img src={google} alt="google" className="mr-2" />
179176
Google

src/authentication/login.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ const Login = () => {
3636
response.headers["access-token"] || response.headers["Authorization"];
3737
console.log("Token received from API:", token);
3838
const user = response.data?.data;
39-
39+
const cookies = response.headers['set-cookie'];
40+
console.log('Cookies from response header:', cookies);
4041
if (token) {
4142
localStorage.setItem("authToken", token);
4243
console.log("Token saved to Local Storage:", token);
@@ -49,7 +50,7 @@ const Login = () => {
4950
setUserId(user.id);
5051

5152
if (user.userType === "CUSTOMER") {
52-
navigate("/userprofile", { state: { userId: user.id } });
53+
navigate("/buyer-dashboard", { state: { userId: user.id } });
5354
} else if (user.userType === "VENDOR") {
5455

5556
navigate("/vendor-dashboard", { state: { userId: user.id } });

src/authentication/vendorSignup.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,8 @@ const VendorSignup: React.FC = () => {
158158
<div className="flex flex-col items-center space-y-4 lg:space-y-0 lg:space-x-4">
159159
<button
160160
className="flex items-center justify-center w-full px-6 py-2 border-2 border-gray-100 rounded-md hover:bg-green-800 transition"
161-
onClick={() =>
162-
(window.location.href =
163-
"https://renergy-hub-express-backend.onrender.com/api/v1/auth/google")
164-
}
161+
162+
165163
>
166164
<img src={google} alt="google" className="mr-2" />
167165
Google
Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,46 @@
1-
2-
import { Routes, Route } from 'react-router-dom';
1+
import { Routes, Route, Outlet } from 'react-router-dom';
32
import BuyerOverview from "./pages/BuyerOverview";
43
import BuyerSideBar from "../components/BuyerSideBar";
54
import SavedProducts from './pages/SavedProducts';
65
import BuyerNavbar from './components/BuyerNavbar';
6+
import BuyerOrders from './pages/BuyerOrders';
7+
import CancelledOrders from './pages/CancelledOrders';
78

8-
9-
function BuyerDashboard() {
9+
function BuyerLayout() {
1010
return (
11-
<div className="flex h-screen">
12-
<BuyerSideBar/>
13-
<div className='flex flex-col h-screen'>
14-
<BuyerNavbar/>
15-
<Routes>
16-
<Route path="/" element={<BuyerOverview />} />
17-
<Route path="/saved-products" element={<SavedProducts />} />
18-
</Routes>
11+
<div className="flex h-screen">
12+
{/* Sidebar */}
13+
<BuyerSideBar />
14+
15+
{/* Main Content */}
16+
<div className="bg-[#E6E6E6] flex flex-col h-screen w-full">
17+
{/* Navbar and Header */}
18+
<BuyerNavbar />
19+
20+
{/* Outlet for page-specific content */}
21+
<div className="bg-[#E6E6E6] flex-grow">
22+
<Outlet />
1923
</div>
2024
</div>
25+
</div>
26+
);
27+
}
28+
29+
function BuyerDashboard() {
30+
return (
31+
<Routes>
32+
{/* Parent Route */}
33+
<Route path="/" element={<BuyerLayout />}>
34+
{/* Default Route (Overview) */}
35+
<Route index element={<BuyerOverview />} />
2136

22-
)
37+
{/* Saved Products Route */}
38+
<Route path="/saved-products" element={<SavedProducts />} />
39+
<Route path="/ordered-products" element={<BuyerOrders/>} />
40+
<Route path="/orders-cancelled" element={<CancelledOrders/>} />
41+
</Route>
42+
</Routes>
43+
);
2344
}
2445

25-
export default BuyerDashboard
46+
export default BuyerDashboard;

0 commit comments

Comments
 (0)