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): Public defender staff overview after review #14848

Merged
merged 19 commits into from
May 21, 2024

Conversation

unakb
Copy link
Member

@unakb unakb commented May 17, 2024

Ríksak - Skrifstofa - Yfirlitssíða eftir yfirlestur

What

  • Display the public defender staff indictment overview screen as it should appear after review.
  • Changed handling of Defendant info on InfoCard so that it's a separate component
  • Added Defender information beneath Defenders in list of defenders on InfoCard
  • Added a button that is used to mark a verdict as viewed by a defender

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

    • Introduced detailed defendant information display, including appeal expiration dates and various personal details.
    • Added a new action button for defendants in the defendant info card.
  • Enhancements

    • Improved state management and type safety in the indictment overview page.
    • Enhanced modal visibility control based on specific scenarios.
  • Bug Fixes

    • Adjusted the display of reviewer choices based on the case state to ensure accurate information.

@unakb unakb requested a review from a team as a code owner May 17, 2024 11:12
Copy link
Contributor

coderabbitai bot commented May 17, 2024

Walkthrough

The changes involve enhancing the DefendantInfo component in the judicial system web app and refactoring the Overview component for indictments. These updates include adding new types, modifying interfaces, and improving state management for handling defendant actions and modal visibility efficiently.

Changes

File Path Change Summary
.../InfoCard/DefendantInfo/DefendantInfo.strings.ts Defines messages for appeal expiration dates for defendants.
.../InfoCard/DefendantInfo/DefendantInfo.tsx Added DefendantInfoActionButton type, modified DefendantInfoProps interface, and exported DefendantInfo component.
.../InfoCard/DefendantInfo/DefendantInfo.css.ts Added styles for displaying defendant information with grid layouts and media queries for responsive design.
.../InfoCard/InfoCard.tsx Updated to include imports for DefendantInfo and DefendantInfoActionButton, and refactored defendant information rendering.
.../PublicProsecutor/Indictments/Overview/Overview.tsx Refactored imports, state management, introduced new types, modified functions for reviewer assignment and defendant verdict views, and adjusted modal visibility control.
.../FormProvider/limitedAccessCase.graphql Expanded limitedAccessCase GraphQL query with a new field verdictViewDate for limited access cases.

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.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.

@unakb unakb marked this pull request as draft May 17, 2024 11:13
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits Files that changed from the base of the PR and between 1ae0baf and 5ec5ca6.
Files selected for processing (16)
  • apps/judicial-system/api/src/app/modules/defendant/dto/updateDefendant.input.ts (1 hunks)
  • apps/judicial-system/api/src/app/modules/defendant/models/defendant.model.ts (1 hunks)
  • apps/judicial-system/backend/migrations/20240514111505-update-defendant.js (1 hunks)
  • apps/judicial-system/backend/src/app/modules/defendant/defendant.controller.ts (2 hunks)
  • apps/judicial-system/backend/src/app/modules/defendant/dto/updateDefendant.dto.ts (1 hunks)
  • apps/judicial-system/backend/src/app/modules/defendant/models/defendant.model.ts (1 hunks)
  • apps/judicial-system/web/src/components/FormProvider/case.graphql (1 hunks)
  • apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.css.ts (1 hunks)
  • apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.tsx (1 hunks)
  • apps/judicial-system/web/src/components/InfoCard/InfoCard.css.ts (1 hunks)
  • apps/judicial-system/web/src/components/InfoCard/InfoCard.tsx (3 hunks)
  • apps/judicial-system/web/src/components/InfoCard/InfoCardClosedIndictment.tsx (2 hunks)
  • apps/judicial-system/web/src/components/InfoCard/InfoCardIndictment.strings.ts (1 hunks)
  • apps/judicial-system/web/src/routes/PublicProsecutor/Indictments/Overview/Overview.strings.ts (1 hunks)
  • apps/judicial-system/web/src/routes/PublicProsecutor/Indictments/Overview/Overview.tsx (6 hunks)
  • apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx (1 hunks)
Files skipped from review due to trivial changes (3)
  • apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.css.ts
  • apps/judicial-system/web/src/components/InfoCard/InfoCardIndictment.strings.ts
  • apps/judicial-system/web/src/routes/PublicProsecutor/Indictments/Overview/Overview.strings.ts
Additional Context Used
Path-based Instructions (13)
apps/judicial-system/backend/migrations/20240514111505-update-defendant.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/InfoCard.css.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/defendant/dto/updateDefendant.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/api/src/app/modules/defendant/models/defendant.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/api/src/app/modules/defendant/dto/updateDefendant.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/backend/src/app/modules/defendant/models/defendant.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/components/InfoCard/DefendantInfo/DefendantInfo.tsx (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/judicial-system/web/src/components/InfoCard/InfoCardClosedIndictment.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/defendant/defendant.controller.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/components/FormProvider/case.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/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/components/InfoCard/InfoCard.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/PublicProsecutor/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."
Learnings (2)
apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.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.
apps/judicial-system/web/src/routes/PublicProsecutor/Indictments/Overview/Overview.tsx (1)
User: oddsson
PR: island-is/island.is#14673
File: apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesForReview.tsx:79-79
Timestamp: 2024-05-06T23:16:04.892Z
Learning: The implementation of `mapIndictmentCaseStateToTagVariant` in `TagCaseState.tsx`, which maps only `CaseState.ACCEPTED` to a specific tag and defaults others to an "unknown" status, is intentional as per the application's requirements.
Additional comments not posted (18)
apps/judicial-system/backend/migrations/20240514111505-update-defendant.js (2)

3-16: The migration script for adding the has_viewed_verdict column is correctly implemented with transaction support.


18-24: The rollback script for removing the has_viewed_verdict column is correctly implemented with transaction support.

apps/judicial-system/web/src/components/InfoCard/InfoCard.css.ts (1)

Line range hint 1-24: The CSS styles in InfoCard.css.ts are well-structured and make good use of theme variables for consistency.

apps/judicial-system/backend/src/app/modules/defendant/dto/updateDefendant.dto.ts (1)

76-80: The addition of the hasViewedVerdict field in UpdateDefendantDto is correctly implemented with appropriate validation and API documentation decorators.

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

65-67: The addition of the hasViewedVerdict field in the Defendant GraphQL model is correctly implemented with the appropriate nullable field decorator.

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

85-89: The addition of the hasViewedVerdict field in UpdateDefendantInput is correctly implemented with the appropriate nullable field decorator.

apps/judicial-system/backend/src/app/modules/defendant/models/defendant.model.ts (1)

146-152: The addition of the hasViewedVerdict field in the Defendant Sequelize model is correctly implemented with the appropriate column definition and API documentation.

apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.tsx (1)

16-97: The DefendantInfo component is well-implemented, making effective use of props to conditionally render defendant details and actions.

apps/judicial-system/web/src/components/InfoCard/InfoCardClosedIndictment.tsx (1)

Line range hint 16-93: The InfoCardClosedIndictment component is well-implemented, effectively integrating with other components and props to display detailed case information.

apps/judicial-system/backend/src/app/modules/defendant/defendant.controller.ts (2)

30-30: Ensure publicProsecutorStaffRule correctly defines the intended permissions for public prosecutor staff.

Verification successful

Ensure publicProsecutorStaffRule correctly defines the intended permissions for public prosecutor staff.

The publicProsecutorStaffRule is defined as allowing public prosecutor staff to perform any action, which seems appropriate for the intended permissions.

  • Definition found in apps/judicial-system/backend/src/app/guards/rolesRules.ts:
    // Allows public prosecutor staff to perform any action
    export const publicProsecutorStaffRule: RolesRule =
      UserRole.PUBLIC_PROSECUTOR_STAFF
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the permissions set by `publicProsecutorStaffRule`.

# Test: Search for the rule definition and usage. Expect: Correct permission settings.
rg --type typescript $'publicProsecutorStaffRule'

Length of output: 83



Script:

#!/bin/bash
# Description: Verify the permissions set by `publicProsecutorStaffRule`.

# Test: Search for the rule definition and usage. Expect: Correct permission settings.
rg --type ts 'publicProsecutorStaffRule'

Length of output: 1298



Script:

#!/bin/bash
# Description: Extract the definition of `publicProsecutorStaffRule` to verify its permissions.

# Test: Locate and display the definition of `publicProsecutorStaffRule`.
rg --type ts --context 5 'publicProsecutorStaffRule' apps/judicial-system/backend/src/app/guards/rolesRules.ts

Length of output: 354


75-75: Ensure publicProsecutorStaffRule correctly defines the intended permissions for public prosecutor staff in the update context.

Verification successful

Ensure publicProsecutorStaffRule correctly defines the intended permissions for public prosecutor staff in the update context.

The publicProsecutorStaffRule is defined as allowing public prosecutor staff to perform any action:

  • apps/judicial-system/backend/src/app/guards/rolesRules.ts
// Allows public prosecutor staff to perform any action
export const publicProsecutorStaffRule: RolesRule = UserRole.PUBLIC_PROSECUTOR_STAFF

This definition aligns with the intended permissions for public prosecutor staff in the update context.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the permissions set by `publicProsecutorStaffRule` in the update context.

# Test: Search for the rule definition and usage. Expect: Correct permission settings.
rg --type typescript $'publicProsecutorStaffRule'

Length of output: 83



Script:

#!/bin/bash
# Description: Verify the permissions set by `publicProsecutorStaffRule` in the update context.

# Test: Search for the rule definition and usage. Expect: Correct permission settings.
rg --type ts 'publicProsecutorStaffRule'

Length of output: 1298



Script:

#!/bin/bash
# Description: Extract the definition of `publicProsecutorStaffRule` to verify its permissions.

# Test: Extract the definition from `rolesRules.ts`.
rg --type ts --context 5 'publicProsecutorStaffRule' apps/judicial-system/backend/src/app/guards/rolesRules.ts

Length of output: 354

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

26-26: Ensure the GraphQL schema and resolver are updated to handle the hasViewedVerdict field correctly.

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

27-27: The updated import path for ReviewDecision looks correct. Ensure that all references to this component are updated accordingly.

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

10-13: The new imports for DefendantActionButton and DefendantInfo are appropriate for the refactoring of the InfoCard component.


37-41: The addition of defendantActionButton to the Props interface enhances the functionality of the InfoCard component, allowing for dynamic interactions.


123-129: The updated rendering logic to include DefendantInfo and defendantActionButton improves the functionality and user interaction of the InfoCard component.

apps/judicial-system/web/src/routes/PublicProsecutor/Indictments/Overview/Overview.tsx (2)

1-13: The new imports and hooks enhance the functionality and interactivity of the Overview component.


133-148: The updated rendering logic to include InfoCardClosedIndictment with defendantActionButton improves the functionality and user interaction of the Overview component.

Copy link

codecov bot commented May 17, 2024

Codecov Report

Attention: Patch coverage is 30.26316% with 53 lines in your changes are missing coverage. Please review.

Project coverage is 36.97%. Comparing base (0ff63ca) to head (1eadc06).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #14848      +/-   ##
==========================================
- Coverage   36.97%   36.97%   -0.01%     
==========================================
  Files        6329     6331       +2     
  Lines      129050   129100      +50     
  Branches    36828    36843      +15     
==========================================
+ Hits        47716    47731      +15     
- Misses      81334    81369      +35     
Flag Coverage Δ
air-discount-scheme-web 0.00% <ø> (ø)
api 3.48% <ø> (ø)
application-api-files 56.51% <ø> (ø)
application-core 71.46% <ø> (ø)
application-system-api 41.96% <ø> (ø)
application-template-api-modules 24.38% <ø> (-0.01%) ⬇️
application-templates-accident-notification 19.92% <ø> (ø)
application-templates-car-recycling 4.23% <ø> (ø)
application-templates-criminal-record 21.67% <ø> (ø)
application-templates-driving-license 16.52% <ø> (ø)
application-templates-estate 11.74% <ø> (ø)
application-templates-example-payment 20.49% <ø> (ø)
application-templates-financial-aid 12.10% <ø> (ø)
application-templates-general-petition 19.14% <ø> (ø)
application-templates-health-insurance 23.10% <ø> (ø)
application-templates-inheritance-report 3.95% <ø> (ø)
application-templates-parental-leave 25.30% <ø> (-0.13%) ⬇️
application-types 7.39% <ø> (ø)
application-ui-components 1.44% <ø> (ø)
auth-react 22.95% <ø> (ø)
clients-charge-fjs-v2 22.58% <ø> (ø)
contentful-apps 6.24% <ø> (ø)
financial-aid-backend 56.44% <ø> (ø)
financial-aid-shared 17.34% <ø> (ø)
island-ui-core 28.98% <ø> (-0.03%) ⬇️
judicial-system-api 17.61% <0.00%> (-0.03%) ⬇️
judicial-system-web 28.08% <30.00%> (+0.01%) ⬆️
portals-admin-regulations-admin 2.08% <ø> (ø)
portals-core 16.14% <ø> (ø)
services-auth-personal-representative 49.75% <ø> (ø)
shared-components 27.79% <ø> (ø)
shared-form-fields 31.87% <ø> (ø)

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

Files Coverage Δ
.../src/app/modules/defendant/defendant.controller.ts 100.00% <ø> (ø)
...c/app/modules/defendant/dto/updateDefendant.dto.ts 100.00% <100.00%> (ø)
...rc/app/modules/defendant/models/defendant.model.ts 88.88% <100.00%> (+0.42%) ⬆️
...ts/InfoCard/DefendantInfo/DefendantInfo.strings.ts 100.00% <100.00%> (ø)
...al-system/web/src/components/InfoCard/InfoCard.tsx 76.08% <100.00%> (-0.39%) ⬇️
.../components/InfoCard/InfoCardIndictment.strings.ts 100.00% <ø> (ø)
...rosecutor/Indictments/Overview/Overview.strings.ts 0.00% <ø> (ø)
...omponents/ReviewDecision/ReviewDecision.strings.ts 0.00% <ø> (ø)
...cutor/components/ReviewDecision/ReviewDecision.tsx 0.00% <ø> (ø)
...s/Shared/IndictmentOverview/IndictmentOverview.tsx 0.00% <ø> (ø)
... and 5 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 6e95b66...1eadc06. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented May 17, 2024

Datadog Report

All test runs f6e73d0 🔗

36 Total Test Services: 0 Failed, 35 Passed
🔻 Test Sessions change in coverage: 4 decreased, 1 increased (+0.01%), 133 no change

Test Services
This report shows up to 10 services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
air-discount-scheme-web 0 0 0 2 0 9.18s 1 no change Link
api 0 0 0 4 0 4.75s 1 no change Link
application-api-files 0 0 0 12 0 10.91s 1 no change Link
application-core 0 0 0 90 0 29.76s 1 no change Link
application-system-api 0 0 0 111 2 3m 5.75s 1 no change Link
application-template-api-modules 0 0 0 109 0 2m 21.01s 1 no change Link
application-templates-accident-notification 0 0 0 98 0 41.01s 1 no change Link
application-templates-criminal-record 0 0 0 2 0 13.65s 1 no change Link
application-templates-driving-license 0 0 0 13 0 27.26s 1 no change Link
application-templates-example-payment 0 0 0 2 0 15.6s 1 no change Link

🔻 Code Coverage Decreases vs Default Branch (4)

  • application-templates-parental-leave - jest 29.63% (-0.09%) - Details
  • portals-admin-regulations-admin - jest 2.51% (-0.04%) - Details
  • island-ui-core - jest 29.14% (-0.04%) - Details
  • judicial-system-api - jest 18.99% (-0.03%) - Details

@unakb unakb marked this pull request as ready for review May 21, 2024 08:54
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: 1

Review Details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits Files that changed from the base of the PR and between 5ec5ca6 and fdcca21.
Files selected for processing (12)
  • apps/judicial-system/api/src/app/modules/defendant/dto/updateDefendant.input.ts (1 hunks)
  • apps/judicial-system/api/src/app/modules/defendant/models/defendant.model.ts (1 hunks)
  • apps/judicial-system/backend/migrations/20240514111505-update-defendant.js (1 hunks)
  • apps/judicial-system/backend/src/app/modules/defendant/dto/updateDefendant.dto.ts (1 hunks)
  • apps/judicial-system/backend/src/app/modules/defendant/models/defendant.model.ts (1 hunks)
  • apps/judicial-system/backend/src/app/modules/defendant/test/defendantController/updateRolesRules.spec.ts (2 hunks)
  • apps/judicial-system/web/src/components/FormProvider/case.graphql (1 hunks)
  • apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.strings.ts (1 hunks)
  • apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.tsx (1 hunks)
  • apps/judicial-system/web/src/components/InfoCard/InfoCard.tsx (3 hunks)
  • apps/judicial-system/web/src/components/InfoCard/InfoCardClosedIndictment.tsx (2 hunks)
  • apps/judicial-system/web/src/routes/PublicProsecutor/Indictments/Overview/Overview.tsx (6 hunks)
Files skipped from review due to trivial changes (1)
  • apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.strings.ts
Files skipped from review as they are similar to previous changes (9)
  • apps/judicial-system/api/src/app/modules/defendant/dto/updateDefendant.input.ts
  • apps/judicial-system/api/src/app/modules/defendant/models/defendant.model.ts
  • apps/judicial-system/backend/migrations/20240514111505-update-defendant.js
  • apps/judicial-system/backend/src/app/modules/defendant/dto/updateDefendant.dto.ts
  • apps/judicial-system/backend/src/app/modules/defendant/models/defendant.model.ts
  • apps/judicial-system/web/src/components/FormProvider/case.graphql
  • apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.tsx
  • apps/judicial-system/web/src/components/InfoCard/InfoCard.tsx
  • apps/judicial-system/web/src/components/InfoCard/InfoCardClosedIndictment.tsx
Additional Context Used
GitHub Check Runs (1)
linting (judicial-system-api,judicial-system-web) success (13)

apps/judicial-system/web/src/routes/PublicProsecutor/Indictments/Overview/Overview.tsx: [warning] 11-11:
'defendant' is defined but never used. Allowed unused vars must match /^_[a-zA-Z0-9]*$/u

Path-based Instructions (2)
apps/judicial-system/backend/src/app/modules/defendant/test/defendantController/updateRolesRules.spec.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/PublicProsecutor/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."
Learnings (1)
apps/judicial-system/web/src/routes/PublicProsecutor/Indictments/Overview/Overview.tsx (1)
User: oddsson
PR: island-is/island.is#14673
File: apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesForReview.tsx:79-79
Timestamp: 2024-05-06T23:16:04.892Z
Learning: The implementation of `mapIndictmentCaseStateToTagVariant` in `TagCaseState.tsx`, which maps only `CaseState.ACCEPTED` to a specific tag and defaults others to an "unknown" status, is intentional as per the application's requirements.
Additional comments not posted (10)
apps/judicial-system/backend/src/app/modules/defendant/test/defendantController/updateRolesRules.spec.ts (2)

7-7: Added publicProsecutorStaffRule to the import list.

This ensures that the new rule is available for use in the test cases.


23-29: Updated test case to reflect the addition of publicProsecutorStaffRule.

The test now correctly checks for the presence of the new rule, ensuring that the DefendantController's update method is properly secured for the additional role.

apps/judicial-system/web/src/routes/PublicProsecutor/Indictments/Overview/Overview.tsx (8)

1-1: Updated imports to include necessary hooks and utilities.

This ensures that all necessary functionalities are available in the component.


8-13: Imported isCompletedCase and message definitions.

These imports are crucial for the new functionality related to handling verdict views and displaying appropriate UI elements.


32-37: Imported Defendant type and utility hooks.

These are essential for managing defendant data and interactions within the component.


40-40: Defined a new type for modal visibility states.

This enhances the readability and maintainability of the state management related to modal dialogs.


Line range hint 47-87: Refactored state management and added new functionality for handling defendant verdict views.

The changes are well-structured and align with the PR objectives to enhance the indictment overview functionality.


134-149: Updated InfoCardClosedIndictment to handle conditional rendering based on case completion.

This is a crucial update for displaying the correct UI elements based on the case state.


161-205: Enhanced UI logic for reviewer assignment and updated form footer handling.

These changes improve the user experience by providing clearer options and feedback during the review process.


Line range hint 207-230: Added modals for different states to enhance user interaction.

The modals provide clear, contextual information to the users, improving the overall usability of the system.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits Files that changed from the base of the PR and between fdcca21 and 861b928.
Files selected for processing (1)
  • apps/judicial-system/web/src/routes/PublicProsecutor/Indictments/Overview/Overview.tsx (6 hunks)
Files skipped from review as they are similar to previous changes (1)
  • apps/judicial-system/web/src/routes/PublicProsecutor/Indictments/Overview/Overview.tsx

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits Files that changed from the base of the PR and between 861b928 and 6abc5cc.
Files selected for processing (3)
  • apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.strings.ts (1 hunks)
  • apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.tsx (1 hunks)
  • apps/judicial-system/web/src/routes/PublicProsecutor/Indictments/Overview/Overview.tsx (6 hunks)
Files skipped from review as they are similar to previous changes (3)
  • apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.strings.ts
  • apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.tsx
  • apps/judicial-system/web/src/routes/PublicProsecutor/Indictments/Overview/Overview.tsx

Copy link
Member

@gudjong gudjong left a comment

Choose a reason for hiding this comment

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

Minor comments

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits Files that changed from the base of the PR and between 6abc5cc and 182f275.
Files selected for processing (1)
  • apps/judicial-system/web/src/components/FormProvider/limitedAccessCase.graphql (1 hunks)
Additional Context Used
Path-based Instructions (1)
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."
Additional comments not posted (1)
apps/judicial-system/web/src/components/FormProvider/limitedAccessCase.graphql (1)

31-31: Addition of verdictViewDate to defendants aligns with the new feature to track when a verdict is viewed.

Verification successful

The verdictViewDate field is well-integrated into the system, both in the frontend and backend components.

  • Overview.tsx: Formatting the date for the server and checking if the verdictViewDate is not null.
  • DefendantInfo.tsx: Using the verdictViewDate to get appeal expiration information.
  • Backend models and DTOs: Defining the verdictViewDate field in the defendant model and update DTO.
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the integration of `verdictViewDate` in the frontend components.

# Test: Search for the usage of `verdictViewDate` in TypeScript files to ensure it's properly integrated.
rg --type ts $'verdictViewDate'

Length of output: 925

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits Files that changed from the base of the PR and between 182f275 and 2e62d05.
Files selected for processing (3)
  • apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.css.ts (1 hunks)
  • apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.tsx (1 hunks)
  • apps/judicial-system/web/src/components/InfoCard/InfoCard.tsx (3 hunks)
Files skipped from review due to trivial changes (1)
  • apps/judicial-system/web/src/components/InfoCard/InfoCard.tsx
Files skipped from review as they are similar to previous changes (2)
  • apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.css.ts
  • apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.tsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants