|
@@ -12,9 +12,13 @@ import {
|
|
|
import { productApi } from "../apis/productApi";
|
|
import { productApi } from "../apis/productApi";
|
|
|
import { Area } from "../services/product/type";
|
|
import { Area } from "../services/product/type";
|
|
|
import { accountLogout } from "../features/account/accuntSlice";
|
|
import { accountLogout } from "../features/account/accuntSlice";
|
|
|
|
|
+import { useSelector } from "react-redux";
|
|
|
|
|
+import { setAreas } from "../features/areas/areasSlice";
|
|
|
|
|
|
|
|
const Header: React.FC = () => {
|
|
const Header: React.FC = () => {
|
|
|
const navigate = useNavigate();
|
|
const navigate = useNavigate();
|
|
|
|
|
+ const areas = useSelector((state: any) => state.areas.areas);
|
|
|
|
|
+
|
|
|
const location = useLocation();
|
|
const location = useLocation();
|
|
|
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
|
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
|
|
const [isBuySimExpanded, setIsBuySimExpanded] = useState(false);
|
|
const [isBuySimExpanded, setIsBuySimExpanded] = useState(false);
|
|
@@ -32,6 +36,7 @@ const Header: React.FC = () => {
|
|
|
const dispatch = useAppDispatch();
|
|
const dispatch = useAppDispatch();
|
|
|
const langMenuRef = useRef<HTMLDivElement>(null);
|
|
const langMenuRef = useRef<HTMLDivElement>(null);
|
|
|
const userMenuRef = useRef<HTMLDivElement>(null);
|
|
const userMenuRef = useRef<HTMLDivElement>(null);
|
|
|
|
|
+ const account = localStorage.getItem("accountInfo");
|
|
|
|
|
|
|
|
const guideItems = [
|
|
const guideItems = [
|
|
|
{ label: "What is eSIM", path: "/support" },
|
|
{ label: "What is eSIM", path: "/support" },
|
|
@@ -39,6 +44,10 @@ const Header: React.FC = () => {
|
|
|
{ label: "Support", path: "/support" },
|
|
{ label: "Support", path: "/support" },
|
|
|
{ label: "Order Tracking Search", path: "/support" },
|
|
{ label: "Order Tracking Search", path: "/support" },
|
|
|
];
|
|
];
|
|
|
|
|
+ const dropdownRef = useRef<HTMLDivElement>(null);
|
|
|
|
|
+ const [areasList, setAreasList] = useState<Area[]>([]);
|
|
|
|
|
+ const [searchQuery, setSearchQuery] = useState("");
|
|
|
|
|
+ const [isSearchDropdownOpen, setIsSearchDropdownOpen] = useState(false);
|
|
|
|
|
|
|
|
const languages = [
|
|
const languages = [
|
|
|
{ code: "en", label: "English", flag: "us" },
|
|
{ code: "en", label: "English", flag: "us" },
|
|
@@ -52,23 +61,21 @@ const Header: React.FC = () => {
|
|
|
const res = await productApi.loadArea(
|
|
const res = await productApi.loadArea(
|
|
|
activeDesktopTab === "popular"
|
|
activeDesktopTab === "popular"
|
|
|
? { isCountry: "-1", isPopular: "1" }
|
|
? { isCountry: "-1", isPopular: "1" }
|
|
|
- : { isCountry: "1", isPopular: "1" }
|
|
|
|
|
|
|
+ : { isCountry: "0", isPopular: "-1" }
|
|
|
);
|
|
);
|
|
|
- setProducts(res.data);
|
|
|
|
|
return res;
|
|
return res;
|
|
|
},
|
|
},
|
|
|
onSuccess: (data) => {
|
|
onSuccess: (data) => {
|
|
|
dispatch(stopLoading());
|
|
dispatch(stopLoading());
|
|
|
- console.log("Get otp response data:", data);
|
|
|
|
|
if (data && data.errorCode === "0") {
|
|
if (data && data.errorCode === "0") {
|
|
|
- console.log("Get otp successful");
|
|
|
|
|
|
|
+ setProducts(data.data);
|
|
|
} else {
|
|
} else {
|
|
|
- console.error("Get otp failed, no token received");
|
|
|
|
|
|
|
+ console.error("Get area failed, no token received");
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
onError: (error: any) => {
|
|
onError: (error: any) => {
|
|
|
dispatch(stopLoading());
|
|
dispatch(stopLoading());
|
|
|
- console.error("Get otp error:", error.response.data);
|
|
|
|
|
|
|
+ console.error("Get area error:", error.response.data);
|
|
|
},
|
|
},
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -120,6 +127,77 @@ const Header: React.FC = () => {
|
|
|
getProductMutation.mutate();
|
|
getProductMutation.mutate();
|
|
|
}, [activeDesktopTab]);
|
|
}, [activeDesktopTab]);
|
|
|
|
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
|
|
+ if (!areas || areas.length === 0) getAreaMutation.mutate();
|
|
|
|
|
+ else {
|
|
|
|
|
+ setAreasList(areas);
|
|
|
|
|
+ console.log("Areas loaded from store:", areas);
|
|
|
|
|
+ }
|
|
|
|
|
+ }, []);
|
|
|
|
|
+
|
|
|
|
|
+ const getAreaMutation = useMutation({
|
|
|
|
|
+ mutationFn: async () => {
|
|
|
|
|
+ dispatch(startLoading({}));
|
|
|
|
|
+ const res = await productApi.loadArea({
|
|
|
|
|
+ isCountry: "-1",
|
|
|
|
|
+ isPopular: "-1",
|
|
|
|
|
+ });
|
|
|
|
|
+ return res;
|
|
|
|
|
+ },
|
|
|
|
|
+ onSuccess: (data) => {
|
|
|
|
|
+ dispatch(stopLoading());
|
|
|
|
|
+ console.log("Get area response data:", data);
|
|
|
|
|
+ if (data && data.errorCode === "0") {
|
|
|
|
|
+ console.log("Get area successful");
|
|
|
|
|
+ dispatch(setAreas(data.data as Area[]));
|
|
|
|
|
+ setAreasList(data.data as Area[]);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ console.error("Get area failed, no token received");
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ onError: (error: any) => {
|
|
|
|
|
+ dispatch(stopLoading());
|
|
|
|
|
+ console.error("Get area error:", error.response.data);
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ const handleSelect = (area: Area) => {
|
|
|
|
|
+ console.log("Selected area:", area);
|
|
|
|
|
+ setIsSearchDropdownOpen(false);
|
|
|
|
|
+ navigate(`/product/${area.id}`, {
|
|
|
|
|
+ state: {
|
|
|
|
|
+ ...area,
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const handleSearch = (query: string) => {
|
|
|
|
|
+ setSearchQuery(query);
|
|
|
|
|
+ if (query.trim() === "") {
|
|
|
|
|
+ setAreasList(areas);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ const filtered = areas.filter((area: Area) =>
|
|
|
|
|
+ area.areaName1.toLowerCase().includes(query.toLowerCase())
|
|
|
|
|
+ );
|
|
|
|
|
+ setAreasList(filtered);
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ useEffect(() => {
|
|
|
|
|
+ const handleClickOutside = (event: MouseEvent) => {
|
|
|
|
|
+ if (
|
|
|
|
|
+ dropdownRef.current &&
|
|
|
|
|
+ !dropdownRef.current.contains(event.target as Node)
|
|
|
|
|
+ ) {
|
|
|
|
|
+ setIsSearchDropdownOpen(false);
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+ document.addEventListener("mousedown", handleClickOutside);
|
|
|
|
|
+ return () => {
|
|
|
|
|
+ document.removeEventListener("mousedown", handleClickOutside);
|
|
|
|
|
+ };
|
|
|
|
|
+ }, []);
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<>
|
|
<>
|
|
|
<header className="sticky top-0 z-[60] w-full bg-white border-b border-slate-100 shadow-sm transition-all duration-300">
|
|
<header className="sticky top-0 z-[60] w-full bg-white border-b border-slate-100 shadow-sm transition-all duration-300">
|
|
@@ -141,15 +219,21 @@ const Header: React.FC = () => {
|
|
|
|
|
|
|
|
{/* Desktop Search on Scroll */}
|
|
{/* Desktop Search on Scroll */}
|
|
|
<div
|
|
<div
|
|
|
- className={`hidden lg:flex items-center transition-all duration-500 overflow-hidden ${
|
|
|
|
|
|
|
+ ref={dropdownRef}
|
|
|
|
|
+ className={`hidden lg:flex items-center transition-all duration-500 ${
|
|
|
isScrolled
|
|
isScrolled
|
|
|
- ? "flex-1 max-w-md mx-8 opacity-100"
|
|
|
|
|
- : "max-w-0 opacity-0 pointer-events-none"
|
|
|
|
|
|
|
+ ? "flex-1 max-w-md mx-8 opacity-100 overflow-visible"
|
|
|
|
|
+ : "max-w-0 opacity-0 pointer-events-none overflow-hidden"
|
|
|
}`}
|
|
}`}
|
|
|
>
|
|
>
|
|
|
<div className="relative w-full">
|
|
<div className="relative w-full">
|
|
|
<input
|
|
<input
|
|
|
type="text"
|
|
type="text"
|
|
|
|
|
+ value={searchQuery}
|
|
|
|
|
+ onChange={(e) => {
|
|
|
|
|
+ handleSearch(e.target.value);
|
|
|
|
|
+ }}
|
|
|
|
|
+ onFocus={() => setIsSearchDropdownOpen(true)}
|
|
|
placeholder="Search country..."
|
|
placeholder="Search country..."
|
|
|
className="w-full bg-slate-50 border border-slate-200 rounded-full py-2.5 px-6 pl-12 text-sm focus:outline-none focus:ring-2 focus:ring-red-100 focus:border-[#EE0434] transition-all"
|
|
className="w-full bg-slate-50 border border-slate-200 rounded-full py-2.5 px-6 pl-12 text-sm focus:outline-none focus:ring-2 focus:ring-red-100 focus:border-[#EE0434] transition-all"
|
|
|
/>
|
|
/>
|
|
@@ -166,9 +250,55 @@ const Header: React.FC = () => {
|
|
|
d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
|
|
d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
|
|
|
/>
|
|
/>
|
|
|
</svg>
|
|
</svg>
|
|
|
|
|
+
|
|
|
|
|
+ {/* Dropdown Menu */}
|
|
|
|
|
+ {isSearchDropdownOpen && (
|
|
|
|
|
+ <div className="absolute top-full left-0 right-0 mt-2 bg-white rounded-2xl shadow-[0_10px_40px_-10px_rgba(0,0,0,0.1)] border border-slate-100 overflow-hidden animate-in fade-in zoom-in-95 duration-200">
|
|
|
|
|
+ <div className="max-h-[300px] overflow-y-auto custom-scrollbar p-2">
|
|
|
|
|
+ <h3 className="text-[10px] font-bold text-slate-400 uppercase tracking-widest mb-2 px-3 pt-2">
|
|
|
|
|
+ Most Popular
|
|
|
|
|
+ </h3>
|
|
|
|
|
+ <div className="space-y-0.5">
|
|
|
|
|
+ {areasList.length > 0 ? (
|
|
|
|
|
+ areasList.map((p) => (
|
|
|
|
|
+ <button
|
|
|
|
|
+ key={p.id}
|
|
|
|
|
+ onClick={() => handleSelect(p)}
|
|
|
|
|
+ className="w-full flex items-center justify-between p-2 hover:bg-slate-50 rounded-xl transition-all group"
|
|
|
|
|
+ >
|
|
|
|
|
+ <div className="flex items-center space-x-3">
|
|
|
|
|
+ <div className="w-8 h-8 rounded-full border border-slate-100 overflow-hidden shadow-sm shrink-0">
|
|
|
|
|
+ <img
|
|
|
|
|
+ src={`${p.iconUrl}`}
|
|
|
|
|
+ alt={p.areaName1}
|
|
|
|
|
+ className="w-full h-full object-cover scale-150"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <span className="font-bold text-slate-700 text-sm group-hover:text-[#EE0434] transition-colors">
|
|
|
|
|
+ {p.areaName1}
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div className="text-right flex items-center space-x-1.5">
|
|
|
|
|
+ <span className="text-xs text-slate-400 font-medium">
|
|
|
|
|
+ from:
|
|
|
|
|
+ </span>
|
|
|
|
|
+ <span className="text-sm font-black text-[#EE0434]">
|
|
|
|
|
+ {p.minSellPrice.toLocaleString()} {p.curency}
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </button>
|
|
|
|
|
+ ))
|
|
|
|
|
+ ) : (
|
|
|
|
|
+ <div className="text-center py-4 text-slate-400 text-sm font-medium">
|
|
|
|
|
+ No matches found
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )}
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
-
|
|
|
|
|
{/* Desktop Nav */}
|
|
{/* Desktop Nav */}
|
|
|
<nav
|
|
<nav
|
|
|
className={`hidden lg:flex items-center h-full transition-all duration-300 ${
|
|
className={`hidden lg:flex items-center h-full transition-all duration-300 ${
|
|
@@ -269,52 +399,26 @@ const Header: React.FC = () => {
|
|
|
Region
|
|
Region
|
|
|
</button>
|
|
</button>
|
|
|
</div>
|
|
</div>
|
|
|
-
|
|
|
|
|
- {activeDesktopTab === "popular" ? (
|
|
|
|
|
- <div className="grid grid-cols-4 gap-y-8 gap-x-4">
|
|
|
|
|
- {products.map((c) => (
|
|
|
|
|
- <div
|
|
|
|
|
- key={c.areaName1}
|
|
|
|
|
- onClick={() => handleAreaClick(c)}
|
|
|
|
|
- className="flex items-center space-x-3 group cursor-pointer hover:bg-slate-50 p-2 rounded-xl transition-colors"
|
|
|
|
|
- >
|
|
|
|
|
- <div className="w-7 h-7 rounded-full overflow-hidden border border-slate-200 shadow-sm shrink-0">
|
|
|
|
|
- <img
|
|
|
|
|
- src={`${c.iconUrl}`}
|
|
|
|
|
- alt={c.areaName1}
|
|
|
|
|
- className="w-full h-full object-cover"
|
|
|
|
|
- />
|
|
|
|
|
- </div>
|
|
|
|
|
- <span className="text-[16px] font-bold text-slate-700 group-hover:text-[#EE0434] transition-colors">
|
|
|
|
|
- {c.areaName1}
|
|
|
|
|
- </span>
|
|
|
|
|
- </div>
|
|
|
|
|
- ))}
|
|
|
|
|
- </div>
|
|
|
|
|
- ) : (
|
|
|
|
|
- <div className="grid grid-cols-4 gap-y-6 gap-x-2">
|
|
|
|
|
- {products.map((region) => (
|
|
|
|
|
- <div
|
|
|
|
|
- key={region}
|
|
|
|
|
- onClick={() => handleAreaClick(region)}
|
|
|
|
|
- className="flex items-center space-x-3 group cursor-pointer hover:bg-slate-50 p-2 rounded-xl transition-colors min-w-0"
|
|
|
|
|
- >
|
|
|
|
|
- <div className="w-7 h-7 rounded-full bg-red-50 flex items-center justify-center shrink-0 border border-red-100/50">
|
|
|
|
|
- <svg
|
|
|
|
|
- className="w-4 h-4 text-red-300"
|
|
|
|
|
- fill="currentColor"
|
|
|
|
|
- viewBox="0 0 24 24"
|
|
|
|
|
- >
|
|
|
|
|
- <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7.01-3.55-7.5-7.5H7v-1H3.5c.49-3.95 3.55-7.01 7.5-7.5v3.5h1V3.5c3.95.49 7.01 3.55 7.5 7.5H17v1h3.5c-.49 3.95-3.55-7.01-7.5 7.5v-3.5h-1v3.5z" />
|
|
|
|
|
- </svg>
|
|
|
|
|
- </div>
|
|
|
|
|
- <span className="text-[16px] font-bold text-slate-700 group-hover:text-[#EE0434] transition-colors truncate">
|
|
|
|
|
- {region.areaName1}
|
|
|
|
|
- </span>
|
|
|
|
|
|
|
+ <div className="grid grid-cols-4 gap-y-8 gap-x-4">
|
|
|
|
|
+ {products.map((p) => (
|
|
|
|
|
+ <div
|
|
|
|
|
+ key={p.id}
|
|
|
|
|
+ onClick={() => handleAreaClick(p)}
|
|
|
|
|
+ className="flex items-center space-x-3 group cursor-pointer hover:bg-slate-50 p-2 rounded-xl transition-colors"
|
|
|
|
|
+ >
|
|
|
|
|
+ <div className="w-7 h-7 rounded-full overflow-hidden border border-slate-200 shadow-sm shrink-0">
|
|
|
|
|
+ <img
|
|
|
|
|
+ src={`${p.iconUrl}`}
|
|
|
|
|
+ alt={p.areaName1}
|
|
|
|
|
+ className="w-full h-full object-cover"
|
|
|
|
|
+ />
|
|
|
</div>
|
|
</div>
|
|
|
- ))}
|
|
|
|
|
- </div>
|
|
|
|
|
- )}
|
|
|
|
|
|
|
+ <span className="text-[16px] font-bold text-slate-700 group-hover:text-[#EE0434] transition-colors">
|
|
|
|
|
+ {p.areaName1}
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ ))}
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
)}
|
|
)}
|
|
@@ -420,56 +524,84 @@ const Header: React.FC = () => {
|
|
|
|
|
|
|
|
{isUserMenuOpen && (
|
|
{isUserMenuOpen && (
|
|
|
<div className="absolute top-full right-0 mt-3 w-56 bg-white rounded-[24px] shadow-[0_20px_40px_rgba(0,0,0,0.1)] border border-slate-50 overflow-hidden animate-in fade-in slide-in-from-top-2 duration-200 z-50">
|
|
<div className="absolute top-full right-0 mt-3 w-56 bg-white rounded-[24px] shadow-[0_20px_40px_rgba(0,0,0,0.1)] border border-slate-50 overflow-hidden animate-in fade-in slide-in-from-top-2 duration-200 z-50">
|
|
|
- <div className="flex flex-col py-2">
|
|
|
|
|
- <button
|
|
|
|
|
- onClick={() => {
|
|
|
|
|
- // onViewChange(ViewMode.ORDER_HISTORY);
|
|
|
|
|
- navigate("/order-history");
|
|
|
|
|
- setIsUserMenuOpen(false);
|
|
|
|
|
- }}
|
|
|
|
|
- className="flex items-center space-x-3 px-6 py-3.5 w-full text-left hover:bg-slate-50 text-slate-700 hover:text-[#EE0434] transition-colors"
|
|
|
|
|
- >
|
|
|
|
|
- <svg
|
|
|
|
|
- className="w-5 h-5 text-slate-400"
|
|
|
|
|
- fill="none"
|
|
|
|
|
- stroke="currentColor"
|
|
|
|
|
- viewBox="0 0 24 24"
|
|
|
|
|
|
|
+ {account !== null && (
|
|
|
|
|
+ <div className="flex flex-col py-2">
|
|
|
|
|
+ <button
|
|
|
|
|
+ onClick={() => {
|
|
|
|
|
+ navigate("/order-history");
|
|
|
|
|
+ setIsUserMenuOpen(false);
|
|
|
|
|
+ }}
|
|
|
|
|
+ className="flex items-center space-x-3 px-6 py-3.5 w-full text-left hover:bg-slate-50 text-slate-700 hover:text-[#EE0434] transition-colors"
|
|
|
>
|
|
>
|
|
|
- <path
|
|
|
|
|
- strokeLinecap="round"
|
|
|
|
|
- strokeLinejoin="round"
|
|
|
|
|
- strokeWidth={2}
|
|
|
|
|
- d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
|
|
|
|
|
- />
|
|
|
|
|
- </svg>
|
|
|
|
|
- <span className="font-bold text-sm">Orders</span>
|
|
|
|
|
- </button>
|
|
|
|
|
- <div className="h-px bg-slate-50 mx-4 my-1"></div>
|
|
|
|
|
- <button
|
|
|
|
|
- onClick={() => {
|
|
|
|
|
- // onViewChange(ViewMode.LOGIN); // Simulate logout
|
|
|
|
|
- dispatch(accountLogout());
|
|
|
|
|
- navigate("/login");
|
|
|
|
|
- setIsUserMenuOpen(false);
|
|
|
|
|
- }}
|
|
|
|
|
- className="flex items-center space-x-3 px-6 py-3.5 w-full text-left hover:bg-slate-50 text-slate-700 hover:text-[#EE0434] transition-colors"
|
|
|
|
|
- >
|
|
|
|
|
- <svg
|
|
|
|
|
- className="w-5 h-5 text-slate-400"
|
|
|
|
|
- fill="none"
|
|
|
|
|
- stroke="currentColor"
|
|
|
|
|
- viewBox="0 0 24 24"
|
|
|
|
|
|
|
+ <svg
|
|
|
|
|
+ className="w-5 h-5 text-slate-400"
|
|
|
|
|
+ fill="none"
|
|
|
|
|
+ stroke="currentColor"
|
|
|
|
|
+ viewBox="0 0 24 24"
|
|
|
|
|
+ >
|
|
|
|
|
+ <path
|
|
|
|
|
+ strokeLinecap="round"
|
|
|
|
|
+ strokeLinejoin="round"
|
|
|
|
|
+ strokeWidth={2}
|
|
|
|
|
+ d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
|
|
|
|
|
+ />
|
|
|
|
|
+ </svg>
|
|
|
|
|
+ <span className="font-bold text-sm">Orders</span>
|
|
|
|
|
+ </button>
|
|
|
|
|
+ <div className="h-px bg-slate-50 mx-4 my-1"></div>
|
|
|
|
|
+
|
|
|
|
|
+ <button
|
|
|
|
|
+ onClick={() => {
|
|
|
|
|
+ dispatch(accountLogout());
|
|
|
|
|
+ navigate("/login");
|
|
|
|
|
+ setIsUserMenuOpen(false);
|
|
|
|
|
+ }}
|
|
|
|
|
+ className="flex items-center space-x-3 px-6 py-3.5 w-full text-left hover:bg-slate-50 text-slate-700 hover:text-[#EE0434] transition-colors"
|
|
|
>
|
|
>
|
|
|
- <path
|
|
|
|
|
- strokeLinecap="round"
|
|
|
|
|
- strokeLinejoin="round"
|
|
|
|
|
- strokeWidth={2}
|
|
|
|
|
- d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"
|
|
|
|
|
- />
|
|
|
|
|
- </svg>
|
|
|
|
|
- <span className="font-bold text-sm">Logout</span>
|
|
|
|
|
- </button>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <svg
|
|
|
|
|
+ className="w-5 h-5 text-slate-400"
|
|
|
|
|
+ fill="none"
|
|
|
|
|
+ stroke="currentColor"
|
|
|
|
|
+ viewBox="0 0 24 24"
|
|
|
|
|
+ >
|
|
|
|
|
+ <path
|
|
|
|
|
+ strokeLinecap="round"
|
|
|
|
|
+ strokeLinejoin="round"
|
|
|
|
|
+ strokeWidth={2}
|
|
|
|
|
+ d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"
|
|
|
|
|
+ />
|
|
|
|
|
+ </svg>
|
|
|
|
|
+ <span className="font-bold text-sm">Logout</span>
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )}
|
|
|
|
|
+ {account === null && (
|
|
|
|
|
+ <div className="flex flex-col py-2">
|
|
|
|
|
+ <button
|
|
|
|
|
+ onClick={() => {
|
|
|
|
|
+ dispatch(accountLogout());
|
|
|
|
|
+ navigate("/login");
|
|
|
|
|
+ setIsUserMenuOpen(false);
|
|
|
|
|
+ }}
|
|
|
|
|
+ className="flex items-center space-x-3 px-6 py-3.5 w-full text-left hover:bg-slate-50 text-slate-700 hover:text-[#EE0434] transition-colors"
|
|
|
|
|
+ >
|
|
|
|
|
+ <svg
|
|
|
|
|
+ className="w-5 h-5 text-slate-400"
|
|
|
|
|
+ fill="none"
|
|
|
|
|
+ stroke="currentColor"
|
|
|
|
|
+ viewBox="0 0 24 24"
|
|
|
|
|
+ >
|
|
|
|
|
+ <path
|
|
|
|
|
+ strokeLinecap="round"
|
|
|
|
|
+ strokeLinejoin="round"
|
|
|
|
|
+ strokeWidth={2}
|
|
|
|
|
+ d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"
|
|
|
|
|
+ />
|
|
|
|
|
+ </svg>
|
|
|
|
|
+ <span className="font-bold text-sm">Login</span>
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )}
|
|
|
</div>
|
|
</div>
|
|
|
)}
|
|
)}
|
|
|
</div>
|
|
</div>
|
|
@@ -770,20 +902,22 @@ const Header: React.FC = () => {
|
|
|
>
|
|
>
|
|
|
Contact
|
|
Contact
|
|
|
</Link>
|
|
</Link>
|
|
|
- <button
|
|
|
|
|
- onClick={() => {
|
|
|
|
|
- // onViewChange(ViewMode.ORDER_HISTORY);
|
|
|
|
|
- navigate("/order-history");
|
|
|
|
|
- setIsMenuOpen(false);
|
|
|
|
|
- }}
|
|
|
|
|
- className={`w-full text-center py-5 px-6 rounded-3xl text-2xl font-black transition-all ${
|
|
|
|
|
- isActive("/order-history")
|
|
|
|
|
- ? "bg-red-50 text-[#EE0434]"
|
|
|
|
|
- : "text-slate-800 hover:bg-slate-50"
|
|
|
|
|
- }`}
|
|
|
|
|
- >
|
|
|
|
|
- Transaction History
|
|
|
|
|
- </button>
|
|
|
|
|
|
|
+
|
|
|
|
|
+ {account !== null && (
|
|
|
|
|
+ <button
|
|
|
|
|
+ onClick={() => {
|
|
|
|
|
+ navigate("/order-history");
|
|
|
|
|
+ setIsMenuOpen(false);
|
|
|
|
|
+ }}
|
|
|
|
|
+ className={`w-full text-center py-5 px-6 rounded-3xl text-2xl font-black transition-all ${
|
|
|
|
|
+ isActive("/order-history")
|
|
|
|
|
+ ? "bg-red-50 text-[#EE0434]"
|
|
|
|
|
+ : "text-slate-800 hover:bg-slate-50"
|
|
|
|
|
+ }`}
|
|
|
|
|
+ >
|
|
|
|
|
+ Transaction History
|
|
|
|
|
+ </button>
|
|
|
|
|
+ )}
|
|
|
|
|
|
|
|
<div className="w-full pt-4">
|
|
<div className="w-full pt-4">
|
|
|
<p className="text-center text-slate-400 font-bold text-xs uppercase tracking-widest mb-4">
|
|
<p className="text-center text-slate-400 font-bold text-xs uppercase tracking-widest mb-4">
|
|
@@ -814,16 +948,30 @@ const Header: React.FC = () => {
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div className="p-8 border-t border-slate-50 bg-slate-50/50">
|
|
<div className="p-8 border-t border-slate-50 bg-slate-50/50">
|
|
|
- <Link
|
|
|
|
|
- to="/login"
|
|
|
|
|
- onClick={() => {
|
|
|
|
|
- setIsMenuOpen(false);
|
|
|
|
|
- dispatch(accountLogout());
|
|
|
|
|
- }}
|
|
|
|
|
- className="w-full bg-gradient-to-r from-[#E21c34] to-[#500B28] text-white py-5 rounded-[40px] font-black text-2xl shadow-xl active:scale-[0.98] transition-all flex justify-center"
|
|
|
|
|
- >
|
|
|
|
|
- Login / Register
|
|
|
|
|
- </Link>
|
|
|
|
|
|
|
+ {account === null && (
|
|
|
|
|
+ <Link
|
|
|
|
|
+ to="/login"
|
|
|
|
|
+ onClick={() => {
|
|
|
|
|
+ setIsMenuOpen(false);
|
|
|
|
|
+ dispatch(accountLogout());
|
|
|
|
|
+ }}
|
|
|
|
|
+ className="w-full bg-gradient-to-r from-[#E21c34] to-[#500B28] text-white py-5 rounded-[40px] font-black text-2xl shadow-xl active:scale-[0.98] transition-all flex justify-center"
|
|
|
|
|
+ >
|
|
|
|
|
+ Login / Register
|
|
|
|
|
+ </Link>
|
|
|
|
|
+ )}
|
|
|
|
|
+ {account !== null && (
|
|
|
|
|
+ <Link
|
|
|
|
|
+ to="/login"
|
|
|
|
|
+ onClick={() => {
|
|
|
|
|
+ setIsMenuOpen(false);
|
|
|
|
|
+ dispatch(accountLogout());
|
|
|
|
|
+ }}
|
|
|
|
|
+ className="w-full bg-gradient-to-r from-[#E21c34] to-[#500B28] text-white py-5 rounded-[40px] font-black text-2xl shadow-xl active:scale-[0.98] transition-all flex justify-center"
|
|
|
|
|
+ >
|
|
|
|
|
+ Logout
|
|
|
|
|
+ </Link>
|
|
|
|
|
+ )}
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|