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(web): Pension Calculator - After 1 September 2025 preview #16392

Merged
merged 5 commits into from
Oct 15, 2024

Conversation

RunarVestmann
Copy link
Member

@RunarVestmann RunarVestmann commented Oct 14, 2024

Pension Calculator - After 1 September 2025 preview

What

  • Comparison between Disability results for current year and after 1 September 2025

Why

  • This was requested by the social insurance administration

Screenshots / Gifs

Before

Screen.Recording.2024-10-14.at.16.48.41.mov
Screen.Recording.2024-10-14.at.16.51.37.mov

After

If the user selects "Örorkulífeyrir" then he'll see the comparison screen

Screen.Recording.2024-10-14.at.16.49.47.mov

Other selectionthan "Örorkulífeyrir" are still looking the same visually

Screen.Recording.2024-10-14.at.16.53.38.mov

Demonstration if config is set to false (then we've got the same old look)

Screen.Recording.2024-10-14.at.17.03.16.mov

Responsiveness (before and after)

Screen.Recording.2024-10-14.at.17.13.10.mov

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

    • Enhanced styling for pension calculator results with new styles.
    • Integrated pension calculation data for the year 2025.
    • Added new translation strings for 2025 pension calculations and disclaimers.
    • Introduced a function to check if the 2025 preview is active.
  • Bug Fixes

    • Improved rendering logic for dynamic headings in the HighlightedItems component.
  • Documentation

    • Updated translation strings for better user understanding of results and disclaimers.

@RunarVestmann RunarVestmann added the automerge Merge this PR as soon as all checks pass label Oct 14, 2024
@RunarVestmann RunarVestmann requested a review from a team as a code owner October 14, 2024 16:48
Copy link
Contributor

coderabbitai bot commented Oct 14, 2024

Walkthrough

The changes in this pull request involve enhancements to the pension calculation functionality and styling in the PensionCalculatorResults component. Key updates include the addition of new styles in the CSS file, the introduction of new state variables and props in the TypeScript component, and the inclusion of new translation strings related to pension calculations for 2025. Additionally, a utility function for checking the 2025 preview status has been added.

Changes

File Change Summary
apps/web/screens/Organization/SocialInsuranceAdministration/PensionCalculatorResults.css.ts Added new styles: longLine, highlightedItemsContainer, and updated imports including themeUtils.
apps/web/screens/Organization/SocialInsuranceAdministration/PensionCalculatorResults.tsx Introduced new state variable calculation2025, updated HighlightedItems props, and modified rendering logic.
apps/web/screens/Organization/SocialInsuranceAdministration/translationStrings.ts Added new translation strings for 2025 pension calculations and disclaimers.
apps/web/screens/Organization/SocialInsuranceAdministration/utils.ts Added function is2025PreviewActive to check if the 2025 preview is active based on customPageData.

Possibly related PRs

Suggested labels

deploy-feature

Suggested reviewers

  • mannipje

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

🧹 Outside diff range and nitpick comments (5)
apps/web/screens/Organization/SocialInsuranceAdministration/PensionCalculatorResults.css.ts (2)

12-14: LGTM: New longLine style

The new longLine style is well-defined and consistent with the existing line style. For improved maintainability, consider using the lineWidth variable here as well.

Consider updating the style definition for consistency:

export const longLine = style({
-  borderLeft: `${lineWidth} solid ${theme.color.blue200}`,
+  borderLeft: `${lineWidth} solid ${theme.color.blue200}`,
})

16-28: LGTM: Responsive highlightedItemsContainer style

The new highlightedItemsContainer style effectively uses themeUtils.responsiveStyle for a responsive grid layout. This aligns well with NextJS best practices for responsive design.

Consider adding intermediate breakpoints (e.g., 'md') for a smoother responsive transition:

export const highlightedItemsContainer = style({
  display: 'grid',
  ...themeUtils.responsiveStyle({
    xs: {
      gridTemplateColumns: '1fr',
      gap: theme.spacing[4],
    },
+   md: {
+     gridTemplateColumns: '1fr auto',
+     gap: theme.spacing[5],
+   },
    lg: {
      gridTemplateColumns: '1fr auto 1fr',
      gap: theme.spacing[7],
    },
  }),
})
apps/web/screens/Organization/SocialInsuranceAdministration/utils.ts (2)

153-155: LGTM with a minor suggestion for clarity

The new is2025PreviewActive function is well-implemented and follows TypeScript best practices. It safely handles the optional customPageData parameter and ensures a boolean return type.

For improved clarity and to make the function's behavior more explicit, consider using a default value:

export const is2025PreviewActive = (customPageData?: CustomPage | null): boolean => {
  return Boolean(customPageData?.configJson?.show2025Preview ?? false)
}

This change explicitly returns false when customPageData is null or undefined, making the function's behavior more predictable.


Line range hint 1-155: Overall impact: Enhances pension calculation utilities

The addition of the is2025PreviewActive function aligns well with the PR objectives and enhances the utility module for pension calculations. It provides a clean way to toggle the 2025 preview feature, which is crucial for comparing current disability results with projected ones.

The implementation is consistent with the existing code style and doesn't introduce any breaking changes. This addition sets the groundwork for implementing the comparative analysis feature requested by the social insurance administration.

To fully realize the PR objectives, ensure that:

  1. The UI components utilize this new function to conditionally render the 2025 preview.
  2. Appropriate tests are added to verify the behavior of this new function.
  3. Documentation is updated to reflect this new feature and its usage.
apps/web/screens/Organization/SocialInsuranceAdministration/translationStrings.ts (1)

582-596: LGTM: Clear translations for "After September 1, 2025" feature added

The new translation strings after1stSeptember2025, after1stSeptember2025Calculate, and after1stSeptember2025Description provide clear and concise text for the new feature to calculate pension in the system after September 1, 2025. They effectively communicate the purpose of this new calculation option to the user.

For consistency, consider updating the after1stSeptember2025Description to match the wording used in the result2025Disclaimer. Suggest changing:

-    defaultMessage: 'Sjá útreikning örorkulífeyris í nýju kerfi',
+    defaultMessage: 'Sjá útreikning lífeyris í nýju kerfi eftir 1. september 2025',

This change would align the description more closely with the terminology used in the disclaimer and other parts of the interface.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 83b076f and 7039298.

📒 Files selected for processing (4)
  • apps/web/screens/Organization/SocialInsuranceAdministration/PensionCalculatorResults.css.ts (2 hunks)
  • apps/web/screens/Organization/SocialInsuranceAdministration/PensionCalculatorResults.tsx (17 hunks)
  • apps/web/screens/Organization/SocialInsuranceAdministration/translationStrings.ts (3 hunks)
  • apps/web/screens/Organization/SocialInsuranceAdministration/utils.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
apps/web/screens/Organization/SocialInsuranceAdministration/PensionCalculatorResults.css.ts (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/web/screens/Organization/SocialInsuranceAdministration/PensionCalculatorResults.tsx (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/web/screens/Organization/SocialInsuranceAdministration/translationStrings.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/web/screens/Organization/SocialInsuranceAdministration/utils.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."
🔇 Additional comments (4)
apps/web/screens/Organization/SocialInsuranceAdministration/PensionCalculatorResults.css.ts (2)

3-3: LGTM: Improved theme utility import

The addition of themeUtils to the import statement is a good practice. It centralizes theme-related utilities and supports the new responsive styling introduced in this file.


Line range hint 1-28: Summary: Enhanced styling for pension calculation comparison

The changes in this file effectively support the PR objective of introducing a feature for comparing pension calculations. The new styles (longLine and highlightedItemsContainer) and the improved use of theme utilities enhance the component's ability to display comparative results responsively.

These modifications align well with NextJS best practices, make efficient use of the theme system, and leverage TypeScript for type safety. The responsive design approach supports the goal of providing a clear comparison between current and future pension calculations.

apps/web/screens/Organization/SocialInsuranceAdministration/translationStrings.ts (2)

431-437: LGTM: Clear and informative disclaimer added

The new translation string result2025Disclaimer provides a clear and informative disclaimer for the 2025 pension calculator. It effectively communicates that the results are based on user-provided assumptions, are not binding, and shows a comparison between the current year and the new system after September 1, 2025.


453-462: LGTM: Clear labels for result details added

The new translation strings resultDetails2024Label and result2025DetailsLabel provide clear and concise labels for the breakdown of pension amounts. They effectively differentiate between the current system (2024) and the future system (after September 1, 2025), which is consistent with the calculator's purpose of comparing the two systems.

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 (7)
apps/web/screens/Organization/SocialInsuranceAdministration/PensionCalculatorResults.tsx (6)

78-79: LGTM: New props for flexible heading customization

The addition of topHeadingText and topHeadingLevel props enhances the flexibility of the HighlightedItems component. This is good for accommodating the 2025 preview feature.

Consider using a union type for topHeadingLevel to restrict it to valid heading levels:

topHeadingLevel?: 2 | 3 | 4 | 5 | 6;

This would prevent accidental use of invalid heading levels.


85-86: LGTM: Implementation of new heading customization props

The changes effectively implement the new topHeadingText and topHeadingLevel props, allowing for dynamic heading customization. This enhances the component's flexibility for different use cases, including the 2025 preview feature.

Consider extracting the heading level logic into a separate function to improve readability:

const getHeadingProps = (index: number, topHeadingLevel: number) => {
  const level = index === 0 ? topHeadingLevel : topHeadingLevel + 1;
  return {
    as: `h${level}` as TextProps['as'],
    variant: `h${level + 1}` as TextProps['variant'],
  };
};

// Usage
const { as: titleAs, variant: titleVariant } = getHeadingProps(index, topHeadingLevel);

This would make the component more maintainable and easier to understand.

Also applies to: 117-123, 128-130


Line range hint 274-285: LGTM: Setup for 2025 preview calculations

The changes effectively set up the necessary state and variables for handling the 2025 preview feature. The use of is2025PreviewActive ensures that the 2025 preview is only shown when appropriate.

Consider extracting the logic for highlighted2025ItemIsPresent into a separate function to improve readability:

const is2025PreviewHighlighted = (
  items: SocialInsurancePensionCalculationResponseItem[],
  customPageData: CustomPage | null | undefined,
  calculationInput: SocialInsurancePensionCalculationInput
) => {
  return (
    items.length > 0 &&
    is2025PreviewActive(customPageData) &&
    calculationInput.dateOfCalculations &&
    new Date(calculationInput.dateOfCalculations).getFullYear() >= 2024
  );
};

// Usage
const highlighted2025ItemIsPresent = is2025PreviewHighlighted(
  highlightedItems2025,
  customPageData,
  calculationInput
);

This would make the component more maintainable and easier to understand.

Also applies to: 297-306, 314-315


364-370: LGTM: Implementation of 2025 preview UI

The changes effectively implement the UI for the 2025 preview feature, including conditional rendering for the 2025 disclaimer and highlighted items, as well as a toggle for showing disability changes in 2025.

Consider extracting the 2025 preview UI logic into a separate component to reduce the complexity of the main component:

const Preview2025 = ({
  highlighted2025ItemIsPresent,
  calculationInput,
  highlightedItems2025,
  showDisabilityChangesIn2025,
  setShowDisabilityChangesIn2025,
  customPageData,
}) => {
  // ... implementation ...
};

// Usage in main component
{highlighted2025ItemIsPresent && (
  <Preview2025
    highlighted2025ItemIsPresent={highlighted2025ItemIsPresent}
    calculationInput={calculationInput}
    highlightedItems2025={highlightedItems2025}
    showDisabilityChangesIn2025={showDisabilityChangesIn2025}
    setShowDisabilityChangesIn2025={setShowDisabilityChangesIn2025}
    customPageData={customPageData}
  />
)}

This would improve the readability and maintainability of the main component.

Also applies to: 385-471


523-536: LGTM: New AccordionItem for 2025 calculation details

The addition of a new AccordionItem for 2025 calculation details is appropriate and consistent with the 2025 preview feature implementation.

Consider adding an aria-label to the AccordionItem for better accessibility:

<AccordionItem
  // ... other props ...
  aria-label={formatMessage(translationStrings.result2025DetailsAriaLabel)}
>
  // ... content ...
</AccordionItem>

Don't forget to add the corresponding translation string.


614-616: LGTM: Data fetching for 2025 preview feature

The implementation of conditional data fetching for the 2025 preview feature is appropriate. It ensures that the 2025 data is only retrieved when the preview is active, which is efficient.

Consider extracting the 2025 data fetching logic into a separate function to improve readability:

const fetch2025Data = async (apolloClient, calculationInput, customPageData) => {
  if (is2025PreviewActive(customPageData)) {
    return apolloClient.query<Query, QueryGetPensionCalculationArgs>({
      query: GET_PENSION_CALCULATION,
      variables: {
        input: {
          ...calculationInput,
          startYear: 2025,
          startMonth: 9,
        },
      },
    });
  }
  return {
    data: {
      getPensionCalculation: {
        groups: [],
        highlightedItems: [],
      },
    },
  };
};

// Usage in getProps
const [
  // ... other queries ...
  { data: { getPensionCalculation: getPensionCalculation2025 } },
] = await Promise.all([
  // ... other queries ...
  fetch2025Data(apolloClient, calculationInput, customPageData),
]);

This would make the getProps method more readable and easier to maintain.

Also applies to: 642-660

apps/web/screens/Organization/SocialInsuranceAdministration/translationStrings.ts (1)

Line range hint 431-601: Summary: New translation strings for 2025 pension system comparison feature.

The added translation strings effectively support the new feature for comparing disability results before and after September 1, 2025. They provide necessary labels, descriptions, and disclaimers for the updated pension calculator. The changes are well-integrated into the existing structure and follow the established patterns in the file.

Some suggestions for further improvement:

  1. Consider adding comments to group related translation strings together for better organization.
  2. Ensure that these new strings are used consistently across the application's components.
  3. Update the application's documentation to reflect these new translation additions.
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 7039298 and 8591842.

📒 Files selected for processing (2)
  • apps/web/screens/Organization/SocialInsuranceAdministration/PensionCalculatorResults.tsx (17 hunks)
  • apps/web/screens/Organization/SocialInsuranceAdministration/translationStrings.ts (3 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
apps/web/screens/Organization/SocialInsuranceAdministration/PensionCalculatorResults.tsx (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/web/screens/Organization/SocialInsuranceAdministration/translationStrings.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."
🔇 Additional comments (12)
apps/web/screens/Organization/SocialInsuranceAdministration/PensionCalculatorResults.tsx (5)

60-60: LGTM: New utility import for 2025 preview feature

The addition of is2025PreviewActive import is appropriate for the new 2025 preview feature.


264-264: LGTM: New prop for 2025 calculation results

The addition of the calculation2025 prop is appropriate for handling the 2025 preview calculations. It uses the same type as the existing calculation prop, maintaining consistency in the data structure.


491-495: LGTM: Conditional label for 2025 preview

The conditional label rendering for the 2025 preview in disability pensions is appropriate and consistent with the overall implementation of the 2025 preview feature.


566-584: LGTM: Consistent props for HighlightedItems in print view

The addition of new props to the HighlightedItems component in the print view ensures consistency with the screen view, including the 2025 preview features when applicable. This is a good practice for maintaining a coherent user experience across different views.


684-684: LGTM: Passing 2025 calculation data to component

The addition of the calculation2025 prop to the return object in getProps is consistent with the earlier changes and ensures that the 2025 calculation data is correctly passed to the component.

apps/web/screens/Organization/SocialInsuranceAdministration/translationStrings.ts (7)

431-437: LGTM: New translation string for 2025 results disclaimer.

The result2025Disclaimer translation string is well-formatted and provides clear information about the calculator's limitations and the comparison between current and post-September 2025 results.


443-447: LGTM: New translation string for 2025 results heading.

The highlightedResult2025ItemHeading translation string is correctly formatted and provides a clear heading for the total disposable income after tax in the 2025 results section.


458-462: LGTM: New translation string for 2024 results breakdown label.

The resultDetails2024Label translation string is correctly formatted and provides a clear label for the breakdown of amounts for the year 2024.


463-467: LGTM: New translation string for post-September 2025 results breakdown label.

The result2025DetailsLabel translation string is correctly formatted and provides a clear label for the breakdown of amounts for the period after September 1, 2025.


587-591: LGTM: New translation string for post-September 2025 label.

The after1stSeptember2025 translation string is correctly formatted and provides a clear label for the period after September 1, 2025.


592-596: LGTM: New translation string for calculate button in 2025 system.

The after1stSeptember2025Calculate translation string is correctly formatted and provides a clear label for the calculate button in the new pension system after September 1, 2025.


597-601: LGTM: New translation string for 2025 system description.

The after1stSeptember2025Description translation string is correctly formatted and provides a clear description for viewing the disability pension calculation in the new system after September 1, 2025.

Copy link

codecov bot commented Oct 14, 2024

Codecov Report

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

Project coverage is 36.73%. Comparing base (a4a05f8) to head (a7ade38).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...suranceAdministration/PensionCalculatorResults.tsx 0.00% 75 Missing ⚠️
...rganization/SocialInsuranceAdministration/utils.ts 0.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #16392      +/-   ##
==========================================
- Coverage   36.75%   36.73%   -0.02%     
==========================================
  Files        6808     6808              
  Lines      140993   141065      +72     
  Branches    40157    40213      +56     
==========================================
+ Hits        51817    51825       +8     
- Misses      89176    89240      +64     
Flag Coverage Δ
download-service 44.19% <ø> (ø)
web 1.82% <0.00%> (-0.01%) ⬇️

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

Files with missing lines Coverage Δ
...ocialInsuranceAdministration/translationStrings.ts 0.00% <ø> (ø)
...rganization/SocialInsuranceAdministration/utils.ts 0.00% <0.00%> (ø)
...suranceAdministration/PensionCalculatorResults.tsx 0.00% <0.00%> (ø)

... and 11 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 a4a05f8...a7ade38. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Oct 14, 2024

Datadog Report

All test runs 0031651 🔗

2 Total Test Services: 0 Failed, 2 Passed
➡️ Test Sessions change in coverage: 5 no change

Test Services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
download-service 0 0 0 1 0 23.45s 1 no change Link
web 0 0 0 84 0 30.95s 1 no change Link

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 (3)
apps/web/screens/Organization/SocialInsuranceAdministration/PensionCalculatorResults.tsx (3)

78-79: LGTM: Enhanced flexibility for HighlightedItems component

The addition of topHeadingText and topHeadingLevel props improves the component's flexibility, allowing it to handle both current and 2025 preview data. This change aligns well with the PR objectives.

Consider using a type union for topHeadingLevel instead of a more permissive type:

topHeadingLevel?: 2 | 3

This would provide stronger type checking and better reflect the intended usage.

Also applies to: 85-86, 117-123, 128-130


285-286: LGTM: Implemented 2025 preview logic

The addition of the showDisabilityChangesIn2025 state variable and the conditional logic for highlighted2025ItemIsPresent effectively implement the 2025 preview feature. These changes align well with the PR objectives.

Consider extracting the complex condition for highlighted2025ItemIsPresent into a separate function for improved readability:

const isHighlighted2025ItemPresent = () => {
  return (
    highlightedItems2025.length > 0 &&
    is2025PreviewActive(customPageData) &&
    calculationInput.dateOfCalculations &&
    new Date(calculationInput.dateOfCalculations).getFullYear() >= 2024
  );
};

Then use it as:

const highlighted2025ItemIsPresent = isHighlighted2025ItemPresent();

Also applies to: 297-306, 314-316


382-469: LGTM: Implemented UI for 2025 preview feature

The changes to the rendering logic effectively implement the UI for the 2025 preview feature. The conditional rendering and new UI elements provide appropriate control and visibility of the 2025 data, aligning well with the PR objectives.

Consider extracting the repeated condition calculationInput.typeOfBasePension === SocialInsurancePensionCalculationBasePensionType.Disability into a constant for improved readability:

const isDisabilityPension = calculationInput.typeOfBasePension === SocialInsurancePensionCalculationBasePensionType.Disability;

Then use this constant in the conditional rendering logic.

Also applies to: 484-534

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 8591842 and a7ade38.

📒 Files selected for processing (1)
  • apps/web/screens/Organization/SocialInsuranceAdministration/PensionCalculatorResults.tsx (17 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
apps/web/screens/Organization/SocialInsuranceAdministration/PensionCalculatorResults.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."
🔇 Additional comments (4)
apps/web/screens/Organization/SocialInsuranceAdministration/PensionCalculatorResults.tsx (4)

33-33: LGTM: New imports support 2025 preview functionality

The addition of SocialInsurancePensionCalculationBasePensionType and is2025PreviewActive imports are appropriate for implementing the new 2025 preview feature. These changes align well with the PR objectives.

Also applies to: 60-60


264-264: LGTM: Added 2025 calculation prop

The addition of the calculation2025 prop to the PensionCalculatorResultsProps interface is appropriate for implementing the 2025 preview feature. This change is consistent with the existing structure and aligns with the PR objectives.


Line range hint 612-658: LGTM: Efficient data fetching for 2025 preview

The changes to the getProps method effectively implement conditional fetching of 2025 preview data. The use of is2025PreviewActive ensures that this feature can be easily toggled, and the data is only fetched when necessary. This approach is efficient and aligns well with the PR objectives.


682-682: LGTM: Added 2025 calculation to return value

The addition of calculation2025 to the return object of getProps is appropriate and consistent with how the current calculation data is handled. This change ensures that the 2025 preview data is correctly passed to the component.

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

Successfully merging this pull request may close these issues.

2 participants