eeshaAI commited on
Commit
b8dd496
·
1 Parent(s): 02e775b

fix: MobileNav outside SwipeBack transform + remove duplicate import

Browse files
src/app/layout.tsx CHANGED
@@ -8,6 +8,7 @@ import { LayoutShell } from "@/components/layout-shell";
8
  import { SwipeBack } from "@/components/swipe-back";
9
  import { OptimisticUIProvider } from "@/components/optimistic-ui";
10
  import { GlobalSpotlight } from "@/components/global-spotlight";
 
11
 
12
  const jakarta = Plus_Jakarta_Sans({
13
  variable: "--font-geist-sans",
@@ -30,6 +31,22 @@ export const metadata: Metadata = {
30
  },
31
  };
32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  export default function RootLayout({
34
  children,
35
  }: Readonly<{
@@ -42,11 +59,9 @@ export default function RootLayout({
42
  >
43
  <AuthProvider>
44
  <OptimisticUIProvider>
45
- <SwipeBack>
46
- <LayoutShell>
47
- {children}
48
- </LayoutShell>
49
- </SwipeBack>
50
  <GlobalSpotlight />
51
  <Toaster />
52
  </OptimisticUIProvider>
 
8
  import { SwipeBack } from "@/components/swipe-back";
9
  import { OptimisticUIProvider } from "@/components/optimistic-ui";
10
  import { GlobalSpotlight } from "@/components/global-spotlight";
11
+ import { usePathname } from "next/navigation";
12
 
13
  const jakarta = Plus_Jakarta_Sans({
14
  variable: "--font-geist-sans",
 
31
  },
32
  };
33
 
34
+ function NavShell({ children }: { children: React.ReactNode }) {
35
+ const pathname = usePathname();
36
+ const hideMobileNav = pathname === '/login' || pathname.startsWith('/product');
37
+
38
+ return (
39
+ <>
40
+ <SwipeBack>
41
+ <main className={`flex-1 ${hideMobileNav ? '' : 'pb-20 md:pb-0'}`}>
42
+ {children}
43
+ </main>
44
+ </SwipeBack>
45
+ {!hideMobileNav && <MobileNav />}
46
+ </>
47
+ );
48
+ }
49
+
50
  export default function RootLayout({
51
  children,
52
  }: Readonly<{
 
59
  >
60
  <AuthProvider>
61
  <OptimisticUIProvider>
62
+ <NavShell>
63
+ {children}
64
+ </NavShell>
 
 
65
  <GlobalSpotlight />
66
  <Toaster />
67
  </OptimisticUIProvider>
src/components/swipe-back.tsx CHANGED
@@ -1,8 +1,8 @@
1
  'use client';
2
 
3
- import { useEffect, useState } from 'react';
4
  import { usePathname, useRouter } from 'next/navigation';
5
- import { motion, AnimatePresence, PanInfo } from 'framer-motion';
6
 
7
  /**
8
  * SwipeBack — iOS-style edge swipe to go back.
@@ -132,4 +132,3 @@ export function SwipeBack({ children }: { children: React.ReactNode }) {
132
  );
133
  }
134
 
135
- import { useRef } from 'react';
 
1
  'use client';
2
 
3
+ import { useEffect, useState, useRef } from 'react';
4
  import { usePathname, useRouter } from 'next/navigation';
5
+ import { motion, AnimatePresence } from 'framer-motion';
6
 
7
  /**
8
  * SwipeBack — iOS-style edge swipe to go back.
 
132
  );
133
  }
134