Skip to content

♻️(frontend) refacto of the grid documents - #2534

Open
AntoLC wants to merge 3 commits into
mainfrom
refacto/grid-document-v3
Open

♻️(frontend) refacto of the grid documents#2534
AntoLC wants to merge 3 commits into
mainfrom
refacto/grid-document-v3

Conversation

@AntoLC

@AntoLC AntoLC commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Purpose

We have refactored the document grid feature to fit the new design system and to improve the code quality.
We can now sort the data by name or updating date (asc / desc).

Ref #2364

Demo

Enregistrement.2026-07-27.153020.mp4

@AntoLC AntoLC self-assigned this Jul 22, 2026
@AntoLC AntoLC added enhancement improve an existing feature frontend labels Jul 22, 2026
This was linked to issues Jul 22, 2026
@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Size Change: +2.39 kB (+0.05%)

Total Size: 4.36 MB

📦 View Changed
Filename Size Change
apps/impress/out/_next/static/1167d8ff/_buildManifest.js 0 B -677 B (removed) 🏆
apps/impress/out/_next/static/17615a37/_buildManifest.js 675 B +675 B (new file) 🆕
apps/impress/out/_next/static/chunks/4749.js 61.9 kB +2.35 kB (+3.93%)
apps/impress/out/_next/static/css/3de8d3c15e78e9de.css 0 B -55.2 kB (removed) 🏆
apps/impress/out/_next/static/css/5fa96f01e21ac681.css 55.3 kB +55.3 kB (new file) 🆕

compressed-size-action

@AntoLC
AntoLC force-pushed the refacto/grid-document-v3 branch 5 times, most recently from 9de768e to f3c05a8 Compare July 23, 2026 14:05
@AntoLC AntoLC linked an issue Jul 27, 2026 that may be closed by this pull request
@AntoLC
AntoLC requested a review from Ovgodd July 27, 2026 13:45
@AntoLC

AntoLC commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The pull request refactors the document grid with target-aware queries, sorting controls, responsive layouts, updated document actions, and hook-based drag-and-drop. End-to-end tests now cover sorting and revised grid interactions. Shared document icons, translations, loading behavior, page styling, focus-visible states, and related changelog entries were also updated.

Estimated code review effort: 4 (Complex) | ~60 minutes

Suggested reviewers: ovgodd

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: a frontend refactor of the document grid.
Description check ✅ Passed The description is clearly related and mentions the grid refactor and new sorting behavior.
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.
✨ 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 refacto/grid-document-v3

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 13

🤖 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 `@CHANGELOG.md`:
- Line 17: Update the frontend grid documents changelog entry to replace the
typo “refacto” with “refactor” or “refactoring,” preserving the rest of the
entry unchanged.

In `@src/frontend/apps/e2e/__tests__/app-impress/doc-grid.spec.ts`:
- Around line 391-401: Strengthen the sorting assertions in the doc-grid test by
verifying the relative DOM positions of the filtered rows, not only their
counts. After clicking “Sort by Name,” assert docA appears before docB; after
clicking “Sorted by Name,” assert docZ is the first matching row. Keep the
existing visibility/count checks for excluded documents.

In
`@src/frontend/apps/impress/src/features/docs/doc-management/components/SimpleDocItem.tsx`:
- Around line 62-115: Refactor the icon rendering in the component’s main
ternary so the shared DocsIcon/SubdocsIcon selection is computed once, with
isChild selecting SubdocsIcon and the default selecting DocsIcon. Render one
Icon instance, conditionally wrap it in the pinned relative Box only when
isPinned, and keep the pinned data-testid and overlay PinnedIcon limited to that
wrapper.

In
`@src/frontend/apps/impress/src/features/docs/docs-grid/components/DocGridContentList.tsx`:
- Around line 300-320: Update DocsGridItem so the useDraggable boxProps,
including role and tabIndex from attributes, are applied after its hardcoded
props and are not overridden; preserve the existing draggable listeners and
attributes wiring so the item remains keyboard-focusable.
- Around line 117-119: Guard the document.body access in the dndAccessibility
setup within the DocGridContentList component so it is only evaluated after
client mounting. Avoid creating the accessibility object with document.body
during server rendering or when isLargeScreen is false, and pass the guarded
value to DndContext while preserving the existing drag behavior.

In
`@src/frontend/apps/impress/src/features/docs/docs-grid/components/DocsGrid.tsx`:
- Around line 119-138: The role-less grid Box in DocsGrid.tsx should no longer
carry aria-label; move the translated “Documents grid” label to the nested Box
with role="list". In SimpleDocItem.tsx, remove aria-label={itemAriaLabel} from
the plain container, relying on DocsGridItem’s enclosing link/listitem for the
accessible name.
- Around line 144-162: Remove the redundant !isFetching && hasNextPage
conditional inside the InView component in DocsGrid. Render the More docs Button
directly within InView, preserving its existing click handler, styling,
translation, and outer hasNextPage && !loading guard.

In
`@src/frontend/apps/impress/src/features/docs/docs-grid/components/DocsGridActions.tsx`:
- Around line 244-266: Move the doc.abilities.restore guard to the start of the
component logic, before constructing the options array in DocsGridActions.
Return null immediately when restore is unavailable, while preserving the
existing restore callback and options behavior for allowed documents.
- Around line 222-242: Update the useRestoreDoc configuration’s onError callback
to accept the error argument supplied by React Query and interpolate that
argument in the restore failure toast, instead of reading the hook-level error
binding. Leave the existing success behavior and toast options unchanged.

In
`@src/frontend/apps/impress/src/features/docs/docs-grid/components/DocsGridColumnName.tsx`:
- Around line 28-32: Update the header controls using toggleOrdering so each
Button’s label includes the visible column text and sort icon, making the entire
header cell clickable. Remove the separate text outside the Button and reuse the
combined label for accessibility instead of maintaining duplicated label and
ariaLabel values.
- Around line 113-129: Update the sort button in DocsGridColumnName to use
distinct neutral, ascending, and descending glyphs based on isActive and isDesc,
while retaining the existing color state. Ensure inactive columns use the
neutral icon, active ascending columns use an up icon, and active descending
columns use a down icon.

In
`@src/frontend/apps/impress/src/features/docs/docs-grid/components/DocsGridItem.tsx`:
- Around line 81-95: Remove tabIndex={0} from the inner Box in DocsGridItem so
the anonymous container is not included in keyboard navigation. Keep keyboard
focus and activation behavior on the existing StyledLink, where handleKeyDown is
defined.
- Around line 92-95: Remove the duplicate grid-template-columns declaration in
the CSS template for the DocsGridItem component, keeping a single
grid-template-columns: subgrid rule alongside the existing grid-column
declaration.
🪄 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: ASSERTIVE

Plan: Pro Plus

Run ID: 2ebbe7cf-d552-4fcf-bffe-fe4b9e139955

📥 Commits

Reviewing files that changed from the base of the PR and between 61c2183 and f3c05a8.

⛔ Files ignored due to path filters (6)
  • src/frontend/apps/impress/src/assets/icons/ui-kit/Docs.svg is excluded by !**/*.svg
  • src/frontend/apps/impress/src/assets/icons/ui-kit/Subdocs.svg is excluded by !**/*.svg
  • src/frontend/apps/impress/src/assets/icons/ui-kit/arrow-up-down.svg is excluded by !**/*.svg
  • src/frontend/apps/impress/src/assets/icons/ui-kit/bin.svg is excluded by !**/*.svg
  • src/frontend/apps/impress/src/assets/icons/ui-kit/clock.svg is excluded by !**/*.svg
  • src/frontend/apps/impress/src/assets/icons/ui-kit/pinned.svg is excluded by !**/*.svg
📒 Files selected for processing (29)
  • CHANGELOG.md
  • src/frontend/apps/e2e/__tests__/app-impress/doc-create.spec.ts
  • src/frontend/apps/e2e/__tests__/app-impress/doc-grid-move.spec.ts
  • src/frontend/apps/e2e/__tests__/app-impress/doc-grid.spec.ts
  • src/frontend/apps/e2e/__tests__/app-impress/doc-member-create.spec.ts
  • src/frontend/apps/e2e/__tests__/app-impress/utils-common.ts
  • src/frontend/apps/e2e/__tests__/app-impress/utils-signin.ts
  • src/frontend/apps/impress/src/components/ErrorPage.tsx
  • src/frontend/apps/impress/src/components/Loading.tsx
  • src/frontend/apps/impress/src/features/docs/doc-header/components/AlertRestore.tsx
  • src/frontend/apps/impress/src/features/docs/doc-management/components/SimpleDocItem.tsx
  • src/frontend/apps/impress/src/features/docs/docs-grid/api/useDocsGridQuery.tsx
  • src/frontend/apps/impress/src/features/docs/docs-grid/components/DocGridContentList.tsx
  • src/frontend/apps/impress/src/features/docs/docs-grid/components/DocMoveModal.tsx
  • src/frontend/apps/impress/src/features/docs/docs-grid/components/DocsGrid.tsx
  • src/frontend/apps/impress/src/features/docs/docs-grid/components/DocsGridActions.tsx
  • src/frontend/apps/impress/src/features/docs/docs-grid/components/DocsGridColumnName.tsx
  • src/frontend/apps/impress/src/features/docs/docs-grid/components/DocsGridItem.tsx
  • src/frontend/apps/impress/src/features/docs/docs-grid/components/DocsGridLoader.tsx
  • src/frontend/apps/impress/src/features/docs/docs-grid/components/DocsGridTrashbinActions.tsx
  • src/frontend/apps/impress/src/features/docs/docs-grid/components/Draggable.tsx
  • src/frontend/apps/impress/src/features/docs/docs-grid/components/Droppable.tsx
  • src/frontend/apps/impress/src/features/docs/docs-grid/components/__tests__/DocsGridItemDate.test.tsx
  • src/frontend/apps/impress/src/features/docs/docs-grid/components/index.ts
  • src/frontend/apps/impress/src/features/docs/docs-grid/hooks/useResponsiveDocGrid.tsx
  • src/frontend/apps/impress/src/features/left-panel/components/LeftPanel.tsx
  • src/frontend/apps/impress/src/pages/404.tsx
  • src/frontend/apps/impress/src/pages/docs/index.tsx
  • src/frontend/apps/impress/src/pages/globals.css
💤 Files with no reviewable changes (8)
  • src/frontend/apps/impress/src/features/docs/docs-grid/components/Droppable.tsx
  • src/frontend/apps/impress/src/features/docs/docs-grid/hooks/useResponsiveDocGrid.tsx
  • src/frontend/apps/impress/src/features/docs/docs-grid/components/index.ts
  • src/frontend/apps/impress/src/features/docs/docs-grid/components/Draggable.tsx
  • src/frontend/apps/impress/src/features/docs/docs-grid/components/DocMoveModal.tsx
  • src/frontend/apps/impress/src/features/docs/docs-grid/components/DocsGridLoader.tsx
  • src/frontend/apps/impress/src/features/docs/docs-grid/components/DocsGridTrashbinActions.tsx
  • src/frontend/apps/impress/src/features/docs/docs-grid/components/tests/DocsGridItemDate.test.tsx

Comment thread CHANGELOG.md
Comment thread src/frontend/apps/e2e/__tests__/app-impress/doc-grid.spec.ts
Comment on lines +28 to +32
const toggleOrdering = (field: 'title' | 'updated_at') => {
setOrdering((prevOrdering) =>
prevOrdering === field ? (`-${field}` as DocsOrdering) : field,
);
};

@coderabbitai coderabbitai Bot Jul 27, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Make the whole header cell the sort control.

The visible Name / Last modified text sits outside the Button, so the only pointer target is the nano icon. Wrapping the label inside the button (it already accepts ReactNode via label) would give a much larger hit area and remove the duplicated label/ariaLabel pair.

Also applies to: 43-57

🤖 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/frontend/apps/impress/src/features/docs/docs-grid/components/DocsGridColumnName.tsx`
around lines 28 - 32, Update the header controls using toggleOrdering so each
Button’s label includes the visible column text and sort icon, making the entire
header cell clickable. Remove the separate text outside the Button and reuse the
combined label for accessibility instead of maintaining duplicated label and
ariaLabel values.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Acceptable for the moment, we will wait for the design review.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@AntoLC, understood. We can revisit the header hit area and accessibility treatment once the design review provides direction.

Comment thread src/frontend/apps/impress/src/features/docs/docs-grid/components/DocsGridItem.tsx Outdated
Comment thread src/frontend/apps/impress/src/features/docs/docs-grid/components/DocsGridItem.tsx Outdated
AntoLC added 3 commits July 29, 2026 10:53
We have refactored the document grid feature to
fit the new design system and to improve the code
quality.
Lot of elements did not have a focus style, or the
focus style was not consistent. We now have a global focus
style that is applied to all elements that are
focusable. The style is still overridable for
specific elements, so buttons and other elements
still have their own focus style.
We will have probably to improve the focus style
in the future of some elements, but this is a
good start.
We can now sort the documents list by clicking on
the column name. The sorting is done in ascending
or descending order.
@AntoLC
AntoLC force-pushed the refacto/grid-document-v3 branch from f3c05a8 to 0e6f2f7 Compare July 29, 2026 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement improve an existing feature frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New icons ♻️ Change loader Grid doc Add alphabetical sorting to docs list

1 participant