Skip to content

feat: add algolia search to videos admin#8948

Open
tanflem wants to merge 20 commits intomainfrom
tannerfleming/vmt-60-add-algolia-search-to-videos-admin
Open

feat: add algolia search to videos admin#8948
tanflem wants to merge 20 commits intomainfrom
tannerfleming/vmt-60-add-algolia-search-to-videos-admin

Conversation

@tanflem
Copy link
Copy Markdown
Contributor

@tanflem tanflem commented Apr 3, 2026

Summary by CodeRabbit

  • New Features

    • Tabbed navigation in Videos with "Library" and "Algolia (Experimental)" to switch views.
    • Experimental Algolia video library: full-text search, published-status filter, pagination, and clickable results to open video details.
    • Tabs are shown only on the main Videos pages via a new Videos layout.
  • Tests

    • Added tests for Algolia UI, filtering, results rendering, navigation, and missing-config warnings.

tanflem and others added 11 commits April 3, 2026 17:09
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Urim Chae <urim027@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
@tanflem tanflem self-assigned this Apr 3, 2026
@linear
Copy link
Copy Markdown

linear Bot commented Apr 3, 2026

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 3, 2026

Walkthrough

Adds a videos dashboard layout with route-aware tabs and a new Algolia-backed video list page/component (with search, published-state filtering, localization-aware title/description selection, row navigation), tests for the Algolia list, and small index re-exports.

Changes

Cohort / File(s) Summary
Tab Navigation & Layout
apps/videos-admin/src/app/(dashboard)/videos/_VideosTabs/VideosTabs.tsx, apps/videos-admin/src/app/(dashboard)/videos/_VideosTabs/index.ts, apps/videos-admin/src/app/(dashboard)/videos/layout.tsx
Added client-side VideosTabs component and re-export; new videos layout that conditionally renders tabs based on pathname and navigates between /videos and /videos/algolia.
Algolia Video List Feature
apps/videos-admin/src/app/(dashboard)/videos/algolia/page.tsx, apps/videos-admin/src/app/(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.tsx, apps/videos-admin/src/app/(dashboard)/videos/algolia/_AlgoliaVideoList/index.ts
New Algolia-backed page and component: reads Algolia env vars (shows warning if missing), initializes InstantSearch with Configure, controlled search input, published refinement, pagination, maps localized titles/descriptions, renders MUI DataGrid, and navigates to /videos/{mediaComponentId} on row click.
Tests for Algolia List
apps/videos-admin/src/app/(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.spec.tsx
Adds comprehensive tests that mock next/navigation, algoliasearch, and react-instantsearch hooks to verify UI rendering, hit mapping, refinement behavior, navigation, and missing-env behavior.

Sequence Diagram(s)

sequenceDiagram
    participant User as User
    participant Tabs as VideosTabs
    participant Router as Router
    participant Page as VideosAlgoliaPage
    participant Search as InstantSearch
    participant Algolia as Algolia
    participant Grid as DataGrid

    User->>Tabs: Click "Algolia (Experimental)" tab
    Tabs->>Router: router.push('/videos/algolia')
    Router->>Page: route -> VideosAlgoliaPage
    Page->>Search: render InstantSearch with Configure
    User->>Search: Enter query / change filters
    Search->>Algolia: send search request
    Algolia-->>Search: return hits
    Search->>Grid: provide normalized hit data
    Grid-->>User: display results
    User->>Grid: Click a row
    Grid->>Router: router.push('/videos/{mediaComponentId}')
    Router-->>User: navigate to video detail
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and directly summarizes the main change: adding Algolia search functionality to the videos admin section.

✏️ 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 tannerfleming/vmt-60-add-algolia-search-to-videos-admin

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.

❤️ Share

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

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Apr 3, 2026

View your CI Pipeline Execution ↗ for commit aa27134

Command Status Duration Result
nx run videos-admin-e2e:e2e ✅ Succeeded 5s View ↗
nx run-many --target=vercel-alias --projects=vi... ✅ Succeeded 2s View ↗
nx run-many --target=upload-sourcemaps --projec... ✅ Succeeded 7s View ↗
nx run-many --target=deploy --projects=videos-a... ✅ Succeeded 1m 42s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-07 16:27:02 UTC

@github-actions github-actions Bot requested a deployment to Preview - videos-admin April 3, 2026 19:38 Pending
@tanflem tanflem requested a review from Kneesal April 3, 2026 19:40
@github-actions github-actions Bot temporarily deployed to Preview - videos-admin April 3, 2026 19:43 Inactive
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 3, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
videos-admin ✅ Ready videos-admin preview Wed Apr 8 04:23:49 NZST 2026

Copy link
Copy Markdown
Contributor

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

🧹 Nitpick comments (1)
apps/videos-admin/src/app/(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.tsx (1)

194-197: Extract the remaining inline event handlers into handle* functions.

The search field and pagination buttons are the only event sites in this component that still bypass the repo's handler naming convention. Pulling them into named callbacks keeps the render path easier to scan and aligns the file with the surrounding handlePublishedChange/handleRowClick pattern.

♻️ Suggested refactor
-import { ReactElement, useMemo } from 'react'
+import { ChangeEvent, ReactElement, useMemo } from 'react'
   const rows: GridRowsProp<AlgoliaRow> = items.map(mapAlgoliaHitToRow)
 
+  const handleSearchChange = (
+    event: ChangeEvent<HTMLInputElement>
+  ): void => {
+    refine(event.target.value)
+  }
+
   const handleRowClick = (params: GridRowParams<AlgoliaRow>): void => {
     const selectedMediaComponentId = params.row.mediaComponentId
     if (selectedMediaComponentId == null || selectedMediaComponentId === '')
       return
 
     router.push(`/videos/${selectedMediaComponentId}`)
   }
+
+  const handlePreviousPageClick = (): void => {
+    refinePage(currentRefinement - 1)
+  }
+
+  const handleNextPageClick = (): void => {
+    refinePage(currentRefinement + 1)
+  }
         <TextField
           label="Search Algolia"
           value={query}
-          onChange={(event) => refine(event.target.value)}
+          onChange={handleSearchChange}
           size="small"
           placeholder="Search titles, descriptions, and IDs"
           sx={{ flexGrow: 1 }}
         />
         <Button
           variant="outlined"
           disabled={currentRefinement <= 0}
-          onClick={() => refinePage(currentRefinement - 1)}
+          onClick={handlePreviousPageClick}
         >
           Previous
         </Button>
@@
         <Button
           variant="outlined"
           disabled={currentRefinement >= nbPages - 1}
-          onClick={() => refinePage(currentRefinement + 1)}
+          onClick={handleNextPageClick}
         >
           Next
         </Button>

As per coding guidelines, event functions should be named with a “handle” prefix, like “handleClick” for onClick and “handleKeyDown” for onKeyDown.

Also applies to: 224-237

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/videos-admin/src/app/`(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.tsx
around lines 194 - 197, The inline onChange for the TextField and the inline
handlers on the pagination buttons should be extracted into named "handle*"
callbacks to match the file's convention (see handlePublishedChange and
handleRowClick); create a handleSearchChange that accepts the event (or string)
and calls refine(event.target.value or value) and replace the TextField onChange
with handleSearchChange, and create handlePrevPage/handleNextPage or
handlePageChange to wrap the pagination button logic used around lines 224-237,
then wire those functions into the JSX so no inline arrow functions remain in
render.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@apps/videos-admin/src/app/`(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.spec.tsx:
- Around line 137-140: Replace the loose "Published" text assertion with a DOM
lookup that targets the PublishedChip test id exposed by the component (use
screen.getByTestId or queryByTestId for the PublishedChip test id instead of
screen.getAllByText('Published')). Update the assertion to assert the specific
chip exists (e.g.,
expect(screen.getByTestId('<PublishedChipTestId>')).toBeInTheDocument()) so the
test checks the chip component itself rather than any shared "Published" label.

In
`@apps/videos-admin/src/app/`(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.tsx:
- Around line 47-55: The AlgoliaRow type should allow mediaComponentId to be
nullable so the existing guard that prevents navigation for non-editable rows
can work; change the AlgoliaRow interface's mediaComponentId from string to
string | null (or optional) and remove any logic that backfills mediaComponentId
with objectID when mapping Algolia hits (the mapping code that constructs
AlgoliaRow/hits). Ensure any navigation code uses the presence of
mediaComponentId as the gate (i.e., only push `/videos/{mediaComponentId}` when
mediaComponentId is non-null) rather than relying on objectID.
- Around line 247-249: The code currently defaults indexName to 'videos-stg'
when NEXT_PUBLIC_ALGOLIA_INDEX_VIDEOS_STG is missing; update the index
resolution in AlgoliaVideoList so it fails closed instead: read
process.env.NEXT_PUBLIC_ALGOLIA_INDEX_VIDEOS_STG (and the other env vars in the
251-261 block) into a const and if undefined/empty throw a clear Error (or call
a guard/invariant) before creating the search client or performing any queries;
reference the indexName constant and getAlgoliaSearchClient()/searchClient so
the error is raised early and prevents silent querying of the wrong corpus.

---

Nitpick comments:
In
`@apps/videos-admin/src/app/`(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.tsx:
- Around line 194-197: The inline onChange for the TextField and the inline
handlers on the pagination buttons should be extracted into named "handle*"
callbacks to match the file's convention (see handlePublishedChange and
handleRowClick); create a handleSearchChange that accepts the event (or string)
and calls refine(event.target.value or value) and replace the TextField onChange
with handleSearchChange, and create handlePrevPage/handleNextPage or
handlePageChange to wrap the pagination button logic used around lines 224-237,
then wire those functions into the JSX so no inline arrow functions remain in
render.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 5d2c52b1-d9b7-4a14-9a61-afb50da4963c

📥 Commits

Reviewing files that changed from the base of the PR and between 97c5d50 and 0b9ea51.

📒 Files selected for processing (7)
  • apps/videos-admin/src/app/(dashboard)/videos/_VideosTabs/VideosTabs.tsx
  • apps/videos-admin/src/app/(dashboard)/videos/_VideosTabs/index.ts
  • apps/videos-admin/src/app/(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.spec.tsx
  • apps/videos-admin/src/app/(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.tsx
  • apps/videos-admin/src/app/(dashboard)/videos/algolia/_AlgoliaVideoList/index.ts
  • apps/videos-admin/src/app/(dashboard)/videos/algolia/page.tsx
  • apps/videos-admin/src/app/(dashboard)/videos/layout.tsx

@github-actions github-actions Bot requested a deployment to Preview - videos-admin April 3, 2026 20:12 Pending
@github-actions github-actions Bot temporarily deployed to Preview - videos-admin April 3, 2026 20:15 Inactive
Copy link
Copy Markdown
Contributor

@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 (2)
apps/videos-admin/src/app/(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.tsx (2)

47-50: ⚠️ Potential issue | 🟠 Major

Keep mediaComponentId nullable instead of backfilling it with objectID.

This makes every hit look editable, so the guard in handleRowClick can never suppress rows that do not map to an admin video. Those records will still route to /videos/{objectID} even though the UI already warns that some Algolia rows are not editable.

Proposed fix
 interface AlgoliaRow {
   id: string
-  mediaComponentId: string
+  displayId: string
+  mediaComponentId?: string
   title: string
   description: string
   subType: string
   containsCount: number
   published: boolean
 }
 
 function mapAlgoliaHitToRow(hit: AlgoliaVideoRecord): AlgoliaRow {
   return {
     id: hit.objectID,
-    mediaComponentId: hit.mediaComponentId ?? hit.objectID,
+    displayId: hit.mediaComponentId ?? hit.objectID,
+    mediaComponentId: hit.mediaComponentId,
     title: getPrimaryText(hit.titles) || hit.title || '',
     description: getPrimaryText(hit.descriptions) || hit.description || '',
     subType: hit.subType ?? '',
-    { field: 'mediaComponentId', headerName: 'ID', minWidth: 220 },
+    { field: 'displayId', headerName: 'ID', minWidth: 220 },

Also applies to: 81-85

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/videos-admin/src/app/`(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.tsx
around lines 47 - 50, The AlgoliaRow interface currently forces mediaComponentId
to be string and code backfills it with objectID which makes every hit appear
editable; change AlgoliaRow.mediaComponentId to be string | null and stop
assigning objectID into mediaComponentId when mapping Algolia hits (remove the
fallback that sets mediaComponentId = objectID), and ensure handleRowClick
continues to guard by checking for a non-null mediaComponentId before routing so
non-editable rows are not treated as editable.

247-255: ⚠️ Potential issue | 🟠 Major

Fail closed when the Algolia index name is missing.

This only guards the app id/API key, but the component also depends on an index env var. If that key is unset—or the deployment is still using the _STG name that the spec seeds—the page mounts search with an undefined index instead of surfacing the warning state.

#!/bin/bash
# Verify which videos-admin Algolia index env key is used elsewhere in the repo.
rg -n --no-heading 'NEXT_PUBLIC_ALGOLIA_INDEX_VIDEOS(_STG)?'

Expected: one canonical key used consistently. If only _STG appears outside this file, Line 248 is reading the wrong variable; if the generic key is canonical, the spec setup should be updated to match.

Also applies to: 263-263

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/videos-admin/src/app/`(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.tsx
around lines 247 - 255, The component currently only checks if searchClient is
null but also requires indexName (const indexName =
process.env.NEXT_PUBLIC_ALGOLIA_INDEX_VIDEOS); update the AlgoliaVideoList
render guard to fail closed when indexName is falsy as well (e.g., if
(!searchClient || !indexName) return the warning UI), and verify the environment
key name is the canonical one used across the repo (replace
NEXT_PUBLIC_ALGOLIA_INDEX_VIDEOS with NEXT_PUBLIC_ALGOLIA_INDEX_VIDEOS_STG if
that is the canonical key or vice versa so the env lookup and spec seeding
match). Ensure any other uses (e.g., where indexName is passed to the search
hook at/around the code using searchClient) are similarly guarded.
🧹 Nitpick comments (1)
apps/videos-admin/src/app/(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.tsx (1)

194-197: Extract named handle* callbacks for search and paging.

These inline closures make the render path harder to scan and miss the repo convention for event-handler naming. handleSearchChange, handlePreviousPageClick, and handleNextPageClick would keep this block consistent with the rest of the component.

As per coding guidelines, "event functions should be named with a “handle” prefix, like “handleClick” for onClick and “handleKeyDown” for onKeyDown."

Also applies to: 224-237

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/videos-admin/src/app/`(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.tsx
around lines 194 - 197, The inline event handlers in AlgoliaVideoList (e.g., the
onChange that calls refine and the paging button onClick closures) should be
extracted into named handlers: implement handleSearchChange (receives event,
calls refine(event.target.value)), handlePreviousPageClick and
handleNextPageClick (call previousPage() and nextPage() respectively), and
replace the inline closures in the JSX with these functions; optionally wrap
them with useCallback for stability. This targets the TextField onChange and the
pagination buttons in the same component so the render becomes easier to scan
and follows the repo convention for "handle*" event names.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In
`@apps/videos-admin/src/app/`(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.tsx:
- Around line 47-50: The AlgoliaRow interface currently forces mediaComponentId
to be string and code backfills it with objectID which makes every hit appear
editable; change AlgoliaRow.mediaComponentId to be string | null and stop
assigning objectID into mediaComponentId when mapping Algolia hits (remove the
fallback that sets mediaComponentId = objectID), and ensure handleRowClick
continues to guard by checking for a non-null mediaComponentId before routing so
non-editable rows are not treated as editable.
- Around line 247-255: The component currently only checks if searchClient is
null but also requires indexName (const indexName =
process.env.NEXT_PUBLIC_ALGOLIA_INDEX_VIDEOS); update the AlgoliaVideoList
render guard to fail closed when indexName is falsy as well (e.g., if
(!searchClient || !indexName) return the warning UI), and verify the environment
key name is the canonical one used across the repo (replace
NEXT_PUBLIC_ALGOLIA_INDEX_VIDEOS with NEXT_PUBLIC_ALGOLIA_INDEX_VIDEOS_STG if
that is the canonical key or vice versa so the env lookup and spec seeding
match). Ensure any other uses (e.g., where indexName is passed to the search
hook at/around the code using searchClient) are similarly guarded.

---

Nitpick comments:
In
`@apps/videos-admin/src/app/`(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.tsx:
- Around line 194-197: The inline event handlers in AlgoliaVideoList (e.g., the
onChange that calls refine and the paging button onClick closures) should be
extracted into named handlers: implement handleSearchChange (receives event,
calls refine(event.target.value)), handlePreviousPageClick and
handleNextPageClick (call previousPage() and nextPage() respectively), and
replace the inline closures in the JSX with these functions; optionally wrap
them with useCallback for stability. This targets the TextField onChange and the
pagination buttons in the same component so the render becomes easier to scan
and follows the repo convention for "handle*" event names.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1c69bf44-c959-481d-9778-7636b6b63c9a

📥 Commits

Reviewing files that changed from the base of the PR and between 0b9ea51 and 3ab782c.

📒 Files selected for processing (2)
  • apps/videos-admin/src/app/(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.spec.tsx
  • apps/videos-admin/src/app/(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.tsx

Copy link
Copy Markdown
Contributor

@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

♻️ Duplicate comments (1)
apps/videos-admin/src/app/(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.tsx (1)

262-264: ⚠️ Potential issue | 🟡 Minor

Add error handling for undefined indexName to match the validation for searchClient.

Line 248 reads process.env.NEXT_PUBLIC_ALGOLIA_INDEX_VIDEOS without a fallback, leaving indexName potentially undefined. While the code guards against a null searchClient (lines 250–260), it passes indexName to InstantSearch at line 263 without validating it first. The InstantSearch component requires indexName to be a non-null string; passing undefined will cause a runtime error.

Add a check for indexName alongside the searchClient validation, or provide a fallback value for the environment variable.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/videos-admin/src/app/`(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.tsx
around lines 262 - 264, The InstantSearch call uses indexName (from
process.env.NEXT_PUBLIC_ALGOLIA_INDEX_VIDEOS) without validation which can be
undefined and crash at runtime; add the same guard used for searchClient to
validate indexName (or provide a sensible fallback) before rendering
InstantSearch, e.g., check indexName and return the existing null/error UI when
it's falsy, or set a default string for indexName so InstantSearch and Configure
receive a non-null string; update references to indexName, searchClient,
InstantSearch (and Configure) accordingly.
🧹 Nitpick comments (1)
apps/videos-admin/src/app/(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.tsx (1)

224-240: Add accessibility labels to pagination buttons.

The "Previous" and "Next" buttons lack aria-label attributes. As per coding guidelines, accessibility features should be implemented on interactive elements.

♿ Proposed fix for accessibility
         <Button
           variant="outlined"
           disabled={currentRefinement <= 0}
           onClick={() => refinePage(currentRefinement - 1)}
+          aria-label="Go to previous page"
         >
           Previous
         </Button>
         <Typography variant="body2" color="text.secondary">
           Page {nbPages === 0 ? 0 : currentRefinement + 1} of {nbPages}
         </Typography>
         <Button
           variant="outlined"
           disabled={currentRefinement >= nbPages - 1}
           onClick={() => refinePage(currentRefinement + 1)}
+          aria-label="Go to next page"
         >
           Next
         </Button>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/videos-admin/src/app/`(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.tsx
around lines 224 - 240, The "Previous" and "Next" pagination Buttons in the
AlgoliaVideoList component lack accessibility labels; update the two <Button>
elements (the ones using currentRefinement, nbPages and calling refinePage) to
include descriptive aria-label attributes such as aria-label="Previous page" and
aria-label="Next page" (you can include dynamic info like current page/total if
desired, e.g. "Previous page, page X of Y") so screen readers can announce their
purpose; keep the existing disabled and onClick behavior tied to
currentRefinement and refinePage.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@apps/videos-admin/src/app/`(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.spec.tsx:
- Around line 60-65: The test in AlgoliaVideoList.spec.tsx sets
NEXT_PUBLIC_ALGOLIA_INDEX_VIDEOS_STG but the component reads
NEXT_PUBLIC_ALGOLIA_INDEX_VIDEOS; fix the mismatch by updating the test
environment to set NEXT_PUBLIC_ALGOLIA_INDEX_VIDEOS (or, if the intended runtime
is the _STG variant, update the component to read
NEXT_PUBLIC_ALGOLIA_INDEX_VIDEOS_STG) so the spec exercises the same env var the
AlgoliaVideoList component reads.

---

Duplicate comments:
In
`@apps/videos-admin/src/app/`(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.tsx:
- Around line 262-264: The InstantSearch call uses indexName (from
process.env.NEXT_PUBLIC_ALGOLIA_INDEX_VIDEOS) without validation which can be
undefined and crash at runtime; add the same guard used for searchClient to
validate indexName (or provide a sensible fallback) before rendering
InstantSearch, e.g., check indexName and return the existing null/error UI when
it's falsy, or set a default string for indexName so InstantSearch and Configure
receive a non-null string; update references to indexName, searchClient,
InstantSearch (and Configure) accordingly.

---

Nitpick comments:
In
`@apps/videos-admin/src/app/`(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.tsx:
- Around line 224-240: The "Previous" and "Next" pagination Buttons in the
AlgoliaVideoList component lack accessibility labels; update the two <Button>
elements (the ones using currentRefinement, nbPages and calling refinePage) to
include descriptive aria-label attributes such as aria-label="Previous page" and
aria-label="Next page" (you can include dynamic info like current page/total if
desired, e.g. "Previous page, page X of Y") so screen readers can announce their
purpose; keep the existing disabled and onClick behavior tied to
currentRefinement and refinePage.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1755ba7b-8296-40aa-b027-c3543031b089

📥 Commits

Reviewing files that changed from the base of the PR and between 3ab782c and 5ebe192.

📒 Files selected for processing (2)
  • apps/videos-admin/src/app/(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.spec.tsx
  • apps/videos-admin/src/app/(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.tsx

@github-actions github-actions Bot requested a deployment to Preview - videos-admin April 6, 2026 22:45 Pending
@github-actions github-actions Bot temporarily deployed to Preview - videos-admin April 6, 2026 22:49 Inactive
Copy link
Copy Markdown
Contributor

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

🧹 Nitpick comments (2)
apps/videos-admin/src/app/(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.spec.tsx (2)

169-169: Use a user-visible title for the click target in the navigation test.

Clicking 'Test Title' better reflects the user path and avoids coupling the test to whether mediaComponentId text is rendered as a cell.

♻️ Suggested tweak
-    fireEvent.click(screen.getByText('video-id'))
+    fireEvent.click(screen.getByText('Test Title'))
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/videos-admin/src/app/`(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.spec.tsx
at line 169, Update the navigation test in AlgoliaVideoList.spec.tsx to click
the user-visible title instead of the internal mediaComponentId: replace the
fireEvent.click(screen.getByText('video-id')) call in the test with a click
targeting the displayed title (e.g., the text 'Test Title') so the test follows
the user path and is not tied to internal IDs.

67-90: Replace as any casts on mock return values with explicit types.

The mocks at lines 70, 73, 78, 83, 90, 134, 139, and 165 use as any casts, which bypasses TypeScript type safety. Replace these with explicit types using Pick<ReturnType<typeof hookName>, ...> or Partial<ReturnType<...>> so that changes to hook return shapes fail at compile time rather than silently at runtime.

Per the coding guideline "Define a type if possible" for **/*.{ts,tsx}, these mock return values should be properly typed instead of escaped with any.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/videos-admin/src/app/`(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.spec.tsx
around lines 67 - 90, The test uses unsafe `as any` casts for mocked hook return
values (mockUseSearchBox, mockUseHits, mockUseInstantSearch, mockUsePagination,
mockUseRefinementList); replace each `as any` with a proper type such as
Pick<ReturnType<typeof useSearchBox>, 'query' | 'refine'> or
Partial<ReturnType<typeof useHits>> (or similar) so the mock shapes are checked
by TypeScript—update each mockReturnValue call to use the appropriate
Pick/PartialReturnType referring to the original hook (useSearchBox, useHits,
useInstantSearch, usePagination, useRefinementList) to ensure compile-time
failures if the hook return shapes change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@apps/videos-admin/src/app/`(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.spec.tsx:
- Line 169: Update the navigation test in AlgoliaVideoList.spec.tsx to click the
user-visible title instead of the internal mediaComponentId: replace the
fireEvent.click(screen.getByText('video-id')) call in the test with a click
targeting the displayed title (e.g., the text 'Test Title') so the test follows
the user path and is not tied to internal IDs.
- Around line 67-90: The test uses unsafe `as any` casts for mocked hook return
values (mockUseSearchBox, mockUseHits, mockUseInstantSearch, mockUsePagination,
mockUseRefinementList); replace each `as any` with a proper type such as
Pick<ReturnType<typeof useSearchBox>, 'query' | 'refine'> or
Partial<ReturnType<typeof useHits>> (or similar) so the mock shapes are checked
by TypeScript—update each mockReturnValue call to use the appropriate
Pick/PartialReturnType referring to the original hook (useSearchBox, useHits,
useInstantSearch, usePagination, useRefinementList) to ensure compile-time
failures if the hook return shapes change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 9d7faeb8-1414-4d54-bfec-9b08a79293ac

📥 Commits

Reviewing files that changed from the base of the PR and between 5ebe192 and 7f0b569.

📒 Files selected for processing (2)
  • apps/videos-admin/src/app/(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.spec.tsx
  • apps/videos-admin/src/app/(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/videos-admin/src/app/(dashboard)/videos/algolia/_AlgoliaVideoList/AlgoliaVideoList.tsx

@github-actions github-actions Bot temporarily deployed to Preview - videos-admin April 6, 2026 23:48 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - videos-admin April 7, 2026 16:20 Inactive
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.

4 participants