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

feat(j-s): Court Session type #15338

Merged
merged 3 commits into from
Jun 25, 2024
Merged

feat(j-s): Court Session type #15338

merged 3 commits into from
Jun 25, 2024

Conversation

gudjong
Copy link
Member

@gudjong gudjong commented Jun 25, 2024

Court Session type

[Aðalmeðferð (Bóka nýtt þinghald með tegund þinghalds)(https://app.asana.com/0/1199153462262248/1206840919693199/f)

What

  • Adds a court session type which can be selected form a drop down when scheduling a new court date.
  • Displays the court session type with the scheduled date in case lists.
  • Displays the court session type in an info card with the scheduled date.

Why

  • Improved usability.

Screenshots / Gifs

image image image image

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

    • Added courtSessionType field to various case-related components, queries, and models for enhanced tracking of court session types.
    • Introduced new CourtDate component for improved rendering of court dates across multiple views.
    • Added new localization strings for court session type selection in the Conclusion step of indictments.
  • Bug Fixes

    • Fixed validation logic to ensure courtSessionType and courtDate are checked in indictment cases.
  • Refactor

    • Replaced date formatting logic with the new CourtDate component for better modularity and readability in display components.

@gudjong gudjong requested a review from a team as a code owner June 25, 2024 11:14
Copy link
Contributor

coderabbitai bot commented Jun 25, 2024

Walkthrough

The changes introduce a new field courtSessionType across multiple modules in the judicial system application, affecting both backend and frontend components. Backend updates include new Sequelize migrations, data models enhancements, and DTO updates to accommodate the new field. The frontend modifications involve updating React components and GraphQL queries to handle and display the new courtSessionType property, ensuring consistent data flow and user interface coherence.

Changes

Files Change Summaries
.../caseList.model.ts Introduced courtSessionType field to CaseListEntry class.
.../updateCase.input.ts Added courtSessionType to UpdateCaseInput class with decorators.
.../case.model.ts Added CourtSessionType enum and corresponding field to Case class.
.../migrations/20240623202256-update-case.js Added migration script to handle court_session_type field in case table.
.../case.service.ts Included courtSessionType and other new fields in UpdateCase interface.
.../updateCase.dto.ts Added courtSessionType property to UpdateCaseDto class.
.../case/guards/rolesRules.ts Added courtSessionType to districtCourtFields array in UpdateCaseDto interface.
.../case/interceptors/caseList.interceptor.ts Added courtSessionType in CaseListInterceptor class.
.../case/limitedAccessCase.service.ts Added courtSessionType to attributes array in Case interface.
.../case/models/case.model.ts Introduced courtSessionType property in Case class representing court session type in indictment cases.
.../case.graphql Included courtSessionType field in Case query.
.../limitedAccessCase.graphql Added courtSessionType field in limitedAccessCase GraphQL query.
.../components/InfoCard/InfoCardCaseScheduled.tsx Updated title property to accept string or null.
.../InfoCardCaseScheduledIndictment.strings.ts Removed schedulingTitle message definition.
.../components/InfoCard/InfoCardCaseScheduledIndictment.tsx Added courtSessionType to component Props and used it to set dynamic titles.
.../Table/CourtDate/CourtDate.tsx Refactored CourtDate component for conditional rendering and added new components to handle various scenarios.
.../Indictments/Conclusion/Conclusion.strings.ts Added new strings for court session label and placeholder.
.../Indictments/Conclusion/Conclusion.tsx Added Select component for court session types and updated related states and logic.
.../Indictments/Overview/Overview.tsx Included courtSessionType prop in IndictmentOverview component.
.../Court/components/CasesInProgressTable/CasesInProgressTable.tsx Updated courtSessionType prop handling in <CourtDate> component.
.../Defender/Cases/components/DefenderCasesTable.tsx Replaced date-fns logic with CourtDate component.
.../Defender/Cases/defenderCases.graphql Included courtSessionType field in DefenderCases query.
.../Prosecutor/Indictments/Overview/Overview.tsx Added courtSessionType prop in Overview component.
.../Shared/Cases/ActiveCases.tsx Simplified rendering logic using CourtDate component with new props.
.../Shared/Cases/cases.graphql Added courtSessionType field in Cases query.
.../Shared/IndictmentOverview/IndictmentOverview.tsx Added courtSessionType prop in IndictmentOverview component.
.../utils/validate.ts Updated validation logic in isConclusionStepValid function to include courtSessionType.
.../types/src/index.ts Exported CourtSessionType and courtSessionTypeNames.
.../types/src/lib/case.ts Introduced CourtSessionType enum and courtSessionTypeNames constant.

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.

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

Outside diff range and nitpick comments (2)
apps/judicial-system/web/src/routes/Defender/Cases/components/DefenderCasesTable.tsx (1)

Line range hint 124-128: Accessibility Enhancement Needed for Click Events.

The ContextMenu component triggered by click events should also be accessible via keyboard events. This is important for accessibility compliance.

- <IconButton
+ <IconButton
+   onKeyUp={handleKeyUp}
+   onKeyDown={handleKeyDown}
+   onKeyPress={handleKeyPress}

Please implement corresponding keyboard event handlers (onKeyUp, onKeyDown, onKeyPress) to ensure that all functionalities are accessible via keyboard.

apps/judicial-system/web/src/utils/validate.ts (1)

Line range hint 43-43: Replace RegExp constructor with literal notation for performance and readability.

Using regular expression literals, as opposed to the RegExp constructor, enhances both performance and readability. This change also aligns with best practices for static analysis and linting rules.

- return { regex: new RegExp('.')}
+ return { regex: /./ }
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8e43c3c and 76171da.

Files selected for processing (29)
  • apps/judicial-system/api/src/app/modules/case-list/models/caseList.model.ts (2 hunks)
  • apps/judicial-system/api/src/app/modules/case/dto/updateCase.input.ts (2 hunks)
  • apps/judicial-system/api/src/app/modules/case/models/case.model.ts (3 hunks)
  • apps/judicial-system/backend/migrations/20240623202256-update-case.js (1 hunks)
  • apps/judicial-system/backend/src/app/modules/case/case.service.ts (1 hunks)
  • apps/judicial-system/backend/src/app/modules/case/dto/updateCase.dto.ts (2 hunks)
  • apps/judicial-system/backend/src/app/modules/case/guards/rolesRules.ts (1 hunks)
  • apps/judicial-system/backend/src/app/modules/case/interceptors/caseList.interceptor.ts (1 hunks)
  • apps/judicial-system/backend/src/app/modules/case/limitedAccessCase.service.ts (1 hunks)
  • apps/judicial-system/backend/src/app/modules/case/models/case.model.ts (2 hunks)
  • apps/judicial-system/web/src/components/FormProvider/case.graphql (1 hunks)
  • apps/judicial-system/web/src/components/FormProvider/limitedAccessCase.graphql (1 hunks)
  • apps/judicial-system/web/src/components/InfoCard/InfoCardCaseScheduled.tsx (1 hunks)
  • apps/judicial-system/web/src/components/InfoCard/InfoCardCaseScheduledIndictment.strings.ts (1 hunks)
  • apps/judicial-system/web/src/components/InfoCard/InfoCardCaseScheduledIndictment.tsx (4 hunks)
  • apps/judicial-system/web/src/components/Table/CourtDate/CourtDate.tsx (1 hunks)
  • apps/judicial-system/web/src/routes/Court/Indictments/Conclusion/Conclusion.strings.ts (1 hunks)
  • apps/judicial-system/web/src/routes/Court/Indictments/Conclusion/Conclusion.tsx (12 hunks)
  • apps/judicial-system/web/src/routes/Court/Indictments/Overview/Overview.tsx (1 hunks)
  • apps/judicial-system/web/src/routes/Court/components/CasesInProgressTable/CasesInProgressTable.tsx (1 hunks)
  • apps/judicial-system/web/src/routes/Defender/Cases/components/DefenderCasesTable.tsx (3 hunks)
  • apps/judicial-system/web/src/routes/Defender/Cases/defenderCases.graphql (1 hunks)
  • apps/judicial-system/web/src/routes/Prosecutor/Indictments/Overview/Overview.tsx (2 hunks)
  • apps/judicial-system/web/src/routes/Shared/Cases/ActiveCases.tsx (2 hunks)
  • apps/judicial-system/web/src/routes/Shared/Cases/cases.graphql (1 hunks)
  • apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx (1 hunks)
  • apps/judicial-system/web/src/utils/validate.ts (1 hunks)
  • libs/judicial-system/types/src/index.ts (1 hunks)
  • libs/judicial-system/types/src/lib/case.ts (1 hunks)
Files not reviewed due to errors (1)
  • apps/judicial-system/backend/src/app/modules/case/case.service.ts (no review received)
Files skipped from review due to trivial changes (4)
  • apps/judicial-system/web/src/components/FormProvider/case.graphql
  • apps/judicial-system/web/src/components/InfoCard/InfoCardCaseScheduledIndictment.strings.ts
  • apps/judicial-system/web/src/routes/Court/Indictments/Conclusion/Conclusion.strings.ts
  • apps/judicial-system/web/src/routes/Defender/Cases/defenderCases.graphql
Additional context used
Path-based instructions (25)
apps/judicial-system/backend/migrations/20240623202256-update-case.js (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/InfoCard/InfoCardCaseScheduled.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.graphql (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/InfoCard/InfoCardCaseScheduledIndictment.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."
libs/judicial-system/types/src/index.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
apps/judicial-system/web/src/components/FormProvider/limitedAccessCase.graphql (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/CourtDate/CourtDate.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/backend/src/app/modules/case/interceptors/caseList.interceptor.ts (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/api/src/app/modules/case-list/models/caseList.model.ts (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/Court/Indictments/Overview/Overview.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/IndictmentOverview/IndictmentOverview.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/Court/components/CasesInProgressTable/CasesInProgressTable.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/Defender/Cases/components/DefenderCasesTable.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/backend/src/app/modules/case/guards/rolesRules.ts (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/api/src/app/modules/case/dto/updateCase.input.ts (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/Prosecutor/Indictments/Overview/Overview.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/backend/src/app/modules/case/dto/updateCase.dto.ts (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/backend/src/app/modules/case/limitedAccessCase.service.ts (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/api/src/app/modules/case/models/case.model.ts (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."
libs/judicial-system/types/src/lib/case.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
apps/judicial-system/web/src/utils/validate.ts (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/ActiveCases.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/Court/Indictments/Conclusion/Conclusion.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/backend/src/app/modules/case/models/case.model.ts (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/backend/src/app/modules/case/case.service.ts (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."
Learnings (1)
apps/judicial-system/web/src/routes/Prosecutor/Indictments/Overview/Overview.tsx (1)
User: unakb
PR: island-is/island.is#14712
File: apps/judicial-system/web/src/routes/PublicProsecutor/Indictments/Overview/IndictmentOverview.tsx:0-0
Timestamp: 2024-05-06T18:09:27.876Z
Learning: The judicial system application uses a toaster notification system to handle errors globally.
Biome
apps/judicial-system/backend/migrations/20240623202256-update-case.js

[error] 1-1: Redundant use strict directive. (lint/suspicious/noRedundantUseStrict)

The entire contents of JavaScript modules are automatically in strict mode, with no statement needed to initiate it.
Safe fix: Remove the redundant use strict directive.

apps/judicial-system/web/src/routes/Defender/Cases/components/DefenderCasesTable.tsx

[error] 124-128: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)

Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.

apps/judicial-system/backend/src/app/modules/case/limitedAccessCase.service.ts

[error] 228-228: Decorators are not valid here. (parse)

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 229-229: Decorators are not valid here. (parse)

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

libs/judicial-system/types/src/lib/case.ts

[error] 107-107: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 108-108: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 109-109: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 110-110: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 111-111: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 112-112: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 113-113: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 117-117: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 118-118: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 119-119: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 120-120: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 121-121: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 122-122: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 123-123: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 124-124: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 156-156: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 157-157: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 158-158: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 159-159: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)


[error] 160-160: The enum member should be initialized with a literal value such as a number or a string. (lint/style/useLiteralEnumMembers)

apps/judicial-system/web/src/utils/validate.ts

[error] 43-43: Use a regular expression literal instead of the RegExp constructor. (lint/complexity/useRegexLiterals)

Regular expression literals avoid some escaping required in a string literal, and are easier to analyze statically.
Safe fix: Use a literal notation instead.

apps/judicial-system/backend/src/app/modules/case/case.service.ts

[error] 360-360: Decorators are not valid here. (parse)

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 361-361: Decorators are not valid here. (parse)

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 362-362: Decorators are not valid here. (parse)

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 363-363: Decorators are not valid here. (parse)

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 365-365: Decorators are not valid here. (parse)

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.


[error] 376-376: Decorators are not valid here. (parse)

Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting the unsafeParameterDecoratorsEnabled option to true in your configuration file.

Additional comments not posted (35)
apps/judicial-system/backend/migrations/20240623202256-update-case.js (2)

5-15: Migration script to add 'court_session_type' column is well-structured.

The use of a transaction ensures that the change is atomic, which is crucial for database integrity during schema changes.


18-24: Proper handling of the column removal in the down migration.

Using a transaction for the removal ensures that any failures during the removal will not leave the database in an inconsistent state.

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

15-15: Consider documenting optional props in the interface.

While the title prop is optional, adding a comment to explain under what conditions it might not be provided could enhance maintainability.


15-15: Ensure consistent handling of optional props.

The ternary operation for title is a good practice to handle optional props gracefully. It ensures that even if title is not provided, a default value is used.

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

97-97: Addition of 'courtSessionType' to GraphQL query is correctly implemented.

This change aligns with the backend updates and ensures that the frontend can retrieve the new courtSessionType data.

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

5-10: Correct usage of imports for new types and enums.

Importing necessary types and enums from the judicial system's type library and GraphQL schema ensures type safety and consistency.


Line range hint 22-32: Proper integration of 'courtSessionType' in component logic.

The conditional rendering based on courtSessionType and its inclusion in the InfoCardCaseScheduled component as a title prop demonstrates a thoughtful integration of the new field into the UI.

Also applies to: 69-69

libs/judicial-system/types/src/index.ts (1)

77-78: Proper declaration and export of 'CourtSessionType' and related constants.

The addition of the CourtSessionType enum and courtSessionTypeNames mapping ensures that these new types are available throughout the application, promoting consistency and reusability.

apps/judicial-system/web/src/components/FormProvider/limitedAccessCase.graphql (1)

149-149: Addition of courtSessionType to GraphQL query approved.

The inclusion of the courtSessionType field in the limitedAccessCase query aligns with the PR objectives to enhance the judicial system's functionality by allowing the selection of court session types.

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

9-11: Import and interface changes for courtSessionType are correct.

The import of courtSessionTypeNames and the CourtSessionType from the types library, and the addition of courtSessionType to the component's props are consistent with the need to handle new court session types in the UI.

Also applies to: 16-16


25-47: New component CourtDateWithCourtSessionType handling approved.

The creation of a specialized component to handle dates with court session types is a good use of React's compositional model, ensuring that each case type is handled distinctly and clearly. The use of Text components to display formatted date and session type information is appropriate and maintains UI consistency.


69-91: Conditional rendering logic in CourtDate component approved.

The conditional rendering based on postponedIndefinitelyExplanation, courtDate, and courtSessionType is logically sound and ensures that the correct component variant is used based on the available data.

apps/judicial-system/backend/src/app/modules/case/interceptors/caseList.interceptor.ts (1)

67-67: Secure inclusion of courtSessionType in case list response approved.

The addition of courtSessionType to the case list response in the interceptor is done securely, aligning with the warning comment about sensitive information. This change enables the frontend to display the new court session types without compromising security.

apps/judicial-system/api/src/app/modules/case-list/models/caseList.model.ts (1)

133-134: Addition of courtSessionType to CaseListEntry model approved.

The addition of the courtSessionType field with appropriate GraphQL decorators ensures that this new data can be correctly queried and used within the application. This change is well-integrated with the existing model structure.

apps/judicial-system/web/src/routes/Court/Indictments/Overview/Overview.tsx (1)

72-72: Passing of courtSessionType to InfoCardCaseScheduledIndictment component approved.

The modification to pass courtSessionType to the InfoCardCaseScheduledIndictment component is correctly implemented. This change allows the component to utilize the new court session type data effectively in the UI.

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

98-98: Ensure consistent prop handling in InfoCardCaseScheduledIndictment.

The addition of courtSessionType to the props passed to InfoCardCaseScheduledIndictment is consistent with the PR objectives. However, ensure that the component correctly handles this new prop, especially in cases where it might be undefined.

Verification successful

Ensure consistent prop handling in InfoCardCaseScheduledIndictment.

The courtSessionType prop is correctly handled within the InfoCardCaseScheduledIndictment component, including cases where it might be undefined or null.

  • The prop is optionally defined with courtSessionType?: CourtSessionType | null.
  • It is used conditionally in the title attribute: title={courtSessionType && courtSessionTypeNames[courtSessionType]}.

These implementations ensure that the component handles the prop properly even if it is not provided or is null.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify proper handling of `courtSessionType` prop in `InfoCardCaseScheduledIndictment`.

# Test: Search for the component usage. Expect: Prop handling for null and undefined.
rg --type tsx -g '*InfoCardCaseScheduledIndictment.tsx' $'InfoCardCaseScheduledIndictment'

Length of output: 117



Script:

#!/bin/bash
# Description: Verify proper handling of `courtSessionType` prop in `InfoCardCaseScheduledIndictment`.

# Test: Search for the component file and check for handling of `courtSessionType` prop.
# 1. Locate the `InfoCardCaseScheduledIndictment` component file.
# 2. Search for the `courtSessionType` prop within the located file.

# Locate the component file
component_file=$(fd 'InfoCardCaseScheduledIndictment.tsx')

# Check for handling of `courtSessionType` prop within the component file
if [[ -n "$component_file" ]]; then
  rg 'courtSessionType' "$component_file"
else
  echo "Component file not found"
fi

Length of output: 562

apps/judicial-system/web/src/routes/Court/components/CasesInProgressTable/CasesInProgressTable.tsx (1)

157-166: Integration of courtSessionType in CourtDate.

The addition of courtSessionType to the CourtDate component is clearly aligned with the PR objectives to display the court session type in various UI components. Ensure that the CourtDate component is equipped to handle this new prop properly, particularly in terms of display logic and null handling.

Verification successful

Integration of courtSessionType in CourtDate.

The courtSessionType prop is properly integrated into the CourtDate component. The code handles cases where courtSessionType might be null or undefined, ensuring robust and error-free operation.

  • The courtSessionType prop is defined as optional and nullable.
  • The component uses conditional logic to handle cases where courtSessionType might not be provided.

This confirms that the changes align with the PR objectives and adhere to best practices.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify proper handling of `courtSessionType` prop in `CourtDate`.

# Test: Search for the component usage. Expect: Prop handling for null and undefined.
rg --type tsx -g '*CourtDate.tsx' $'CourtDate'

Length of output: 73



Script:

#!/bin/bash
# Description: Verify proper handling of `courtSessionType` prop in `CourtDate`.

# Test: Search for the component usage. Expect: Prop handling for null and undefined.
rg --type-add 'tsx:*.tsx' -t tsx 'CourtDate' | xargs -I {} rg 'courtSessionType' {}

Length of output: 16774



Script:

#!/bin/bash
# Description: Verify proper handling of `courtSessionType` prop in `CourtDate`.

# Test: Search for the `courtSessionType` prop in the `CourtDate` component file.
rg --type-add 'tsx:*.tsx' -t tsx 'courtSessionType' $(rg --files | grep 'CourtDate.tsx')

Length of output: 1163

apps/judicial-system/web/src/routes/Defender/Cases/components/DefenderCasesTable.tsx (1)

183-189: Integration of courtSessionType in CourtDate.

The addition of courtSessionType to the CourtDate component within the DefenderCasesTable is consistent with the PR objectives. This change helps in displaying the court session type alongside other case details. Ensure that CourtDate handles this prop correctly.

Verification successful

Verification of courtSessionType Prop Handling in CourtDate Component

The courtSessionType prop is correctly integrated and handled in the CourtDate component. The CourtDate component imports the courtSessionTypeNames and uses the courtSessionType prop appropriately, ensuring proper rendering and null handling.

  • File: apps/judicial-system/web/src/components/Table/CourtDate/CourtDate.tsx
    • Lines:
      • import { courtSessionTypeNames } from '@island.is/judicial-system/types'
      • courtSessionType?: CourtSessionType | null
      • courtSessionType: CourtSessionType
      • > = ({ courtDate, courtSessionType }) => {
      • <Text>{courtSessionTypeNames[courtSessionType]}</Text>
      • courtSessionType,
      • if (courtSessionType) {
      • courtSessionType={courtSessionType}
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify proper handling of `courtSessionType` prop in `CourtDate` within `DefenderCasesTable`.

# Test: Search for the component usage. Expect: Prop handling for null and undefined.
rg --type tsx -g '*CourtDate.tsx' $'CourtDate'

Length of output: 73



Script:

#!/bin/bash
# Description: Verify proper handling of `courtSessionType` prop in `CourtDate` within `DefenderCasesTable`.

# Test: Search for the component usage and prop handling within TypeScript files.
rg --type ts -g '*CourtDate.tsx' 'courtSessionType'

Length of output: 961

apps/judicial-system/backend/src/app/modules/case/guards/rolesRules.ts (1)

95-95: Addition of courtSessionType to districtCourtFields.

The inclusion of courtSessionType in the districtCourtFields array allows district court roles to update this new field. This change is aligned with the PR objectives and enhances the flexibility of the system by accommodating new legal session types.

apps/judicial-system/api/src/app/modules/case/dto/updateCase.input.ts (1)

500-503: Addition of courtSessionType to UpdateCaseInput.

The optional courtSessionType field has been added to the UpdateCaseInput class, allowing API clients to specify the court session type during case updates. This change supports the new functionality introduced in the PR and should be validated properly to ensure it accepts only valid CourtSessionType values.

apps/judicial-system/web/src/routes/Prosecutor/Indictments/Overview/Overview.tsx (1)

194-194: Addition of courtSessionType property usage is appropriate

The addition of the courtSessionType property to the InfoCardCaseScheduledIndictment component aligns with the PR's objective to display the court session type alongside scheduled dates. This change integrates well with the existing code structure and follows the modifications described in the PR summary and AI-generated summary.

apps/judicial-system/backend/src/app/modules/case/dto/updateCase.dto.ts (2)

30-30: Enum CourtSessionType Imported Correctly

The import statement for CourtSessionType is correctly placed and used within the UpdateCaseDto class. This ensures that the type checks and validations will work as expected when the courtSessionType field is utilized.


507-510: Proper Addition of courtSessionType to UpdateCaseDto

The optional courtSessionType field has been added correctly to the UpdateCaseDto class, with appropriate use of decorators for validation and API documentation. This change is consistent with the backend changes outlined in the PR summary and AI-generated summary.

apps/judicial-system/backend/src/app/modules/case/limitedAccessCase.service.ts (1)

106-106: Inclusion of courtSessionType in attributes array

The courtSessionType has been appropriately added to the attributes array, ensuring that this field is included when case data is fetched. This change supports the backend integration of the new court session type field as described in the PR.

apps/judicial-system/api/src/app/modules/case/models/case.model.ts (3)

21-21: **** Added CourtSessionType to imports.

The import of CourtSessionType is correctly placed within the import block, adhering to project standards.


57-57: **** Registration of CourtSessionType enum.

The registration of the CourtSessionType enum using registerEnumType is correctly implemented, ensuring that it is recognized by the GraphQL server.


445-446: **** Added courtSessionType field to the Case class.

The optional courtSessionType field has been correctly added to the Case class with appropriate GraphQL annotations. This change aligns with the PR's objective to handle court session types in the judicial system.

libs/judicial-system/types/src/lib/case.ts (3)

276-286: **** Declaration of CourtSessionType enum.

The CourtSessionType enum has been correctly declared with appropriate values, which are essential for categorizing different types of court sessions. This addition aligns with the new feature requirements.


288-298: **** Addition of courtSessionTypeNames constant.

The courtSessionTypeNames constant provides a mapping of CourtSessionType enum values to their display names in Icelandic. This is useful for UI elements and improves localization and usability.


Line range hint 107-160: **** Enum members initialization check.

Several enum members across the file are flagged by static analysis for not being initialized with a literal value. Please verify if this is an intentional design choice or if it requires adjustment to align with TypeScript best practices.

Verification successful

The CaseState enum members are initialized with literal values, as confirmed by the script output. The RequestCaseState enum members reference these literals, maintaining initialization integrity. The CaseAppealState and CaseTransition enums in the provided snippet also use literal values.

Verification Summary:

  • CaseState enum members are initialized with literal values.
  • RequestCaseState enum members reference CaseState literals.
  • CaseAppealState and CaseTransition enums use literal values.

No changes required.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Check enum members initialization.
ast-grep --lang typescript --pattern $'enum CaseLegalProvisions {
  $$$
}'

Length of output: 968



Script:

#!/bin/bash
# Locate the CaseState enum and check its members for initialization
ast-grep --lang typescript --pattern $'export enum CaseState {
  $$$
}' --json

Length of output: 1127

apps/judicial-system/web/src/utils/validate.ts (1)

479-481: Ensure logic correctness in validation for scheduling.

The validation logic for scheduling court sessions checks both courtSessionType and courtDate.date. Ensure that this logic accurately reflects the intended conditions for a valid court session setup. If additional conditions are required (e.g., checking the validity of courtSessionType against a set of allowed values), consider enhancing this validation.

Verification successful

Ensure logic correctness in validation for scheduling.

The validation logic for scheduling court sessions in the isConclusionStepValid function checks both courtSessionType and courtDate.date. Based on the implementation, it appears to be correctly verifying these fields under the IndictmentDecision.SCHEDULING case. However, if additional conditions are required (e.g., validating courtSessionType against a set of allowed values), consider enhancing this validation accordingly.

  • Implementation in validate.ts:

    export const isConclusionStepValid = (workingCase: Case): boolean => {
      switch (workingCase.indictmentDecision) {
        case IndictmentDecision.POSTPONING:
          return Boolean(workingCase.postponedIndefinitelyExplanation)
        case IndictmentDecision.SCHEDULING:
          return Boolean(
            workingCase.courtSessionType && workingCase.courtDate?.date,
          )
        case IndictmentDecision.COMPLETING:
          return isIndictmentRulingDecisionValid(workingCase)
        case IndictmentDecision.POSTPONING_UNTIL_VERDICT:
          return Boolean(
            workingCase.caseFiles?.some(
              (file) => file.category === CaseFileCategory.COURT_RECORD,
            ),
          )
        default:
          return false
      }
    }
  • Usage in formHelper.ts:

    [constants.INDICTMENTS_CONCLUSION_ROUTE]: (theCase: Case) =>
      validations.isConclusionStepValid(theCase),
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Search for all usages of `isConclusionStepValid` to ensure they align with the expected validation logic.

# Test: Search for the function usage. Expect: Proper handling of courtSessionType and courtDate.date.
rg --type python $'isConclusionStepValid'

Length of output: 71



Script:

#!/bin/bash
# Description: Search for all usages of `isConclusionStepValid` in JavaScript/TypeScript files to ensure they align with the expected validation logic.

# Test: Search for the function usage. Expect: Proper handling of courtSessionType and courtDate.date.
rg 'isConclusionStepValid' --type js --type ts

Length of output: 263



Script:

#!/bin/bash
# Description: Extract the usage context of `isConclusionStepValid` from `formHelper.ts` to verify the handling of `courtSessionType` and `courtDate.date`.

# Extract the relevant lines where `isConclusionStepValid` is used in `formHelper.ts`.
rg 'isConclusionStepValid' -A 10 -B 10 apps/judicial-system/web/src/utils/formHelper.ts

Length of output: 1272



Script:

#!/bin/bash
# Description: Extract the implementation of `isConclusionStepValid` from `validate.ts` to verify the handling of `courtSessionType` and `courtDate.date`.

# Extract the relevant lines where `isConclusionStepValid` is implemented in `validate.ts`.
rg 'export const isConclusionStepValid' -A 10 -B 10 apps/judicial-system/web/src/utils/validate.ts

Length of output: 799

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

338-344: Ensure CourtDate component handles all props correctly.

The CourtDate component is passed courtDate, postponedIndefinitelyExplanation, and courtSessionType props. Verify that this component is designed to handle these props appropriately, especially in cases where courtSessionType might be null or undefined. Consider adding prop validation or TypeScript interfaces to enforce the types and presence of these props.

Verification successful

Ensure CourtDate component handles all props correctly.

The CourtDate component is defined in apps/judicial-system/web/src/components/Table/CourtDate/CourtDate.tsx and it handles the props courtDate, postponedIndefinitelyExplanation, and courtSessionType correctly. The component uses TypeScript interfaces to enforce the types and presence of these props, including handling cases where courtSessionType might be null or undefined.

  • File: apps/judicial-system/web/src/components/Table/CourtDate/CourtDate.tsx
    • The CourtDate component uses TypeScript to define the props, ensuring type safety.
    • It includes null checks for courtSessionType and other props, ensuring robustness.

No further action is required as the component already meets the necessary standards.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the `CourtDate` component properly handles the props it receives.

# Test: Search for the `CourtDate` component definition to check prop handling.
rg --type typescript $'CourtDate'

Length of output: 67



Script:

#!/bin/bash
# Locate the `CourtDate` component definition.
rg 'CourtDate' --type tsx

# Once located, inspect the prop handling within the `CourtDate` component.
# Assuming the main file is identified as `CourtDate.tsx`, this command will extract the relevant lines.
# Note: Adjust the file path based on the actual location found in the previous command.
rg 'CourtDate' --type tsx | awk -F: '{print $1}' | sort -u | xargs -I {} sh -c 'echo "File: {}\n"; rg "courtDate|postponedIndefinitelyExplanation|courtSessionType" {}'

Length of output: 251



Script:

#!/bin/bash
# Locate the `CourtDate` component definition.
rg 'CourtDate' --type ts

# Once located, inspect the prop handling within the `CourtDate` component.
# Assuming the main file is identified as `CourtDate.tsx`, this command will extract the relevant lines.
# Note: Adjust the file path based on the actual location found in the previous command.
rg 'CourtDate' --type ts | awk -F: '{print $1}' | sort -u | xargs -I {} sh -c 'echo "File: {}\n"; rg "courtDate|postponedIndefinitelyExplanation|courtSessionType" {}'

Length of output: 57980

apps/judicial-system/web/src/routes/Court/Indictments/Conclusion/Conclusion.tsx (1)

218-218: Validate court session setup thoroughly.

The validation for scheduling a court session checks if both selectedCourtSessionType and courtDate.date are set. This is crucial for ensuring that all necessary data is provided before proceeding. Consider enhancing this validation to check the specific requirements or constraints related to courtSessionType values.

apps/judicial-system/backend/src/app/modules/case/models/case.model.ts (2)

32-32: Addition of CourtSessionType import is appropriate.
The import of CourtSessionType from @island.is/judicial-system/types is necessary for the new feature implementation concerning court session types. This aligns with the PR's objective to handle different court session types within the application.


1038-1047: Review of the new courtSessionType field in the Case model.
The addition of the courtSessionType field as an optional ENUM type in the Case model is consistent with the PR's objective to include court session type in case management. The use of DataType.ENUM and referencing CourtSessionType ensures that only valid session types can be assigned, which is good for data integrity.

However, it's important to ensure that the values attribute correctly references all possible enum values from CourtSessionType. This should be verified, especially if the enum is updated in the future.

Copy link

codecov bot commented Jun 25, 2024

Codecov Report

Attention: Patch coverage is 36.66667% with 38 lines in your changes missing coverage. Please review.

Project coverage is 37.04%. Comparing base (b04fa29) to head (509a5e0).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #15338   +/-   ##
=======================================
  Coverage   37.03%   37.04%           
=======================================
  Files        6539     6538    -1     
  Lines      133079   133116   +37     
  Branches    38119    38125    +6     
=======================================
+ Hits        49292    49308   +16     
- Misses      83787    83808   +21     
Flag Coverage Δ
judicial-system-api 18.18% <65.00%> (+0.31%) ⬆️
judicial-system-formatters 81.63% <100.00%> (+0.30%) ⬆️
judicial-system-message 66.06% <ø> (ø)
judicial-system-types 49.45% <84.61%> (+0.85%) ⬆️
judicial-system-web 28.33% <24.39%> (-0.01%) ⬇️

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

Files Coverage Δ
...ystem/backend/src/app/modules/case/case.service.ts 91.33% <ø> (ø)
...backend/src/app/modules/case/dto/updateCase.dto.ts 86.23% <ø> (ø)
.../backend/src/app/modules/case/guards/rolesRules.ts 59.09% <ø> (ø)
.../modules/case/interceptors/caseList.interceptor.ts 37.50% <ø> (ø)
.../src/app/modules/case/limitedAccessCase.service.ts 72.07% <ø> (ø)
.../backend/src/app/modules/case/models/case.model.ts 74.59% <ø> (ø)
.../src/components/InfoCard/InfoCardCaseScheduled.tsx 16.66% <ø> (ø)
...nfoCard/InfoCardCaseScheduledIndictment.strings.ts 100.00% <ø> (ø)
...Court/Indictments/Conclusion/Conclusion.strings.ts 0.00% <ø> (ø)
...src/routes/Court/Indictments/Overview/Overview.tsx 0.00% <ø> (ø)
... and 14 more

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 b04fa29...509a5e0. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Jun 25, 2024

Datadog Report

All test runs 4fd9334 🔗

8 Total Test Services: 0 Failed, 8 Passed
🔻 Test Sessions change in coverage: 1 decreased (-0.04%), 6 increased, 4 no change

Test Services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
judicial-system-api 0 0 0 54 0 11.13s 1 increased (+0.35%) Link
judicial-system-backend 0 0 0 19897 0 18m 45.64s 1 increased (+0.05%) Link
judicial-system-formatters 0 0 0 36 0 11.54s 1 increased (+0.19%) Link
judicial-system-message 0 0 0 29 0 16.27s 1 no change Link
judicial-system-message-handler 0 0 0 3 0 8.37s 1 increased (+0.36%) Link
judicial-system-types 0 0 0 19 0 13.07s 1 increased (+0.83%) Link
judicial-system-web 0 0 0 316 0 1m 10.22s 1 decreased (-0.04%) Link
judicial-system-xrd-api 0 0 0 6 0 15.07s 1 increased (+0.29%) Link

🔻 Code Coverage Decreases vs Default Branch (1)

  • judicial-system-web - jest 32.57% (-0.04%) - Details

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

Outside diff range and nitpick comments (1)
apps/judicial-system/web/src/routes/Defender/Cases/components/DefenderCasesTable.tsx (1)

Line range hint 123-127: Accessibility Issue: Missing Keyboard Event Handlers for Context Menu

The ContextMenu component's trigger button only handles mouse click events. For accessibility compliance, keyboard event handlers such as onKeyUp, onKeyDown, or onKeyPress should also be implemented to ensure that keyboard-only users can interact with this component.

<IconButton
  icon="ellipsisVertical"
  colorScheme="transparent"
  onClick={(evt) => {
    evt.stopPropagation()
  }}
+ onKeyUp={(evt) => {
+   if (evt.key === 'Enter') {
+     evt.stopPropagation()
+   }
+ }}
  disabled={false}
/>
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 76171da and f1a7524.

Files selected for processing (1)
  • apps/judicial-system/web/src/routes/Defender/Cases/components/DefenderCasesTable.tsx (4 hunks)
Additional context used
Path-based instructions (1)
apps/judicial-system/web/src/routes/Defender/Cases/components/DefenderCasesTable.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."
Biome
apps/judicial-system/web/src/routes/Defender/Cases/components/DefenderCasesTable.tsx

[error] 123-127: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event. (lint/a11y/useKeyWithClickEvents)

Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.

Additional comments not posted (2)
apps/judicial-system/web/src/routes/Defender/Cases/components/DefenderCasesTable.tsx (2)

21-21: Updated import statement for CourtDate component

The addition of the CourtDate component in the import statement aligns with the changes in the table where this component is now used to display court session details. This is a necessary change to support the new feature.


182-188: Integration of CourtDate component with new courtSessionType property

The CourtDate component is now used within the table to display the court date along with any postponement explanations and the new courtSessionType. This change effectively utilizes the newly introduced court session types, enhancing the display of court-related information in a structured format.

@oddsson oddsson added the deprecated:automerge (Disabled) Merge this PR as soon as all checks pass label Jun 25, 2024
@kodiakhq kodiakhq bot merged commit b7942bd into main Jun 25, 2024
36 checks passed
@kodiakhq kodiakhq bot deleted the j-s/indictment-session-type branch June 25, 2024 14:04
sigruntg pushed a commit that referenced this pull request Jun 27, 2024
* Adds court session type to scheduled indictments

* Removes unused Contentful string

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
snaerseljan pushed a commit that referenced this pull request Jul 2, 2024
* Adds court session type to scheduled indictments

* Removes unused Contentful string

---------

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
deprecated:automerge (Disabled) Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants