Feature: show level purchases view#949
Conversation
📝 WalkthroughWalkthroughAdds a summit-scoped sponsor purchases list: new fetch/export actions, reducer/store wiring, a purchases page with search/pagination/sort and inline approve/reject (now taking sponsorId), route/menu/translations, and related UI/tests updates. ChangesSponsor Purchases List Feature
Sequence DiagramsequenceDiagram
participant Page as ShowPurchaseListPage
participant Redux as Redux (actions/store)
participant API as SummitAPI
Page->>Redux: mount() → getAllSponsorPurchases(term,page,perPage,order,orderDir)
Redux->>API: GET /api/public/v1/summits/{id}/purchases?filters...
API-->>Redux: returns purchases array
Redux->>Redux: dispatch RECEIVE_ALL_SPONSOR_PURCHASES
Redux-->>Page: state update triggers re-render with purchases
Page->>Redux: user selects status → approveSponsorPurchase(sponsorId,paymentId) or rejectSponsorPurchase(sponsorId,paymentId)
Redux->>API: POST /api/public/v1/summits/{id}/sponsors/{sponsorId}/payments/{paymentId}/approve or /cancel
API-->>Redux: purchase status updated
Redux-->>Page: updated purchase status reflected in table
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/actions/sponsor-purchases-actions.js`:
- Around line 95-103: The current promise chain calling
getRequest(createAction(REQUEST_ALL_SPONSOR_PURCHASES),
createAction(RECEIVE_ALL_SPONSOR_PURCHASES), ...)(params)(dispatch) only
dispatches stopLoading() inside .then(...), so on failures the global loading
state can remain set; change the chain to ensure stopLoading() is dispatched in
all outcomes (use .finally(() => dispatch(stopLoading())) or add a .catch(err =>
{ /* optional handle */; throw err; }).finally(...) ) so that stopLoading() is
always dispatched after the getRequest call, keeping createAction, getRequest,
and stopLoading usage intact.
In `@src/pages/sponsors/show-pages-list-page/index.js`:
- Around line 184-191: The JSX unguarded access to match.url can throw if match
is undefined; update the Breadcrumb data to use a safe fallback (e.g., use
optional chaining and a default: pathname: match?.url || '' or match?.path ||
'') or ensure the component is wrapped with withRouter so match is always
injected; locate the Breadcrumb usage and replace direct match.url with the
guarded expression (or add withRouter to the component export) to prevent the
TypeError.
In `@src/pages/sponsors/show-purchase-list-page/index.js`:
- Around line 90-92: The menu handler handleMenu currently only console.logs the
item, leaving a dead UI control and leaking payloads; replace the debug log with
a real action or disable the control: implement a meaningful handler (e.g., call
a passed prop like onMenuSelect(item), open the purchase details modal, or
trigger navigation to the purchase view) and remove the console.log, and if no
action is available remove the menu rendering or render a disabled menu entry so
users cannot interact with it; also apply the same change to the other menu
handler block that mirrors this behavior.
- Around line 78-80: handleExport currently calls exportAllSponsorPurchases()
with no context so the exported CSV ignores the current term, order, and
orderDir; update handleExport to pass the current filter/sort state (term,
order, orderDir) to exportAllSponsorPurchases (or read them from the same state
object it uses) so the export mirrors the table view—refer to the handleExport
function and the exportAllSponsorPurchases function and ensure they accept and
forward those parameters.
🪄 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: 28b8f85e-d7de-43cf-9bc9-62bd810a332f
📒 Files selected for processing (9)
src/actions/sponsor-purchases-actions.jssrc/components/menu/menu-definition.jssrc/i18n/en.jsonsrc/layouts/sponsor-layout.jssrc/pages/sponsors/show-pages-list-page/index.jssrc/pages/sponsors/show-purchase-list-page/index.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-purchases-tab/index.jssrc/reducers/sponsors/show-purchase-list-reducer.jssrc/store.js
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/actions/sponsor-purchases-actions.js`:
- Around line 75-76: The amount column is displayed from net_amount but the
query/sorting still uses raw_amount, causing mismatched ordering; find every
place in this file where sorting or ORDER BY references raw_amount (e.g., the
query builders/parameters used around the amount column and the places noted in
the comment) and change those to use net_amount (or the same derived field used
to populate amount) so displayed values and sort order match; update any
references in functions that build the CSV/fields string or list endpoints to
use net_amount consistently.
🪄 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: c77d50b2-c29e-4af5-a741-6ac547a5e3cd
📒 Files selected for processing (4)
src/actions/sponsor-purchases-actions.jssrc/i18n/en.jsonsrc/pages/sponsors/show-purchase-list-page/index.jssrc/reducers/sponsors/show-purchase-list-reducer.js
✅ Files skipped from review due to trivial changes (1)
- src/i18n/en.json
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/pages/sponsors/show-purchase-list-page/index.js (1)
90-92:⚠️ Potential issue | 🟡 MinorAvoid shipping a non-functional menu action with debug logging.
The
handleMenufunction at lines 90-92 only logs row data to the console, and the menu column at lines 177-191 renders a clickable icon that triggers this no-op handler. This leaves a non-functional UI control and exposes row payloads in the browser console.Also applies to: 177-191
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/pages/sponsors/show-purchase-list-page/index.js` around lines 90 - 92, The menu icon currently calls handleMenu which only does console.log("MENU : ", item) — remove the debug logging and either implement the intended behavior or disable/remove the clickable control; specifically update the handleMenu function to perform a real action (e.g., open details, call an existing onEditPurchase/onDeletePurchase handler, or open a contextual menu component) and wire the menu column renderer (the clickable icon in the menu column) to that real behavior, or alternatively render a non-interactive icon if no action is available. Ensure no row payloads are logged to the console.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Duplicate comments:
In `@src/pages/sponsors/show-purchase-list-page/index.js`:
- Around line 90-92: The menu icon currently calls handleMenu which only does
console.log("MENU : ", item) — remove the debug logging and either implement the
intended behavior or disable/remove the clickable control; specifically update
the handleMenu function to perform a real action (e.g., open details, call an
existing onEditPurchase/onDeletePurchase handler, or open a contextual menu
component) and wire the menu column renderer (the clickable icon in the menu
column) to that real behavior, or alternatively render a non-interactive icon if
no action is available. Ensure no row payloads are logged to the console.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6fa961d4-2695-4b9b-a01a-eea949affdf9
📒 Files selected for processing (3)
src/actions/sponsor-purchases-actions.jssrc/pages/sponsors/show-pages-list-page/index.jssrc/pages/sponsors/show-purchase-list-page/index.js
https://app.clickup.com/t/86b66n5gb
Summary by CodeRabbit
New Features
Bug Fixes
Style
Documentation