Skip to content

refactor: split layout into (app) and (funnels) route groups#1598

Open
sidneyswift wants to merge 1 commit intotestfrom
feature/funnels-route-group
Open

refactor: split layout into (app) and (funnels) route groups#1598
sidneyswift wants to merge 1 commit intotestfrom
feature/funnels-route-group

Conversation

@sidneyswift
Copy link
Copy Markdown
Collaborator

@sidneyswift sidneyswift commented Mar 25, 2026

Summary

  • Split root layout.tsx into a thin HTML shell (fonts, metadata, analytics) and moved the SaaS UI (Providers, Sidebar, Header, modals, toasts) into (app)/layout.tsx
  • Moved all 20+ existing page routes into (app)/ route group — URLs are unchanged since route groups are invisible to the browser
  • Created (funnels)/ route group with a bare layout for standalone conversion funnels, completely isolated from the SaaS shell
  • Added song-drop/ as the first funnel placeholder at /song-drop

Test plan

  • Verify all existing routes load correctly (/, /chat, /tasks, /artists, /settings/connectors, etc.)
  • Verify /song-drop loads as a bare page with no sidebar/header
  • Verify Privy auth still works on SaaS routes
  • Verify pnpm build passes (confirmed locally — 46 routes, 0 errors)

Made with Cursor

Summary by CodeRabbit

  • New Features

    • Introduced a new "Song Drop" page allowing users to submit their music for processing.
  • Refactor

    • Restructured app layouts into modular, section-specific components for improved organization and separation of concerns.

Move all existing SaaS routes into (app)/ route group with its own
layout containing Providers, Sidebar, Header, and all shell UI.
Root layout now only has the HTML shell (fonts, metadata, analytics).

Create (funnels)/ route group with a bare layout for standalone
conversion funnels. Add song-drop/ as the first funnel placeholder
at /song-drop.

URLs are unchanged — route groups are invisible to the browser.

Made-with: Cursor
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
recoup-chat Ready Ready Preview Mar 25, 2026 9:02pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 25, 2026

📝 Walkthrough

Walkthrough

The application's layout architecture is restructured to support separate layout branches. App-specific UI components (sidebar, header, modals, notification containers, providers) are moved from the root layout into a dedicated AppLayout component. A new funnels section is introduced with its own minimal layout, including a song drop page. The root layout is simplified to render only children and deferred analytics.

Changes

Cohort / File(s) Summary
App Layout Shell
app/(app)/layout.tsx
New AppLayout component wraps children with Providers, Suspense, responsive flex container, and renders Sidebar, Header, ArtistSettingModal, styled main content region, ArtistsSidebar, MobileDownloadModal, plus global notification UIs (ToastContainer, Toaster).
Funnels Section
app/(funnels)/layout.tsx, app/(funnels)/song-drop/page.tsx
New FunnelsLayout wraps content in viewport-height container. New SongDropPage presents centered headline and supporting text for song drop funnel entry point.
Root Layout Simplification
app/layout.tsx
Removes Providers, Suspense, Sidebar, Header, ArtistSettingModal, ArtistsSidebar, MobileDownloadModal, ToastContainer, Toaster, and flex page structure. Now renders only children and DeferredAnalytics in body.

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

From tangled roots, a cleaner tree grows,
App and funnels in separate rows,
Layouts branching left and right,
Architecture shining bright! ✨

🚥 Pre-merge checks | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Solid & Clean Code ⚠️ Warning Refactoring violates Single Responsibility Principle by splitting Providers across layouts, leaving (funnels) routes without critical contexts like ThemeProvider, PrivyProvider, and QueryClientProvider. Move Providers wrapper to root app/layout.tsx around {children} inside , then remove duplicate wrapper from app/(app)/layout.tsx for centralized initialization.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/funnels-route-group

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
app/(funnels)/song-drop/page.tsx (1)

3-12: Give the standalone funnel a real content landmark.

This page owns the whole flow but exposes it through generic divs only. Making the outer wrapper <main> gives keyboard and screen-reader users a stable entry point without extra ARIA.

♻️ Suggested tweak
-    <div className="flex items-center justify-center min-h-dvh">
+    <main className="flex items-center justify-center min-h-dvh">
       <div className="text-center space-y-4">
         <h1 className="text-4xl font-bold tracking-tight">
           Drop your song.
         </h1>
         <p className="text-lg text-muted-foreground">
           We&apos;ll do the rest.
         </p>
       </div>
-    </div>
+    </main>
As per coding guidelines, "Use semantic HTML elements appropriate to the component's role" and "Start with semantic HTML first, then augment with ARIA if needed".
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/`(funnels)/song-drop/page.tsx around lines 3 - 12, The outer wrapper
currently uses a plain div which provides no semantic landmark for the funnel;
replace the outermost <div className="flex items-center justify-center
min-h-dvh"> with a semantic <main> element (keeping the same className and
internal structure) so keyboard and screen-reader users get a proper content
landmark—ensure the inner structure (<div className="text-center space-y-4">,
<h1>, <p>) remains unchanged and do not add ARIA unless needed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/layout.tsx`:
- Around line 70-72: The Providers wrapper (which composes ThemeProvider,
PrivyProvider, QueryClientProvider, FunnelReportProvider, PaymentProvider) was
moved inside the (app) route and so non-(app) branches (e.g., (funnels)) render
without those contexts; move the Providers component up in app/layout.tsx so it
wraps the whole route-group split (wrap children and DeferredAnalytics) and then
remove the nested Providers wrapper from app/(app)/layout.tsx so the provider
tree is initialized once for all routes.

---

Nitpick comments:
In `@app/`(funnels)/song-drop/page.tsx:
- Around line 3-12: The outer wrapper currently uses a plain div which provides
no semantic landmark for the funnel; replace the outermost <div className="flex
items-center justify-center min-h-dvh"> with a semantic <main> element (keeping
the same className and internal structure) so keyboard and screen-reader users
get a proper content landmark—ensure the inner structure (<div
className="text-center space-y-4">, <h1>, <p>) remains unchanged and do not add
ARIA unless needed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6d8bd8a4-f0d5-48ed-bbdc-7c840c084d9f

📥 Commits

Reviewing files that changed from the base of the PR and between c39460a and a8b027e.

📒 Files selected for processing (38)
  • app/(app)/access/page.tsx
  • app/(app)/agents/page.tsx
  • app/(app)/artists/page.tsx
  • app/(app)/catalogs/[catalogId]/page.tsx
  • app/(app)/catalogs/page.tsx
  • app/(app)/chat/[roomId]/page.tsx
  • app/(app)/chat/page.tsx
  • app/(app)/docs/account/constants.ts
  • app/(app)/docs/account/page.tsx
  • app/(app)/docs/base/constants.ts
  • app/(app)/docs/base/page.tsx
  • app/(app)/docs/fans/constants.ts
  • app/(app)/docs/fans/page.tsx
  • app/(app)/docs/posts/constants.ts
  • app/(app)/docs/posts/page.tsx
  • app/(app)/docs/segment_report/constants.ts
  • app/(app)/docs/segment_report/page.tsx
  • app/(app)/fans/page.tsx
  • app/(app)/files/page.tsx
  • app/(app)/keys/page.tsx
  • app/(app)/layout.tsx
  • app/(app)/offline/page.tsx
  • app/(app)/page.tsx
  • app/(app)/posts/page.tsx
  • app/(app)/privacy/page.tsx
  • app/(app)/sandboxes/layout.tsx
  • app/(app)/sandboxes/page.tsx
  • app/(app)/segment/[segmentId]/page.tsx
  • app/(app)/segments/page.tsx
  • app/(app)/settings/connectors/page.tsx
  • app/(app)/signin/page.tsx
  • app/(app)/sms/page.tsx
  • app/(app)/tasks/[runId]/page.tsx
  • app/(app)/tasks/page.tsx
  • app/(app)/terms/page.tsx
  • app/(funnels)/layout.tsx
  • app/(funnels)/song-drop/page.tsx
  • app/layout.tsx

Comment on lines 70 to 72
<body className={`${geist.variable} antialiased`}>
<Suspense>
<Providers>
<div className="flex flex-col md:flex-row">
<Sidebar />
<Header />
<ArtistSettingModal />
<div className="grow flex h-[100dvh] pt-16 md:pt-0 md:h-screen overflow-hidden bg-sidebar">
<div className="size-full md:py-4 md:pl-4">
<div className="size-full bg-card overflow-y-auto md:rounded-xl flex flex-col md:shadow-md md:border md:border-border">
{children}
</div>
</div>
<ArtistsSidebar />
</div>
<MobileDownloadModal />
</div>
<ToastContainer />
<Toaster />
</Providers>
</Suspense>
{children}
<DeferredAnalytics />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Keep shared providers above the route-group split.

Providers now only wraps the (app) branch (app/(app)/layout.tsx:17-35), but that tree owns ThemeProvider, PrivyProvider, QueryClientProvider, FunnelReportProvider, and PaymentProvider (providers/Providers.tsx:1-52). Every non-(app) route — including the new (funnels) branch — now renders without those contexts, which is a bigger behavior change than just removing the SaaS chrome.

♻️ Suggested direction
+import Providers from "@/providers/Providers";
...
-      <body className={`${geist.variable} antialiased`}>
-        {children}
+      <body className={`${geist.variable} antialiased`}>
+        <Providers>{children}</Providers>
         <DeferredAnalytics />
       </body>
Then drop the nested `Providers` wrapper from `app/(app)/layout.tsx` so the tree is initialized once.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<body className={`${geist.variable} antialiased`}>
<Suspense>
<Providers>
<div className="flex flex-col md:flex-row">
<Sidebar />
<Header />
<ArtistSettingModal />
<div className="grow flex h-[100dvh] pt-16 md:pt-0 md:h-screen overflow-hidden bg-sidebar">
<div className="size-full md:py-4 md:pl-4">
<div className="size-full bg-card overflow-y-auto md:rounded-xl flex flex-col md:shadow-md md:border md:border-border">
{children}
</div>
</div>
<ArtistsSidebar />
</div>
<MobileDownloadModal />
</div>
<ToastContainer />
<Toaster />
</Providers>
</Suspense>
{children}
<DeferredAnalytics />
import Providers from "@/providers/Providers";
<body className={`${geist.variable} antialiased`}>
<Providers>{children}</Providers>
<DeferredAnalytics />
</body>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/layout.tsx` around lines 70 - 72, The Providers wrapper (which composes
ThemeProvider, PrivyProvider, QueryClientProvider, FunnelReportProvider,
PaymentProvider) was moved inside the (app) route and so non-(app) branches
(e.g., (funnels)) render without those contexts; move the Providers component up
in app/layout.tsx so it wraps the whole route-group split (wrap children and
DeferredAnalytics) and then remove the nested Providers wrapper from
app/(app)/layout.tsx so the provider tree is initialized once for all routes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant