Skip to content

Conversation

@tomrndom
Copy link

@tomrndom tomrndom commented Feb 2, 2026

ref:
https://app.clickup.com/t/86b7991aw
https://app.clickup.com/t/86b7991bq

Signed-off-by: Tomás Castillo [email protected]

Summary by CodeRabbit

  • New Features

    • Added a Pages tab in sponsor management to view and manage both managed and sponsor‑customized pages.
    • Two side‑by‑side tables with search, hide‑archived toggle, pagination, sorting, and per‑page controls.
    • Add buttons for creating pages and using templates; row actions for edit, delete, and archive.
  • Localization

    • Added English translations for the sponsor Pages tab UI.

@coderabbitai
Copy link

coderabbitai bot commented Feb 2, 2026

📝 Walkthrough

Walkthrough

Adds sponsor pages management: new action types and thunks to fetch managed/customized pages, a reducer and store entry to hold pagination/filtering state, a new SponsorPagesTab UI integrated into EditSponsorPage, and i18n entries for sponsor pages labels.

Changes

Cohort / File(s) Summary
Actions
src/actions/sponsor-pages-actions.js
Added four action type constants and two thunk actions: getSponsorManagedPages and getSponsorCustomizedPages (support pagination, filtering by term/is_archived, ordering, token/timezone, and loading lifecycle).
Reducer & Store
src/reducers/sponsors/sponsor-page-pages-list-reducer.js, src/store.js
New reducer managing managedPages and customizedPages sub-states (pagination, sorting, term, summitTZ, hideArchived). Registered in root reducers as sponsorPagePagesListState.
UI / Pages
src/pages/sponsors/sponsor-pages-tab/index.js, src/pages/sponsors/edit-sponsor-page.js
New SponsorPagesTab React-Redux component that fetches both page lists on mount, provides search, hide-archived, sorting, pagination, and action handlers; integrated as a new tab panel in EditSponsorPage.
Localization
src/i18n/en.json
Added pages_tab translation block under sponsor pages UI keys (duplicated block appears twice in the file).

Sequence Diagram(s)

sequenceDiagram
    participant UI as SponsorPagesTab
    participant Redux as Actions/Thunks
    participant API as Backend API
    participant Reducer as PagesReducer
    participant Store as Redux Store

    UI->>Redux: dispatch getSponsorManagedPages(sponsorId, params)
    UI->>Redux: dispatch getSponsorCustomizedPages(sponsorId, params)
    Redux->>API: GET /sponsors/{id}/managed-pages (token, tz, filters)
    Redux->>API: GET /sponsors/{id}/sponsor-pages (token, tz, filters)
    API-->>Redux: 200 managed pages payload
    API-->>Redux: 200 customized pages payload
    Redux->>Reducer: dispatch RECEIVE_SPONSOR_MANAGED_PAGES(payload)
    Redux->>Reducer: dispatch RECEIVE_SPONSOR_CUSTOMIZED_PAGES(payload)
    Reducer->>Store: update managedPages and customizedPages state
    Store-->>UI: mapStateToProps returns updated lists
    UI->>UI: re-render tables with new data
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • smarcet
  • santipalenque

Poem

🐰 Hop, hop — new pages in sight,

Managed and custom, left and right.
Actions fetch, reducers store,
Tabs appear — I bound for more.
✨📄

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately and specifically describes the primary changes: adding a sponsor pages tab with both customized and managed tables.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/sponsor-pages-tab-tables

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

Copy link

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

🤖 Fix all issues with AI agents
In `@src/actions/sponsor-pages-actions.js`:
- Around line 37-43: The exported action types (REQUEST_SPONSOR_MANAGED_PAGES,
RECEIVE_SPONSOR_MANAGED_PAGES, REQUEST_SPONSOR_CUSTOMIZED_PAGES,
RECEIVE_SPONSOR_CUSTOMIZED_PAGES) are missing the perPage/hideArchived values in
their dispatched payloads and API requests; update the action creators that use
these constants so the dispatched REQUEST_* and RECEIVE_* actions include
perPage and hideArchived in the action.payload, and change the API query/body
param for archived filtering from whatever is currently used to is_archived
(true/false) so the reducer and UI receive is_archived for archive labels and
row state; apply the same change to the other similar action creators referenced
in the comment (lines 149-203 and 209-263) so all sponsor-managed/customized
page flows carry perPage, hideArchived and send is_archived to the backend.

In `@src/i18n/en.json`:
- Around line 2463-2478: Add a new i18n key "managed_pages" under the existing
"pages_tab" object in src/i18n/en.json (e.g., "pages_tab.managed_pages":
"Managed Pages") and update the component that renders the managed pages header
to consume pages_tab.managed_pages instead of displaying the raw i18n key;
ensure the component uses the same i18n path ("pages_tab.managed_pages") so the
header no longer falls back to the key string.

In `@src/pages/sponsors/sponsor-pages-tab/index.js`:
- Around line 120-140: The action handlers (handleArchiveCustomizedPage,
handleArchiveManagedPage, handleManagedEdit, handleManagedDelete,
handleCustomizedEdit, handleCustomizedDelete) are currently no-ops that only
console.log; either implement them to perform the real actions (e.g., open edit
UI or navigate to edit route in handleManagedEdit/handleCustomizedEdit; show
confirm modal then call the archive/delete API and update local state/refresh
list in
handleArchiveManagedPage/handleArchiveCustomizedPage/handleManagedDelete/handleCustomizedDelete;
handle success/error and loading state) or remove the action props from the
components that render the buttons until you implement these behaviors so users
don’t get non-functional buttons. Use the existing API/dispatch/navigation
utilities in the file to perform the calls and update state accordingly.
- Around line 115-118: handleSearch currently calls
getSponsorManagedPages(searchTerm) and getSponsorCustomizedPages(searchTerm)
which causes filters/paging (hideArchived, current page, pageSize, sort) to
reset; update handleSearch to preserve and forward the current
filter/paging/sort state: read the existing hideArchived, pagination (page,
pageSize) and sort state variables and pass them as additional arguments or an
options object to getSponsorManagedPages and getSponsorCustomizedPages (or
update those functions to accept an options param) so the search only changes
the searchTerm and does not reset hideArchived/paging/sort.
- Around line 195-202: Replace the incorrect i18n key used for the managed pages
header: in the managedPagesColumns initialization (variable managedPagesColumns
calling baseColumns and T.translate) swap
T.translate("edit_sponsor.pages_tab.managed_forms") for a pages-specific key
(for example T.translate("edit_sponsor.pages_tab.managed_pages")) and ensure
that corresponding i18n entry is added to the locale files so the new key exists
and returns the intended label.
- Around line 14-70: The module is calling undefined setters setOpenPopup and
setCustomFormEdit from button handlers (e.g., the buttons that open the add/edit
popups), causing a ReferenceError; declare state hooks at the top of the
component (add useState to the React import) such as an openPopup state with
setter setOpenPopup (initial false) and a customFormEdit state with setter
setCustomFormEdit (initial null or {}), then update the existing button handlers
that reference setOpenPopup and setCustomFormEdit to use these newly declared
setters so the popup logic (open/close and edit payload) works correctly.

In `@src/reducers/sponsors/sponsor-page-pages-list-reducer.js`:
- Around line 55-87: The reducer handlers for REQUEST_SPONSOR_MANAGED_PAGES and
REQUEST_SPONSOR_CUSTOMIZED_PAGES are wrong: they set a non-existent forms field
so the list never clears and they do not persist per-page changes; update the
objects under state.managedPages and state.customizedPages to clear pages (set
pages: []) instead of forms and copy/persist perPage from payload (e.g.,
perPage: payload.perPage || existing perPage) while keeping order, orderDir and
currentPage updates (refer to REQUEST_SPONSOR_MANAGED_PAGES,
REQUEST_SPONSOR_CUSTOMIZED_PAGES, state.managedPages and state.customizedPages
to locate the code).
- Around line 89-142: In the RECEIVE_SPONSOR_MANAGED_PAGES and
RECEIVE_SPONSOR_CUSTOMIZED_PAGES handlers fix the swapped module counts and
include archive state: in the pages mapping for both cases assign upload_mod to
a.modules_count.media_request_modules_count and download_mod to
a.modules_count.document_download_modules_count (they are currently reversed),
and add is_archived: a.is_archived to each page object so row/archive labels
render correctly; also ensure the API request that populates payload.response
includes the is_archived field so payload.response.data items contain
a.is_archived.

Comment on lines +37 to +43
export const REQUEST_SPONSOR_MANAGED_PAGES = "REQUEST_SPONSOR_MANAGED_PAGES";
export const RECEIVE_SPONSOR_MANAGED_PAGES = "RECEIVE_SPONSOR_MANAGED_PAGES";

export const REQUEST_SPONSOR_CUSTOMIZED_PAGES =
"REQUEST_SPONSOR_CUSTOMIZED_PAGES";
export const RECEIVE_SPONSOR_CUSTOMIZED_PAGES =
"RECEIVE_SPONSOR_CUSTOMIZED_PAGES";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Propagate perPage/hideArchived and request is_archived.

The reducer expects these values and the UI needs is_archived for archive labels and row state, but they’re currently missing.

🛠️ Suggested fix
-    const params = {
-      page,
-      fields: "id,code,name,kind,modules_count,allowed_add_ons",
-      per_page: perPage,
-      access_token: accessToken
-    };
+    const params = {
+      page,
+      fields: "id,code,name,kind,modules_count,allowed_add_ons,is_archived",
+      per_page: perPage,
+      access_token: accessToken
+    };
...
-      { order, orderDir, page, term, summitTZ }
+      { order, orderDir, page, perPage, term, summitTZ, hideArchived }
-    const params = {
-      page,
-      fields: "id,code,name,kind,modules_count,allowed_add_ons",
-      per_page: perPage,
-      access_token: accessToken
-    };
+    const params = {
+      page,
+      fields: "id,code,name,kind,modules_count,allowed_add_ons,is_archived",
+      per_page: perPage,
+      access_token: accessToken
+    };
...
-      { order, orderDir, page, term, summitTZ }
+      { order, orderDir, page, perPage, term, summitTZ, hideArchived }

Also applies to: 149-203, 209-263

🤖 Prompt for AI Agents
In `@src/actions/sponsor-pages-actions.js` around lines 37 - 43, The exported
action types (REQUEST_SPONSOR_MANAGED_PAGES, RECEIVE_SPONSOR_MANAGED_PAGES,
REQUEST_SPONSOR_CUSTOMIZED_PAGES, RECEIVE_SPONSOR_CUSTOMIZED_PAGES) are missing
the perPage/hideArchived values in their dispatched payloads and API requests;
update the action creators that use these constants so the dispatched REQUEST_*
and RECEIVE_* actions include perPage and hideArchived in the action.payload,
and change the API query/body param for archived filtering from whatever is
currently used to is_archived (true/false) so the reducer and UI receive
is_archived for archive labels and row state; apply the same change to the other
similar action creators referenced in the comment (lines 149-203 and 209-263) so
all sponsor-managed/customized page flows carry perPage, hideArchived and send
is_archived to the backend.

Comment on lines 2463 to 2478
"pages_tab": {
"alert_info": "To add a Sponsor Specific Page for this show's sponsor, click Add Page button. Note: this Page will be visible only to this sponsor for this show. The General Pages can only be managed on the Show's Pages section.",
"hide_archived": "Hide archived Pages",
"using_template": "Using Template",
"new_page": "New Page",
"pages": "pages",
"sponsor_customized_pages": "Customized Sponsor Pages",
"code": "Code",
"name": "Name",
"add_ons": "Add-ons",
"info_mod": "Info Mod",
"upload_mod": "Upload Mod",
"download_mod": "Download Mod",
"archive": "Archive",
"unarchive": "Unarchive"
},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add a managed-pages label to match the new table header.

The UI renders a managed pages header, but there’s no dedicated label here. Add a key (and update the component to use it) to avoid falling back to the raw i18n key.

📝 Suggested addition
     "pages_tab": {
       "alert_info": "To add a Sponsor Specific Page for this show's sponsor, click Add Page button. Note: this Page will be visible only to this sponsor for this show. The General Pages can only be managed on the Show's Pages section.",
       "hide_archived": "Hide archived Pages",
       "using_template": "Using Template",
       "new_page": "New Page",
       "pages": "pages",
+      "managed_pages": "Managed Pages",
       "sponsor_customized_pages": "Customized Sponsor Pages",
       "code": "Code",
       "name": "Name",
       "add_ons": "Add-ons",
       "info_mod": "Info Mod",
       "upload_mod": "Upload Mod",
       "download_mod": "Download Mod",
       "archive": "Archive",
       "unarchive": "Unarchive"
     },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"pages_tab": {
"alert_info": "To add a Sponsor Specific Page for this show's sponsor, click Add Page button. Note: this Page will be visible only to this sponsor for this show. The General Pages can only be managed on the Show's Pages section.",
"hide_archived": "Hide archived Pages",
"using_template": "Using Template",
"new_page": "New Page",
"pages": "pages",
"sponsor_customized_pages": "Customized Sponsor Pages",
"code": "Code",
"name": "Name",
"add_ons": "Add-ons",
"info_mod": "Info Mod",
"upload_mod": "Upload Mod",
"download_mod": "Download Mod",
"archive": "Archive",
"unarchive": "Unarchive"
},
"pages_tab": {
"alert_info": "To add a Sponsor Specific Page for this show's sponsor, click Add Page button. Note: this Page will be visible only to this sponsor for this show. The General Pages can only be managed on the Show's Pages section.",
"hide_archived": "Hide archived Pages",
"using_template": "Using Template",
"new_page": "New Page",
"pages": "pages",
"managed_pages": "Managed Pages",
"sponsor_customized_pages": "Customized Sponsor Pages",
"code": "Code",
"name": "Name",
"add_ons": "Add-ons",
"info_mod": "Info Mod",
"upload_mod": "Upload Mod",
"download_mod": "Download Mod",
"archive": "Archive",
"unarchive": "Unarchive"
},
🤖 Prompt for AI Agents
In `@src/i18n/en.json` around lines 2463 - 2478, Add a new i18n key
"managed_pages" under the existing "pages_tab" object in src/i18n/en.json (e.g.,
"pages_tab.managed_pages": "Managed Pages") and update the component that
renders the managed pages header to consume pages_tab.managed_pages instead of
displaying the raw i18n key; ensure the component uses the same i18n path
("pages_tab.managed_pages") so the header no longer falls back to the key
string.

Comment on lines +14 to +70
import React, { useEffect } from "react";
import { connect } from "react-redux";
import T from "i18n-react/dist/i18n-react";
import {
Box,
Button,
Checkbox,
FormControlLabel,
FormGroup,
Grid2
} from "@mui/material";
import AddIcon from "@mui/icons-material/Add";
import {
archiveSponsorCustomizedForm,
deleteSponsorCustomizedForm,
saveSponsorManagedForm,
unarchiveSponsorCustomizedForm
} from "../../../actions/sponsor-forms-actions";
import {
getSponsorManagedPages,
getSponsorCustomizedPages
} from "../../../actions/sponsor-pages-actions";
import CustomAlert from "../../../components/mui/custom-alert";
import SearchInput from "../../../components/mui/search-input";
import MuiTable from "../../../components/mui/table/mui-table";
// import AddSponsorFormTemplatePopup from "./components/add-sponsor-form-template-popup";
// import CustomizedFormPopup from "./components/customized-form/customized-form-popup";
import { DEFAULT_CURRENT_PAGE } from "../../../utils/constants";

const SponsorPagesTab = ({
term,
hideArchived,
managedPages,
customizedPages,
getSponsorManagedPages,
getSponsorCustomizedPages
}) => {
useEffect(() => {
getSponsorManagedPages();
getSponsorCustomizedPages();
}, []);

const handleManagedPageChange = (page) => {
const { perPage, order, orderDir } = managedPages;
getSponsorManagedPages(term, page, perPage, order, orderDir, hideArchived);
};

const handleManagedPerPageChange = (newPerPage) => {
const { currentPage, order, orderDir } = managedPages;
getSponsorManagedPages(
term,
currentPage,
newPerPage,
order,
orderDir,
hideArchived
);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check for references to the popup setters
rg -n "setOpenPopup|setCustomFormEdit" src/pages/sponsors/sponsor-pages-tab/index.js

Repository: fntechgit/summit-admin

Length of output: 278


🏁 Script executed:

wc -l src/pages/sponsors/sponsor-pages-tab/index.js

Repository: fntechgit/summit-admin

Length of output: 115


🏁 Script executed:

cat -n src/pages/sponsors/sponsor-pages-tab/index.js | head -100

Repository: fntechgit/summit-admin

Length of output: 3725


🏁 Script executed:

cat -n src/pages/sponsors/sponsor-pages-tab/index.js | sed -n '240,280p'

Repository: fntechgit/summit-admin

Length of output: 1563


🏁 Script executed:

# Check if useState is imported
rg -n "useState" src/pages/sponsors/sponsor-pages-tab/index.js

Repository: fntechgit/summit-admin

Length of output: 48


🏁 Script executed:

# Check lines around where state might be declared (after line 50)
cat -n src/pages/sponsors/sponsor-pages-tab/index.js | sed -n '50,120p'

Repository: fntechgit/summit-admin

Length of output: 2194


🏁 Script executed:

# Check the remaining section to see all state declarations and usage
cat -n src/pages/sponsors/sponsor-pages-tab/index.js | sed -n '310,347p'

Repository: fntechgit/summit-admin

Length of output: 1322


Define popup setters before using them.

setOpenPopup and setCustomFormEdit aren't declared in this module. Clicking either button at lines 256 or 268 will throw a ReferenceError at runtime.

🛠️ Suggested fix
-import React, { useEffect } from "react";
+import React, { useEffect, useState } from "react";
...
 const SponsorPagesTab = ({
   term,
   hideArchived,
   managedPages,
   customizedPages,
   getSponsorManagedPages,
   getSponsorCustomizedPages
 }) => {
+  const [openPopup, setOpenPopup] = useState(null);
+  const [customFormEdit, setCustomFormEdit] = useState(null);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import React, { useEffect } from "react";
import { connect } from "react-redux";
import T from "i18n-react/dist/i18n-react";
import {
Box,
Button,
Checkbox,
FormControlLabel,
FormGroup,
Grid2
} from "@mui/material";
import AddIcon from "@mui/icons-material/Add";
import {
archiveSponsorCustomizedForm,
deleteSponsorCustomizedForm,
saveSponsorManagedForm,
unarchiveSponsorCustomizedForm
} from "../../../actions/sponsor-forms-actions";
import {
getSponsorManagedPages,
getSponsorCustomizedPages
} from "../../../actions/sponsor-pages-actions";
import CustomAlert from "../../../components/mui/custom-alert";
import SearchInput from "../../../components/mui/search-input";
import MuiTable from "../../../components/mui/table/mui-table";
// import AddSponsorFormTemplatePopup from "./components/add-sponsor-form-template-popup";
// import CustomizedFormPopup from "./components/customized-form/customized-form-popup";
import { DEFAULT_CURRENT_PAGE } from "../../../utils/constants";
const SponsorPagesTab = ({
term,
hideArchived,
managedPages,
customizedPages,
getSponsorManagedPages,
getSponsorCustomizedPages
}) => {
useEffect(() => {
getSponsorManagedPages();
getSponsorCustomizedPages();
}, []);
const handleManagedPageChange = (page) => {
const { perPage, order, orderDir } = managedPages;
getSponsorManagedPages(term, page, perPage, order, orderDir, hideArchived);
};
const handleManagedPerPageChange = (newPerPage) => {
const { currentPage, order, orderDir } = managedPages;
getSponsorManagedPages(
term,
currentPage,
newPerPage,
order,
orderDir,
hideArchived
);
import React, { useEffect, useState } from "react";
import { connect } from "react-redux";
import T from "i18n-react/dist/i18n-react";
import {
Box,
Button,
Checkbox,
FormControlLabel,
FormGroup,
Grid2
} from "@mui/material";
import AddIcon from "@mui/icons-material/Add";
import {
archiveSponsorCustomizedForm,
deleteSponsorCustomizedForm,
saveSponsorManagedForm,
unarchiveSponsorCustomizedForm
} from "../../../actions/sponsor-forms-actions";
import {
getSponsorManagedPages,
getSponsorCustomizedPages
} from "../../../actions/sponsor-pages-actions";
import CustomAlert from "../../../components/mui/custom-alert";
import SearchInput from "../../../components/mui/search-input";
import MuiTable from "../../../components/mui/table/mui-table";
// import AddSponsorFormTemplatePopup from "./components/add-sponsor-form-template-popup";
// import CustomizedFormPopup from "./components/customized-form/customized-form-popup";
import { DEFAULT_CURRENT_PAGE } from "../../../utils/constants";
const SponsorPagesTab = ({
term,
hideArchived,
managedPages,
customizedPages,
getSponsorManagedPages,
getSponsorCustomizedPages
}) => {
const [openPopup, setOpenPopup] = useState(null);
const [customFormEdit, setCustomFormEdit] = useState(null);
useEffect(() => {
getSponsorManagedPages();
getSponsorCustomizedPages();
}, []);
const handleManagedPageChange = (page) => {
const { perPage, order, orderDir } = managedPages;
getSponsorManagedPages(term, page, perPage, order, orderDir, hideArchived);
};
const handleManagedPerPageChange = (newPerPage) => {
const { currentPage, order, orderDir } = managedPages;
getSponsorManagedPages(
term,
currentPage,
newPerPage,
order,
orderDir,
hideArchived
);
🤖 Prompt for AI Agents
In `@src/pages/sponsors/sponsor-pages-tab/index.js` around lines 14 - 70, The
module is calling undefined setters setOpenPopup and setCustomFormEdit from
button handlers (e.g., the buttons that open the add/edit popups), causing a
ReferenceError; declare state hooks at the top of the component (add useState to
the React import) such as an openPopup state with setter setOpenPopup (initial
false) and a customFormEdit state with setter setCustomFormEdit (initial null or
{}), then update the existing button handlers that reference setOpenPopup and
setCustomFormEdit to use these newly declared setters so the popup logic
(open/close and edit payload) works correctly.

Comment on lines 115 to 118
const handleSearch = (searchTerm) => {
getSponsorManagedPages(searchTerm);
getSponsorCustomizedPages(searchTerm);
};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Preserve hideArchived/paging when searching.

handleSearch resets filters to defaults, which breaks the hide-archived toggle and current per-page/sort state.

🛠️ Suggested fix
   const handleSearch = (searchTerm) => {
-    getSponsorManagedPages(searchTerm);
-    getSponsorCustomizedPages(searchTerm);
+    getSponsorManagedPages(
+      searchTerm,
+      DEFAULT_CURRENT_PAGE,
+      managedPages.perPage,
+      managedPages.order,
+      managedPages.orderDir,
+      hideArchived
+    );
+    getSponsorCustomizedPages(
+      searchTerm,
+      DEFAULT_CURRENT_PAGE,
+      customizedPages.perPage,
+      customizedPages.order,
+      customizedPages.orderDir,
+      hideArchived
+    );
   };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const handleSearch = (searchTerm) => {
getSponsorManagedPages(searchTerm);
getSponsorCustomizedPages(searchTerm);
};
const handleSearch = (searchTerm) => {
getSponsorManagedPages(
searchTerm,
DEFAULT_CURRENT_PAGE,
managedPages.perPage,
managedPages.order,
managedPages.orderDir,
hideArchived
);
getSponsorCustomizedPages(
searchTerm,
DEFAULT_CURRENT_PAGE,
customizedPages.perPage,
customizedPages.order,
customizedPages.orderDir,
hideArchived
);
};
🤖 Prompt for AI Agents
In `@src/pages/sponsors/sponsor-pages-tab/index.js` around lines 115 - 118,
handleSearch currently calls getSponsorManagedPages(searchTerm) and
getSponsorCustomizedPages(searchTerm) which causes filters/paging (hideArchived,
current page, pageSize, sort) to reset; update handleSearch to preserve and
forward the current filter/paging/sort state: read the existing hideArchived,
pagination (page, pageSize) and sort state variables and pass them as additional
arguments or an options object to getSponsorManagedPages and
getSponsorCustomizedPages (or update those functions to accept an options param)
so the search only changes the searchTerm and does not reset
hideArchived/paging/sort.

Comment on lines 89 to 142
case RECEIVE_SPONSOR_MANAGED_PAGES: {
const {
current_page: currentPage,
total,
last_page: lastPage
} = payload.response;

const pages = payload.response.data.map((a) => ({
id: a.id,
code: a.code,
name: a.name,
info_mod: a.modules_count.info_modules_count,
upload_mod: a.modules_count.document_download_modules_count,
download_mod: a.modules_count.media_request_modules_count
}));

return {
...state,
managedPages: {
...state.managedPages,
pages,
currentPage,
totalCount: total,
lastPage
}
};
}
case RECEIVE_SPONSOR_CUSTOMIZED_PAGES: {
const {
current_page: currentPage,
total,
last_page: lastPage
} = payload.response;

const pages = payload.response.data.map((a) => ({
id: a.id,
code: a.code,
name: a.name,
allowed_add_ons: a.allowed_add_ons,
info_mod: a.modules_count.info_modules_count,
upload_mod: a.modules_count.document_download_modules_count,
download_mod: a.modules_count.media_request_modules_count
}));

return {
...state,
customizedPages: {
...state.customizedPages,
pages,
currentPage,
totalCount: total,
lastPage
}
};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Correct module counts and include archive state.

upload_mod/download_mod are swapped, and is_archived is missing, so archive labels/row state can’t be accurate. (Make sure the API request includes is_archived.)

🛠️ Suggested fix
       const pages = payload.response.data.map((a) => ({
         id: a.id,
         code: a.code,
         name: a.name,
         info_mod: a.modules_count.info_modules_count,
-        upload_mod: a.modules_count.document_download_modules_count,
-        download_mod: a.modules_count.media_request_modules_count
+        upload_mod: a.modules_count.media_request_modules_count,
+        download_mod: a.modules_count.document_download_modules_count,
+        is_archived: a.is_archived
       }));
       const pages = payload.response.data.map((a) => ({
         id: a.id,
         code: a.code,
         name: a.name,
         allowed_add_ons: a.allowed_add_ons,
         info_mod: a.modules_count.info_modules_count,
-        upload_mod: a.modules_count.document_download_modules_count,
-        download_mod: a.modules_count.media_request_modules_count
+        upload_mod: a.modules_count.media_request_modules_count,
+        download_mod: a.modules_count.document_download_modules_count,
+        is_archived: a.is_archived
       }));
🤖 Prompt for AI Agents
In `@src/reducers/sponsors/sponsor-page-pages-list-reducer.js` around lines 89 -
142, In the RECEIVE_SPONSOR_MANAGED_PAGES and RECEIVE_SPONSOR_CUSTOMIZED_PAGES
handlers fix the swapped module counts and include archive state: in the pages
mapping for both cases assign upload_mod to
a.modules_count.media_request_modules_count and download_mod to
a.modules_count.document_download_modules_count (they are currently reversed),
and add is_archived: a.is_archived to each page object so row/archive labels
render correctly; also ensure the API request that populates payload.response
includes the is_archived field so payload.response.data items contain
a.is_archived.

Copy link

@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

🤖 Fix all issues with AI agents
In `@src/pages/sponsors/sponsor-pages-tab/index.js`:
- Around line 253-256: Replace the Checkbox's uncontrolled "value" prop with the
controlled "checked" prop so the checkbox reflects the hideArchived state;
locate the Checkbox rendered in the sponsors tab (the one using
value={hideArchived} and onChange={handleHideArchived}) and change it to use
checked={hideArchived} while keeping onChange={handleHideArchived} so the UI
stays in sync with the hideArchived state.

@tomrndom tomrndom requested review from romanetar and smarcet February 3, 2026 00:31
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.

2 participants