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(regulations): Updated date flow #15587

Merged
merged 4 commits into from
Aug 7, 2024
Merged

feat(regulations): Updated date flow #15587

merged 4 commits into from
Aug 7, 2024

Conversation

thordurhhh
Copy link
Member

@thordurhhh thordurhhh commented Aug 6, 2024

What

  • Updated regulation date flow
  • Update package - new text editor version.

Why

Change of design ✨

Screenshots / Gifs

Attach Screenshots / Gifs to help reviewers understand the scope of the pull request

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • New Features

    • Introduced a new Checkbox and DatePicker in the EditMeta component for fast track application and publish date selection.
    • Enhanced date selection functionality in the ImpactDate component, allowing users to choose a custom date with improved error handling.
  • Bug Fixes

    • Adjusted the OverviewItem component to accurately reflect the context of the ideal publish date as part of the metadata.
  • Refactor

    • Streamlined the EditSignature component by removing the DatePicker and Checkbox, simplifying the user interface.
  • Chores

    • Updated the version of the regulations-tools package to incorporate potential improvements.

Copy link
Contributor

coderabbitai bot commented Aug 6, 2024

Walkthrough

The recent updates to the codebase enhance the functionality and user experience of several components within the admin regulations portal. Key changes include the introduction of new UI elements such as checkboxes and date pickers for managing metadata, alongside layout adjustments for improved responsiveness. Some components were streamlined by removing less critical features, resulting in a more focused user interaction and simplified state management.

Changes

Files Change Summary
libs/portals/admin/regulations-admin/src/components/EditMeta.tsx Added Checkbox for fast track option and DatePicker for publish date selection. Enhanced layout with defined column widths and updated state management.
libs/portals/admin/regulations-admin/src/components/EditReviewOverview.tsx Changed step prop of OverviewItem from "signature" to "meta" to reflect contextual updates in the UI.
libs/portals/admin/regulations-admin/src/components/EditSignature.tsx Removed DatePicker and Checkbox, simplifying the component's functionality and reducing complexity.
libs/portals/admin/regulations-admin/src/components/impacts/ImpactDate.tsx Introduced functionality for custom date selection with new state variables and error handling. Added conditional rendering for Checkbox and DatePicker.
libs/portals/admin/regulations-admin/src/lib/messages.ts Added new message specificDateApply to enhance localization and improve user communication regarding date changes.
package.json Updated @island.is/regulations-tools package version from 0.9.0 to 0.9.1, potentially including bug fixes or new features.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Aug 6, 2024

Codecov Report

Attention: Patch coverage is 0% with 23 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@390aa85). Learn more about missing BASE report.

Files Patch % Lines
...ations-admin/src/components/impacts/ImpactDate.tsx 0.00% 16 Missing ⚠️
...dmin/regulations-admin/src/components/EditMeta.tsx 0.00% 7 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #15587   +/-   ##
=======================================
  Coverage        ?   36.90%           
=======================================
  Files           ?     6558           
  Lines           ?   134458           
  Branches        ?    38576           
=======================================
  Hits            ?    49621           
  Misses          ?    84837           
  Partials        ?        0           
Flag Coverage Δ
air-discount-scheme-backend 54.06% <ø> (?)
api 3.44% <ø> (?)
api-catalogue-services 77.85% <ø> (?)
api-domains-education 33.71% <ø> (?)
application-types 7.26% <ø> (?)
financial-aid-backend 56.34% <ø> (?)
judicial-system-api 18.15% <ø> (?)
judicial-system-backend 55.97% <ø> (?)
judicial-system-scheduler 58.15% <ø> (?)
judicial-system-types 50.35% <ø> (?)
nest-config 77.67% <ø> (?)
nest-feature-flags 51.52% <ø> (?)
portals-admin-regulations-admin 2.03% <0.00%> (?)
portals-core 16.29% <ø> (?)
services-auth-admin-api 51.08% <ø> (?)
services-auth-delegation-api 61.56% <ø> (?)
services-auth-ids-api 54.62% <ø> (?)
services-auth-personal-representative 48.31% <ø> (?)
services-auth-personal-representative-public 44.17% <ø> (?)
services-auth-public-api 51.04% <ø> (?)
services-documents 60.96% <ø> (?)
shared-components 27.87% <ø> (?)
shared-utils 29.87% <ø> (?)
web 1.89% <ø> (?)

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

Files Coverage Δ
...ations-admin/src/components/EditReviewOverview.tsx 0.00% <ø> (ø)
...regulations-admin/src/components/EditSignature.tsx 0.00% <ø> (ø)
...ortals/admin/regulations-admin/src/lib/messages.ts 0.00% <ø> (ø)
...dmin/regulations-admin/src/components/EditMeta.tsx 0.00% <0.00%> (ø)
...ations-admin/src/components/impacts/ImpactDate.tsx 0.00% <0.00%> (ø)

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 390aa85...e25d00e. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Aug 6, 2024

Datadog Report

All test runs fc67ed5 🔗

101 Total Test Services: 1 Failed, 98 Passed
❄️ 1 with New Flaky
🔻 Test Sessions change in coverage: 3 decreased, 2 increased, 193 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
message-queue 1 0 0 6 0 32.48s 1 decreased (-0.9%) Link
services-auth-delegation-api 0 0 2 254 0 2m 23.52s 1 no change Link
air-discount-scheme-backend 0 0 0 81 0 31.65s N/A Link
air-discount-scheme-web 0 0 0 2 0 7.74s N/A Link
api 0 0 0 4 0 2.69s N/A Link
api-catalogue-services 0 0 0 23 0 10.9s N/A Link
api-domains-air-discount-scheme 0 0 0 6 0 17.1s N/A Link
api-domains-assets 0 0 0 3 0 10.92s N/A Link
api-domains-auth-admin 0 0 0 18 0 11.57s N/A Link
api-domains-communications 0 0 0 5 0 33.72s N/A Link

❌ Failed Tests (1)

  • QueueService updates queue attributes when queue config changes - libs/message-queue/src/lib/nest/queue.service.spec.ts - Details

    Expand for error
     Request aborted
    

🔻 Code Coverage Decreases vs Default Branch (3)

  • message-queue - jest 68.16% (-0.9%) - Details
  • services-university-gateway - jest 44.69% (-0.02%) - Details
  • portals-admin-regulations-admin - jest 2.44% (-0.01%) - Details

@thordurhhh thordurhhh added deploy-feature Deploys features to dev and removed deploy-feature Deploys features to dev labels Aug 7, 2024
@thordurhhh thordurhhh added the automerge Merge this PR as soon as all checks pass label Aug 7, 2024
@thordurhhh thordurhhh marked this pull request as ready for review August 7, 2024 09:58
@thordurhhh thordurhhh requested review from a team as code owners August 7, 2024 09:58
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 9020fbf and ddecdc5.

Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
Files selected for processing (5)
  • libs/portals/admin/regulations-admin/src/components/EditMeta.tsx (4 hunks)
  • libs/portals/admin/regulations-admin/src/components/EditReviewOverview.tsx (1 hunks)
  • libs/portals/admin/regulations-admin/src/components/EditSignature.tsx (3 hunks)
  • libs/portals/admin/regulations-admin/src/components/impacts/ImpactDate.tsx (2 hunks)
  • package.json (1 hunks)
Files skipped from review due to trivial changes (1)
  • package.json
Additional context used
Path-based instructions (4)
libs/portals/admin/regulations-admin/src/components/impacts/ImpactDate.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/portals/admin/regulations-admin/src/components/EditMeta.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/portals/admin/regulations-admin/src/components/EditSignature.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/portals/admin/regulations-admin/src/components/EditReviewOverview.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 not posted (16)
libs/portals/admin/regulations-admin/src/components/impacts/ImpactDate.tsx (6)

20-22: State initialization looks good.

The state variables hasCustomDate, selectedDate, and errorMessage are correctly initialized.


31-33: State update for errorMessage looks good.

The useEffect hook correctly updates the errorMessage state based on impact.date.


39-45: Checkbox component integration looks good.

The Checkbox component is correctly integrated to manage the hasCustomDate state.


47-74: Conditional rendering of DatePicker looks good.

The DatePicker component and associated button are correctly conditionally rendered based on hasCustomDate.


1-6: Ensure all imports are necessary.

The imports from @island.is/island-ui/core and other libraries should be verified for necessity. Unused imports can lead to unnecessary bloat.

Verification successful

All imports are necessary.

The imported components Box, Button, DatePicker, and Checkbox from @island.is/island-ui/core are used within the ImpactDate.tsx file.

  • Box is used multiple times.
  • Button is used.
  • DatePicker is used.
  • Checkbox is used.

No unnecessary imports were found.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify if the imported components are used within the file.

# Test: Search for the usage of imported components. Expect: All imported components should be used.
rg --type tsx -A 5 $'import { Box, Button, DatePicker, Checkbox } from \'@island.is/island-ui/core\''

Length of output: 275


Script:

#!/bin/bash
# Description: Verify if the imported components are used within the file.

# Test: Search for the usage of imported components. Expect: All imported components should be used.
rg --type tsx -A 5 'import \{ Box, Button, DatePicker, Checkbox \} from \'@island.is/island-ui/core\''

Length of output: 93


Script:

#!/bin/bash
# Description: Verify if the imported components are used within the file.

# Test: Search for the usage of imported components. Expect: All imported components should be used.
rg --type tsx -A 5 "import \\{ Box, Button, DatePicker, Checkbox \\} from '@island.is/island-ui/core'"

Length of output: 136


Script:

#!/bin/bash
# Description: Verify if the imported components are used within the file.

# Define the tsx file type and search for the usage of imported components.
rg --type-add 'tsx:*.tsx' -t tsx -A 5 "import \\{ Box, Button, DatePicker, Checkbox \\} from '@island.is/island-ui/core'"

Length of output: 898


Script:

#!/bin/bash
# Description: Verify if the imported components are used within the file.

# Define the tsx file type and search for the usage of each imported component.
components=("Box" "Button" "DatePicker" "Checkbox")
for component in "${components[@]}"; do
  rg --type-add 'tsx:*.tsx' -t tsx "$component" libs/portals/admin/regulations-admin/src/components/impacts/ImpactDate.tsx
done

Length of output: 1163


25-29: Ensure correct state updates in useEffect.

The useEffect hook updates selectedDate based on hasCustomDate, date.value, and minDate. Verify that these dependencies are correctly handled.

Verification successful

Let's correct the regex error and re-run the script to verify the dependencies of the useEffect hook.


Let's simplify the regex pattern to avoid the unclosed counted repetition error and re-run the script to verify the dependencies of the useEffect hook.


Let's correct the regex pattern and specify the correct file type to re-run the script for verifying the dependencies of the useEffect hook.


Ensure correct state updates in useEffect.

The dependencies hasCustomDate, date.value, and minDate are correctly handled within the useEffect hook in the ImpactDate.tsx component.

  • hasCustomDate is used in multiple places within the component.
  • date.value is referenced correctly.
  • minDate is also used appropriately.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify if the dependencies of the useEffect hook are correctly handled.

# Test: Search for the usage of `hasCustomDate`, `date.value`, and `minDate`. Expect: All dependencies should be correctly handled.
rg --type tsx -A 5 $'useEffect(() => {'

Length of output: 138


Script:

#!/bin/bash
# Description: Verify if the dependencies of the useEffect hook are correctly handled.

# Test: Search for the usage of `useEffect` and include 5 lines of context to check the dependencies.
rg --type tsx -A 5 'useEffect\(\(\) => {'

Length of output: 147


Script:

#!/bin/bash
# Description: Verify if the dependencies of the useEffect hook are correctly handled.

# Test: Search for the usage of `useEffect` and include 5 lines of context to check the dependencies.
rg --type tsx -A 5 'useEffect\(\(\) => {'

# Additionally, search for the usage of `hasCustomDate`, `date.value`, and `minDate` to ensure they are correctly handled.
rg --type tsx 'hasCustomDate'
rg --type tsx 'date\.value'
rg --type tsx 'minDate'

Length of output: 315


Script:

#!/bin/bash
# Description: Verify if the dependencies of the useEffect hook are correctly handled.

# Test: Search for the usage of `useEffect` and include 5 lines of context to check the dependencies.
rg --type ts -A 5 'useEffect\(\(\) => {'

# Additionally, search for the usage of `hasCustomDate`, `date.value`, and `minDate` to ensure they are correctly handled.
rg --type ts 'hasCustomDate'
rg --type ts 'date\.value'
rg --type ts 'minDate'

Length of output: 21351

libs/portals/admin/regulations-admin/src/components/EditMeta.tsx (5)

Line range hint 20-48: State management and layout adjustments look good.

The state management using updateState and the layout adjustments for responsiveness are correctly implemented.


53-73: DatePicker component integration looks good.

The DatePicker component is correctly integrated to handle the selection of the ideal publish date.


76-85: Checkbox component integration looks good.

The Checkbox component is correctly integrated to handle the fast track option.


Line range hint 90-135: Layout adjustments for effective date and law chapters select look good.

The layout adjustments for the effective date and law chapters select are correctly implemented and improve the user experience.


Line range hint 4-15: Ensure all imports are necessary.

The imports from @island.is/island-ui/core and other libraries should be verified for necessity. Unused imports can lead to unnecessary bloat.

Verification successful

All imports are necessary.

The imported components Checkbox, Column, Columns, DatePicker, and Input from @island.is/island-ui/core are all used within the EditMeta.tsx file.

  • Checkbox is used on line 1.
  • Column and Columns are used multiple times in the file.
  • DatePicker is used on lines 1 and 2.
  • Input is used on lines 1 and 2.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify if the imported components are used within the file.

# Test: Search for the usage of imported components. Expect: All imported components should be used.
rg --type tsx -A 5 $'import { Box, Button, Checkbox, Column, Columns, DatePicker, Input } from \'@island.is/island-ui/core\''

Length of output: 323


Script:

#!/bin/bash
# Description: Verify if the imported components are used within the file.

# Test: Search for the usage of each imported component individually. Expect: All imported components should be used.
components=("Checkbox" "Column" "Columns" "DatePicker" "Input")
for component in "${components[@]}"; do
  rg --type tsx "$component" libs/portals/admin/regulations-admin/src/components/EditMeta.tsx
done

Length of output: 841


Script:

#!/bin/bash
# Description: Verify if the imported components are used within the file.

# Test: Search for the usage of each imported component individually. Expect: All imported components should be used.
components=("Checkbox" "Column" "Columns" "DatePicker" "Input")
for component in "${components[@]}"; do
  rg --glob "*.tsx" "$component" libs/portals/admin/regulations-admin/src/components/EditMeta.tsx
done

Length of output: 1502

libs/portals/admin/regulations-admin/src/components/EditSignature.tsx (3)

Line range hint 21-40: State management and useEffect hooks look good.

The state management and useEffect hooks are correctly updated to reflect the removal of the DatePicker and Checkbox components.


Line range hint 41-135: Rendering logic looks good.

The rendering logic is correctly updated to reflect the removal of the DatePicker and Checkbox components and handles the updated state and user interactions.


Line range hint 1-20: Ensure all imports are necessary.

The imports from @island.is/island-ui/core and other libraries should be verified for necessity. Unused imports can lead to unnecessary bloat.

libs/portals/admin/regulations-admin/src/components/EditReviewOverview.tsx (2)

Line range hint 35-45:
LGTM!

The OverviewItem component is well-implemented and does not have any issues.


156-159: LGTM! But verify the impact of the step prop change.

The code changes are approved.

However, ensure that the change in the step prop from "signature" to "meta" does not affect the functionality or rendering of the component.

Verification successful

The change in the step prop from "signature" to "meta" does not negatively impact the functionality or rendering of the component.

  • The step="meta" value is used consistently across multiple OverviewItem components within the same file.
  • The step="signature" value is used in a different context and does not conflict with the change.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of the `step` prop change in the `OverviewItem` component.

# Test: Search for the `step` prop usage. Expect: Only occurrences of the new value.
rg --type tsx -A 5 $'step="meta"'

Length of output: 62


Script:

#!/bin/bash
# Description: Verify the impact of the `step` prop change in the `OverviewItem` component.

# Test: Search for the old and new `step` prop values in `.tsx` files to ensure no unintended consequences.
rg --glob '*.tsx' -A 5 $'step="signature"'
rg --glob '*.tsx' -A 5 $'step="meta"'

Length of output: 2829

Copy link
Member

@disaerna disaerna left a comment

Choose a reason for hiding this comment

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

💯

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ddecdc5 and a8db68c.

Files selected for processing (2)
  • libs/portals/admin/regulations-admin/src/components/impacts/ImpactDate.tsx (2 hunks)
  • libs/portals/admin/regulations-admin/src/lib/messages.ts (1 hunks)
Additional context used
Path-based instructions (2)
libs/portals/admin/regulations-admin/src/components/impacts/ImpactDate.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/portals/admin/regulations-admin/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 (5)
libs/portals/admin/regulations-admin/src/components/impacts/ImpactDate.tsx (4)

20-22: State variables initialization looks good.

The state variables hasCustomDate, selectedDate, and errorMessage are initialized correctly.


39-74: Rendering logic looks good.

The rendering logic for the Checkbox and DatePicker is implemented correctly and adheres to best practices.


25-33: Ensure useEffect dependencies are correct.

The useEffect hooks should only include necessary dependencies to avoid unnecessary re-renders.


1-6: Ensure all imported modules are necessary.

Verify that all imported modules are used in the code. Remove any unused imports to keep the code clean.

libs/portals/admin/regulations-admin/src/lib/messages.ts (1)

389-392: New message definition looks good.

The new message definition specificDateApply is implemented correctly and adheres to best practices.

@kodiakhq kodiakhq bot merged commit 3727be5 into main Aug 7, 2024
249 checks passed
@kodiakhq kodiakhq bot deleted the regulations/date-flow branch August 7, 2024 11:28
oskarjs pushed a commit that referenced this pull request Aug 20, 2024
* Updated regulation date flow

* Translate
jonnigs pushed a commit that referenced this pull request Sep 2, 2024
* Updated regulation date flow

* Translate
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.

4 participants