119 lines
3.9 KiB
JavaScript
119 lines
3.9 KiB
JavaScript
import { m as require_jsx_runtime } from "../_libs/react+tanstack__react-query.mjs";
|
|
import { b as FileText, g as MapPin, h as MessageSquare, l as ShoppingCart, o as Ticket, p as Package, r as User, v as Info } from "../_libs/lucide-react.mjs";
|
|
import { a as p, c as ProfileImage, i as MyButton, s as MyTouchableOpacity, t as AppContainer } from "./src-u_N1opJl.mjs";
|
|
import { l as useNavigate } from "../_libs/@tanstack/react-router+[...].mjs";
|
|
import { n as useAuth } from "./auth-context-DzjwonUC.mjs";
|
|
//#region node_modules/.nitro/vite/services/ssr/assets/me-Dn8Tk_dJ.js
|
|
var import_jsx_runtime = require_jsx_runtime();
|
|
function MePage() {
|
|
const navigate = useNavigate();
|
|
const { user, logout } = useAuth();
|
|
if (!user) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
className: "flex flex-col items-center gap-4 py-20",
|
|
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(p, { children: "Please sign in" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyButton, {
|
|
textContent: "Sign In",
|
|
onClick: () => navigate({ to: "/login" })
|
|
})]
|
|
}) });
|
|
const menuItems = [
|
|
{
|
|
section: "Shopping & Activity",
|
|
items: [
|
|
{
|
|
icon: Package,
|
|
label: "My Orders",
|
|
to: "/me/orders"
|
|
},
|
|
{
|
|
icon: ShoppingCart,
|
|
label: "My Cart",
|
|
to: "/cart"
|
|
},
|
|
{
|
|
icon: Ticket,
|
|
label: "Coupons",
|
|
to: "/me/coupons"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
section: "Saved Information",
|
|
items: [{
|
|
icon: MapPin,
|
|
label: "Addresses",
|
|
to: "/me/addresses"
|
|
}, {
|
|
icon: User,
|
|
label: "Profile Settings",
|
|
to: "/me/edit-profile"
|
|
}]
|
|
},
|
|
{
|
|
section: "Support",
|
|
items: [{
|
|
icon: MessageSquare,
|
|
label: "Help & Complaints",
|
|
to: "/me/complaints"
|
|
}, {
|
|
icon: FileText,
|
|
label: "Terms & Conditions",
|
|
to: "/me/terms"
|
|
}]
|
|
},
|
|
{
|
|
section: "About",
|
|
items: [{
|
|
icon: Info,
|
|
label: "About Us",
|
|
to: "/me/about"
|
|
}]
|
|
}
|
|
];
|
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AppContainer, { children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
className: "mb-6 flex items-center gap-4 rounded-xl bg-brand-50 p-4",
|
|
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProfileImage, {
|
|
uri: user.profileImage,
|
|
size: 64
|
|
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(p, {
|
|
weight: "bold",
|
|
className: "text-lg",
|
|
children: user.name || "User"
|
|
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(p, {
|
|
className: "text-sm text-gray-500",
|
|
children: user.mobile
|
|
})] })]
|
|
}),
|
|
menuItems.map((section) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
className: "mb-6",
|
|
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(p, {
|
|
weight: "semibold",
|
|
className: "mb-2 text-sm text-gray-500 uppercase tracking-wide",
|
|
children: section.section
|
|
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
className: "rounded-xl border border-gray-100 bg-white shadow-sm",
|
|
children: section.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyTouchableOpacity, {
|
|
onClick: () => navigate({ to: item.to }),
|
|
className: "flex w-full items-center gap-3 border-b border-gray-50 px-4 py-3.5 last:border-b-0",
|
|
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(item.icon, { className: "h-5 w-5 text-gray-400" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(p, {
|
|
className: "flex-1 text-left text-sm",
|
|
children: item.label
|
|
})]
|
|
}, item.label))
|
|
})]
|
|
}, section.section)),
|
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyButton, {
|
|
fullWidth: true,
|
|
onClick: logout,
|
|
variant: "red",
|
|
className: "mb-8",
|
|
textContent: "Logout"
|
|
}),
|
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(p, {
|
|
className: "mb-8 text-center text-xs text-gray-400",
|
|
children: "Version 1.0.0"
|
|
})
|
|
] });
|
|
}
|
|
//#endregion
|
|
export { MePage as component };
|