From f60f249c966b26f6ffcd016b4e27589fb0d233bf Mon Sep 17 00:00:00 2001 From: Hardik Date: Sat, 16 May 2026 21:31:57 +0530 Subject: [PATCH] feat(mobile): extend mobile experience to Accounts role for payment actions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add ACCOUNTS to MOBILE_ROLES so the desktop-required wall no longer blocks them on small screens. - MobileBottomNav is now role-aware: ACCOUNTS gets Payments + Profile tabs; MANAGER/SUPERUSER keep Approvals + Profile. Role prop threaded from layout → MobileBottomNav. - PaymentActions (both MGR_APPROVED and SENT_FOR_PAYMENT states) stacks vertically on small screens — input takes full width, button below it — then reverts to the horizontal inline layout at sm+ breakpoint. - Payments page card bottom row (status badge + action) stacks on mobile (flex-col sm:flex-row) so the reference input isn't squashed. Co-Authored-By: Claude Sonnet 4.6 --- App/pelagia-portal/app/(portal)/layout.tsx | 8 ++++---- .../app/(portal)/payments/page.tsx | 2 +- .../app/(portal)/payments/payment-actions.tsx | 8 ++++---- .../components/layout/mobile-bottom-nav.tsx | 20 +++++++++++++++---- 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/App/pelagia-portal/app/(portal)/layout.tsx b/App/pelagia-portal/app/(portal)/layout.tsx index 77b6567..9b75f02 100644 --- a/App/pelagia-portal/app/(portal)/layout.tsx +++ b/App/pelagia-portal/app/(portal)/layout.tsx @@ -7,8 +7,8 @@ import { MobileHeader } from "@/components/layout/mobile-header"; import { MobileBottomNav } from "@/components/layout/mobile-bottom-nav"; import { DesktopRequired } from "@/components/layout/desktop-required"; -// Roles that have a useful mobile experience (approval queue + PO review) -const MOBILE_ROLES = ["MANAGER", "SUPERUSER"] as const; +// Roles that have a useful mobile experience +const MOBILE_ROLES = ["MANAGER", "SUPERUSER", "ACCOUNTS"] as const; export default async function PortalLayout({ children, @@ -67,8 +67,8 @@ export default async function PortalLayout({ {children} - {/* Mobile bottom nav — managers/superusers only */} - {hasMobile && } + {/* Mobile bottom nav — roles with a mobile experience */} + {hasMobile && } {/* Full-screen overlay for roles without a mobile experience */} {!hasMobile && } diff --git a/App/pelagia-portal/app/(portal)/payments/page.tsx b/App/pelagia-portal/app/(portal)/payments/page.tsx index 45d03fe..95123fb 100644 --- a/App/pelagia-portal/app/(portal)/payments/page.tsx +++ b/App/pelagia-portal/app/(portal)/payments/page.tsx @@ -74,7 +74,7 @@ export default async function PaymentsPage() { -
+
+
{error && {error}} @@ -46,7 +46,7 @@ export function PaymentActions({ poId, poStatus }: { poId: string; poStatus: POS if (poStatus === "SENT_FOR_PAYMENT") { return ( -
+ {pending ? "Confirming…" : "Confirm Payment Sent"} diff --git a/App/pelagia-portal/components/layout/mobile-bottom-nav.tsx b/App/pelagia-portal/components/layout/mobile-bottom-nav.tsx index db3db9e..d598dde 100644 --- a/App/pelagia-portal/components/layout/mobile-bottom-nav.tsx +++ b/App/pelagia-portal/components/layout/mobile-bottom-nav.tsx @@ -2,20 +2,32 @@ import Link from "next/link"; import { usePathname } from "next/navigation"; -import { CheckSquare, UserCircle } from "lucide-react"; +import { CheckSquare, CreditCard, UserCircle } from "lucide-react"; import { cn } from "@/lib/utils"; +import type { Role } from "@prisma/client"; -const TABS = [ +const MANAGER_TABS = [ { href: "/approvals", label: "Approvals", icon: CheckSquare }, { href: "/profile", label: "Profile", icon: UserCircle }, ]; -export function MobileBottomNav() { +const ACCOUNTS_TABS = [ + { href: "/payments", label: "Payments", icon: CreditCard }, + { href: "/profile", label: "Profile", icon: UserCircle }, +]; + +function tabsForRole(role: Role) { + if (role === "ACCOUNTS") return ACCOUNTS_TABS; + return MANAGER_TABS; // MANAGER, SUPERUSER +} + +export function MobileBottomNav({ role }: { role: Role }) { const pathname = usePathname(); + const tabs = tabsForRole(role); return (