feat: updated the dj evening event #73
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 15 minutes and 39 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughDJHighlightSection now queries events by an encoded Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Pull request overview
Updates the Home “DJ Evening” highlight card to target a specific DJ event and display an offline-sales notice for that event.
Changes:
- Switches event fetching from department-based filtering to a hardcoded event name query.
- Adds a conditional caption (“Passes will be sold offline”) when the highlighted event matches the configured DJ event name.
- Minor UI text change in the CTA button label.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| axios | ||
| .get(`/api/events?departmentId=${DJ_DEPARTMENT_ID}&limit=1`) | ||
| .get(`/api/events?name=${encodeURIComponent(DJ_EVENT_NAME)}&limit=1`) | ||
| .then(res => { |
There was a problem hiding this comment.
/api/events does not support a name query parameter; the public handler only reads categoryId, departmentId, search, sort, page, and limit. As written, this request will behave like “no filters” and may return an unrelated event (or none, depending on ordering). Use the existing search parameter (e.g., search=DJ EVEONICS) and then select the correct event client-side, or add explicit name filtering support in the API/service layer.
| }} | ||
| > | ||
| View Details | ||
| View Details |
There was a problem hiding this comment.
The button label has a trailing whitespace ('View Details '), which will get committed into the UI text and can cause snapshot/test diffs and inconsistent rendering. Remove the extra space.
| View Details | |
| View Details |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/views/home/DJHighlightSection.js (1)
35-40:⚠️ Potential issue | 🔴 CriticalUnsupported
namequery parameter breaks DJ event selection.Line 35 calls
/api/events?name=..., butsrc/pages/api/events/index.js(Lines 24-70 in the provided snippet) does not parse or forward anameparam. This makes the result non-targeted, and withlimit=1you can render the wrong event.Suggested fix (align with current API contract)
- .get(`/api/events?name=${encodeURIComponent(DJ_EVENT_NAME)}&limit=1`) + .get(`/api/events?search=${encodeURIComponent(DJ_EVENT_NAME)}&limit=10`) .then(res => { if (cancelled) return const events = res.data?.data || [] - if (events.length > 0) setEvent(events[0]) + const djEvent = events.find(e => (e.title || '').trim() === DJ_EVENT_NAME) + if (djEvent) setEvent(djEvent) })🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/views/home/DJHighlightSection.js` around lines 35 - 40, The GET request in DJHighlightSection.js uses a unsupported name query param so replace the targeted server-side query with client-side filtering: call /api/events?limit=... without the name param (keep encodeURIComponent removed), then in the .then handler use the DJ_EVENT_NAME constant to find the matching event from res.data.data (e.g. events.find(e => e.name === DJ_EVENT_NAME)) before calling setEvent; preserve the cancelled guard and existing limit behavior and update the variable references (events, setEvent, DJ_EVENT_NAME) accordingly.
🧹 Nitpick comments (1)
src/views/home/DJHighlightSection.js (1)
223-223: Remove trailing space in button label.Line 223 includes an unnecessary trailing space in
"View Details ".Suggested cleanup
- View Details + View Details🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/views/home/DJHighlightSection.js` at line 223, In the DJHighlightSection component, remove the trailing space in the button label string ("View Details ") so it becomes "View Details"; locate the JSX element that renders the button (the element containing the "View Details " text on line with that label) and update the literal to drop the extra whitespace, ensuring any surrounding concatenation or template usage also doesn't reintroduce the space.
🤖 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/views/home/DJHighlightSection.js`:
- Around line 188-200: The condition is checking event?.name but the service
maps e.name to title, so DJ_EVENT_NAME will never match; update the conditional
in the JSX that renders the offline-pass caption to use the normalized title
field (e.g., event?.title) or a fallback (event?.name || event?.title) so the
check against DJ_EVENT_NAME succeeds; adjust the conditional where DJ_EVENT_NAME
is used and any related references in the DJHighlightSection component to rely
on the normalized title property.
---
Outside diff comments:
In `@src/views/home/DJHighlightSection.js`:
- Around line 35-40: The GET request in DJHighlightSection.js uses a unsupported
name query param so replace the targeted server-side query with client-side
filtering: call /api/events?limit=... without the name param (keep
encodeURIComponent removed), then in the .then handler use the DJ_EVENT_NAME
constant to find the matching event from res.data.data (e.g. events.find(e =>
e.name === DJ_EVENT_NAME)) before calling setEvent; preserve the cancelled guard
and existing limit behavior and update the variable references (events,
setEvent, DJ_EVENT_NAME) accordingly.
---
Nitpick comments:
In `@src/views/home/DJHighlightSection.js`:
- Line 223: In the DJHighlightSection component, remove the trailing space in
the button label string ("View Details ") so it becomes "View Details"; locate
the JSX element that renders the button (the element containing the "View
Details " text on line with that label) and update the literal to drop the extra
whitespace, ensuring any surrounding concatenation or template usage also
doesn't reintroduce the space.
🪄 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: 4c7f3dc8-1b76-4afb-807c-7860e6ca508e
📒 Files selected for processing (1)
src/views/home/DJHighlightSection.js
| {event?.name === DJ_EVENT_NAME && ( | ||
| <Typography | ||
| variant='caption' | ||
| sx={{ | ||
| color: alpha(accent, 0.7), | ||
| fontWeight: 600, | ||
| fontSize: '0.8rem', | ||
| letterSpacing: '0.5px' | ||
| }} | ||
| > | ||
| Passes will be sold offline | ||
| </Typography> | ||
| )} |
There was a problem hiding this comment.
event?.name condition never matches current API payload shape.
src/services/event-service.js selects e.name AS title, so event?.name is not populated. At Line 188 this prevents the offline-pass caption from rendering even when the DJ event is fetched.
Suggested fix (use a single normalized title field)
+ const eventTitle = event?.title || event?.name || 'DJ Evening'
...
- alt={event?.name || 'DJ Evening'}
+ alt={eventTitle}
...
- {event?.name || 'DJ Evening'}
+ {eventTitle}
...
- {event?.name === DJ_EVENT_NAME && (
+ {eventTitle === DJ_EVENT_NAME && (🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/views/home/DJHighlightSection.js` around lines 188 - 200, The condition
is checking event?.name but the service maps e.name to title, so DJ_EVENT_NAME
will never match; update the conditional in the JSX that renders the
offline-pass caption to use the normalized title field (e.g., event?.title) or a
fallback (event?.name || event?.title) so the check against DJ_EVENT_NAME
succeeds; adjust the conditional where DJ_EVENT_NAME is used and any related
references in the DJHighlightSection component to rely on the normalized title
property.
Summary by CodeRabbit