From a6af487b67de1eb96a50b865eb6ef443ff68260e Mon Sep 17 00:00:00 2001 From: "nabanita.jana" Date: Mon, 14 Jul 2025 16:11:34 +0530 Subject: [PATCH] fix: fix the layout of fund transfer --- .../funds_transfer/add_beneficary/page.tsx | 0 src/app/(main)/funds_transfer/layout.tsx | 127 +++++++++--------- 2 files changed, 65 insertions(+), 62 deletions(-) create mode 100644 src/app/(main)/funds_transfer/add_beneficary/page.tsx diff --git a/src/app/(main)/funds_transfer/add_beneficary/page.tsx b/src/app/(main)/funds_transfer/add_beneficary/page.tsx new file mode 100644 index 0000000..e69de29 diff --git a/src/app/(main)/funds_transfer/layout.tsx b/src/app/(main)/funds_transfer/layout.tsx index dcc186c..0ab1188 100644 --- a/src/app/(main)/funds_transfer/layout.tsx +++ b/src/app/(main)/funds_transfer/layout.tsx @@ -1,71 +1,74 @@ "use client"; -import { Button, Group } from '@mantine/core'; -import { IconHome } from '@tabler/icons-react'; +import { Divider, Stack, Text } from '@mantine/core'; +import { usePathname } from 'next/navigation'; import Link from 'next/link'; -import React from 'react'; +import React, { useEffect, useState } from 'react'; +import { useRouter } from "next/navigation"; export default function Layout({ children }: { children: React.ReactNode }) { - return ( -
-
-

Menu

+ const [authorized, SetAuthorized] = useState(null); + const router = useRouter(); + const pathname = usePathname(); - - - + const links = [ + { label: " Quick Pay", href: "/funds_transfer" }, + { label: "Send to Beneficiary", href: "/accounts/account_statement" }, + { label: "Transfer within the bank", href: "/accounts/account_statement" }, + { label: "Add Beneficary", href: "/accounts/account_statement" }, + { label: "View Beneficary ", href: "/accounts/account_statement" }, + ]; + useEffect(() => { + const token = localStorage.getItem("access_token"); + if (!token) { + SetAuthorized(false); + router.push("/login"); + } + else { + SetAuthorized(true); + } + }, []); - - - + if (authorized) { + return ( +
+
+ + + Send Money + + - - - + + {links.map(link => { + const isActive = pathname === link.href; + return ( + + {link.label} + + ); + })} + +
+ +
+ {children} +
- - {/* Main content */} -
- {children} -
-
- ); + ); + } }