diff --git a/src/app/(customer)/(shop)/profile/(routes)/(landing)/page.tsx b/src/app/(customer)/(shop)/profile/(routes)/(landing)/page.tsx index 83b770d..30cae4d 100644 --- a/src/app/(customer)/(shop)/profile/(routes)/(landing)/page.tsx +++ b/src/app/(customer)/(shop)/profile/(routes)/(landing)/page.tsx @@ -1,33 +1,11 @@ -import Link from "next/link"; -import { requireSession } from "@/lib/auth/session"; -import { LogoutButton } from "@/components/customer/logout-button"; -import ProfileListTileItem from "@/components/profile/profile-menu-item"; import ProfileListMenu from "@/components/profile/profile-menu"; import ProfilePageHeadLine from "@/components/profile/profile-page-head-line"; import ProfilePersonDetailCard from "@/components/profile/profile-person-detail-card"; -// Minimal placeholder — winofyfrontenddoc.md's bottom-nav references a "پروفایل" -// tab, but no profile screen is documented yet in either doc. -export default async function ProfilePage() { - // await requireSession("/profile"); - return
+export default function ProfilePage() { + return
- -
- // return ( - //
- //

پروفایل

- // - // سفارش‌های من - // - // - // آدرس‌های من - // - //
- // - //
- //
- // ); + } diff --git a/src/app/(customer)/(shop)/profile/(routes)/wallet/page.tsx b/src/app/(customer)/(shop)/profile/(routes)/wallet/page.tsx index 9827f0b..5af139a 100644 --- a/src/app/(customer)/(shop)/profile/(routes)/wallet/page.tsx +++ b/src/app/(customer)/(shop)/profile/(routes)/wallet/page.tsx @@ -1,16 +1,15 @@ import ProfilePageHeadLine from '@/components/profile/profile-page-head-line' import TransactionHistory from '@/components/wallet/transaction-history' import WalletBlancCard from '@/components/wallet/wallet-blanc-card' -import React from 'react' const WalletPage = () => { return ( -
+
-
+ ) } diff --git a/src/app/(customer)/(shop)/profile/layout.tsx b/src/app/(customer)/(shop)/profile/layout.tsx new file mode 100644 index 0000000..96b622d --- /dev/null +++ b/src/app/(customer)/(shop)/profile/layout.tsx @@ -0,0 +1,17 @@ +import { requireSession } from '@/lib/auth/session'; +import React from 'react' + +interface ProfileLayoutInterface { + children: React.ReactNode; +} + + +const ProfileLayout = async ({ children }: ProfileLayoutInterface) => { + await requireSession("/profile"); + + return
+ {children} +
+} + +export default ProfileLayout \ No newline at end of file diff --git a/src/components/profile/profile-exit-account.tsx b/src/components/profile/profile-exit-account.tsx index ac53b5b..cb23a24 100644 --- a/src/components/profile/profile-exit-account.tsx +++ b/src/components/profile/profile-exit-account.tsx @@ -1,13 +1,27 @@ 'use client'; import { ChevronLeft, LogOutIcon } from "lucide-react" +import { useRouter } from "next/navigation"; +import { useTransition } from "react"; const ProfileExitAccount = () => { + + const router = useRouter(); + const [isPending, startTransition] = useTransition(); + + function handleLogout() { + startTransition(async () => { + await fetch("/api/auth/logout", { method: "POST" }); + router.push("/"); + router.refresh(); + }); + } + return
{ alert('logout latter....') }} + onClick={handleLogout} >
diff --git a/src/components/profile/profile-menu.tsx b/src/components/profile/profile-menu.tsx index bb670a2..5e3392e 100644 --- a/src/components/profile/profile-menu.tsx +++ b/src/components/profile/profile-menu.tsx @@ -5,18 +5,19 @@ import { MapPin, Wallet, Bell, - Headset + Headset, + CircleQuestionMark } from 'lucide-react'; import ProfileMenuItem from './profile-menu-item'; import ProfileExitAccount from './profile-exit-account'; const menuItems = [ - { id: 1, href: '/profile/address', text: 'سعادت‌آباد', icon: }, - { id: 2, href: '/profile/orders', text: 'سفارش‌های من', icon: }, - { id: 3, href: '/profile/addresses', text: 'آدرس‌های من', icon: }, - { id: 4, href: '/profile/wallet', text: 'کیف پول', icon: }, - { id: 5, href: '/profile/notifications', text: 'اعلان‌ها', icon: }, - { id: 6, href: '/profile/support', text: 'پشتیبانی', icon: }, + { id: 1, href: '/addresses', text: 'سعادت‌آباد', icon: }, + { id: 2, href: '/orders', text: 'سفارش‌های من', icon: }, + { id: 3, href: '/addresses', text: 'آدرس‌های من', icon: }, + { id: 4, href: '/profile/wallet', text: 'کیف پول', icon: }, + { id: 5, href: '/profile/notifications', text: 'اعلان‌ها', icon: }, + { id: 6, href: '/profile/support', text: 'پشتیبانی', icon: }, ]; const ProfileMenu = () => { @@ -31,7 +32,7 @@ const ProfileMenu = () => { isLast={index === menuItems.length - 1} /> ))} -
+
); diff --git a/src/proxy.ts b/src/proxy.ts index 728b2b1..c834035 100644 --- a/src/proxy.ts +++ b/src/proxy.ts @@ -12,7 +12,7 @@ const AUTH_REQUIRED_PREFIXES = [ "/order-groups", "/addresses", "/account", - // "/profile", + "/profile", "/notifications", ];