Expose Exhibition under /exhibition + mobile navigation#281
Conversation
Co-authored-by: Domenik Töfflinger <dmnktoe@users.noreply.github.com>
📝 WalkthroughWalkthroughSwitches the lint script to run ESLint over Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #281 +/- ##
==========================================
- Coverage 64.77% 63.77% -1.01%
==========================================
Files 67 67
Lines 758 784 +26
Branches 155 161 +6
==========================================
+ Hits 491 500 +9
- Misses 267 284 +17 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (2)
src/components/layout/Header.tsx (1)
79-85: DuplicatenavLinksrendering — desktopNavigationand mobile panel both map the same array with identical markup.Minor DRY concern. Consider factoring a single
<NavList orientation="row|col" />that both call sites render, so future changes (e.g., adding a link, closing menu on click) happen in one place.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/layout/Header.tsx` around lines 79 - 85, Currently both the desktop Navigation and the mobile panel map navLinks with identical markup (the ul/li/NavLink pattern), so extract that mapping into a single reusable component (e.g., create a NavList component) that accepts an orientation prop ("row" | "col") and an optional onItemClick callback; move the navLinks.map logic into NavList (rendering a ul with className based on orientation and li key={link.href} with <NavLink>{link.text}</NavLink>) and replace the duplicated mapping in both Navigation and the mobile panel with <NavList orientation="row" /> and <NavList orientation="col" onItemClick={closeMenu} /> (or equivalent) so link additions and behavior changes happen in one place.vercel.json (1)
4-14: Collapse the three rewrites for/api/eventsinto one.
:path*matches zero segments, so/api/events/:path*already covers both/api/eventsand/api/events/. Remove the first two entries.Suggested diff
- { - "source": "/api/events", - "destination": "https://sentiment-exhibition.vercel.app/api/events/" - }, - { - "source": "/api/events/", - "destination": "https://sentiment-exhibition.vercel.app/api/events/" - }, { "source": "/api/events/:path*", "destination": "https://sentiment-exhibition.vercel.app/api/events/:path*" },🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@vercel.json` around lines 4 - 14, Remove the redundant rewrite rules for "/api/events" and "/api/events/" and keep only the rule with source "/api/events/:path*" pointing to "https://sentiment-exhibition.vercel.app/api/events/:path*"; specifically delete the entries whose source is "/api/events" and "/api/events/" so that the single rule with source "/api/events/:path*" (which matches zero or more segments) handles all three cases.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/components/layout/Header.tsx`:
- Line 15: Update the navLinks entry for Exhibition to remove the trailing slash
so it matches other entries and the test expectation: change the object in the
navLinks array (the entry with text 'Exhibition') from href: '/exhibition/' to
href: '/exhibition'; this keeps NavLink's active-state logic
(pathname.startsWith(href)) consistent with the canonical URL and satisfies
Header.test.tsx's assertion that href === '/exhibition'.
- Around line 70-87: The mobile menu (controlled by mobileNavOpen in Header)
never closes on navigation or Escape/outside clicks; update Header so the menu
closes when a nav item is activated and on Escape/outside-click: add a click
handler to NavLink (or pass an onNavigate callback) that sets
mobileNavOpen=false when a link is clicked, and add keyboard/document listeners
in Header to close the menu on "Escape" and a mousedown/touchstart handler that
closes when clicks happen outside the element with id mobileNavId; ensure to
cleanup listeners on unmount and/or when mobileNavOpen changes.
In `@vercel.json`:
- Around line 2-31: The rewrites currently cause relative asset requests like
/exhibition/public/... to miss the /public/:path* rule; either update the
exhibition app to use absolute asset URLs (/public/...) and keep the existing
/public/:path* rewrite, or add a specific rewrite mapping
"/exhibition/public/:path*" ->
"https://sentiment-exhibition.vercel.app/public/:path*" (or otherwise ensure
"/exhibition/:path*" correctly strips the /exhibition prefix) so assets
requested under /exhibition/public/* are forwarded to the exhibition origin.
---
Nitpick comments:
In `@src/components/layout/Header.tsx`:
- Around line 79-85: Currently both the desktop Navigation and the mobile panel
map navLinks with identical markup (the ul/li/NavLink pattern), so extract that
mapping into a single reusable component (e.g., create a NavList component) that
accepts an orientation prop ("row" | "col") and an optional onItemClick
callback; move the navLinks.map logic into NavList (rendering a ul with
className based on orientation and li key={link.href} with
<NavLink>{link.text}</NavLink>) and replace the duplicated mapping in both
Navigation and the mobile panel with <NavList orientation="row" /> and <NavList
orientation="col" onItemClick={closeMenu} /> (or equivalent) so link additions
and behavior changes happen in one place.
In `@vercel.json`:
- Around line 4-14: Remove the redundant rewrite rules for "/api/events" and
"/api/events/" and keep only the rule with source "/api/events/:path*" pointing
to "https://sentiment-exhibition.vercel.app/api/events/:path*"; specifically
delete the entries whose source is "/api/events" and "/api/events/" so that the
single rule with source "/api/events/:path*" (which matches zero or more
segments) handles all three cases.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: ef74d549-0617-4d50-9544-7d3b47319da3
📒 Files selected for processing (4)
package.jsonsrc/__tests__/components/layout/Header.test.tsxsrc/components/layout/Header.tsxvercel.json
| "rewrites": [ | ||
| { | ||
| "source": "/api/events", | ||
| "destination": "https://sentiment-exhibition.vercel.app/api/events/" | ||
| }, | ||
| { | ||
| "source": "/api/events/", | ||
| "destination": "https://sentiment-exhibition.vercel.app/api/events/" | ||
| }, | ||
| { | ||
| "source": "/api/events/:path*", | ||
| "destination": "https://sentiment-exhibition.vercel.app/api/events/:path*" | ||
| }, | ||
| { | ||
| "source": "/public/:path*", | ||
| "destination": "https://sentiment-exhibition.vercel.app/public/:path*" | ||
| }, | ||
| { | ||
| "source": "/exhibition", | ||
| "destination": "https://sentiment-exhibition.vercel.app/" | ||
| }, | ||
| { | ||
| "source": "/exhibition/", | ||
| "destination": "https://sentiment-exhibition.vercel.app/" | ||
| }, | ||
| { | ||
| "source": "/exhibition/:path*", | ||
| "destination": "https://sentiment-exhibition.vercel.app/:path*" | ||
| } | ||
| ] |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Confirm the exhibition app serves a Next.js HTML shell referencing /_next/*
curl -s -L https://sentiment-exhibition.vercel.app/ | grep -oE '"/_next/[^"]+"|href="/[^"]+"|src="/[^"]+"' | sort -u | head -40Repository: dmnktoe/sentiment
Length of output: 43
🏁 Script executed:
#!/bin/bash
# Get response headers and first part of HTML to identify the app type
curl -s -I https://sentiment-exhibition.vercel.app/ | head -20
echo "---"
curl -s https://sentiment-exhibition.vercel.app/ | head -100Repository: dmnktoe/sentiment
Length of output: 5142
🏁 Script executed:
#!/bin/bash
# Check if the domain is accessible and what it serves
curl -s -w "\nHTTP Status: %{http_code}\n" https://sentiment-exhibition.vercel.app/ | head -150Repository: dmnktoe/sentiment
Length of output: 6606
Relative asset paths in the exhibition app will 404 under the current rewrites.
The exhibition app at sentiment-exhibition.vercel.app is a static/traditional website (not Next.js) that references assets via relative paths: public/css/main.css, public/img/logo.svg, public/img/stage-video.mp4, etc.
When served via /exhibition, the browser URL remains /exhibition, so relative asset paths resolve to /exhibition/public/css/main.css, /exhibition/public/img/logo.svg, etc. These do not match the /public/:path* rewrite (which only catches /public/* at the root), causing assets to 404 or serve from the wrong origin.
Either:
- Reconfigure the exhibition app to use absolute paths (
/public/...) instead of relative paths, then ensure the/public/:path*rewrite is in place (it already is), or - Restructure the rewrite rules to handle
/exhibition/:path*→sentiment-exhibition.vercel.app/:path*to preserve all sub-paths including/exhibition/public/*.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@vercel.json` around lines 2 - 31, The rewrites currently cause relative asset
requests like /exhibition/public/... to miss the /public/:path* rule; either
update the exhibition app to use absolute asset URLs (/public/...) and keep the
existing /public/:path* rewrite, or add a specific rewrite mapping
"/exhibition/public/:path*" ->
"https://sentiment-exhibition.vercel.app/public/:path*" (or otherwise ensure
"/exhibition/:path*" correctly strips the /exhibition prefix) so assets
requested under /exhibition/public/* are forwarded to the exhibition origin.
Adds Vercel rewrites to serve the exhibition app under
/exhibition/and updates the header navigation to include an “Exhibition” link with a mobile-friendly hamburger menu.vercel.jsonrewrites for/exhibition->https://sentiment-exhibition.vercel.app/next linthere), sopnpm lintworks again/public/*to the exhibition app to avoid 404s when the embedded app requests assets with/public/.../api/events*to proxy the exhibition events endpoint (handles missing trailing slash)overflow-hiddenon the header pill containerVerification:
pnpm lint✅pnpm test✅