Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(j-s): ActiveCases table refactoring #15474

Merged
merged 17 commits into from
Jul 15, 2024
Merged

chore(j-s): ActiveCases table refactoring #15474

merged 17 commits into from
Jul 15, 2024

Conversation

oddsson
Copy link
Member

@oddsson oddsson commented Jul 9, 2024

ActiveCases table refactoring

Asana

What

  • Update the ActiveCases table to use our new Table component.
  • Fix a layout bug where the loading indicator in the Table component would shift the entire row on render
  • Removed a bunch of unused CSS
  • ISLAND-UI: Update framer-motion to be able to set mode='popLayout' on AnimatePresence. See upgrade instructions here

Screenshots / Gifs

Screen.Recording.2024-07-09.at.11.56.11.mov

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • New Features

    • Refined animation behavior across various components for a smoother user experience.
  • Bug Fixes

    • Improved table column styling and consistency in data presentation.
    • Enhanced sorting functionality and context menu handling in case tables.
  • Refactor

    • Simplified the ActiveCases component, improving maintainability and performance.
    • Updated test cases for better accuracy and reliability.
  • Chores

    • Upgraded framer-motion to version 9.0.0 for improved animation capabilities.

Copy link
Contributor

coderabbitai bot commented Jul 9, 2024

Walkthrough

The changes across the judicial-system web app primarily involve updates to components and styling to improve animation behavior, rendering logic, and consistency. Notably, the Framer Motion version was upgraded, and animation handling for context menus adjusted. Significant refactoring involved the ActiveCases component's structure and state management. Various test selectors and styling adjustments were made to streamline and enhance the user interface.

Changes

Files Change Summary
IndictmentsCaseFilesAccordionItem.tsx Changed AnimatePresence component’s mode prop from exitBeforeEnter to mode="wait".
PastCasesTable.tsx Modified className for a <td> element to use styles.largeColumn class.
Table.css.ts Removed several style declarations and added smallContainer style.
Table.tsx Adjusted rendering conditions based on screen width, imported motion from framer-motion, and modified animation handling.
TableSkeleton.tsx Removed className={styles.td} from <td> elements, directly used SkeletonLoader component.
Cases/ActiveCases.tsx Refactored component structure, removed unused imports and functions, and updated props and state handling.
Cases/Cases.css.ts Removed multiple styles related to table elements.
Cases/Cases.spec.tsx Refactored test suite, updated test selectors for table rows and sorting buttons.
Cases/Cases.strings.ts Removed the activeRequests.table.headers section from the activeRequests object.
Cases.tsx Updated ActiveCases component prop onDeleteCase to use onContextMenuDeleteClick, which now sets visibleModal state.
SignedVerdictOverview.tsx Changed AnimatePresence component’s mode prop from exitBeforeEnter to mode="wait".
package.json Updated framer-motion version from "6.5.1" to "9.0.0".

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@datadog-island-is
Copy link

datadog-island-is bot commented Jul 9, 2024

Datadog Report

All test runs 7d89b76 🔗

101 Total Test Services: 0 Failed, 99 Passed
🔻 Test Sessions change in coverage: 3 decreased, 2 increased, 195 no change

Test Services
This report shows up to 10 services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
air-discount-scheme-backend 0 0 0 81 0 33.95s N/A Link
air-discount-scheme-web 0 0 0 2 0 8.87s N/A Link
api 0 0 0 4 0 3.5s 1 no change Link
api-catalogue-services 0 0 0 23 0 14s 1 no change Link
api-domains-air-discount-scheme 0 0 0 6 0 18.53s N/A Link
api-domains-assets 0 0 0 3 0 11.58s N/A Link
api-domains-auth-admin 0 0 0 18 0 12.15s N/A Link
api-domains-communications 0 0 0 5 0 34.71s N/A Link
api-domains-criminal-record 0 0 0 5 0 10.52s N/A Link
api-domains-driving-license 0 0 0 23 0 33.82s 1 no change Link

🔻 Code Coverage Decreases vs Default Branch (3)

  • judicial-system-web - jest 32.51% (-0.12%) - Details
  • services-university-gateway - jest 44.76% (-0.02%) - Details
  • services-user-notification - jest 71.11% (-0.01%) - Details

@oddsson oddsson changed the title J s/table refacotring chore(j-s): ActiveCases table refactoring Jul 9, 2024
Copy link

codecov bot commented Jul 9, 2024

Codecov Report

Attention: Patch coverage is 86.36364% with 3 lines in your changes missing coverage. Please review.

Project coverage is 37.04%. Comparing base (3883852) to head (85c7921).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##             main   #15474    +/-   ##
========================================
  Coverage   37.03%   37.04%            
========================================
  Files        6557     6556     -1     
  Lines      134057   133848   -209     
  Branches    38371    38318    -53     
========================================
- Hits        49653    49583    -70     
+ Misses      84404    84265   -139     
Flag Coverage Δ
api-domains-driving-license 44.39% <ø> (ø)
application-templates-estate 11.91% <ø> (ø)
application-templates-mortgage-certificate 43.78% <ø> (ø)
auth-shared 75.00% <ø> (ø)
clients-license-client 1.84% <ø> (ø)
clients-rsk-company-registry 30.64% <ø> (ø)
icelandic-names-registry-backend 54.18% <ø> (ø)
infra-nest-server 48.33% <ø> (ø)
island-ui-core 28.85% <ø> (ø)
judicial-system-message 66.33% <ø> (ø)
nest-audit 68.20% <ø> (ø)
nest-feature-flags 51.52% <ø> (ø)
nest-problem 46.19% <ø> (ø)
nest-sequelize 94.44% <ø> (ø)
residence-history 85.00% <ø> (ø)
services-auth-public-api 51.04% <ø> (+0.01%) ⬆️
skilavottord-ws 23.58% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...ccordionItem/IndictmentsCaseFilesAccordionItem.tsx 20.11% <ø> (ø)
...components/Table/PastCasesTable/PastCasesTable.tsx 54.05% <ø> (ø)
...c/components/Table/TableSkeleton/TableSkeleton.tsx 80.00% <ø> (ø)
...ystem/web/src/routes/Shared/Cases/Cases.strings.ts 100.00% <ø> (ø)
...icial-system/web/src/routes/Shared/Cases/Cases.tsx 72.72% <ø> (-0.25%) ⬇️
...ed/SignedVerdictOverview/SignedVerdictOverview.tsx 13.90% <ø> (ø)
...judicial-system/web/src/components/Table/Table.tsx 74.32% <80.00%> (+5.40%) ⬆️
...system/web/src/routes/Shared/Cases/ActiveCases.tsx 88.88% <88.23%> (+26.75%) ⬆️

... and 52 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3883852...85c7921. Read the comment docs.

@oddsson oddsson marked this pull request as ready for review July 9, 2024 15:16
@oddsson oddsson requested review from a team as code owners July 9, 2024 15:16
Copy link
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: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 13b66f5 and 26a6a28.

Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
Files selected for processing (12)
  • apps/judicial-system/web/src/components/AccordionItems/IndictmentsCaseFilesAccordionItem/IndictmentsCaseFilesAccordionItem.tsx (1 hunks)
  • apps/judicial-system/web/src/components/Table/PastCasesTable/PastCasesTable.tsx (1 hunks)
  • apps/judicial-system/web/src/components/Table/Table.css.ts (3 hunks)
  • apps/judicial-system/web/src/components/Table/Table.tsx (3 hunks)
  • apps/judicial-system/web/src/components/Table/TableSkeleton/TableSkeleton.tsx (1 hunks)
  • apps/judicial-system/web/src/routes/Shared/Cases/ActiveCases.tsx (1 hunks)
  • apps/judicial-system/web/src/routes/Shared/Cases/Cases.css.ts (2 hunks)
  • apps/judicial-system/web/src/routes/Shared/Cases/Cases.spec.tsx (6 hunks)
  • apps/judicial-system/web/src/routes/Shared/Cases/Cases.strings.ts (1 hunks)
  • apps/judicial-system/web/src/routes/Shared/Cases/Cases.tsx (1 hunks)
  • apps/judicial-system/web/src/routes/Shared/SignedVerdictOverview/SignedVerdictOverview.tsx (1 hunks)
  • package.json (1 hunks)
Files skipped from review due to trivial changes (7)
  • apps/judicial-system/web/src/components/Table/PastCasesTable/PastCasesTable.tsx
  • apps/judicial-system/web/src/components/Table/Table.css.ts
  • apps/judicial-system/web/src/routes/Shared/Cases/ActiveCases.tsx
  • apps/judicial-system/web/src/routes/Shared/Cases/Cases.css.ts
  • apps/judicial-system/web/src/routes/Shared/Cases/Cases.spec.tsx
  • apps/judicial-system/web/src/routes/Shared/Cases/Cases.strings.ts
  • package.json
Additional context used
Path-based instructions (5)
apps/judicial-system/web/src/components/Table/TableSkeleton/TableSkeleton.tsx (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/judicial-system/web/src/components/Table/Table.tsx (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/judicial-system/web/src/routes/Shared/Cases/Cases.tsx (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/judicial-system/web/src/components/AccordionItems/IndictmentsCaseFilesAccordionItem/IndictmentsCaseFilesAccordionItem.tsx (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/judicial-system/web/src/routes/Shared/SignedVerdictOverview/SignedVerdictOverview.tsx (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
Additional comments not posted (5)
apps/judicial-system/web/src/components/Table/TableSkeleton/TableSkeleton.tsx (1)

55-170: Verify styling after class name removal.

The changes involve removing class names from <td> elements and directly using the SkeletonLoader component. Ensure that the styling is still correct after these changes.

apps/judicial-system/web/src/components/Table/Table.tsx (2)

Line range hint 11-129:
Verify screen width condition update.

The screen width condition for rendering has been updated from theme.breakpoints.md to theme.breakpoints.lg. Ensure that this change aligns with the design requirements.


208-247: Verify context menu animations.

The changes involve adding AnimatePresence and motion components for context menu animations. Ensure that the animations work as intended and do not introduce any performance issues.

apps/judicial-system/web/src/routes/Shared/Cases/Cases.tsx (1)

303-303: Verify prop change in ActiveCases component.

The ActiveCases component's prop has been updated from onDeleteCase to onContextMenuDeleteClick. Ensure that this change does not break the functionality and that the visibleModal state is set correctly.

apps/judicial-system/web/src/routes/Shared/SignedVerdictOverview/SignedVerdictOverview.tsx (1)

722-722: Verify the animation behavior with mode="wait".

The mode prop update to "wait" in AnimatePresence ensures smoother transitions by waiting for the exit animation to complete before starting the enter animation. Verify that this change achieves the desired animation behavior.

Copy link
Member

@unakb unakb left a comment

Choose a reason for hiding this comment

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

Love it

Copy link
Member

@baering baering left a comment

Choose a reason for hiding this comment

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

Core files LGTM.

@gudjong gudjong added the automerge Merge this PR as soon as all checks pass label Jul 15, 2024
@kodiakhq kodiakhq bot merged commit 7cb58ad into main Jul 15, 2024
249 checks passed
@kodiakhq kodiakhq bot deleted the j-s/table_refacotring branch July 15, 2024 17:13
oskarjs pushed a commit that referenced this pull request Aug 20, 2024
* Fix sideStepper for cases in WAITING_FOR_CANCELLATION state

* Remove unused code

* Remove unused css

* Use Table component for ActiveCases

* Refactoring

* Remove unused code

* Styling

* Add nicer animations

* Add better animations

* Refactoring

* Remove debug code

* Add ability to remove cases

* Fix tests

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants