-
Notifications
You must be signed in to change notification settings - Fork 61
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
Conversation
WalkthroughThe changes introduce a new field Changes
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this 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
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 theunsafeParameterDecoratorsEnabled
option totrue
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 theunsafeParameterDecoratorsEnabled
option totrue
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 theunsafeParameterDecoratorsEnabled
option totrue
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 theunsafeParameterDecoratorsEnabled
option totrue
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 theunsafeParameterDecoratorsEnabled
option totrue
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 theunsafeParameterDecoratorsEnabled
option totrue
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 theunsafeParameterDecoratorsEnabled
option totrue
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 theunsafeParameterDecoratorsEnabled
option totrue
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 iftitle
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 theInfoCardCaseScheduled
component as atitle
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 andcourtSessionTypeNames
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 ofcourtSessionType
to GraphQL query approved.The inclusion of the
courtSessionType
field in thelimitedAccessCase
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 forcourtSessionType
are correct.The import of
courtSessionTypeNames
and theCourtSessionType
from the types library, and the addition ofcourtSessionType
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 componentCourtDateWithCourtSessionType
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 inCourtDate
component approved.The conditional rendering based on
postponedIndefinitelyExplanation
,courtDate
, andcourtSessionType
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 ofcourtSessionType
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 ofcourtSessionType
toCaseListEntry
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 ofcourtSessionType
toInfoCardCaseScheduledIndictment
component approved.The modification to pass
courtSessionType
to theInfoCardCaseScheduledIndictment
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 inInfoCardCaseScheduledIndictment
.The addition of
courtSessionType
to the props passed toInfoCardCaseScheduledIndictment
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 theInfoCardCaseScheduledIndictment
component, including cases where it might beundefined
ornull
.
- 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" fiLength of output: 562
apps/judicial-system/web/src/routes/Court/components/CasesInProgressTable/CasesInProgressTable.tsx (1)
157-166
: Integration ofcourtSessionType
inCourtDate
.The addition of
courtSessionType
to theCourtDate
component is clearly aligned with the PR objectives to display the court session type in various UI components. Ensure that theCourtDate
component is equipped to handle this new prop properly, particularly in terms of display logic and null handling.Verification successful
Integration of
courtSessionType
inCourtDate
.The
courtSessionType
prop is properly integrated into theCourtDate
component. The code handles cases wherecourtSessionType
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 ofcourtSessionType
inCourtDate
.The addition of
courtSessionType
to theCourtDate
component within theDefenderCasesTable
is consistent with the PR objectives. This change helps in displaying the court session type alongside other case details. Ensure thatCourtDate
handles this prop correctly.Verification successful
Verification of
courtSessionType
Prop Handling inCourtDate
ComponentThe
courtSessionType
prop is correctly integrated and handled in theCourtDate
component. TheCourtDate
component imports thecourtSessionTypeNames
and uses thecourtSessionType
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 ofcourtSessionType
todistrictCourtFields
.The inclusion of
courtSessionType
in thedistrictCourtFields
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 ofcourtSessionType
toUpdateCaseInput
.The optional
courtSessionType
field has been added to theUpdateCaseInput
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 validCourtSessionType
values.apps/judicial-system/web/src/routes/Prosecutor/Indictments/Overview/Overview.tsx (1)
194-194
: Addition of courtSessionType property usage is appropriateThe addition of the
courtSessionType
property to theInfoCardCaseScheduledIndictment
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 CorrectlyThe import statement for
CourtSessionType
is correctly placed and used within theUpdateCaseDto
class. This ensures that the type checks and validations will work as expected when thecourtSessionType
field is utilized.
507-510
: Proper Addition of courtSessionType to UpdateCaseDtoThe optional
courtSessionType
field has been added correctly to theUpdateCaseDto
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 arrayThe
courtSessionType
has been appropriately added to theattributes
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
: **** AddedCourtSessionType
to imports.The import of
CourtSessionType
is correctly placed within the import block, adhering to project standards.
57-57
: **** Registration ofCourtSessionType
enum.The registration of the
CourtSessionType
enum usingregisterEnumType
is correctly implemented, ensuring that it is recognized by the GraphQL server.
445-446
: **** AddedcourtSessionType
field to theCase
class.The optional
courtSessionType
field has been correctly added to theCase
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 ofCourtSessionType
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 ofcourtSessionTypeNames
constant.The
courtSessionTypeNames
constant provides a mapping ofCourtSessionType
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. TheRequestCaseState
enum members reference these literals, maintaining initialization integrity. TheCaseAppealState
andCaseTransition
enums in the provided snippet also use literal values.Verification Summary:
CaseState
enum members are initialized with literal values.RequestCaseState
enum members referenceCaseState
literals.CaseAppealState
andCaseTransition
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 { $$$ }' --jsonLength 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
andcourtDate.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 ofcourtSessionType
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 bothcourtSessionType
andcourtDate.date
. Based on the implementation, it appears to be correctly verifying these fields under theIndictmentDecision.SCHEDULING
case. However, if additional conditions are required (e.g., validatingcourtSessionType
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 tsLength 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.tsLength 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.tsLength of output: 799
apps/judicial-system/web/src/routes/Shared/Cases/ActiveCases.tsx (1)
338-344
: EnsureCourtDate
component handles all props correctly.The
CourtDate
component is passedcourtDate
,postponedIndefinitelyExplanation
, andcourtSessionType
props. Verify that this component is designed to handle these props appropriately, especially in cases wherecourtSessionType
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 inapps/judicial-system/web/src/components/Table/CourtDate/CourtDate.tsx
and it handles the propscourtDate
,postponedIndefinitelyExplanation
, andcourtSessionType
correctly. The component uses TypeScript interfaces to enforce the types and presence of these props, including handling cases wherecourtSessionType
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
andcourtDate.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 tocourtSessionType
values.apps/judicial-system/backend/src/app/modules/case/models/case.model.ts (2)
32-32
: Addition of CourtSessionType import is appropriate.
The import ofCourtSessionType
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 thecourtSessionType
field as an optional ENUM type in theCase
model is consistent with the PR's objective to include court session type in case management. The use ofDataType.ENUM
and referencingCourtSessionType
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 fromCourtSessionType
. This should be verified, especially if the enum is updated in the future.
apps/judicial-system/web/src/routes/Court/Indictments/Conclusion/Conclusion.tsx
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
|
Datadog ReportAll test runs ✅ 8 Total Test Services: 0 Failed, 8 Passed Test Services
🔻 Code Coverage Decreases vs Default Branch (1)
|
There was a problem hiding this 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 MenuThe
ContextMenu
component's trigger button only handles mouse click events. For accessibility compliance, keyboard event handlers such asonKeyUp
,onKeyDown
, oronKeyPress
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
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 forCourtDate
componentThe 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 ofCourtDate
component with newcourtSessionType
propertyThe
CourtDate
component is now used within the table to display the court date along with any postponement explanations and the newcourtSessionType
. This change effectively utilizes the newly introduced court session types, enhancing the display of court-related information in a structured format.
* Adds court session type to scheduled indictments * Removes unused Contentful string --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
* Adds court session type to scheduled indictments * Removes unused Contentful string --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Court Session type
[Aðalmeðferð (Bóka nýtt þinghald með tegund þinghalds)(https://app.asana.com/0/1199153462262248/1206840919693199/f)
What
Why
Screenshots / Gifs
Checklist:
Summary by CodeRabbit
New Features
courtSessionType
field to various case-related components, queries, and models for enhanced tracking of court session types.CourtDate
component for improved rendering of court dates across multiple views.Bug Fixes
courtSessionType
andcourtDate
are checked in indictment cases.Refactor
CourtDate
component for better modularity and readability in display components.