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(service-portal): law and order module #14819

Merged
merged 149 commits into from
Oct 2, 2024
Merged

Conversation

disaerna
Copy link
Member

@disaerna disaerna commented May 16, 2024

Service Portal - Law and order 👮🏼

What

✨ NEW ✨
"Lög og reglur" module for displaying charges and subpoenas. Will also be displayed in "Pósthólf"

FYI => This was originally in three separate pull requests but with time I found it hard to manage the code on three different branches so unfortunately I have created a monster sized PR! Sorry 🫶 👹

Mailbox

  • Added urgent tag for document line both in dashboard and mailbox
  • Added confirmation modal so user has to confirm that he has received the document
  • Added actions buttons
  • Added alert message
  • This new changes are versioned with a feature flag in the front end

Law and order

  • New module - is feature flagged
  • Displays overview of court cases
  • Court case detail view
  • Subpoena detail view (Only available if user has confirmed receiving the message in the digital mailbox)
  • Change defense option form (Only available if user has not changed option too often)

Judicial System Service Portal client

  • Client that fetches data for the service portal

Screenshots / Gifs

User has to confirm before opening document in the digital mailbox (subpoena)
Screenshot 2024-09-26 at 09 08 43

Overview for court cases information in the new module Law and order
Screenshot 2024-09-26 at 09 09 09

Subpoena detail
Screenshot 2024-09-26 at 09 09 21

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

Summary by CodeRabbit

  • New Features

    • Introduced a new "Law and Order" module to the service portal, including navigation, components, and routes for managing legal information and court cases.
    • Added a search and view functionality for court cases and subpoenas.
    • Implemented a new LawAndOrderOverview component for displaying an overview of legal information.
    • Created a user-friendly interface for acknowledging subpoenas and making defense choices.
    • Integrated JudicialSystemServicePortal, LawAndOrderModule, and new mapping functions for defense choices into the service architecture.
    • Added GraphQL resolvers and services for managing court cases, subpoenas, and lawyers.
    • Introduced new React components for document management, including DocumentLineV3, FavAndStashV3, and ServicePortalDocumentsV3.
    • Enhanced messaging capabilities with new entries related to legal interactions.
    • Added new feature flags for enhanced service portal functionalities.
  • Bug Fixes

    • Improved breadcrumb path logic and mobile view responsiveness in the service portal.
  • Refactor

    • Updated several components to import getDateLocale from a central location for consistency.

@disaerna disaerna added the deploy-feature Deploys features to dev label May 16, 2024
Copy link
Contributor

coderabbitai bot commented May 16, 2024

Walkthrough

The changes involve updating ownership entries in the .github/CODEOWNERS file and modifying several files related to the integration of the JudicialSystemServicePortal and LawAndOrderModule. This includes adding new services, modules, and configurations in the API layer, enhancing the application's structure and functionality to support legal-related services. Additionally, new React components for document management in the service portal have been introduced.

Changes

File(s) Change Summary
.github/CODEOWNERS Added ownership entries for /libs/api/domains/law-and-order/ and /libs/clients/judicial-system-sp/ owned by @island-is/hugsmidjan.
apps/api/infra/api.ts, apps/api/src/app/app.module.ts Added JudicialSystemServicePortal to imports and services object; added LawAndOrderModule and JudicialSystemSPClientConfig to module imports and providers.
libs/api/domains/law-and-order/src/lib/helpers/mappers.ts Introduced mapping functions and localization structure for defense choices and state tag colors.
libs/api/domains/law-and-order/src/lib/law-and-order.module.ts, libs/api/domains/law-and-order/src/lib/law-and-order.resolver.ts, libs/api/domains/law-and-order/src/lib/law-and-order.service.ts Added LawAndOrderModule, LawAndOrderResolver, and LawAndOrderService with various methods for handling law and order functionalities.
libs/api/domains/law-and-order/src/models/*.model.ts Introduced several new models related to actions, court cases, lawyers, and subpoenas, defining GraphQL object types and enumerations for structured data representation.
libs/service-portal/documents/src/components/*.tsx Added new React components (DocumentLineV3, FavAndStashV3, OverviewV3) for document management in the service portal, including handling user interactions and displaying document details.
libs/api/domains/documents/src/lib/documentV2.service.ts Updated DocumentServiceV2 to enhance document retrieval and action processing, including new parameters and methods for improved functionality.
libs/feature-flags/src/lib/features.ts Added new feature flags related to service portal functionalities.
libs/service-portal/core/src/index.ts Added export for the ConfirmationModal component.
libs/service-portal/core/src/lib/messages.ts Introduced new message definitions related to legal and administrative functionalities.

Possibly related PRs

Suggested labels

deploy-feature

Suggested reviewers

  • thorkellmani
  • unakb
  • oddsson

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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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.

@disaerna
Copy link
Member Author

@coderabbitai review

Copy link
Contributor

coderabbitai bot commented May 16, 2024

Actions Performed

Review triggered.

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

Copy link
Contributor

github-actions bot commented May 16, 2024

Affected services are: air-discount-scheme-api,air-discount-scheme-backend,api,application-system-api,download-service,financial-aid-api,financial-aid-backend,financial-aid-open-api,icelandic-names-registry-backend,judicial-system-api,judicial-system-digital-mailbox-api,judicial-system-backend,judicial-system-message-handler,judicial-system-robot-api,judicial-system-scheduler,judicial-system-xrd-api,license-api,regulations-admin-backend,services-auth-admin-api,services-auth-ids-api,services-auth-delegation-api,services-auth-personal-representative,services-auth-personal-representative-public,services-auth-public-api,services-documents,services-endorsements-api,services-search-indexer,services-sessions,services-university-gateway,services-user-notification,services-user-profile,air-discount-scheme-web,financial-aid-web-osk,financial-aid-web-veita,skilavottord-web,web,application-system-form,island-ui-storybook,portals-admin,service-portal,system-e2e,
Feature deployment of your services will begin shortly. Your feature will be accessible here:
https://service-portallaw-and-order-ui-api-catalogue.dev01.devland.is/api
https://service-portallaw-and-order-ui-api.dev01.devland.is/download
https://service-portallaw-and-order-ui-application-callback-xrd.internal.dev01.devland.is/application-payment
https://service-portallaw-and-order-ui-application-callback-xrd.internal.dev01.devland.is/applications
https://service-portallaw-and-order-ui-application-payment-callback-xrd.internal.dev01.devland.is/application-payment
https://service-portallaw-and-order-ui-application-payment-callback-xrd.internal.dev01.devland.is/applications
https://service-portallaw-and-order-ui-beta.dev01.devland.is/
https://service-portallaw-and-order-ui-beta.dev01.devland.is/api
https://service-portallaw-and-order-ui-beta.dev01.devland.is/app/skilavottord/
https://service-portallaw-and-order-ui-beta.dev01.devland.is/minarsidur
https://service-portallaw-and-order-ui-beta.dev01.devland.is/samradsgatt
https://service-portallaw-and-order-ui-beta.dev01.devland.is/stjornbord
https://service-portallaw-and-order-ui-beta.dev01.devland.is/umsoknir
https://service-portallaw-and-order-ui-license-api-xrd.internal.dev01.devland.is/
https://service-portallaw-and-order-ui-loftbru-cf.dev01.devland.is/
https://service-portallaw-and-order-ui-loftbru-cf.dev01.devland.is/api/graphql
https://service-portallaw-and-order-ui-loftbru-cf.dev01.devland.is/api/public
https://service-portallaw-and-order-ui-loftbru-cf.dev01.devland.is/api/swagger
https://service-portallaw-and-order-ui-loftbru.dev01.devland.is/
https://service-portallaw-and-order-ui-loftbru.dev01.devland.is/api/graphql
https://service-portallaw-and-order-ui-loftbru.dev01.devland.is/api/public
https://service-portallaw-and-order-ui-loftbru.dev01.devland.is/api/swagger
https://service-portallaw-and-order-ui-service-portal-api.internal.dev01.devland.is/
https://service-portallaw-and-order-ui-services-university-gateway.internal.dev01.devland.is/api
https://service-portallaw-and-order-ui-sessions-api.internal.dev01.devland.is/
https://service-portallaw-and-order-ui-ui.dev01.devland.is/

Deployed services: application-system-api,application-system-form,service-portal,service-portal-api,portals-admin,api,web,skilavottord-web,services-documents,island-ui-storybook,download-service,icelandic-names-registry-backend,endorsement-system-api,air-discount-scheme-web,air-discount-scheme-backend,air-discount-scheme-api,regulations-admin-backend,application-system-api-worker,license-api,services-sessions,services-sessions-worker,services-sessions-cleanup,services-university-gateway,services-university-gateway-worker,consultation-portal.
Excluded services: search-indexer-service,user-notification,user-notification-worker,user-notification-cleanup-worker

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

Out of diff range and nitpick comments (9)
apps/service-portal/src/components/ContentBreadcrumbs/ContentBreadcrumbs.tsx (4)

Line range hint 1-1: Ensure consistent import order.

Consider organizing imports by grouping external and internal imports separately for better readability.


Line range hint 14-14: Consider adding a return type for the parseNavItemName function.

const parseNavItemName = (
  navItem: ServicePortalNavigationItem,
  activePath: PathMatch<string> | null,
): string | MessageDescriptor => {
  ...
}

Line range hint 28-28: Consider adding a return type for the findBreadcrumbsPath function.

const findBreadcrumbsPath = (
  navItem: ServicePortalNavigationItem | undefined,
  currentBreadcrumbs: ContentBreadcrumb[],
): void => {
  ...
}

Line range hint 50-50: Avoid using deprecated components.

Replace BreadcrumbsDeprecated with the updated Breadcrumbs component from @island.is/island-ui/core.

- BreadcrumbsDeprecated as Breadcrumbs,
+ Breadcrumbs,
libs/service-portal/law-and-order/src/screens/Subpeana.tsx (1)

1-1: Ensure consistent import order.

Consider organizing imports by grouping external and internal imports separately for better readability.

libs/service-portal/core/src/components/UserInfoLine/UserInfoLine.tsx (3)

12-12: Ensure consistent import order.

Consider organizing imports by grouping external and internal imports separately for better readability.


30-33: Consider adding a return type for the LineButton type.

type LineButton = {
  title: MessageDescriptor | string
  onClick: () => void
}

78-78: Consider adding a return type for the UserInfoLine component.

export const UserInfoLine: FC<React.PropsWithChildren<Props>> = ({
  ...
}): JSX.Element => {
  ...
}
libs/service-portal/law-and-order/src/components/DefenderChoices/DefenderChoices.tsx (1)

1-1: Ensure consistent import order.

Consider organizing imports by grouping external and internal imports separately for better readability.

Review Details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits Files that changed from the base of the PR and between 36271b4 and 35d94aa.
Files selected for processing (40)
  • apps/service-portal/src/components/ContentBreadcrumbs/ContentBreadcrumbs.tsx (1 hunks)
  • apps/service-portal/src/lib/masterNavigation.ts (2 hunks)
  • apps/service-portal/src/lib/modules.ts (2 hunks)
  • libs/auth/scopes/src/lib/api.scope.ts (1 hunks)
  • libs/service-portal/assets/src/screens/VehicleDetail/VehicleDetail.tsx (2 hunks)
  • libs/service-portal/assets/src/screens/VehicleHistory/HistoryTableData.tsx (1 hunks)
  • libs/service-portal/assets/src/utils/constants.ts (1 hunks)
  • libs/service-portal/core/src/components/LinkButton/LinkButton.tsx (1 hunks)
  • libs/service-portal/core/src/components/UserInfoLine/UserInfoLine.tsx (6 hunks)
  • libs/service-portal/core/src/lib/messages.ts (2 hunks)
  • libs/service-portal/core/src/utils/constants.ts (1 hunks)
  • libs/service-portal/core/src/utils/dateUtils.ts (1 hunks)
  • libs/service-portal/law-and-order/.babelrc (1 hunks)
  • libs/service-portal/law-and-order/.eslintrc.json (1 hunks)
  • libs/service-portal/law-and-order/README.md (1 hunks)
  • libs/service-portal/law-and-order/codegen.yml (1 hunks)
  • libs/service-portal/law-and-order/jest.config.ts (1 hunks)
  • libs/service-portal/law-and-order/project.json (1 hunks)
  • libs/service-portal/law-and-order/src/components/ConfirmationModal/ConfirmationModal.css.ts (1 hunks)
  • libs/service-portal/law-and-order/src/components/ConfirmationModal/ConfirmationModal.tsx (1 hunks)
  • libs/service-portal/law-and-order/src/components/DefenderChoices/DefenderChoices.tsx (1 hunks)
  • libs/service-portal/law-and-order/src/components/InfoLines/InfoLines.css.ts (1 hunks)
  • libs/service-portal/law-and-order/src/components/InfoLines/InfoLines.tsx (1 hunks)
  • libs/service-portal/law-and-order/src/helpers/LawAndOrderContext.tsx (1 hunks)
  • libs/service-portal/law-and-order/src/helpers/mockData.ts (1 hunks)
  • libs/service-portal/law-and-order/src/index.ts (1 hunks)
  • libs/service-portal/law-and-order/src/lib/const.ts (1 hunks)
  • libs/service-portal/law-and-order/src/lib/messages.ts (1 hunks)
  • libs/service-portal/law-and-order/src/lib/navigation.ts (1 hunks)
  • libs/service-portal/law-and-order/src/lib/paths.ts (1 hunks)
  • libs/service-portal/law-and-order/src/module.tsx (1 hunks)
  • libs/service-portal/law-and-order/src/screens/CourtCaseDetail.tsx (1 hunks)
  • libs/service-portal/law-and-order/src/screens/CourtCases.tsx (1 hunks)
  • libs/service-portal/law-and-order/src/screens/LawAndOrderOverview.tsx (1 hunks)
  • libs/service-portal/law-and-order/src/screens/Subpeana.tsx (1 hunks)
  • libs/service-portal/law-and-order/src/screens/index.tsx (1 hunks)
  • libs/service-portal/law-and-order/tsconfig.json (1 hunks)
  • libs/service-portal/law-and-order/tsconfig.lib.json (1 hunks)
  • libs/service-portal/law-and-order/tsconfig.spec.json (1 hunks)
  • tsconfig.base.json (1 hunks)
Files skipped from review due to trivial changes (21)
  • apps/service-portal/src/lib/modules.ts
  • libs/auth/scopes/src/lib/api.scope.ts
  • libs/service-portal/assets/src/screens/VehicleDetail/VehicleDetail.tsx
  • libs/service-portal/assets/src/screens/VehicleHistory/HistoryTableData.tsx
  • libs/service-portal/assets/src/utils/constants.ts
  • libs/service-portal/core/src/utils/constants.ts
  • libs/service-portal/law-and-order/.babelrc
  • libs/service-portal/law-and-order/.eslintrc.json
  • libs/service-portal/law-and-order/README.md
  • libs/service-portal/law-and-order/codegen.yml
  • libs/service-portal/law-and-order/jest.config.ts
  • libs/service-portal/law-and-order/project.json
  • libs/service-portal/law-and-order/src/components/ConfirmationModal/ConfirmationModal.css.ts
  • libs/service-portal/law-and-order/src/components/InfoLines/InfoLines.css.ts
  • libs/service-portal/law-and-order/src/index.ts
  • libs/service-portal/law-and-order/src/lib/const.ts
  • libs/service-portal/law-and-order/src/lib/paths.ts
  • libs/service-portal/law-and-order/tsconfig.json
  • libs/service-portal/law-and-order/tsconfig.lib.json
  • libs/service-portal/law-and-order/tsconfig.spec.json
  • tsconfig.base.json
Additional Context Used
Path-based Instructions (19)
libs/service-portal/law-and-order/src/lib/navigation.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."
libs/service-portal/law-and-order/src/screens/LawAndOrderOverview.tsx (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."
libs/service-portal/law-and-order/src/screens/index.tsx (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."
libs/service-portal/core/src/components/LinkButton/LinkButton.tsx (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."
libs/service-portal/law-and-order/src/screens/CourtCases.tsx (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."
libs/service-portal/law-and-order/src/module.tsx (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."
libs/service-portal/core/src/utils/dateUtils.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."
libs/service-portal/law-and-order/src/helpers/LawAndOrderContext.tsx (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/service-portal/src/lib/masterNavigation.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/service-portal/law-and-order/src/components/InfoLines/InfoLines.tsx (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."
libs/service-portal/law-and-order/src/components/ConfirmationModal/ConfirmationModal.tsx (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."
libs/service-portal/law-and-order/src/screens/CourtCaseDetail.tsx (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/service-portal/src/components/ContentBreadcrumbs/ContentBreadcrumbs.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/service-portal/law-and-order/src/screens/Subpeana.tsx (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."
libs/service-portal/core/src/components/UserInfoLine/UserInfoLine.tsx (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."
libs/service-portal/law-and-order/src/components/DefenderChoices/DefenderChoices.tsx (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."
libs/service-portal/law-and-order/src/lib/messages.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."
libs/service-portal/law-and-order/src/helpers/mockData.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."
libs/service-portal/core/src/lib/messages.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."
Additional comments not posted (79)
libs/service-portal/law-and-order/src/lib/navigation.ts (1)

1-33: The navigation structure is clear and logical. The use of constants for paths and messages ensures maintainability.

libs/service-portal/law-and-order/src/screens/LawAndOrderOverview.tsx (1)

1-38: The component is well-structured and uses localization effectively. The use of IntroHeader and UserInfoLine components ensures consistency in the UI.

libs/service-portal/law-and-order/src/screens/index.tsx (1)

1-36: The component is well-structured and uses a provider to manage state. The dynamic rendering of components based on the component prop is a good approach.

libs/service-portal/core/src/components/LinkButton/LinkButton.tsx (1)

Line range hint 1-48: The component is well-structured and handles external links appropriately. The use of different variants for the button ensures flexibility.

libs/service-portal/law-and-order/src/screens/CourtCases.tsx (5)

1-11: Imports look good and necessary for the component functionality.


13-16: Usage of hooks for localization is appropriate and follows best practices.


17-24: Rendering of IntroHeader with appropriate props looks good.


25-45: Mapping and rendering of ActionCard for each court case are correctly implemented.


48-49: Export statement is correct.

libs/service-portal/law-and-order/src/module.tsx (3)

1-9: Imports look good and necessary for the module functionality.


14-14: Module name definition is correct.


15-46: Routes definition is correct and follows best practices.

libs/service-portal/core/src/utils/dateUtils.ts (6)

Line range hint 5-9: dateParse function is correctly implemented.


Line range hint 11-19: formatDate function is correctly implemented.


Line range hint 21-25: formatDateWithTime function is correctly implemented.


Line range hint 27-37: icelandLocalTime function is correctly implemented.


Line range hint 39-55: displayMonthOrYear function is correctly implemented.


65-66: getDateLocale function is correctly implemented.

libs/service-portal/law-and-order/src/helpers/LawAndOrderContext.tsx (5)

1-9: Imports look good and necessary for the context and provider functionality.


11-19: LawAndOrderStateProps type definition is correctly implemented.


21-29: LawAndOrderContext creation is correctly implemented.


31-59: LawAndOrderProvider component is correctly implemented and follows best practices.


61-61: useLawAndOrderContext hook is correctly implemented.

apps/service-portal/src/lib/masterNavigation.ts (1)

24-24: LGTM! Ensure lawAndOrderNavigation is correctly defined and used.

Verification successful

The definition and usage of lawAndOrderNavigation have been verified and are correct.

  • lawAndOrderNavigation is defined in libs/service-portal/law-and-order/src/lib/navigation.ts.
  • It is correctly imported and used in apps/service-portal/src/lib/masterNavigation.ts.
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the definition and usage of `lawAndOrderNavigation`.

# Test: Search for the definition of `lawAndOrderNavigation`. Expect: Correct definition and usage.
rg --type typescript $'lawAndOrderNavigation'

Length of output: 79



Script:

#!/bin/bash
# Description: Verify the definition and usage of `lawAndOrderNavigation`.

# Test: Search for the definition of `lawAndOrderNavigation`. Expect: Correct definition and usage.
rg --type ts 'lawAndOrderNavigation'

Length of output: 356

libs/service-portal/law-and-order/src/components/InfoLines/InfoLines.tsx (1)

1-73: LGTM! Ensure useNamespaces is correctly used and props.groups structure is well-defined.

Verification successful

The useNamespaces hook is correctly used in the InfoLines component, and the props.groups structure is well-defined. The Items type includes the expected properties (label, value, link, action), ensuring proper alignment with the component's usage.

  • useNamespaces is correctly imported and used.
  • The Items type is defined with the necessary properties in libs/service-portal/law-and-order/src/helpers/mockData.ts.
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of `useNamespaces` and the structure of `props.groups`.

# Test: Search for the usage of `useNamespaces` and the definition of `props.groups`. Expect: Correct usage and definition.
rg --type typescript $'useNamespaces'
rg --type typescript $'props.groups'

Length of output: 142



Script:

#!/bin/bash
# Description: Verify the usage of `useNamespaces` and the structure of `props.groups`.

# Test: Search for the usage of `useNamespaces` in the codebase.
rg 'useNamespaces'

# Test: Search for the structure of `props.groups` in the codebase.
rg 'props.groups'

Length of output: 38648



Script:

#!/bin/bash
# Description: Verify the definition of the `Items` type to ensure the `props.groups` structure is well-defined.

# Test: Search for the definition of the `Items` type in the codebase.
rg 'type Items' --type-add 'typescript:*.{ts,tsx}'

Length of output: 132



Script:

#!/bin/bash
# Description: Display the definition of the `Items` type to ensure it aligns with the usage in the `InfoLines` component.

# Test: Display the definition of the `Items` type.
rg 'export type Items' -A 10 --type-add 'typescript:*.{ts,tsx}'

Length of output: 846

libs/service-portal/law-and-order/src/components/ConfirmationModal/ConfirmationModal.tsx (1)

1-117: LGTM! Ensure useNamespaces and useLawAndOrderContext are correctly used.

Verification successful

The useNamespaces and useLawAndOrderContext hooks are correctly used in the ConfirmationModal.tsx file. The useNamespaces hook sets the namespace for localization, and useLawAndOrderContext manages the state related to law and order context.

  • useNamespaces('sp.law-and-order') is used to set the namespace for localization.
  • useLawAndOrderContext() is used to access and manage the state related to subpoenas.

Both hooks are correctly imported and utilized in the SubpoenaConfirmationModal component.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of `useNamespaces` and `useLawAndOrderContext`.

# Test: Search for the usage of `useNamespaces` and `useLawAndOrderContext`. Expect: Correct usage.
rg --type typescript $'useNamespaces'
rg --type typescript $'useLawAndOrderContext'

Length of output: 151



Script:

#!/bin/bash
# Description: Verify the usage of `useNamespaces` and `useLawAndOrderContext`.

# Test: Search for the usage of `useNamespaces` and `useLawAndOrderContext`. Expect: Correct usage.
rg 'useNamespaces'
rg 'useLawAndOrderContext'

Length of output: 39780

libs/service-portal/law-and-order/src/screens/CourtCaseDetail.tsx (1)

1-125: LGTM! Ensure useNamespaces, useLocale, useParams, and useLawAndOrderContext are correctly used.

Verification successful

The hooks useNamespaces, useLocale, useParams, and useLawAndOrderContext are correctly used in the CourtCaseDetail component.

  • useNamespaces is used to set the namespace for localization.
  • useLocale is used to get the formatMessage function for localization.
  • useParams is used to retrieve the id parameter from the route.
  • useLawAndOrderContext is used to get and set context values related to the law and order module.
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of `useNamespaces`, `useLocale`, `useParams`, and `useLawAndOrderContext`.

# Test: Search for the usage of `useNamespaces`, `useLocale`, `useParams`, and `useLawAndOrderContext`. Expect: Correct usage.
rg --type typescript $'useNamespaces'
rg --type typescript $'useLocale'
rg --type typescript $'useParams'
rg --type typescript $'useLawAndOrderContext'

Length of output: 287



Script:

#!/bin/bash
# Description: Verify the usage of `useNamespaces`, `useLocale`, `useParams`, and `useLawAndOrderContext`.

# Test: Search for the usage of `useNamespaces`, `useLocale`, `useParams`, and `useLawAndOrderContext` in TypeScript files.
rg --glob '*.ts' --glob '*.tsx' 'useNamespaces'
rg --glob '*.ts' --glob '*.tsx' 'useLocale'
rg --glob '*.ts' --glob '*.tsx' 'useParams'
rg --glob '*.ts' --glob '*.tsx' 'useLawAndOrderContext'

Length of output: 293666

libs/service-portal/law-and-order/src/lib/messages.ts (44)

4-7: LGTM! The message myData is correctly defined.


8-11: LGTM! The message courtCases is correctly defined.


12-15: LGTM! The message courtCasesDescription is correctly defined.


16-19: LGTM! The message seeInfo is correctly defined.


20-23: LGTM! The message courtCaseNotFound is correctly defined.


24-27: LGTM! The message courtCaseNumberNotRegistered is correctly defined.


28-31: LGTM! The message defendant is correctly defined.


32-35: LGTM! The message subpoena is correctly defined.


36-39: LGTM! The message subpoenaSent is correctly defined.


40-43: LGTM! The message seeSubpoena is correctly defined.


44-47: LGTM! The message subpoenaNotFound is correctly defined.


48-51: LGTM! The message process is correctly defined.


52-55: LGTM! The message defenseAttorney is correctly defined.


56-59: LGTM! The message caseInformation is correctly defined.


60-63: LGTM! The message LOKECaseNumber is correctly defined.


64-67: LGTM! The message caseNumberCourt is correctly defined.


68-71: LGTM! The message court is correctly defined.


72-75: LGTM! The message prosecution is correctly defined.


76-79: LGTM! The message judge is correctly defined.


80-83: LGTM! The message requestedDateTime is correctly defined.


84-87: LGTM! The message prosecutor is correctly defined.


88-91: LGTM! The message timeOfArrest is correctly defined.


92-95: LGTM! The message confirmedHearingDateTime is correctly defined.


96-99: LGTM! The message state is correctly defined.


100-103: LGTM! The message type is correctly defined.


104-107: LGTM! The message information is correctly defined.


108-111: LGTM! The message caseNumberShort is correctly defined.


112-115: LGTM! The message accuser is correctly defined.


116-119: LGTM! The message accused is correctly defined.


120-123: LGTM! The message dateOfHearing is correctly defined.


124-127: LGTM! The message place is correctly defined.


128-131: LGTM! The message courtType is correctly defined.


132-135: LGTM! The message chooseDefenderTitle is correctly defined.


136-139: LGTM! The message defenderList is correctly defined.


140-143: LGTM! The message chooseDefender is correctly defined.


144-147: LGTM! The message office is correctly defined.


148-151: LGTM! The message date is correctly defined.


152-155: LGTM! The message openSubpeona is correctly defined.


156-159: LGTM! The message confirm is correctly defined.


160-163: LGTM! The message cancel is correctly defined.


164-167: LGTM! The message registrationCompleted is correctly defined.


168-171: LGTM! The message firstChoiceNoDefender is correctly defined.


172-176: LGTM! The message secondChoiceChoosingLawyer is correctly defined.


177-181: LGTM! The message thirdChoiceDelayChoice is correctly defined.

libs/service-portal/law-and-order/src/helpers/mockData.ts (6)

4-13: Type definitions look good.


15-36: Type definitions look good.


38-55: Type definitions look good.


57-75: Type definitions look good.


360-369: Function looks good.


397-581: Function looks good.

libs/service-portal/core/src/lib/messages.ts (2)

1287-1291: New tooltip message for domsmalaraduneytidTooltip looks good.


1514-1530: New messages for the "Law and Order" module look good.

@datadog-island-is
Copy link

datadog-island-is bot commented May 16, 2024

Datadog Report

All test runs fd9d8b9 🔗

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

Test Services
This report shows up to 10 services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
air-discount-scheme-backend 0 0 0 81 0 29.59s N/A Link
air-discount-scheme-web 0 0 0 2 0 8.61s N/A Link
api 0 0 0 4 0 4.11s N/A Link
api-catalogue-services 0 0 0 23 0 14.74s N/A Link
api-domains-air-discount-scheme 0 0 0 6 0 39.03s N/A Link
api-domains-assets 0 0 0 3 0 25.84s N/A Link
api-domains-auth-admin 0 0 0 18 0 13.29s N/A Link
api-domains-communications 0 0 0 5 0 41.2s N/A Link
api-domains-criminal-record 0 0 0 5 0 16.45s N/A Link
api-domains-driving-license 0 0 0 23 0 52.24s N/A Link

🔻 Code Coverage Decreases vs Default Branch (2)

  • services-auth-personal-representative-public - jest 46.87% (-0.06%) - Details
  • judicial-system-backend - jest 59.3% (-0.01%) - Details

Copy link

codecov bot commented May 16, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.

Project coverage is 36.78%. Comparing base (9ef986b) to head (003dcf4).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
apps/api/src/app/app.module.ts 0.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #14819      +/-   ##
==========================================
+ Coverage   36.76%   36.78%   +0.01%     
==========================================
  Files        6785     6783       -2     
  Lines      139900   139847      -53     
  Branches    39772    39754      -18     
==========================================
+ Hits        51435    51439       +4     
+ Misses      88465    88408      -57     
Flag Coverage Δ
air-discount-scheme-backend 54.27% <100.00%> (+0.03%) ⬆️
air-discount-scheme-web 0.00% <ø> (ø)
api 3.37% <0.00%> (-0.03%) ⬇️
api-domains-air-discount-scheme 37.00% <100.00%> (+0.09%) ⬆️
api-domains-assets 26.71% <ø> (ø)
api-domains-auth-admin 48.77% <ø> (ø)
api-domains-communications 39.93% <100.00%> (+0.01%) ⬆️
api-domains-criminal-record 47.93% <100.00%> (+0.07%) ⬆️
api-domains-driving-license 44.52% <100.00%> (+0.04%) ⬆️
api-domains-education 31.74% <100.00%> (+0.06%) ⬆️
api-domains-health-insurance 34.78% <100.00%> (+0.09%) ⬆️
api-domains-mortgage-certificate 35.76% <100.00%> (+0.05%) ⬆️
api-domains-payment-schedule 41.29% <100.00%> (+0.08%) ⬆️
application-api-files 57.91% <100.00%> (+0.05%) ⬆️
application-core 71.29% <ø> (-0.33%) ⬇️
application-system-api 41.62% <100.00%> (+<0.01%) ⬆️
application-template-api-modules 23.74% <100.00%> (+0.01%) ⬆️
application-templates-accident-notification 22.14% <ø> (ø)
application-templates-car-recycling 3.12% <ø> (ø)
application-templates-criminal-record 26.63% <ø> (ø)
application-templates-driving-license 18.70% <ø> (ø)
application-templates-estate 12.33% <0.00%> (-0.01%) ⬇️
application-templates-example-payment 25.41% <ø> (ø)
application-templates-financial-aid 14.34% <ø> (ø)
application-templates-general-petition 23.68% <ø> (ø)
application-templates-health-insurance 26.62% <ø> (ø)
application-templates-inheritance-report 6.45% <ø> (ø)
application-templates-marriage-conditions 15.23% <ø> (ø)
application-templates-mortgage-certificate 43.96% <ø> (ø)
application-templates-parental-leave 30.15% <ø> (ø)
application-types 6.71% <ø> (ø)
application-ui-components 1.28% <ø> (ø)
application-ui-shell 21.29% <0.00%> (-0.01%) ⬇️
clients-charge-fjs-v2 24.11% <ø> (ø)
clients-driving-license 40.73% <100.00%> (+0.08%) ⬆️
clients-driving-license-book 43.97% <100.00%> (+0.05%) ⬆️
clients-financial-statements-inao 49.25% <100.00%> (+0.07%) ⬆️
clients-license-client 1.83% <ø> (ø)
clients-regulations 42.71% <100.00%> (+0.08%) ⬆️
clients-rsk-company-registry 29.76% <ø> (ø)
clients-rsk-personal-tax-return 38.00% <ø> (ø)
clients-smartsolutions 12.77% <ø> (ø)
clients-syslumenn 49.71% <100.00%> (+0.04%) ⬆️
cms 0.43% <ø> (ø)
cms-translations 39.06% <100.00%> (+0.01%) ⬆️
dokobit-signing 63.20% <100.00%> (+0.17%) ⬆️
download-service 44.79% <100.00%> (+0.04%) ⬆️
email-service 60.97% <100.00%> (+0.15%) ⬆️
feature-flags 90.97% <100.00%> (+0.13%) ⬆️
file-storage 53.48% <100.00%> (+0.23%) ⬆️
financial-aid-backend 56.58% <100.00%> (+0.03%) ⬆️
financial-aid-shared 19.03% <ø> (ø)
icelandic-names-registry-backend 54.68% <100.00%> (+0.03%) ⬆️
judicial-system-api 18.30% <ø> (ø)
judicial-system-audit-trail 69.10% <100.00%> (+0.16%) ⬆️
judicial-system-backend 55.30% <100.00%> (+<0.01%) ⬆️
judicial-system-message 67.12% <100.00%> (+0.12%) ⬆️
judicial-system-message-handler 48.17% <100.00%> (+0.37%) ⬆️
judicial-system-scheduler 69.17% <100.00%> (+0.05%) ⬆️
license-api 42.57% <100.00%> (-0.11%) ⬇️
nest-config 78.32% <100.00%> (+0.12%) ⬆️
nest-feature-flags 52.16% <100.00%> (+0.12%) ⬆️
nova-sms 62.56% <100.00%> (+0.18%) ⬆️
portals-admin-regulations-admin 1.88% <ø> (ø)
portals-core 16.17% <ø> (ø)
services-auth-admin-api 52.00% <100.00%> (+0.01%) ⬆️
services-auth-delegation-api 57.88% <100.00%> (-0.06%) ⬇️
services-auth-ids-api 51.90% <100.00%> (+0.01%) ⬆️
services-auth-personal-representative 45.56% <100.00%> (+0.04%) ⬆️
services-auth-personal-representative-public 41.61% <100.00%> (+0.01%) ⬆️
services-auth-public-api 49.39% <100.00%> (+0.01%) ⬆️
services-documents 61.29% <100.00%> (+0.02%) ⬆️
services-endorsements-api 55.27% <100.00%> (+0.03%) ⬆️
services-sessions 65.83% <100.00%> (+0.04%) ⬆️
services-university-gateway 48.56% <100.00%> (+0.14%) ⬆️
services-user-notification 47.08% <100.00%> (+0.01%) ⬆️
services-user-profile 62.40% <100.00%> (+0.02%) ⬆️
shared-form-fields 31.63% <100.00%> (+0.02%) ⬆️
web 1.83% <ø> (ø)

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

Files with missing lines Coverage Δ
libs/auth/scopes/src/lib/api.scope.ts 100.00% <100.00%> (ø)
libs/feature-flags/src/lib/features.ts 100.00% <100.00%> (ø)
...al/core/src/components/IntroHeader/IntroHeader.tsx 0.00% <ø> (ø)
...rtal/core/src/components/LinkButton/LinkButton.tsx 0.00% <ø> (ø)
.../core/src/components/UserInfoLine/UserInfoLine.tsx 3.44% <ø> (+0.22%) ⬆️
libs/service-portal/core/src/index.ts 0.00% <ø> (ø)
libs/service-portal/core/src/lib/messages.ts 50.00% <ø> (ø)
libs/service-portal/core/src/utils/constants.ts 0.00% <ø> (ø)
libs/service-portal/core/src/utils/dateUtils.ts 15.38% <ø> (ø)
...elds/src/lib/SelectController/SelectController.tsx 55.55% <100.00%> (+1.70%) ⬆️
... and 1 more

... and 9 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

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

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

🧹 Outside diff range and nitpick comments (3)
libs/service-portal/documents/src/screens/Overview/OverviewV3.tsx (2)

32-301: Ensure reusability and adherence to coding guidelines

As per the coding guidelines for libs/**/*, please confirm that the ServicePortalDocumentsV3 component and its associated hooks and components are designed for reusability across different NextJS apps. Ensure that shared logic is abstracted appropriately and that TypeScript types are defined and exported where necessary.


32-301: Explicitly define TypeScript types for improved clarity

While TypeScript can infer types, explicitly defining types for component props, state, and other variables enhances code readability and maintainability. Consider adding explicit type annotations where appropriate.

libs/service-portal/documents/src/components/DocumentLine/DocumentLineV3.tsx (1)

21-21: Improve readability by correcting the hook's name formatting

The hook useIsChildFocusedorHovered would be more readable if 'Or' is capitalized: useIsChildFocusedOrHovered. This enhances clarity and follows standard naming conventions.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 3344181 and 0d1bb2d.

📒 Files selected for processing (5)
  • libs/api/domains/law-and-order/src/lib/law-and-order.resolver.ts (1 hunks)
  • libs/api/domains/law-and-order/src/lib/law-and-order.service.ts (1 hunks)
  • libs/service-portal/documents/src/components/DocumentLine/DocumentLineV3.tsx (1 hunks)
  • libs/service-portal/documents/src/components/FavAndStash/FavAndStashV3.tsx (1 hunks)
  • libs/service-portal/documents/src/screens/Overview/OverviewV3.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • libs/api/domains/law-and-order/src/lib/law-and-order.resolver.ts
  • libs/api/domains/law-and-order/src/lib/law-and-order.service.ts
🧰 Additional context used
📓 Path-based instructions (3)
libs/service-portal/documents/src/components/DocumentLine/DocumentLineV3.tsx (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."
libs/service-portal/documents/src/components/FavAndStash/FavAndStashV3.tsx (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."
libs/service-portal/documents/src/screens/Overview/OverviewV3.tsx (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."
🔇 Additional comments (5)
libs/service-portal/documents/src/components/FavAndStash/FavAndStashV3.tsx (5)

1-14: LGTM: Imports and type definition are well-structured

The imports and type definition for FavAndStashProps are well-organized and follow TypeScript best practices. The use of specific imports from '@island.is' packages promotes reusability across different NextJS apps.


16-25: LGTM: Component declaration and props destructuring are well-implemented

The FavAndStashV3 component is correctly declared as a React functional component with TypeScript props. The props destructuring in the function parameters enhances code readability and follows modern JavaScript conventions.


26-32: LGTM: Loading state is handled effectively

The component correctly handles the loading state by rendering a LoadingDots component when the loading prop is true. This approach provides a good user experience and maintains consistency with the UI library.


85-85: LGTM: Component export is correct

The component is correctly exported as the default export, following common React component export patterns. This allows for easy import and potential renaming in other files.


1-85: Overall assessment: Well-implemented and reusable component

The FavAndStashV3 component is well-implemented and adheres to the coding guidelines for the libs directory. Key points:

  1. Reusability: The component is designed to be used across different NextJS apps.
  2. TypeScript usage: Props are well-defined using TypeScript, enhancing type safety.
  3. Best practices: The component follows React and TypeScript best practices.
  4. Flexibility: Conditional rendering based on props makes the component adaptable to various use cases.

The suggested minor improvement for accessibility (adding aria-label to buttons) would further enhance the component's quality.

Copy link
Member

@thorkellmani thorkellmani left a comment

Choose a reason for hiding this comment

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

Cool 🕶️

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

🧹 Outside diff range and nitpick comments (3)
libs/service-portal/core/src/components/LinkButton/LinkButton.tsx (1)

53-54: Approved changes with a suggestion for improvement

The modifications to the icon and iconType handling improve the flexibility and consistency of the LinkButton component. This aligns well with the coding guidelines for reusability across NextJS apps.

To further enhance clarity, consider adding a comment explaining the logic behind using the 'open' icon for external links and the custom icon for internal links. This would make the code more self-documenting and easier to maintain.

Consider adding a comment like this:

// Use 'open' icon for external links, custom icon (if provided) for internal links
icon={isExternal ? 'open' : icon}
libs/api/domains/documents/src/lib/documentV2.service.ts (2)

355-392: Consider defining 'actionMapper' as a regular method

The actionMapper is currently defined as an arrow function property. For consistency and potential performance benefits, consider converting it to a regular method within the class.

Apply this diff to convert actionMapper to a regular method:

-private actionMapper = (id: string, actions?: Array<MessageAction>) => {
+private actionMapper(id: string, actions?: Array<MessageAction>) {

374-375: Simplify 'actions.map' by removing unnecessary optional chaining

Since you've already checked that actions is not undefined earlier in the actionMapper method, the optional chaining operator in actions?.map is unnecessary. You can simplify the code by removing the ?.

Apply this diff to simplify the mapping:

-    const mapped: Array<Action> = actions?.map((x) => {
+    const mapped: Array<Action> = actions.map((x) => {
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 0d1bb2d and c00d839.

📒 Files selected for processing (5)
  • libs/api/domains/documents/src/lib/documentV2.service.ts (7 hunks)
  • libs/feature-flags/src/lib/features.ts (1 hunks)
  • libs/service-portal/core/src/components/LinkButton/LinkButton.tsx (1 hunks)
  • libs/service-portal/core/src/index.ts (1 hunks)
  • libs/service-portal/core/src/lib/messages.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
libs/api/domains/documents/src/lib/documentV2.service.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."
libs/feature-flags/src/lib/features.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."
libs/service-portal/core/src/components/LinkButton/LinkButton.tsx (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."
libs/service-portal/core/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."
libs/service-portal/core/src/lib/messages.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."
🔇 Additional comments (10)
libs/service-portal/core/src/index.ts (1)

13-13: LGTM: New export statement adheres to guidelines

The new export statement for ConfirmationModal component follows the existing pattern in the file and adheres to the coding guidelines for libs directory:

  1. Reusability: By exporting the ConfirmationModal component from this central index.ts file, it becomes easily accessible for use across different NextJS apps within the project.
  2. TypeScript usage: While we can't see the actual component file here, the export statement suggests that TypeScript is being used, as it follows the same pattern as other component exports in this file.
  3. Tree-shaking and bundling: The use of a wildcard export (export *) allows for effective tree-shaking, as unused exports can be easily eliminated during the build process.

To ensure that the ConfirmationModal component is properly implemented with TypeScript, let's verify its file content:

libs/feature-flags/src/lib/features.ts (1)

58-59: LGTM! New feature flags align with PR objectives.

The newly added feature flags servicePortalLawAndOrderModuleEnabled and servicePortalDocumentsActionsEnabled are correctly implemented and follow consistent naming conventions. They align well with the PR objectives, specifically:

  1. servicePortalLawAndOrderModuleEnabled corresponds to the new "Law and Order" module.
  2. servicePortalDocumentsActionsEnabled likely relates to the document handling enhancements mentioned in the PR description.

These additions adhere to the coding guidelines for the libs/**/* pattern, supporting TypeScript usage and effective tree-shaking.

libs/service-portal/core/src/lib/messages.ts (5)

1637-1640: LGTM: New message correctly implemented.

The lawAndOrder message is properly defined and follows the existing pattern for message definitions in this file.


1641-1644: LGTM: New message correctly implemented.

The lawAndOrderDashboard message is properly defined and follows the existing pattern for message definitions in this file.


1645-1649: LGTM: New message correctly implemented with multi-line description.

The lawAndOrderDescription message is properly defined and follows the existing pattern for message definitions in this file. The multi-line description is correctly formatted.


1650-1653: LGTM: New message correctly implemented.

The courtCases message is properly defined and follows the existing pattern for message definitions in this file.


1654-1657: LGTM: New message correctly implemented.

The subpoena message is properly defined and follows the existing pattern for message definitions in this file.

libs/api/domains/documents/src/lib/documentV2.service.ts (3)

39-40: Ensure 'getCustomersDocument' supports new optional parameters

You've added optional parameters locale and includeDocument to the findDocumentById method and are passing them to getCustomersDocument. Please verify that the getCustomersDocument method in the DocumentsClientV2Service correctly handles these parameters when they are undefined.

Also applies to: 45-46


145-145: Include 'isUrgent' in document data mapping

Good job adding isUrgent to the document data mapping in listDocuments. This ensures that the urgency status is correctly reflected in the documents list.


67-73: Properly handle 'confirmation' and 'alert' actions

The extraction of confirmation, alert, and other actions from document.actions is handled correctly with optional chaining and filtering. This ensures that special actions are appropriately identified and processed.

libs/service-portal/core/src/lib/messages.ts Outdated Show resolved Hide resolved
libs/service-portal/core/src/lib/messages.ts Outdated Show resolved Hide resolved
libs/api/domains/documents/src/lib/documentV2.service.ts Outdated Show resolved Hide resolved
Copy link
Member

@eirikurn eirikurn left a comment

Choose a reason for hiding this comment

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

Approving core files 👍

@disaerna disaerna dismissed jonbjarnio’s stale review October 1, 2024 10:53

Irrelavant - Approved from other team member

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

🧹 Outside diff range and nitpick comments (1)
libs/api/domains/documents/src/lib/documentV2.service.ts (1)

Line range hint 37-93: LGTM: Enhanced findDocumentById method

The changes to findDocumentById method improve its functionality and flexibility. The addition of locale and includeDocument parameters, along with the new handling of confirmation and alert actions, enhances the method's capabilities.

Consider adding JSDoc comments to describe the new parameters and their purpose for better code documentation.

Would you like me to generate the JSDoc comments for the findDocumentById method?

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between c00d839 and 4105e04.

📒 Files selected for processing (2)
  • libs/api/domains/documents/src/lib/documentV2.service.ts (7 hunks)
  • libs/service-portal/core/src/lib/messages.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • libs/service-portal/core/src/lib/messages.ts
🧰 Additional context used
📓 Path-based instructions (1)
libs/api/domains/documents/src/lib/documentV2.service.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."
🪛 GitHub Check: prepare
libs/api/domains/documents/src/lib/documentV2.service.ts

[failure] 374-374:
Type '({ icon: string; type?: string | undefined; title?: string | undefined; data?: string | undefined; } | undefined)[]' is not assignable to type 'Action[]'.


[failure] 374-374:
Type '({ icon: string; type?: string | undefined; title?: string | undefined; data?: string | undefined; } | undefined)[]' is not assignable to type 'Action[]'.


[failure] 374-374:
Type '({ icon: string; type?: string | undefined; title?: string | undefined; data?: string | undefined; } | undefined)[]' is not assignable to type 'Action[]'.


[failure] 374-374:
Type '({ icon: string; type?: string | undefined; title?: string | undefined; data?: string | undefined; } | undefined)[]' is not assignable to type 'Action[]'.


[failure] 374-374:
Type '({ icon: string; type?: string | undefined; title?: string | undefined; data?: string | undefined; } | undefined)[]' is not assignable to type 'Action[]'.


[failure] 374-374:
Type '({ icon: string; type?: string | undefined; title?: string | undefined; data?: string | undefined; } | undefined)[]' is not assignable to type 'Action[]'.

🔇 Additional comments (2)
libs/api/domains/documents/src/lib/documentV2.service.ts (2)

2-5: LGTM: Import statements updated correctly

The new imports for MessageAction and Action are correctly added and align with the changes made in the file.

Also applies to: 14-14


145-145: LGTM: Added isUrgent field to listDocuments output

The addition of isUrgent: d.urgent to the document data in the listDocuments method ensures consistency with the findDocumentById method and provides valuable information about the urgency of documents.

libs/api/domains/documents/src/lib/documentV2.service.ts Outdated Show resolved Hide resolved
@disaerna disaerna added automerge Merge this PR as soon as all checks pass and removed deploy-feature Deploys features to dev labels Oct 1, 2024
@kodiakhq kodiakhq bot merged commit 4d38b65 into main Oct 2, 2024
211 checks passed
@kodiakhq kodiakhq bot deleted the service-portal/law-and-order-ui branch October 2, 2024 10:09
thoreyjona pushed a commit that referenced this pull request Oct 2, 2024
* feat: add law and order library

* feat: overview and detail screen

* feat: subpeona and modals, refactor data and structure

* fix: revert changes on progress meter

* fix: render modules

* chore: nx format:write update dirty files

* fix: naming

* fix: minor probs

* feat: graphql and client temp mocked

* fix: cleanup generated test file

* fix: path error

* fix: responsive fixes and spacing

* fix: path & mock data

* feat: locale changes + fixes

* fix: env missing

* chore: charts update dirty files

* feat: connect to service

* fix: ui changes

* feat: new client for judical system

* Update .github/CODEOWNERS

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fix: add missing provider file

* fix: logger type

* update: use judicial client

* chore: charts update dirty files

* feat: get subpoena data from service

* fix: subpoena logic

* Update README.md

* chore: nx format:write update dirty files

* feat: update client

* Update libs/clients/judicial-system-sp/README.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update libs/clients/judicial-system-sp/README.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fix: loading state for button

* update: client

* update client config

* update: move modal to core

* update: client

* chore: charts update dirty files

* fix: cleanup type declrations

* update: client

* fix: merge conflict

* fix: models

* fix: service

* feat: connect subpoena to service

* fix: errors

* update client

* fix: remove timout

* fix: import

* fix: remove type - causing errors

* chore: remove "as" from locale type & better error handling

* fix: locale typing

* fix: query after deleting input

* fix: dumdum

* fix: remove unused fields

* feat: add feature flag for module

* feat: add document actions

* feat: add callback for confirmation

* chore: nx format:write update dirty files

* display confirmation text

* missing text

* locale

* fix: locale

* fix: hide actions

* fix: defender null check

* testing new flow

* chore: charts update dirty files

* add scopes to resolver

* refactor data models

* feat: remove check if urgent

* refactor: remove async from resolver

* feat: redirect to mailbox

* fix: include doc in service

* cleanup

* fix

* feat: add feature flag for document actions

* refactor: strings and rollback fflag

* fix: PR comments

* fix: remove unused xroad

* chore: charts update dirty files

* feat: add versioning for digital mailbox

* refactor: add message to document actions from service

* refactor: updates from service + other refactor

* refactor: document actions

* fix: documents

* cleanup

* feat: add feature flag to resolver

* sort imports

* pr fixes and sorting

* fix: PR review

* fix build

---------

Co-authored-by: andes-it <builders@andes.is>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Tryggvi Geir Magnússon <tryggvi@hugsmidjan.is>
Co-authored-by: Kristofer <kristofer@andes.is>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
@coderabbitai coderabbitai bot mentioned this pull request Oct 21, 2024
6 tasks
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.

9 participants