Skip to content

feat: route architecture — public/auth/dashboard groups with placehol…#246

Merged
onerandomdevv merged 2 commits into
devfrom
feat/route-architecture
Apr 5, 2026
Merged

feat: route architecture — public/auth/dashboard groups with placehol…#246
onerandomdevv merged 2 commits into
devfrom
feat/route-architecture

Conversation

@onerandomdevv
Copy link
Copy Markdown
Collaborator

@onerandomdevv onerandomdevv commented Apr 5, 2026

Summary by CodeRabbit

  • New Features

    • Added placeholder pages for multiple app sections including admin dashboard, merchant store, about us, category browsing, contact, explore, help center, merchant directory, product details, privacy policy, and terms of service. All display "Coming Soon" messages.
  • Chores

    • Added internal scaffolding utilities for automated route generation.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 5, 2026

📝 Walkthrough

Walkthrough

This pull request adds eleven "Coming Soon" placeholder page components across public, dashboard, and route groups, introduces a public layout component for wrapping shared structure, and includes a Node.js scaffolding script that auto-generates route directories and templates while removing previously existing route paths.

Changes

Cohort / File(s) Summary
Public Placeholder Pages
apps/web/src/app/(public)/about/page.tsx, apps/web/src/app/(public)/contact/page.tsx, apps/web/src/app/(public)/explore/page.tsx, apps/web/src/app/(public)/help/page.tsx, apps/web/src/app/(public)/merchants/page.tsx, apps/web/src/app/(public)/privacy/page.tsx, apps/web/src/app/(public)/terms/page.tsx, apps/web/src/app/(public)/c/[category]/page.tsx, apps/web/src/app/(public)/p/[code]/page.tsx, apps/web/src/app/(public)/_at_[slug]/page.tsx
Added centered, full-viewport placeholder page components with "Coming Soon" headings using Tailwind CSS flex centering utilities. Each follows identical template structure (7 lines).
Public Layout
apps/web/src/app/(public)/layout.tsx
Added public layout component accepting children prop, wrapping content in a fragment with placeholder TODO comment for future header and <main> element.
Dashboard Placeholder Page
apps/web/src/app/(dashboard)/admin/dashboard/page.tsx
Added centered placeholder page component displaying "Admin Dashboard — Coming Soon" heading in full-viewport layout.
Route Scaffolding Script
scripts/scaffold-routes.js
Added Node.js script that generates nested route directory structure with templated page.tsx and layout.tsx files across group routes (public), (auth), and (dashboard). Includes logic to skip existing files and remove a hardcoded list of previously existing route paths via recursive deletion.

Poem

🐰 Through routes and groups, we hop along,
Placeholder pages, cheerful and strong—
"Coming Soon" in centered display,
A scaffold script that builds the way!
The layout wraps the journey sweet,
While scripts ensure no missed beat. ✨

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request has no description provided, missing all required template sections including objectives, affected modules, change type, and testing instructions. Complete the pull request description using the provided template, including what this PR does, affected modules, change type, and testing steps.
Docstring Coverage ⚠️ Warning Docstring coverage is 7.69% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: introducing route architecture with public/auth/dashboard groups and placeholder pages.

✏️ 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 feat/route-architecture

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: 2

🧹 Nitpick comments (2)
scripts/scaffold-routes.js (1)

172-179: Consider guarding destructive cleanup behind an explicit CLI flag.

Cleanup currently always runs after scaffolding. A --cleanup opt-in would make scaffold-only runs safer for local/dev workflows.

Suggested diff
-console.log("Cleaning up old routes...");
-for (const p of toDelete) {
-  const fullPath = path.join(APP_DIR, p);
-  if (fs.existsSync(fullPath)) {
-    fs.rmSync(fullPath, { recursive: true, force: true });
-    console.log('Deleted old route: ' + fullPath);
-  }
-}
+const shouldCleanup = process.argv.includes('--cleanup');
+if (shouldCleanup) {
+  console.log("Cleaning up old routes...");
+  for (const p of toDelete) {
+    const fullPath = path.join(APP_DIR, p);
+    if (fs.existsSync(fullPath)) {
+      fs.rmSync(fullPath, { recursive: true, force: true });
+      console.log('Deleted old route: ' + fullPath);
+    }
+  }
+} else {
+  console.log("Skipping cleanup (pass --cleanup to enable).");
+}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/scaffold-routes.js` around lines 172 - 179, The cleanup loop that
removes paths from toDelete using fs.rmSync (inside scripts/scaffold-routes.js
referencing APP_DIR and toDelete) should be gated behind an explicit CLI flag
(e.g., --cleanup) rather than always running; detect the flag via
process.argv.includes('--cleanup') or your CLI parser, and only execute the
console.log("Cleaning up old routes...") / for (const p of toDelete) { ...
fs.rmSync(...) } block when that flag is present, otherwise skip deletion and
log that cleanup was skipped to make scaffold-only runs safe for local/dev
workflows.
apps/web/src/app/(public)/merchants/page.tsx (1)

1-5: Extract a shared ComingSoonPage component for repeated placeholders.

Lines 1–5 repeat the same structure used across many new routes. Consider moving this UI into a reusable component (e.g., ComingSoonPage with a title prop) to avoid copy/paste drift and simplify future updates.

♻️ Proposed refactor
- export default function PageName() {
-   return (
-     <div className="flex items-center justify-center min-h-screen">
-       <h1 className="text-2xl font-semibold">Merchant Directory — Coming Soon</h1>
-     </div>
-   );
- }
+import { ComingSoonPage } from "@/components/coming-soon-page";
+
+export default function MerchantsPage() {
+  return <ComingSoonPage title="Merchant Directory" />;
+}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/web/src/app/`(public)/merchants/page.tsx around lines 1 - 5, Extract the
repeated placeholder UI into a reusable ComingSoonPage component that accepts a
title prop: create a new component (e.g., ComingSoonPage) which renders the
shared div and h1 structure, then update the existing PageName component to
return <ComingSoonPage title="Merchant Directory — Coming Soon" /> (or
equivalent) so PageName only delegates to ComingSoonPage; ensure the new
component is exported and imported where needed and remove the duplicated JSX
from PageName.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/scaffold-routes.js`:
- Around line 161-179: The script is deleting legacy routes listed in the
toDelete array inside scripts/scaffold-routes.js which are still referenced by
UI components (merchant-sidebar.tsx, buyer-sidebar.tsx, product-detail-view.tsx,
product-card.tsx), causing 404s; either remove those entries from the toDelete
array or update the components to stop referencing those paths, or add
server-side/client-side redirects for each path; locate the toDelete constant
and the for loop that calls fs.rmSync and then update the array or implement
redirects and update the referenced components (merchant-sidebar, buyer-sidebar,
product-detail-view, product-card) in the same PR so navigation remains valid.
- Line 83: The route segment '_at_[slug]' (pageTemplate('Merchant Store'))
currently generates URLs under '/_at_/:slug' but needs to be served at public
'/@:slug' URLs; fix by adding a rewrite in next.config.mjs that maps '/@:slug' →
'/_at_/:slug' (or alternatively implement a middleware that rewrites requests
from '/@:slug' to '/_at_/:slug' or rename the segment to escape '@' if
supported), and verify the rewrite covers dynamic slugs so the
pageTemplate('Merchant Store') route is reachable at '/@:slug'.

---

Nitpick comments:
In `@apps/web/src/app/`(public)/merchants/page.tsx:
- Around line 1-5: Extract the repeated placeholder UI into a reusable
ComingSoonPage component that accepts a title prop: create a new component
(e.g., ComingSoonPage) which renders the shared div and h1 structure, then
update the existing PageName component to return <ComingSoonPage title="Merchant
Directory — Coming Soon" /> (or equivalent) so PageName only delegates to
ComingSoonPage; ensure the new component is exported and imported where needed
and remove the duplicated JSX from PageName.

In `@scripts/scaffold-routes.js`:
- Around line 172-179: The cleanup loop that removes paths from toDelete using
fs.rmSync (inside scripts/scaffold-routes.js referencing APP_DIR and toDelete)
should be gated behind an explicit CLI flag (e.g., --cleanup) rather than always
running; detect the flag via process.argv.includes('--cleanup') or your CLI
parser, and only execute the console.log("Cleaning up old routes...") / for
(const p of toDelete) { ... fs.rmSync(...) } block when that flag is present,
otherwise skip deletion and log that cleanup was skipped to make scaffold-only
runs safe for local/dev workflows.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7307846f-2f6f-4c92-ad17-356e1fdfe035

📥 Commits

Reviewing files that changed from the base of the PR and between d0993f1 and 5fafd59.

📒 Files selected for processing (13)
  • apps/web/src/app/(dashboard)/admin/dashboard/page.tsx
  • apps/web/src/app/(public)/_at_[slug]/page.tsx
  • apps/web/src/app/(public)/about/page.tsx
  • apps/web/src/app/(public)/c/[category]/page.tsx
  • apps/web/src/app/(public)/contact/page.tsx
  • apps/web/src/app/(public)/explore/page.tsx
  • apps/web/src/app/(public)/help/page.tsx
  • apps/web/src/app/(public)/layout.tsx
  • apps/web/src/app/(public)/merchants/page.tsx
  • apps/web/src/app/(public)/p/[code]/page.tsx
  • apps/web/src/app/(public)/privacy/page.tsx
  • apps/web/src/app/(public)/terms/page.tsx
  • scripts/scaffold-routes.js

'layout.tsx': publicLayout,
explore: { 'page.tsx': pageTemplate('Explore') },
p: { '[code]': { 'page.tsx': pageTemplate('Product Detail') } },
'_at_[slug]': { 'page.tsx': pageTemplate('Merchant Store') },
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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "1) Find route/rewrite config related to merchant slug paths"
fd -HI "next.config.*" | xargs -r rg -n "rewrites|redirects|_at_|@|merchant|slug"

echo "2) Find app links/usages targeting old/new merchant public paths"
rg -n "/@|/_at_|_at_\\[slug\\]|/m/|m/\\[slug\\]" apps/web/src

Repository: coded-devs/twizrr

Length of output: 441


🏁 Script executed:

cat -n scripts/scaffold-routes.js | head -100

Repository: coded-devs/twizrr

Length of output: 3423


🏁 Script executed:

cat -n next.config.js

Repository: coded-devs/twizrr

Length of output: 107


🏁 Script executed:

rg -n "_at_" apps/web/src --type ts --type tsx

Repository: coded-devs/twizrr

Length of output: 88


🏁 Script executed:

fd -HI "next.config" .

Repository: coded-devs/twizrr

Length of output: 87


🏁 Script executed:

rg "_at_" apps/web/src --max-count 10

Repository: coded-devs/twizrr

Length of output: 43


🏁 Script executed:

cat -n apps/web/src/middleware.ts 2>/dev/null || echo "No middleware.ts found"

Repository: coded-devs/twizrr

Length of output: 83


🏁 Script executed:

cat -n apps/web/next.config.mjs

Repository: coded-devs/twizrr

Length of output: 1111


🏁 Script executed:

rg "scaffold-routes" . --max-count 5

Repository: coded-devs/twizrr

Length of output: 43


🏁 Script executed:

rg "@" apps/web/src/app --type-not min -A 2 -B 2 | grep -E "(/@|merchant|slug)" | head -20

Repository: coded-devs/twizrr

Length of output: 88


🏁 Script executed:

cat apps/web/package.json | grep -A 10 "scripts"

Repository: coded-devs/twizrr

Length of output: 352


🏁 Script executed:

find apps/web/src/app -name "_at_*" -o -name "@*"

Repository: coded-devs/twizrr

Length of output: 97


🏁 Script executed:

ls -la apps/web/src/app/\(public\)/ 2>/dev/null | head -20

Repository: coded-devs/twizrr

Length of output: 787


🏁 Script executed:

find apps/web -name "middleware*" -o -name "*rewrite*" -o -name "*redirect*" 2>/dev/null

Repository: coded-devs/twizrr

Length of output: 43


Fix route naming: _at_[slug] should use rewrites to serve at @[slug] public URLs.

The route segment _at_[slug] creates URLs at /_at_/slug, but marketing promises @yourname format. No rewrites or middleware currently exist to convert /_at_/ to @/, making intended public URLs unreachable. Either:

  1. Add rewrites in next.config.mjs to map /@/:slug/_at_/:slug, or
  2. Use a middleware to handle the rewrite, or
  3. Rename the route segment if @ can be accommodated with proper escaping.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/scaffold-routes.js` at line 83, The route segment '_at_[slug]'
(pageTemplate('Merchant Store')) currently generates URLs under '/_at_/:slug'
but needs to be served at public '/@:slug' URLs; fix by adding a rewrite in
next.config.mjs that maps '/@:slug' → '/_at_/:slug' (or alternatively implement
a middleware that rewrites requests from '/@:slug' to '/_at_/:slug' or rename
the segment to escape '@' if supported), and verify the rewrite covers dynamic
slugs so the pageTemplate('Merchant Store') route is reachable at '/@:slug'.

Comment on lines +161 to +179
const toDelete = [
'buyer/catalogue',
'buyer/products/[id]',
'buyer/merchants/[id]',
'buyer/merchants',
'm/[slug]',
'merchant/wholesale',
'merchant/procurement',
'merchant/trade-financing'
];

console.log("Cleaning up old routes...");
for (const p of toDelete) {
const fullPath = path.join(APP_DIR, p);
if (fs.existsSync(fullPath)) {
fs.rmSync(fullPath, { recursive: true, force: true });
console.log('Deleted old route: ' + fullPath);
}
}
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

Deleting legacy routes here will break existing in-app navigation.

Line 162–169 removes paths still referenced by links in apps/web/src/components/layout/merchant-sidebar.tsx:1-50, apps/web/src/components/layout/buyer-sidebar.tsx:1-50, apps/web/src/components/shared/product-detail-view.tsx:1-50, and apps/web/src/components/shared/product-card.tsx:1-50. That will create user-facing 404s. Please update those links or add redirects in the same PR.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/scaffold-routes.js` around lines 161 - 179, The script is deleting
legacy routes listed in the toDelete array inside scripts/scaffold-routes.js
which are still referenced by UI components (merchant-sidebar.tsx,
buyer-sidebar.tsx, product-detail-view.tsx, product-card.tsx), causing 404s;
either remove those entries from the toDelete array or update the components to
stop referencing those paths, or add server-side/client-side redirects for each
path; locate the toDelete constant and the for loop that calls fs.rmSync and
then update the array or implement redirects and update the referenced
components (merchant-sidebar, buyer-sidebar, product-detail-view, product-card)
in the same PR so navigation remains valid.

@onerandomdevv onerandomdevv merged commit ad08728 into dev Apr 5, 2026
4 checks passed
@onerandomdevv onerandomdevv deleted the feat/route-architecture branch April 5, 2026 20:09
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