Skip to content

Commit ab07f11

Browse files
authored
Merge pull request #26 from BlendRush/Imasha_dev_connector
Imasha dev connector
2 parents 48dfa52 + c827eeb commit ab07f11

File tree

7 files changed

+120
-65
lines changed

7 files changed

+120
-65
lines changed

src/App.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useContext } from "react";
1+
import { useContext } from "react";
22
import { Routes, Route, Navigate } from "react-router-dom";
33
import HomePage from "./Pages/HomePage.jsx";
44
import SignIn from "./Pages/SignIn";
@@ -8,7 +8,7 @@ import ForgotPW from "./Pages/forgot-pw.jsx";
88
import Menu from "./Pages/Menu.jsx";
99
import Cart from "./Pages/Cart.jsx";
1010
import Orders from "./Pages/Order.jsx";
11-
import About from "./Pages/About.jsx"; // Assuming you have an About page
11+
import About from "./Pages/About.jsx";
1212
import { AuthContext } from "./context/AuthContext.jsx";
1313
import ResetPW from "./Pages/reset-pw.jsx";
1414

@@ -23,17 +23,17 @@ export default function App() {
2323
<Route path="/register" element={<Register />} />
2424
<Route path="/forgot-pw" element={<ForgotPW />} />
2525
<Route path="/reset-pw" element={<ResetPW />} />
26+
<Route path="/about" element={<About />} />
27+
<Route path="/menu" element={<Menu />} />
2628

2729
{token !== null && token !== "" ? (
2830
<>
29-
<Route path="/menu" element={<Menu />} />
3031
<Route path="/cart" element={<Cart />} />
3132
<Route path="/orders" element={<Orders />} />
32-
<Route path="/about" element={<About />} />
3333
<Route path="*" element={<div>Not Found</div>} />
3434
</>
3535
) : (
36-
<Route path="*" element={<Navigate to="/sign-in" />} />
36+
<Route path="*" element={<Navigate to="/home" />} />
3737
)}
3838
</Routes>
3939
);

src/Component/N-SearchBar.js

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
import { NavLink, Link, useNavigate } from "react-router-dom";
33
import { useNotification } from "../context/NotificationContext";
44
import { useCart } from "./CartContext";
5+
import { getLocalStoragedata } from "../helpers/Storage";
56

67
export default function NavBar({ search = "", onSearchChange }) {
78
const navigate = useNavigate();
89
const { openNotification } = useNotification();
910
const { count } = useCart();
11+
const token = getLocalStoragedata("token");
1012
const navLink = ({ isActive }) =>
1113
[
1214
"relative inline-flex items-center gap-2 px-3 py-1 rounded-lg",
@@ -104,33 +106,34 @@ export default function NavBar({ search = "", onSearchChange }) {
104106
{/* Right cluster: Cart (left) + Search (middle) + Logout icon (right) */}
105107
<div className="flex items-center gap-3">
106108
{/* Cart (left of search) */}
107-
<Link
108-
to="/cart"
109-
className="relative grid place-items-center rounded-xl border border-white/30 bg-white/60 p-2 hover:bg-white/80 transition"
110-
aria-label={`Cart${
111-
count ? `, ${count} item${count > 1 ? "s" : ""}` : ""
112-
}`}
113-
>
114-
<svg
115-
xmlns="http://www.w3.org/2000/svg"
116-
className="h-6 w-6 text-emerald-700"
117-
viewBox="0 0 24 24"
118-
fill="none"
119-
stroke="currentColor"
120-
strokeWidth="1.8"
109+
{token && (
110+
<Link
111+
to="/cart"
112+
className="relative grid place-items-center rounded-xl border border-white/30 bg-white/60 p-2 hover:bg-white/80 transition"
113+
aria-label={`Cart${
114+
count ? `, ${count} item${count > 1 ? "s" : ""}` : ""
115+
}`}
121116
>
122-
<path d="M6 6h15l-1.5 9h-12z" />
123-
<path d="M6 6l-1-3H2" />
124-
<circle cx="9" cy="20" r="1.6" />
125-
<circle cx="18" cy="20" r="1.6" />
126-
</svg>
127-
{count > 0 && (
128-
<span className="absolute -top-1.5 -right-1.5 grid h-5 min-w-[1.25rem] place-items-center rounded-full bg-emerald-600 px-1.5 text-[11px] font-bold text-white shadow ring-1 ring-white">
129-
{count}
130-
</span>
131-
)}
132-
</Link>
133-
117+
<svg
118+
xmlns="http://www.w3.org/2000/svg"
119+
className="h-6 w-6 text-emerald-700"
120+
viewBox="0 0 24 24"
121+
fill="none"
122+
stroke="currentColor"
123+
strokeWidth="1.8"
124+
>
125+
<path d="M6 6h15l-1.5 9h-12z" />
126+
<path d="M6 6l-1-3H2" />
127+
<circle cx="9" cy="20" r="1.6" />
128+
<circle cx="18" cy="20" r="1.6" />
129+
</svg>
130+
{count > 0 && (
131+
<span className="absolute -top-1.5 -right-1.5 grid h-5 min-w-[1.25rem] place-items-center rounded-full bg-emerald-600 px-1.5 text-[11px] font-bold text-white shadow ring-1 ring-white">
132+
{count}
133+
</span>
134+
)}
135+
</Link>
136+
)}
134137
{/* Search (middle) */}
135138
<div className="hidden md:block w-[340px]">
136139
<div className="relative">

src/Component/NavBar.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from "react";
21
import { NavLink } from "react-router-dom";
32
import Button from "../Component/Button";
43
import { useNavigate } from "react-router-dom";

src/Pages/About.jsx

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
// src/Pages/About.jsx
2-
import React from "react";
31
import { Link } from "react-router-dom";
4-
import AboutBg from "../assets/AboutBg.png"; // <-- put your about/background image here
2+
import AboutBg from "../assets/AboutBg.png";
53

64
export default function About() {
75
return (
@@ -29,43 +27,50 @@ export default function About() {
2927
</h1>
3028

3129
<p className="mt-10 text-slate-700">
32-
blendRUSH is a small, quality-obsessed juice bar focused on fresh smoothies,
33-
cold-pressed juices, and nourishing bowls. We keep it simple: real fruit,
34-
real flavor, blended to order—fast.
30+
blendRUSH is a small, quality-obsessed juice bar focused on fresh
31+
smoothies, cold-pressed juices, and nourishing bowls. We keep it
32+
simple: real fruit, real flavor, blended to order—fast.
3533
</p>
3634

3735
<p className="mt-3 text-slate-700">
38-
Our menu is built around seasonal produce, balanced recipes, and feel-good
39-
nutrition. Whether you’re post-workout, mid-study, or on the go, we’ve got a
40-
cup that matches your vibe.
36+
Our menu is built around seasonal produce, balanced recipes, and
37+
feel-good nutrition. Whether you’re post-workout, mid-study, or on the
38+
go, we’ve got a cup that matches your vibe.
4139
</p>
4240

43-
<h2 className="mt-6 text-xl font-bold text-slate-900">What we stand for</h2>
41+
<h2 className="mt-6 text-xl font-bold text-slate-900">
42+
What we stand for
43+
</h2>
4444
<ul className="mt-2 list-disc pl-5 text-slate-700 space-y-1">
4545
<li>100% natural ingredients—whole fruit and greens</li>
4646
<li>No added sugar or syrups; sweetness comes from fruit</li>
4747
<li>Made-to-order for peak freshness and flavor</li>
4848
<li>Eco-conscious packaging where possible</li>
4949
</ul>
5050

51-
<h2 className="mt-6 text-xl font-bold text-slate-900">Sourcing & sustainability</h2>
51+
<h2 className="mt-6 text-xl font-bold text-slate-900">
52+
Sourcing & sustainability
53+
</h2>
5254
<p className="mt-2 text-slate-700">
53-
We prioritize local markets and seasonal produce when possible, reduce waste
54-
with smart prep, and use recyclable/compostable cups where facilities exist.
55+
We prioritize local markets and seasonal produce when possible, reduce
56+
waste with smart prep, and use recyclable/compostable cups where
57+
facilities exist.
5558
</p>
5659

5760
<div className="mt-6 grid grid-cols-1 sm:grid-cols-2 gap-4 rounded-xl border bg-white p-4">
5861
<div>
5962
<h3 className="font-semibold text-slate-900">Hours</h3>
6063
<p className="text-slate-700 text-sm mt-1">
61-
Mon–Fri: 8:00–18:00<br />
64+
Mon–Fri: 8:00–18:00
65+
<br />
6266
Sat–Sun: 9:00–17:00
6367
</p>
6468
</div>
6569
<div>
6670
<h3 className="font-semibold text-slate-900">Contact</h3>
6771
<p className="text-slate-700 text-sm mt-1">
68-
hello@blendrush.example<br />
72+
hello@blendrush.example
73+
<br />
6974
+94 71 234 5678
7075
</p>
7176
</div>
@@ -93,15 +98,25 @@ export default function About() {
9398
<div className="text-base font-extrabold tracking-tight text-emerald-600">
9499
blend<span className="text-slate-800">RUSH</span>
95100
</div>
96-
<p className="text-xs text-slate-500">Fresh. Fast. Fruit-first.</p>
101+
<p className="text-xs text-slate-500">
102+
Fresh. Fast. Fruit-first.
103+
</p>
97104
</div>
98105
</div>
99106

100107
<nav className="text-sm text-slate-700 flex flex-wrap gap-4">
101-
<Link className="hover:text-slate-900" to="/home">Home</Link>
102-
<Link className="hover:text-slate-900" to="/menu">Menu</Link>
103-
<Link className="hover:text-slate-900" to="/orders">Orders</Link>
104-
<Link className="hover:text-slate-900" to="/about">About</Link>
108+
<Link className="hover:text-slate-900" to="/home">
109+
Home
110+
</Link>
111+
<Link className="hover:text-slate-900" to="/menu">
112+
Menu
113+
</Link>
114+
<Link className="hover:text-slate-900" to="/orders">
115+
Orders
116+
</Link>
117+
<Link className="hover:text-slate-900" to="/about">
118+
About
119+
</Link>
105120
</nav>
106121

107122
<div className="text-sm text-slate-600">

src/Pages/Menu.jsx

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { getMenuService } from "../services/MenuService.jsx";
66
import { getLocalStoragedata } from "../helpers/Storage.js";
77
import { useNotification } from "../context/NotificationContext.jsx";
88
import { useCart } from "../Component/CartContext.jsx";
9+
import NavBar from "../Component/NavBar.js";
910

1011
const formatCurrency = (n) => `$${n.toFixed(2)}`;
1112

@@ -21,12 +22,13 @@ export default function MenuPage() {
2122
const [categories, setCategories] = useState([]);
2223
const { openNotification } = useNotification();
2324
const serviceURL = process.env.REACT_APP_API_URL;
25+
const token = getLocalStoragedata("token");
2426
const { fetchCart } = useCart();
2527

2628
useEffect(() => {
2729
fetchMenuItemData();
2830
fetchCart();
29-
}, []);
31+
}, [fetchCart]);
3032

3133
const fetchMenuItemData = async () => {
3234
setLoading(true);
@@ -142,7 +144,11 @@ export default function MenuPage() {
142144

143145
{/* Main content */}
144146
<div className="relative">
145-
<NavSearchBar search={search} onSearchChange={(v) => setSearch(v)} />
147+
{token ? (
148+
<NavSearchBar search={search} onSearchChange={(v) => setSearch(v)} />
149+
) : (
150+
<NavBar />
151+
)}
146152
<main id="menu" className="mx-auto max-w-6xl px-4 pb-24">
147153
{/* Hero */}
148154
<section className="mt-8 rounded-2xl bg-emerald-600/90 text-white p-6 md:p-8 flex flex-col md:flex-row items-center gap-6">
@@ -259,12 +265,14 @@ export default function MenuPage() {
259265
</div>
260266

261267
<div className="mt-3 flex items-center justify-between">
262-
<button
263-
onClick={() => handleAdd(item)}
264-
className="rounded-xl bg-emerald-600 text-white px-4 py-2 text-sm font-medium hover:bg-emerald-700 active:scale-[0.99] transition"
265-
>
266-
Add
267-
</button>
268+
{token && (
269+
<button
270+
onClick={() => handleAdd(item)}
271+
className="rounded-xl bg-emerald-600 text-white px-4 py-2 text-sm font-medium hover:bg-emerald-700 active:scale-[0.99] transition"
272+
>
273+
Add
274+
</button>
275+
)}
268276

269277
<details>
270278
<summary className="cursor-pointer text-sm text-emerald-700 hover:underline">

src/Pages/Register.jsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// src/Pages/Register.jsx
2-
import React, { useRef, useState, useEffect, useContext } from "react";
1+
import { useRef, useState, useEffect, useContext } from "react";
32
import signupBg from "../assets/signup.png";
43
import { Form, Input, Checkbox, Button, Typography, Modal } from "antd";
54
import { MailOutlined, LockOutlined } from "@ant-design/icons";
@@ -90,7 +89,22 @@ export default function Register() {
9089
className="relative min-h-screen bg-cover bg-center flex items-center justify-center"
9190
style={{ backgroundImage: `url(${signupBg})` }}
9291
>
93-
{/* CARD — centered, then nudged DOWN to sit inside the monitor */}
92+
<div className="absolute top-6 left-64">
93+
<Button
94+
type="link"
95+
className="!text-white !font-semibold"
96+
onClick={() => navigate("/home")}
97+
>
98+
<span className="inline-grid place-items-center h-9 w-9 rounded-xl bg-emerald-500 text-white font-black">
99+
bR
100+
</span>
101+
<div className="leading-tight">
102+
<div className="text-base font-extrabold tracking-tight text-emerald-600">
103+
blend<span className="text-slate-800">RUSH</span>
104+
</div>
105+
</div>
106+
</Button>
107+
</div>
94108
<div
95109
className="
96110
bg-white/0 rounded-2xl shadow-xl ring-1 ring-black/5 backdrop-blur

src/Pages/SignIn.jsx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// src/Pages/SignIn.jsx
2-
import React, { useContext, useState } from "react";
1+
import { useContext, useState } from "react";
32
import signupBg from "../assets/signup.png";
43
import { Form, Input, Button, Typography, Checkbox } from "antd";
54
import { MailOutlined, LockOutlined, GoogleOutlined } from "@ant-design/icons";
@@ -69,6 +68,23 @@ export default function SignIn() {
6968
className="relative min-h-screen bg-cover bg-center flex flex-col items-center justify-center px-4"
7069
style={{ backgroundImage: `url(${signupBg})` }}
7170
>
71+
<div className="absolute top-6 left-64">
72+
<Button
73+
type="link"
74+
className="!text-white !font-semibold"
75+
onClick={() => navigate("/home")}
76+
>
77+
<span className="inline-grid place-items-center h-9 w-9 rounded-xl bg-emerald-500 text-white font-black">
78+
bR
79+
</span>
80+
<div className="leading-tight">
81+
<div className="text-base font-extrabold tracking-tight text-emerald-600">
82+
blend<span className="text-slate-800">RUSH</span>
83+
</div>
84+
</div>
85+
</Button>
86+
</div>
87+
7288
{/* CARD */}
7389
<div
7490
className="

0 commit comments

Comments
 (0)