Skip to content

Feature: show level purchases view#949

Open
santipalenque wants to merge 4 commits into
masterfrom
feature/show-level-sponsor-orders
Open

Feature: show level purchases view#949
santipalenque wants to merge 4 commits into
masterfrom
feature/show-level-sponsor-orders

Conversation

@santipalenque
Copy link
Copy Markdown

@santipalenque santipalenque commented May 19, 2026

https://app.clickup.com/t/86b66n5gb

Summary by CodeRabbit

  • New Features

    • Global "All Sponsor Purchases" view with search, sorting, pagination and export-to-CSV for summit-scoped purchases
    • Sponsor-level purchases page with details, per-row status controls, and breadcrumbs
    • "Purchases" menu item under Sponsors
  • Bug Fixes

    • Amount sorting now reflects net amounts for accurate ordering
  • Style

    • Updated UI styling for purchase controls and action buttons
  • Documentation

    • English labels and search placeholder updated for purchases list

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

📝 Walkthrough

Walkthrough

Adds 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.

Changes

Sponsor Purchases List Feature

Layer / File(s) Summary
Redux action contract
src/actions/sponsor-purchases-actions.js
New action constants REQUEST_ALL_SPONSOR_PURCHASES/RECEIVE_ALL_SPONSOR_PURCHASES; getAllSponsorPurchases and exportAllSponsorPurchases implemented (filtering, pagination, CSV export); amount ordering maps to net_amount; approveSponsorPurchase / rejectSponsorPurchase signatures updated to accept sponsorId and use it in API URLs.
Redux reducer and store
src/reducers/sponsors/show-purchase-list-reducer.js, src/store.js
New reducer showPurchaseListReducer with pagination/sort defaults, request/receive/status-update handling (formats dates, converts cents), exported and registered as showPurchaseListState in the persisted root reducer.
Purchase list page component
src/pages/sponsors/show-purchase-list-page/index.js
ShowPurchaseListPage fetches purchases on mount and supports search, pagination, sorting, CSV export, details navigation, and inline status updates that dispatch approve/reject actions; connected to Redux.
Routing, menu, and translations
src/layouts/sponsor-layout.js, src/components/menu/menu-definition.js, src/i18n/en.json
Adds ${match.url}/purchases route (lazy-loaded), new "Purchases" menu item under sponsors, and English translations for menu label and purchase table headers/placeholders.
Existing UI and tests updates
src/pages/sponsors/show-pages-list-page/index.js, src/pages/sponsors/sponsor-page/tabs/sponsor-purchases-tab/index.js, src/pages/sponsors/.../__tests__/*
ShowPagesListPage adds breadcrumb using match.url; SponsorPurchasesTab adjusts status-change call signatures and button styling; tests updated to pass match prop and to expect updated approve/reject call signatures.

Sequence Diagram

sequenceDiagram
  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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • smarcet
  • tomrndom
  • romanetar

Poem

🐰 I hopped through code with nimble feet,
Added lists, exports, and a purchases seat,
Approve and reject now take their ID,
Breadcrumbs and menus show where to be,
Hooray — admins can manage with a treat!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Feature: show level purchases view' accurately describes the main change—adding a new purchases view for sponsors—and aligns with the PR's stated objective of adding a 'show level purchases' view.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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/show-level-sponsor-orders

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

Copy link
Copy Markdown

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

📥 Commits

Reviewing files that changed from the base of the PR and between 30c2c8a and cb2f3f7.

📒 Files selected for processing (9)
  • src/actions/sponsor-purchases-actions.js
  • src/components/menu/menu-definition.js
  • src/i18n/en.json
  • src/layouts/sponsor-layout.js
  • src/pages/sponsors/show-pages-list-page/index.js
  • src/pages/sponsors/show-purchase-list-page/index.js
  • src/pages/sponsors/sponsor-page/tabs/sponsor-purchases-tab/index.js
  • src/reducers/sponsors/show-purchase-list-reducer.js
  • src/store.js

Comment thread src/actions/sponsor-purchases-actions.js
Comment thread src/pages/sponsors/show-pages-list-page/index.js
Comment thread src/pages/sponsors/show-purchase-list-page/index.js
Comment thread src/pages/sponsors/show-purchase-list-page/index.js
Copy link
Copy Markdown

@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

🤖 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

📥 Commits

Reviewing files that changed from the base of the PR and between f60c5c7 and 3833eaf.

📒 Files selected for processing (4)
  • src/actions/sponsor-purchases-actions.js
  • src/i18n/en.json
  • src/pages/sponsors/show-purchase-list-page/index.js
  • src/reducers/sponsors/show-purchase-list-reducer.js
✅ Files skipped from review due to trivial changes (1)
  • src/i18n/en.json

Comment thread src/actions/sponsor-purchases-actions.js
Copy link
Copy Markdown

@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.

♻️ Duplicate comments (1)
src/pages/sponsors/show-purchase-list-page/index.js (1)

90-92: ⚠️ Potential issue | 🟡 Minor

Avoid shipping a non-functional menu action with debug logging.

The handleMenu function 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

📥 Commits

Reviewing files that changed from the base of the PR and between 3833eaf and 4a29c5d.

📒 Files selected for processing (3)
  • src/actions/sponsor-purchases-actions.js
  • src/pages/sponsors/show-pages-list-page/index.js
  • src/pages/sponsors/show-purchase-list-page/index.js

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