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): Service announcement for defenders #16731

Merged
merged 29 commits into from
Nov 13, 2024

Conversation

oddsson
Copy link
Member

@oddsson oddsson commented Nov 5, 2024

Service announcement for defenders

Asana

What

When a subpoena has been served to a defendant, the defendant's defender needs to see that, who served the subpoena and when. This PR implements that. Note that we don't differentiate between how the service was done, i.e. if the subpoena was served to the defender or through island.is, we just say "Service complete".

Island.is change

This PR also refactors the AlertMessage component in Island UI. The refactoring is

  • Remove the action prop. This prop is not being used by anyone and should not be a part of this component according to the design in Figma.
  • Fixes the messages text alignment when only the title or message is being rendered (see before/after photos 👇)
  • Remove the message container if a message prop is not passed down.

I also added the alignSelf property to useBoxStyles

Screenshots / Gifs

Alert Banner

Before
Screenshot 2024-11-06 at 10 28 36
After (No change)
Screenshot 2024-11-06 at 10 33 52

Only title

Before
Screenshot 2024-11-06 at 10 29 52
After
Screenshot 2024-11-05 at 22 48 27

Only message

Before
Screenshot 2024-11-06 at 10 29 11
After (No change)
Screenshot 2024-11-05 at 22 48 55

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

Release Notes

  • New Features

    • Introduced ServiceAnnouncement component to display service alerts in the Indictment Overview.
    • Added alignSelf property to the Box component for enhanced layout control.
  • Enhancements

    • Expanded export options to include localized service announcement strings.
    • Improved error handling and readability in the Indictment Overview component.
    • Streamlined the AlertMessage component for better performance and clarity.
  • Styling Updates

    • Added responsive style variants for the new alignSelf property in the Box component.

Copy link
Contributor

coderabbitai bot commented Nov 5, 2024

Walkthrough

The pull request introduces enhancements across multiple components in the judicial system application. It adds a new export for localized service announcement strings, integrates a new ServiceAnnouncement component in IndictmentOverview.tsx, and updates the AlertMessage component for improved clarity. Additionally, it introduces a new alignSelf property in the Box component and related styling adjustments, enhancing flexibility in layout management. These changes collectively improve functionality, maintainability, and responsiveness within the application.

Changes

File Change Summary
apps/judicial-system/web/src/components/index.ts Added export for serviceAnnouncementStrings from ServiceAnnouncement.strings.
apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx Introduced ServiceAnnouncement component; updated logic for displaying service announcements based on user roles.
libs/island-ui/core/src/lib/AlertMessage/AlertMessage.tsx Modified AlertMessage component, updated props and rendering logic for clarity, removed unused properties.
libs/island-ui/core/src/lib/Box/Box.tsx Added new alignSelf property to Box component for enhanced alignment control.
libs/island-ui/core/src/lib/Box/useBoxStyles.css.ts Introduced alignSelfRules for various alignment options and responsive variants for the alignSelf property.
libs/island-ui/core/src/lib/Box/useBoxStyles.ts Added alignSelf property to UseBoxStylesProps interface and updated useBoxStyles function accordingly.

Possibly related PRs

Suggested labels

automerge


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 6893968 and b351374.

📒 Files selected for processing (1)
  • libs/island-ui/core/src/lib/AlertMessage/AlertMessage.tsx (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • libs/island-ui/core/src/lib/AlertMessage/AlertMessage.tsx

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.

Copy link

codecov bot commented Nov 5, 2024

Codecov Report

Attention: Patch coverage is 26.66667% with 22 lines in your changes missing coverage. Please review.

Project coverage is 36.42%. Comparing base (c769f00) to head (b351374).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...s/Shared/IndictmentOverview/IndictmentOverview.tsx 0.00% 21 Missing ⚠️
...land-ui/core/src/lib/AlertMessage/AlertMessage.tsx 85.71% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #16731      +/-   ##
==========================================
- Coverage   36.44%   36.42%   -0.02%     
==========================================
  Files        6852     6855       +3     
  Lines      143478   143442      -36     
  Branches    40949    40933      -16     
==========================================
- Hits        52290    52255      -35     
+ Misses      91188    91187       -1     
Flag Coverage Δ
air-discount-scheme-web 0.00% <ø> (ø)
api 3.34% <ø> (ø)
application-api-files 62.45% <ø> (ø)
application-core 70.75% <ø> (-0.32%) ⬇️
application-system-api 40.97% <ø> (+<0.01%) ⬆️
application-template-api-modules 27.63% <ø> (ø)
application-templates-accident-notification 28.98% <ø> (ø)
application-templates-car-recycling 3.12% <ø> (ø)
application-templates-criminal-record 25.87% <ø> (ø)
application-templates-driving-license 18.26% <ø> (ø)
application-templates-estate 12.14% <11.11%> (-0.01%) ⬇️
application-templates-example-payment 24.80% <ø> (ø)
application-templates-financial-aid 15.48% <ø> (ø)
application-templates-general-petition 23.07% <ø> (ø)
application-templates-inheritance-report 6.52% <ø> (ø)
application-templates-marriage-conditions 15.04% <ø> (ø)
application-templates-mortgage-certificate 43.22% <ø> (ø)
application-templates-parental-leave 29.71% <ø> (-0.12%) ⬇️
application-types 6.60% <ø> (ø)
application-ui-components 1.27% <ø> (ø)
application-ui-shell 20.83% <22.22%> (+<0.01%) ⬆️
auth-react 21.85% <22.22%> (+0.01%) ⬆️
clients-charge-fjs-v2 24.11% <ø> (ø)
contentful-apps 4.69% <ø> (ø)
financial-aid-backend 51.26% <ø> (ø)
financial-aid-shared 17.81% <ø> (ø)
island-ui-core 28.88% <11.11%> (+0.01%) ⬆️
judicial-system-web 27.13% <26.66%> (-0.39%) ⬇️
portals-admin-regulations-admin 1.85% <ø> (ø)
portals-core 15.89% <11.11%> (-0.01%) ⬇️
services-auth-personal-representative 45.59% <ø> (ø)
shared-components 26.90% <22.22%> (+0.01%) ⬆️
shared-form-fields 31.26% <22.22%> (+0.01%) ⬆️
web 1.80% <ø> (ø)

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

Files with missing lines Coverage Δ
libs/island-ui/core/src/lib/Box/Box.tsx 100.00% <ø> (ø)
libs/island-ui/core/src/lib/Box/useBoxStyles.ts 91.93% <100.00%> (+0.26%) ⬆️
...land-ui/core/src/lib/AlertMessage/AlertMessage.tsx 73.68% <85.71%> (+7.01%) ⬆️
...s/Shared/IndictmentOverview/IndictmentOverview.tsx 0.00% <0.00%> (ø)

... and 28 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 de4bcc8...b351374. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Nov 5, 2024

Datadog Report

All test runs b344218 🔗

34 Total Test Services: 0 Failed, 32 Passed
🔻 Test Sessions change in coverage: 3 decreased, 4 increased, 143 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 7.67s 1 no change Link
api 0 0 0 4 0 2.97s 1 no change Link
application-api-files 0 0 0 2 0 4.6s 1 no change Link
application-core 0 0 0 97 0 18.56s 1 decreased (-0.2%) Link
application-system-api 0 0 0 112 2 3m 29.58s 1 no change Link
application-template-api-modules 0 0 0 113 0 2m 25.65s 1 no change Link
application-templates-accident-notification 0 0 0 148 0 19.19s 1 no change Link
application-templates-criminal-record 0 0 0 2 0 10.3s 1 no change Link
application-templates-driving-license 0 0 0 13 0 15.47s 1 no change Link
application-templates-example-payment 0 0 0 2 0 11.33s 1 no change Link

🔻 Code Coverage Decreases vs Default Branch (3)

  • judicial-system-web - jest 31.39% (-0.38%) - Details
  • application-core - jest 78.49% (-0.2%) - Details
  • application-templates-parental-leave - jest 34.86% (-0.1%) - Details

@oddsson oddsson changed the title J s/service announcement defenders feat(j-s): Service announcement for defenders Nov 6, 2024
@oddsson oddsson marked this pull request as ready for review November 6, 2024 10:39
@oddsson oddsson requested review from a team as code owners November 6, 2024 10:39
@oddsson oddsson requested a review from snaerseljan November 6, 2024 10:39
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 (6)
libs/island-ui/core/src/lib/Box/Box.tsx (2)

33-33: LGTM! Consider adding JSDoc documentation.

The addition of the alignSelf prop follows the existing patterns and enhances the component's flexibility in flex layouts. Consider adding JSDoc documentation to describe the new prop's purpose and accepted values.

 export const Box = forwardRef<HTMLElement, BoxProps & TestSupport>(
   (
     {
+      /** Controls how the box aligns itself within its container when used in a flex layout */
       alignSelf,

Also applies to: 97-97


Line range hint 8-73: Consider organizing props into logical groups.

The props destructuring could be more maintainable by grouping related properties. This would make it easier to understand and maintain the component's API.

Consider organizing props into groups like this:

interface BoxLayoutProps {
  display?: ResponsiveProp<'block' | 'flex' | /* ... */>;
  position?: ResponsiveProp<'static' | 'relative' | /* ... */>;
  // ... other layout props
}

interface BoxFlexProps {
  flexDirection?: ResponsiveProp<'row' | 'column' | /* ... */>;
  flexWrap?: ResponsiveProp<'nowrap' | 'wrap' | /* ... */>;
  alignItems?: ResponsiveProp<'flex-start' | 'center' | /* ... */>;
  alignSelf?: ResponsiveProp<'auto' | 'flex-start' | /* ... */>;
  // ... other flex props
}

interface BoxSpacingProps {
  margin?: ResponsiveProp<Space | number>;
  padding?: ResponsiveProp<Space | number>;
  // ... other spacing props
}

type BoxProps = BoxLayoutProps & BoxFlexProps & BoxSpacingProps & {
  // ... other props
};
libs/island-ui/core/src/lib/AlertMessage/AlertMessage.tsx (2)

57-74: Consider re-exporting the AlertMessageProps interface.

Since this is a reusable UI component, consumers might need the type definitions for proper TypeScript usage. Consider re-exporting the AlertMessageProps interface to maintain good TypeScript practices and improve developer experience.

-interface AlertMessageProps {
+export interface AlertMessageProps {
   type: AlertMessageType
   testid?: string
 }

101-106: Consider simplifying nested Box components.

The nested Box components for message rendering could be simplified to reduce DOM depth and improve maintainability.

 <Box
   display="flex"
   width="full"
   flexDirection="column"
   alignSelf="center"
 >
   {title && (
     <Text as="h5" variant="h5" marginBottom={message ? 1 : 0}>
       {title}
     </Text>
   )}
-  {message && (
-    <Box display="flex" alignItems="center">
-      {isValidElement(message) ? (
-        message
-      ) : (
-        <Box flexGrow={1}>
-          <Text variant="small">{message}</Text>
-        </Box>
-      )}
-    </Box>
-  )}
+  {message && (
+    isValidElement(message) ? message : (
+      <Text variant="small">{message}</Text>
+    )
+  )}
 </Box>

Also applies to: 112-122

libs/island-ui/core/src/lib/Box/useBoxStyles.ts (1)

Line range hint 38-359: Architecture Review: Well-implemented component enhancement

The addition of the alignSelf property follows best practices for reusable UI components by:

  • Maintaining TypeScript type safety throughout the implementation
  • Supporting responsive styling consistently with other properties
  • Ensuring proper tree-shaking through careful style reference handling
  • Following established patterns for maximum reusability across NextJS apps
apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx (1)

88-88: Simplify the logic for determining hasLawsBroken and hasMergeCases.

The logic for determining hasLawsBroken and hasMergeCases can be simplified by directly using the lawsBroken.size and workingCase.mergedCases?.length checks, respectively. This eliminates the need for separate variable declarations.

Apply this diff to simplify the logic:

-const hasLawsBroken = lawsBroken.size > 0
-const hasMergeCases =
-  workingCase.mergedCases && workingCase.mergedCases.length > 0
+const hasLawsBroken = lawsBroken.size > 0
+const hasMergeCases = workingCase.mergedCases?.length > 0

Also applies to: 100-102

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 4d4cbd0 and f18cda6.

📒 Files selected for processing (6)
  • apps/judicial-system/web/src/components/index.ts (1 hunks)
  • apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx (5 hunks)
  • libs/island-ui/core/src/lib/AlertMessage/AlertMessage.tsx (4 hunks)
  • libs/island-ui/core/src/lib/Box/Box.tsx (2 hunks)
  • libs/island-ui/core/src/lib/Box/useBoxStyles.css.ts (1 hunks)
  • libs/island-ui/core/src/lib/Box/useBoxStyles.ts (3 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
apps/judicial-system/web/src/components/index.ts (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/judicial-system/web/src/routes/Shared/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."
libs/island-ui/core/src/lib/AlertMessage/AlertMessage.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/island-ui/core/src/lib/Box/Box.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/island-ui/core/src/lib/Box/useBoxStyles.css.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/island-ui/core/src/lib/Box/useBoxStyles.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."
📓 Learnings (1)
apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx (1)
Learnt from: unakb
PR: island-is/island.is#14712
File: apps/judicial-system/web/src/routes/PublicProsecutor/Indictments/Overview/IndictmentOverview.tsx:0-0
Timestamp: 2024-10-08T15:39:04.351Z
Learning: The judicial system application uses a toaster notification system to handle errors globally.
🔇 Additional comments (15)
libs/island-ui/core/src/lib/AlertMessage/AlertMessage.tsx (2)

1-1: Well-optimized imports for better tree-shaking!

The specific React imports (FC, PropsWithChildren, ReactNode, isValidElement) instead of the entire React module will result in better tree-shaking and smaller bundle sizes.


76-78: Excellent TypeScript implementation!

The component properly uses TypeScript's FC and PropsWithChildren types, providing good type safety and documentation for consumers.

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

66-66: LGTM! Verify the export usage.

The new export follows the established patterns and conventions. The naming is consistent, and it's properly placed among related exports.

Let's verify the usage of this export:

✅ Verification successful

Let me gather more context about the usage pattern by checking the import statement and surrounding code:


Let me check one more thing to verify the import pattern:


Export is correctly implemented and properly used

The verification shows that:

  • The serviceAnnouncementStrings export is properly imported in IndictmentOverview.tsx
  • It's used correctly to format messages for service status notifications
  • The strings file contains the required serviceStatusSuccess message that's being used
  • The implementation follows the established i18n patterns using react-intl
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the serviceAnnouncementStrings export is being used correctly

# Test: Search for imports of serviceAnnouncementStrings
rg "import.*serviceAnnouncementStrings.*from.*components" -A 3

# Test: Search for direct usage of serviceAnnouncementStrings
rg "serviceAnnouncementStrings\." -A 3

Length of output: 532


Script:

#!/bin/bash
# Check the import statement and surrounding context in IndictmentOverview.tsx
rg -B 5 -A 10 "serviceAnnouncementStrings" "apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx"

# Check if there are any other files importing from components/index.ts
rg "from '\.\.\/\.\.\/\.\.\/components'" "apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx"

Length of output: 1167


Script:

#!/bin/bash
# Check the import statement pattern without escaping
rg "from '@island.is/judicial-system-web/src/components'" -B 3 "apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx"

# Check the ServiceAnnouncement component's strings file to verify the exported string
cat "apps/judicial-system/web/src/components/ServiceAnnouncement/ServiceAnnouncement.strings.ts"

Length of output: 2265

libs/island-ui/core/src/lib/Box/useBoxStyles.ts (3)

38-38: LGTM: Type-safe interface extension

The alignSelf property is properly typed using ResponsiveProp and follows the established pattern for responsive styling properties.


102-102: LGTM: Consistent parameter addition

The alignSelf parameter is correctly positioned among related flex properties, maintaining the established parameter ordering pattern.


351-359: LGTM: Proper responsive style resolution

The implementation correctly:

  • Handles responsive breakpoints using resolveResponsiveProp
  • Follows the established pattern for conditional style application
  • Maintains tree-shaking capability through direct style references
libs/island-ui/core/src/lib/Box/useBoxStyles.css.ts (2)

329-338: LGTM! The alignSelf implementation follows the established patterns.

The implementation correctly defines the standard flex alignment values and exports them using the consistent pattern found throughout the codebase.


340-367: LGTM! Responsive variants are properly implemented.

The responsive variants (sm, md, lg, xl) are correctly implemented using themeUtils.responsiveStyle, maintaining consistency with other flex-related properties in the codebase.

✅ Verification successful

Responsive variants for alignSelf follow the same pattern as alignItems - Verified!

The implementation of alignSelf responsive variants (sm, md, lg, xl) perfectly matches the pattern used for alignItems, using the same themeUtils.responsiveStyle approach with consistent breakpoint handling. Both sets of variants use identical structure:

  • Same styleVariants wrapper
  • Same mapToStyleProperty usage
  • Identical responsive breakpoint implementation (sm, md, lg, xl)
  • Consistent property mapping approach
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify that the implementation follows the same pattern as other flex properties
echo "Checking pattern consistency with other flex properties..."
rg --type ts "export const align(Items|Self)[A-Z][a-z]+ = styleVariants\(" -A 5

Length of output: 4337

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

49-52: LGTM!

The ServiceAnnouncementProps interface is well-defined and accurately captures the required properties for the ServiceAnnouncement component.


39-39: Confirm the usage of the imported types.

The Defendant, ServiceStatus, and Subpoena types are imported correctly from the @island.is/judicial-system-web/src/graphql/schema package. Ensure that these types are being used appropriately in the newly added code segments, such as the ServiceAnnouncementProps interface and the ServiceAnnouncement component.

To verify the usage of the imported types, run the following script:

Also applies to: 41-42


5-5: Confirm the usage of the AlertMessage component.

The AlertMessage component is imported correctly from the @island.is/island-ui/core package. Ensure that the component is being used as per the updated implementation, considering the removal of the action prop and other changes made to the component.

To verify the usage of the AlertMessage component, run the following script:


15-15: Confirm the usage of the isSuccessfulServiceStatus function.

The isSuccessfulServiceStatus function is imported correctly from the @island.is/judicial-system/types package. Ensure that the function is being used appropriately to check the service status of subpoenas.

To verify the usage of the isSuccessfulServiceStatus function, run the following script:

✅ Verification successful

Let me try another search to find the usage of isSuccessfulServiceStatus:


The isSuccessfulServiceStatus function is correctly used in the codebase

The function is properly imported from @island.is/judicial-system/types and is used appropriately in several key places:

  • In IndictmentOverview.tsx to conditionally render service announcements when subpoena service is successful
  • In IndictmentCaseFilesList.tsx to control the display of PDF buttons for service certificates
  • In the backend services to handle service status notifications and case responses

The implementation in judicial-system/types shows it's a boolean function that checks if a service status is in a list of successful statuses, which is the expected behavior for this use case.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the `isSuccessfulServiceStatus` function.

# Test: Search for the function usage. Expect: Usage in the conditional rendering logic.
rg -A 5 $'isSuccessfulServiceStatus'

Length of output: 17640


Script:

#!/bin/bash
# Search for isSuccessfulServiceStatus function usage
ast-grep --pattern 'isSuccessfulServiceStatus($_)'

# Also try with ripgrep for any string matches
rg -A 5 'isSuccessfulServiceStatus'

Length of output: 9105


7-10: Ensure consistent usage of the imported utility functions.

The formatDate and normalizeAndFormatNationalId utility functions are imported correctly. Verify that these functions are being used consistently throughout the file, especially in the newly added code segments.

To check the usage of the utility functions, run the following script:

✅ Verification successful

Let me generate another script to check for the usage of formatDate since the previous output didn't show its usage:


Both utility functions are used correctly and consistently in the codebase

The verification shows that:

  • formatDate is used correctly in the IndictmentOverview.tsx file to format service dates with the 'Pp' format pattern
  • normalizeAndFormatNationalId is used consistently for national ID comparisons in multiple places within the file
  • Both functions are imported from the correct package and their implementations in @island.is/judicial-system/formatters are properly defined and tested
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the utility functions.

# Test: Search for the usage of `formatDate`. Expect: Consistent usage.
rg -A 3 $'formatDate'

# Test: Search for the usage of `normalizeAndFormatNationalId`. Expect: Consistent usage.
rg -A 3 $'normalizeAndFormatNationalId'

Length of output: 17640


Script:

#!/bin/bash
# Search for formatDate usage in the IndictmentOverview.tsx file
rg -A 3 "formatDate" "apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx"

# Also check the implementation of formatDate
ast-grep --pattern 'export const formatDate = $_'

Length of output: 12714


34-34: Confirm the usage of the serviceAnnouncementStrings import.

The serviceAnnouncementStrings import is added correctly from the @island.is/judicial-system-web/src/components package. Verify that the imported strings are being used appropriately in the ServiceAnnouncement component.

To check the usage of the serviceAnnouncementStrings, run the following script:

✅ Verification successful

Let me generate another script to check the usage of serviceAnnouncementStrings in the ServiceAnnouncement component:


Let me check the ServiceAnnouncement.strings.ts file to verify the strings:


The serviceAnnouncementStrings import is correctly used in the codebase

The import is properly used in the IndictmentOverview component where it's referenced to display service status messages. The strings are defined in ServiceAnnouncement.strings.ts and contain localized messages for different service announcement states like success, failure, expiry etc. The usage is consistent with the component's purpose of showing subpoena service status notifications.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the `serviceAnnouncementStrings` import.

# Test: Search for the usage of `serviceAnnouncementStrings`. Expect: Usage in the `ServiceAnnouncement` component.
rg -A 5 $'serviceAnnouncementStrings'

Length of output: 17640


Script:

#!/bin/bash
# Check the ServiceAnnouncement component and its strings
ast-grep --pattern 'export const strings = {
  $$$
}'

# Also check the ServiceAnnouncement component implementation
rg -A 5 'ServiceAnnouncement'

Length of output: 47928


Script:

#!/bin/bash
# Check the ServiceAnnouncement strings file
cat apps/judicial-system/web/src/components/ServiceAnnouncement/ServiceAnnouncement.strings.ts

Length of output: 1981


173-187: Ensure the conditional rendering logic is correct.

The logic for conditionally rendering the ServiceAnnouncement component based on the user role and subpoena service status appears to be correct. It checks if the user is a defense user and maps through the defendants and their subpoenas to render the component only when the service status is successful.

To double-check the conditional rendering logic, run the following script:

✅ Verification successful

Let me gather more information about the conditional rendering logic.


Let me search for the ServiceAnnouncement component definition and its usage.


Let me check the ServiceAnnouncement strings and component implementation.


Based on the comprehensive review of the code, I can now provide the final response:

The conditional rendering logic is correctly implemented and secure.

The implementation shows that:

  1. The isDefenceUser(user) check correctly gates access to defence-only content
  2. The isSuccessfulServiceStatus(subpoena.serviceStatus) properly filters subpoenas to show only successfully served ones
  3. The ServiceAnnouncement component has proper error handling, loading states, and type safety
  4. Each announcement is uniquely keyed using both defendant and subpoena IDs
  5. The Box wrapper with marginBottom provides consistent spacing
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the conditional rendering logic for `ServiceAnnouncement`.

# Test: Search for the rendering logic. Expect: Correct user role and service status checks.
rg -A 10 $'isDefenceUser\(user\) &&'

Length of output: 17640


Script:

#!/bin/bash
# Search for isDefenceUser function definition and usage
rg -A 5 "isDefenceUser"

# Search for isSuccessfulServiceStatus function definition and usage
rg -A 5 "isSuccessfulServiceStatus"

# Search for ServiceAnnouncement component definition
ast-grep --pattern 'const ServiceAnnouncement = $_'

Length of output: 56498


Script:

#!/bin/bash
# Search for ServiceAnnouncement component definition and imports
rg -A 5 "ServiceAnnouncement"

# Search for the file containing ServiceAnnouncement strings
fd -g "*ServiceAnnouncement.strings*"

Length of output: 8048


Script:

#!/bin/bash
# Get the ServiceAnnouncement strings content
cat apps/judicial-system/web/src/components/ServiceAnnouncement/ServiceAnnouncement.strings.ts

# Get the ServiceAnnouncement component implementation
cat apps/judicial-system/web/src/components/ServiceAnnouncement/ServiceAnnouncement.tsx

Length of output: 7144

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.

LGTM

Copy link
Member

@Toti91 Toti91 left a comment

Choose a reason for hiding this comment

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

LGTM

@oddsson oddsson removed the request for review from snaerseljan November 7, 2024 15:34
@oddsson oddsson added the automerge Merge this PR as soon as all checks pass label Nov 7, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (1)
apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx (1)

48-81: Consider performance optimizations for the ServiceAnnouncement component.

The component implementation is clean and well-structured. Consider these improvements:

  1. Memoize helper functions to prevent unnecessary recalculations
  2. Add validation for required subpoena fields

Apply this diff to optimize the component:

 interface ServiceAnnouncementProps {
   defendant: Defendant
   subpoena: Subpoena
 }

 const ServiceAnnouncement: FC<ServiceAnnouncementProps> = (props) => {
   const { defendant, subpoena } = props
   const { formatMessage } = useIntl()

-  const getTitle = (defendantName?: string | null): string => {
+  const getTitle = useCallback((defendantName?: string | null): string => {
     const successMessage = formatMessage(
       serviceAnnouncementStrings.serviceStatusSuccess,
     )

     return defendantName
       ? `${successMessage} - ${defendantName}`
       : successMessage
-  }
+  }, [formatMessage])

-  const getMessage = (
+  const getMessage = useCallback((
     servedBy?: string | null,
     serviceDate?: string | null,
-  ): string => {
+  ): string => {
     return [servedBy, formatDate(serviceDate, 'Pp')].filter(Boolean).join(', ')
-  }
+  }, [])

+  if (!subpoena.serviceDate || !subpoena.servedBy) {
+    return null
+  }

   return (
     <AlertMessage
       type="success"
       title={getTitle(defendant.name)}
       message={getMessage(subpoena.servedBy, subpoena.serviceDate)}
     />
   )
 }
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between f18cda6 and d98dbd0.

📒 Files selected for processing (1)
  • apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx (5 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
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."
📓 Learnings (1)
apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx (1)
Learnt from: unakb
PR: island-is/island.is#14712
File: apps/judicial-system/web/src/routes/PublicProsecutor/Indictments/Overview/IndictmentOverview.tsx:0-0
Timestamp: 2024-10-08T15:39:04.351Z
Learning: The judicial system application uses a toaster notification system to handle errors globally.
🔇 Additional comments (1)
apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx (1)

Line range hint 5-41: LGTM! Import statements are well-organized.

The new imports are logically grouped and necessary for the service announcement feature.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx (2)

48-81: Consider extracting string formatting logic to separate utility functions.

The component implementation is solid, but the string formatting logic in getTitle and getMessage could be extracted to make the component more focused and easier to test.

Consider this refactor:

+const formatServiceTitle = (successMessage: string, defendantName?: string | null): string => {
+  return defendantName ? `${successMessage} - ${defendantName}` : successMessage
+}
+
+const formatServiceMessage = (servedBy?: string | null, serviceDate?: string | null): string => {
+  return [servedBy, formatDate(serviceDate, 'Pp')].filter(Boolean).join(', ')
+}
+
 const ServiceAnnouncement: FC<ServiceAnnouncementProps> = (props) => {
   const { defendant, subpoena } = props
   const { formatMessage } = useIntl()
-
-  const getTitle = (defendantName?: string | null): string => {
-    const successMessage = formatMessage(
-      serviceAnnouncementStrings.serviceStatusSuccess,
-    )
-
-    return defendantName
-      ? `${successMessage} - ${defendantName}`
-      : successMessage
-  }
-
-  const getMessage = (
-    servedBy?: string | null,
-    serviceDate?: string | null,
-  ): string => {
-    return [servedBy, formatDate(serviceDate, 'Pp')].filter(Boolean).join(', ')
-  }
+  const successMessage = formatMessage(serviceAnnouncementStrings.serviceStatusSuccess)

   return (
     <AlertMessage
       type="success"
-      title={getTitle(defendant.name)}
-      message={getMessage(subpoena.servedBy, subpoena.serviceDate)}
+      title={formatServiceTitle(successMessage, defendant.name)}
+      message={formatServiceMessage(subpoena.servedBy, subpoena.serviceDate)}
     />
   )
 }

172-185: Optimize nested map operations for better performance.

The nested map operations could be simplified using flatMap and filter for better performance and readability.

Consider this optimization:

-        {isDefenceUser(user) &&
-          workingCase.defendants?.map((defendant) =>
-            defendant.subpoenas?.map(
-              (subpoena) =>
-                isSuccessfulServiceStatus(subpoena.serviceStatus) && (
-                  <Box marginBottom={2} key={`${defendant.id}${subpoena.id}`}>
-                    <ServiceAnnouncement
-                      defendant={defendant}
-                      subpoena={subpoena}
-                    />
-                  </Box>
-                ),
-            ),
-          )}
+        {isDefenceUser(user) &&
+          workingCase.defendants?.flatMap((defendant) =>
+            (defendant.subpoenas ?? [])
+              .filter((subpoena) => isSuccessfulServiceStatus(subpoena.serviceStatus))
+              .map((subpoena) => (
+                <Box marginBottom={2} key={`${defendant.id}${subpoena.id}`}>
+                  <ServiceAnnouncement
+                    defendant={defendant}
+                    subpoena={subpoena}
+                  />
+                </Box>
+              ))
+          )}
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between d98dbd0 and 2deeef3.

📒 Files selected for processing (1)
  • apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx (5 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
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."
📓 Learnings (1)
apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx (1)
Learnt from: unakb
PR: island-is/island.is#14712
File: apps/judicial-system/web/src/routes/PublicProsecutor/Indictments/Overview/IndictmentOverview.tsx:0-0
Timestamp: 2024-10-08T15:39:04.351Z
Learning: The judicial system application uses a toaster notification system to handle errors globally.
🔇 Additional comments (1)
apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx (1)

Line range hint 5-41: LGTM: Import statements are well-organized.

The new imports are properly grouped and all are utilized within the component implementations.

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 (2)
apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx (2)

67-72: Consider enhancing the getMessage function for better maintainability.

The current implementation combines formatting and filtering in a single line. Consider separating these concerns for better readability and maintainability.

-  const getMessage = (
-    servedBy?: string | null,
-    serviceDate?: string | null,
-  ): string => {
-    return [servedBy, formatDate(serviceDate, 'Pp')].filter(Boolean).join(', ')
-  }
+  const getMessage = (
+    servedBy?: string | null,
+    serviceDate?: string | null,
+  ): string => {
+    const formattedDate = serviceDate ? formatDate(serviceDate, 'Pp') : null
+    const messageParts = [servedBy, formattedDate]
+    return messageParts.filter(Boolean).join(', ')
+  }

173-187: Consider optimizing the service announcement rendering logic.

The current implementation uses nested array operations. Consider using reduce for better performance and readability.

-        {isDefenceUser(user) &&
-          workingCase.defendants?.map((defendant) =>
-            (defendant.subpoenas ?? [])
-              .filter((subpoena) =>
-                isSuccessfulServiceStatus(subpoena.serviceStatus),
-              )
-              .map((subpoena) => (
-                <Box key={`${defendant.id}${subpoena.id}`} marginBottom={2}>
-                  <ServiceAnnouncement
-                    defendant={defendant}
-                    subpoena={subpoena}
-                  />
-                </Box>
-              )),
-          )}
+        {isDefenceUser(user) &&
+          workingCase.defendants?.reduce<React.ReactNode[]>((acc, defendant) => {
+            const announcements = (defendant.subpoenas ?? [])
+              .filter((subpoena) => isSuccessfulServiceStatus(subpoena.serviceStatus))
+              .map((subpoena) => (
+                <Box key={`${defendant.id}${subpoena.id}`} marginBottom={2}>
+                  <ServiceAnnouncement
+                    defendant={defendant}
+                    subpoena={subpoena}
+                  />
+                </Box>
+              ));
+            return [...acc, ...announcements];
+          }, [])}
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 2deeef3 and a0133c1.

📒 Files selected for processing (1)
  • apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx (6 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
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."
📓 Learnings (1)
apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx (1)
Learnt from: unakb
PR: island-is/island.is#14712
File: apps/judicial-system/web/src/routes/PublicProsecutor/Indictments/Overview/IndictmentOverview.tsx:0-0
Timestamp: 2024-10-08T15:39:04.351Z
Learning: The judicial system application uses a toaster notification system to handle errors globally.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx (2)

48-81: Consider performance and error handling improvements.

While the implementation is correct, consider these enhancements:

  1. Wrap with error boundary to gracefully handle formatting errors
  2. Memoize the formatted date to prevent unnecessary recalculations
  3. Use React.memo since this is a presentational component
+import React from 'react'
+
 interface ServiceAnnouncementProps {
   defendant: Defendant
   subpoena: Subpoena
 }

-const ServiceAnnouncement: FC<ServiceAnnouncementProps> = (props) => {
+const ServiceAnnouncement: FC<ServiceAnnouncementProps> = React.memo((props) => {
   const { defendant, subpoena } = props
   const { formatMessage } = useIntl()

+  const formattedDate = useMemo(
+    () => formatDate(subpoena.serviceDate, 'Pp'),
+    [subpoena.serviceDate]
+  )

   const getTitle = (defendantName?: string | null): string => {
     const successMessage = formatMessage(
       serviceAnnouncementStrings.serviceStatusSuccess,
     )

     return defendantName
       ? `${successMessage} - ${defendantName}`
       : successMessage
   }

   const getMessage = (
     servedBy?: string | null,
     serviceDate?: string | null,
   ): string => {
-    return [servedBy, formatDate(serviceDate, 'Pp')].filter(Boolean).join(', ')
+    return [servedBy, formattedDate].filter(Boolean).join(', ')
   }

   return (
     <AlertMessage
       type="success"
       title={getTitle(defendant.name)}
       message={getMessage(subpoena.servedBy, subpoena.serviceDate)}
     />
   )
-}
+})
+
+ServiceAnnouncement.displayName = 'ServiceAnnouncement'

172-186: Add type guard for null safety.

While the implementation works, we should add explicit type guards to handle potential null values more safely.

         {isDefenceUser(user) &&
-          workingCase.defendants?.map((defendant) =>
+          (workingCase.defendants ?? []).map((defendant) =>
             (defendant.subpoenas ?? [])
               .filter((subpoena) =>
                 isSuccessfulServiceStatus(subpoena.serviceStatus),
               )
               .map((subpoena) => (
                 <Box key={`${defendant.id}${subpoena.id}`} marginBottom={2}>
                   <ServiceAnnouncement
                     defendant={defendant}
                     subpoena={subpoena}
                   />
                 </Box>
               )),
           )}
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 9079a4c and ae44420.

📒 Files selected for processing (1)
  • apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx (5 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
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."
📓 Learnings (1)
apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx (2)
Learnt from: oddsson
PR: island-is/island.is#16731
File: apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx:172-186
Timestamp: 2024-11-08T12:52:18.973Z
Learning: In `IndictmentOverview.tsx`, since the defendants data does not change, using `useMemo` to memoize the filtering logic is unnecessary.
Learnt from: unakb
PR: island-is/island.is#14712
File: apps/judicial-system/web/src/routes/PublicProsecutor/Indictments/Overview/IndictmentOverview.tsx:0-0
Timestamp: 2024-10-08T15:39:04.351Z
Learning: The judicial system application uses a toaster notification system to handle errors globally.
🔇 Additional comments (1)
apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx (1)

Line range hint 5-41: LGTM! Import statements are well-organized.

The new imports are properly organized and all are utilized in the implementation.

@oddsson oddsson removed the automerge Merge this PR as soon as all checks pass label Nov 11, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx (2)

48-81: LGTM! Consider enhancing type safety for string formatting.

The ServiceAnnouncement component is well-implemented with proper null handling and string formatting.

Consider adding type safety for the formatMessage result:

-const successMessage = formatMessage(
-  serviceAnnouncementStrings.serviceStatusSuccess,
-)
+const successMessage = formatMessage(
+  serviceAnnouncementStrings.serviceStatusSuccess,
+) as string

172-186: Consider simplifying the nested map/filter for better readability.

While the code is functionally correct, the nested map/filter operations could be simplified for better readability.

Consider this more readable approach:

-workingCase.defendants?.map((defendant) =>
-  (defendant.subpoenas ?? [])
-    .filter((subpoena) =>
-      isSuccessfulServiceStatus(subpoena.serviceStatus),
-    )
-    .map((subpoena) => (
-      <Box key={`${defendant.id}${subpoena.id}`} marginBottom={2}>
-        <ServiceAnnouncement
-          defendant={defendant}
-          subpoena={subpoena}
-        />
-      </Box>
-    )),
+workingCase.defendants?.flatMap((defendant) => 
+  (defendant.subpoenas ?? [])
+    .filter(subpoena => isSuccessfulServiceStatus(subpoena.serviceStatus))
+    .map(subpoena => (
+      <Box key={`${defendant.id}${subpoena.id}`} marginBottom={2}>
+        <ServiceAnnouncement
+          defendant={defendant}
+          subpoena={subpoena}
+        />
+      </Box>
+    ))
+)
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between a054b4d and 6893968.

📒 Files selected for processing (2)
  • apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx (5 hunks)
  • libs/island-ui/core/src/lib/AlertMessage/AlertMessage.tsx (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • libs/island-ui/core/src/lib/AlertMessage/AlertMessage.tsx
🧰 Additional context used
📓 Path-based instructions (1)
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."
📓 Learnings (1)
apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx (3)
Learnt from: oddsson
PR: island-is/island.is#16731
File: apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx:172-186
Timestamp: 2024-11-10T17:05:28.408Z
Learning: In `IndictmentOverview.tsx`, since the defendants data does not change, using `useMemo` to memoize the filtering logic is unnecessary.
Learnt from: unakb
PR: island-is/island.is#14712
File: apps/judicial-system/web/src/routes/PublicProsecutor/Indictments/Overview/IndictmentOverview.tsx:0-0
Timestamp: 2024-11-10T17:05:23.796Z
Learning: The judicial system application uses a toaster notification system to handle errors globally.
Learnt from: unakb
PR: island-is/island.is#14712
File: apps/judicial-system/web/src/routes/PublicProsecutor/Indictments/Overview/IndictmentOverview.tsx:0-0
Timestamp: 2024-11-10T17:05:23.796Z
Learning: The judicial system application uses a toaster notification system to handle errors globally.
🔇 Additional comments (1)
apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx (1)

Line range hint 5-41: LGTM! Import statements are well-organized.

The new imports are properly organized and all are utilized within the component.

@gudjong gudjong added automerge Merge this PR as soon as all checks pass and removed automerge Merge this PR as soon as all checks pass labels Nov 12, 2024
@oddsson oddsson added automerge Merge this PR as soon as all checks pass high priority VIP-Kodiak PR labels Nov 13, 2024
@kodiakhq kodiakhq bot merged commit c40a213 into main Nov 13, 2024
139 of 140 checks passed
@kodiakhq kodiakhq bot deleted the j-s/service-announcement-defenders branch November 13, 2024 08:58
jonnigs pushed a commit that referenced this pull request Nov 26, 2024
* Checkpoint

* Refactor AlertMessage

* Format date

* Cleanup

* Cleanup

* Merge

* Add key

* Refactor

* Remove console.log

* Import React

* Add action prop bacj

* Add action prop bacj

* Add action prop bacj

* Fix import

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Guðjón Guðjónsson <gudjon@kolibri.is>
@coderabbitai coderabbitai bot mentioned this pull request Nov 26, 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 high priority VIP-Kodiak PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants