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

chore(inao): Make inao applications share code #16473

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

jonnigs
Copy link
Member

@jonnigs jonnigs commented Oct 18, 2024

What

Make applications in inao folder share code

Why

Minimize code duplication, making the templates less bloated and more readable

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 Logo component for dynamic rendering based on provided parameters.
    • Enhanced CemeteryOverview and PartyOverview components with additional props for improved data presentation.
  • Bug Fixes

    • Corrected component imports across multiple files to streamline functionality and maintainability.
  • Refactor

    • Updated import paths to a shared module for various constants and components, improving code organization.
    • Consolidated imports in several components to enhance clarity and reduce redundancy.
  • Removed

    • Deleted several components and constants that were no longer necessary, simplifying the codebase.

@jonnigs jonnigs changed the title chore/(inao): Make inao applications share code chore(inao): Make inao applications share code Oct 18, 2024
Copy link

codecov bot commented Oct 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 36.69%. Comparing base (d1c22d8) to head (55ffd7a).
Report is 65 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #16473      +/-   ##
==========================================
- Coverage   36.75%   36.69%   -0.07%     
==========================================
  Files        6835     6850      +15     
  Lines      141330   142532    +1202     
  Branches    40238    40697     +459     
==========================================
+ Hits        51949    52297     +348     
- Misses      89381    90235     +854     
Flag Coverage Δ
air-discount-scheme-web 0.00% <ø> (ø)
api 3.37% <ø> (ø)
api-domains-auth-admin 48.48% <ø> (ø)
api-domains-mortgage-certificate 34.98% <ø> (+0.02%) ⬆️
application-api-files 56.76% <ø> (-0.11%) ⬇️
application-core 71.56% <ø> (+0.32%) ⬆️
application-system-api 40.98% <ø> (-0.39%) ⬇️
application-template-api-modules 27.42% <ø> (-0.43%) ⬇️
application-templates-accident-notification 29.27% <ø> (ø)
application-templates-car-recycling 3.12% <ø> (ø)
application-templates-criminal-record 26.34% <ø> (ø)
application-templates-driving-license 18.34% <ø> (+0.01%) ⬆️
application-templates-estate 12.31% <ø> (-0.01%) ⬇️
application-templates-example-payment 25.14% <ø> (ø)
application-templates-financial-aid 15.49% <ø> (-0.02%) ⬇️
application-templates-general-petition 23.44% <ø> (ø)
application-templates-inheritance-report 6.49% <ø> (ø)
application-templates-marriage-conditions 15.17% <ø> (ø)
application-templates-mortgage-certificate 43.56% <ø> (-0.26%) ⬇️
application-templates-parental-leave 29.96% <ø> (ø)
application-types 6.63% <ø> (ø)
application-ui-components 1.28% <ø> (ø)
application-ui-shell 21.36% <ø> (-0.01%) ⬇️
auth-react 22.81% <ø> (+0.03%) ⬆️
clients-charge-fjs-v2 24.11% <ø> (ø)
clients-syslumenn 49.49% <ø> (+0.04%) ⬆️
contentful-apps 5.44% <ø> (ø)
financial-aid-backend 56.25% <ø> (-0.12%) ⬇️
financial-aid-shared 18.94% <ø> (ø)
island-ui-core 28.44% <ø> (+0.04%) ⬆️
judicial-system-web 27.93% <ø> (+0.01%) ⬆️
portals-admin-regulations-admin 1.85% <ø> (ø)
portals-core 16.14% <ø> (-0.02%) ⬇️
services-auth-admin-api 51.94% <ø> (+<0.01%) ⬆️
services-auth-delegation-api 57.37% <ø> (+0.01%) ⬆️
services-auth-ids-api 51.41% <ø> (-0.01%) ⬇️
services-auth-personal-representative 45.15% <ø> (+<0.01%) ⬆️
services-auth-personal-representative-public 41.28% <ø> (+0.01%) ⬆️
services-auth-public-api 48.91% <ø> (+<0.01%) ⬆️
services-endorsements-api 53.59% <ø> (-0.07%) ⬇️
services-user-notification 46.93% <ø> (-0.07%) ⬇️
services-user-profile 61.84% <ø> (-0.19%) ⬇️
shared-components 27.70% <ø> (+0.05%) ⬆️
shared-form-fields 31.57% <ø> (-0.02%) ⬇️
web 1.80% <ø> (-0.02%) ⬇️

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

see 134 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 18b2931...55ffd7a. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Oct 18, 2024

Datadog Report

All test runs dd635b2 🔗

46 Total Test Services: 0 Failed, 44 Passed
🔻 Test Sessions change in coverage: 2 decreased, 168 no change

Test Services
This report shows up to 10 services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
air-discount-scheme-web 0 0 0 2 0 9.32s 1 no change Link
api 0 0 0 4 0 3.4s 1 no change Link
api-domains-auth-admin 0 0 0 18 0 14.91s 1 no change Link
api-domains-mortgage-certificate 0 0 0 5 0 18.93s 1 no change Link
application-api-files 0 0 0 12 0 7.1s 1 no change Link
application-core 0 0 0 92 0 18.89s 1 decreased (-0.1%) Link
application-system-api 0 0 0 120 2 3m 49.01s 1 no change Link
application-template-api-modules 0 0 0 123 0 2m 26.11s 1 no change Link
application-templates-accident-notification 0 0 0 148 0 20.29s 1 no change Link
application-templates-criminal-record 0 0 0 2 0 12.64s 1 no change Link

🔻 Code Coverage Decreases vs Default Branch (2)

  • application-core - jest 79.47% (-0.1%) - Details
  • services-endorsements-api - jest 51.65% (-0.04%) - Details

@jonnigs jonnigs marked this pull request as ready for review October 21, 2024 14:13
@jonnigs jonnigs requested a review from a team as a code owner October 21, 2024 14:13
Copy link
Contributor

coderabbitai bot commented Oct 21, 2024

Walkthrough

The pull request implements a series of changes across multiple components in the financial statement application. The primary focus is on updating import paths for constants and components to a shared directory, enhancing modularity and organization. Several components have had their props expanded to accommodate additional data, and some components have been removed entirely. Error handling and core logic remain largely unchanged, ensuring that the functionality of the application is preserved while streamlining the codebase.

Changes

File Path Change Summary
libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryCaretaker/index.tsx Updated import path for constants from relative to shared utilities. Refined error handling in setBeforeSubmitCallback.
libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryEquities/index.tsx Consolidated imports from local utils to a shared path. Maintained core logic and error handling.
libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOperation/CemeteryExpenses.tsx Updated import for INPUTCHANGEINTERVAL to a shared path. No changes to core functionality.
libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOperation/CemeteryIncome.tsx Updated import for INPUTCHANGEINTERVAL to a shared path. Preserved core logic and error handling.
libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOperation/index.tsx Updated imports for Total and OPERATINGCOST to a shared path. Corrected variable name from CemetryIncome to CemeteryIncome.
libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOverview/AboutOverview.tsx Component removed.
libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOverview/BottomBar.tsx Component removed.
libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOverview/CapitalNumbersOverview.tsx Component removed.
libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOverview/FileValueLine.tsx Component removed.
libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOverview/ValueLine.tsx Component removed.
libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOverview/index.tsx Updated imports and enhanced props for child components for better data handling.
libs/application/templates/inao/financial-statement-cemetery/src/fields/DelegationCheck/index.tsx Updated import path for VALIDATOR to a shared path.
libs/application/templates/inao/financial-statement-cemetery/src/fields/KeyNumbers/index.tsx Component removed.
libs/application/templates/inao/financial-statement-cemetery/src/fields/KeyNumbersCapital/index.tsx Updated imports for Total, CAPITALNUMBERS, and INPUTCHANGEINTERVAL to a shared path.
libs/application/templates/inao/financial-statement-cemetery/src/fields/OperatingYear/index.tsx Updated import for ABOUTIDS to a shared path.
libs/application/templates/inao/financial-statement-cemetery/src/fields/PowerOfAttorney/index.tsx Updated import for ABOUTIDS to a shared path.
libs/application/templates/inao/financial-statement-cemetery/src/fields/Success/index.tsx Renamed PropTypes to Props and removed unused imports.
libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/cemeteryFinancialStatementSection/index.ts Updated import for currencyStringToNumber to a shared path.
libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/cemeteryKeyNumbersSection/capitalNumberSubSection.ts Updated import for CAPITALNUMBERS to a shared path.
libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/clientInfoSection/index.ts Updated import for ABOUTIDS to a shared path.
libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/index.ts Updated import for Logo and changed logo property to a function call.
libs/application/templates/inao/financial-statement-cemetery/src/forms/done/index.ts Added logo property to form configuration as a function returning the Logo component.
libs/application/templates/inao/financial-statement-cemetery/src/forms/prerequisites/index.ts Updated import for Logo and changed logo property to a function call.
libs/application/templates/inao/financial-statement-cemetery/src/hooks/useTotals.ts Updated import for getTotal to a shared path.
libs/application/templates/inao/financial-statement-cemetery/src/utils/constants.ts Removed several constants related to the cemetery caretaker functionality.
libs/application/templates/inao/financial-statement-cemetery/src/utils/helpers.ts Removed several functions and updated imports for shared utility functions.
libs/application/templates/inao/financial-statement-individual-election/src/components/Logo.tsx Component removed.
libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionEquities/index.tsx Updated imports to a shared module.
libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionInfoFields/ElectionSelect.tsx Updated import for ABOUTIDS to a shared path.
libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionStatement/index.tsx Updated imports and modified props for BottomBar.
libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/index.ts Updated import for Logo and changed logo property to a function call.
libs/application/templates/inao/financial-statement-political-party/src/components/Logo.tsx Component removed.
libs/application/templates/inao/financial-statement-political-party/src/fields/DelegationCheck/DelegationCheck.tsx Updated import path for VALIDATOR to a shared path.
libs/application/templates/inao/financial-statement-political-party/src/fields/ElectionStatement/ElectionStatement.tsx Updated imports and modified props for BottomBar.
libs/application/templates/inao/financial-statement-political-party/src/fields/PartyOverview/PartyOverview.tsx Updated imports and enhanced props for child components.
libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/index.ts Updated import for Logo and changed logo property to a function call.
libs/application/templates/inao/financial-statement-political-party/src/hooks/useTotals.tsx Updated import path for getTotal to a shared module.
libs/application/templates/inao/financial-statement-political-party/src/lib/dataSchema.ts Updated import for checkIfNegative to a shared path.
libs/application/templates/inao/financial-statement-political-party/src/lib/utils/constants.ts Removed several constants related to political party functionality.
libs/application/templates/inao/financial-statement-political-party/src/lib/utils/dataSchema.ts Updated import for checkIfNegative to a shared path.
libs/application/templates/inao/financial-statement-political-party/src/types/types.ts Removed FSIUSERTYPE enum.

Possibly related PRs

Suggested labels

automerge

Suggested reviewers

  • snaerseljan
  • fjandakornid

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

🧹 Outside diff range and nitpick comments (51)
libs/application/templates/inao/financial-statement-cemetery/src/forms/done/index.ts (1)

10-10: LGTM: Logo property addition with minor suggestion

The addition of the logo property as a function returning the Logo component is a good approach. It allows for dynamic rendering and proper prop passing, which aligns with the PR objectives and coding guidelines.

For improved type safety, consider explicitly typing the function return:

logo: (): JSX.Element => Logo({ serviceProvider: m.serviceProvider, inao: m.inao }),

This change would make the return type explicit and potentially catch any type-related issues early.

libs/application/templates/inao/financial-statement-political-party/src/forms/done/index.ts (2)

10-10: LGTM: Enhanced form structure with shared Logo component.

The addition of the logo property to the buildForm function call improves the reusability of the form structure and aligns with the PR objectives. The use of a function to return the Logo component with dynamic props is a good practice.

Consider adding explicit return type annotation to the logo function for improved type safety:

logo: (): JSX.Element => Logo({ serviceProvider: m.serviceProvider, inao: m.inao }),

Line range hint 1-14: Overall: Excellent implementation of shared components.

The changes in this file successfully implement the PR objective of sharing code between applications. The introduction of the shared Logo component and the use of absolute imports enhance maintainability and reduce code duplication. The modifications adhere to TypeScript usage and follow good coding practices.

As you continue to refactor other parts of the application, consider creating a shared module for common form structures and utilities. This could further reduce duplication and improve consistency across different forms in the application.

libs/application/templates/inao/financial-statement-individual-election/src/forms/done/index.ts (1)

10-10: Good addition of dynamic logo rendering.

The logo property effectively incorporates the shared Logo component, enhancing the form with visual branding. This change promotes consistency across forms and supports localization through the use of the m object for messages.

For improved type safety, consider explicitly typing the function return:

logo: (): JSX.Element => Logo({ serviceProvider: m.serviceProvider, inao: m.inao }),

This change would make the expected return type clear and catch any potential type mismatches early.

libs/application/templates/inao/financial-statement-cemetery/src/forms/prerequisites/index.ts (1)

12-12: Great improvement in logo rendering flexibility!

The modification to the logo property enhances the component's reusability by allowing dynamic prop passing. This change aligns well with TypeScript best practices for prop definitions.

For improved readability, consider destructuring the m object in the logo function:

logo: () => {
  const { serviceProvider, inao } = m;
  return Logo({ serviceProvider, inao });
},
libs/application/templates/inao/financial-statement-individual-election/src/hooks/useTotals.ts (2)

3-3: Approved: Import path updated to use shared utility.

The change to import getTotal from a shared utility aligns with the PR objective of enabling code sharing among applications. This reduces code duplication and improves maintainability.

Consider using an absolute import path instead of a relative one to improve readability and make the code more resilient to file moves. For example:

import { getTotal } from '@island.is/application/templates/inao/shared/utils/helpers'

This assumes that you have configured path aliases in your TypeScript configuration.


Line range hint 5-22: Approved: Hook implementation is reusable and follows best practices.

The useTotals hook is well-implemented:

  • It's reusable across different NextJS apps.
  • TypeScript is used effectively for type definitions.
  • The implementation allows for effective tree-shaking.
  • React hooks are used correctly for performance optimization.

Consider adding a type for the key parameter to improve type safety:

const useTotals = (key: keyof FormValues): [() => void, number] => {
  // ... existing implementation
}

This assumes you have a FormValues type defined for your form structure.

libs/application/templates/inao/financial-statement-political-party/src/forms/prerequsites/index.ts (1)

12-12: Good enhancement for dynamic logo content.

The modification to use a function call for the logo property, incorporating parameters from the messages module, improves flexibility and reusability. This aligns well with our TypeScript usage guidelines for defining props.

However, to ensure effective tree-shaking:

Consider importing only the necessary messages instead of the entire module. This can be achieved by using named imports:

import { serviceProvider, inao } from '../../lib/messages'

Then update the logo property:

logo: () => Logo({ serviceProvider, inao }),

This change would help optimize bundling and improve tree-shaking capabilities.

libs/application/templates/inao/financial-statement-individual-election/src/forms/prerequisites/index.ts (1)

12-12: Great improvement in Logo rendering!

The change to use a function for the logo property allows for dynamic customization of the Logo component. This approach enhances flexibility and supports internationalization.

For improved type safety, consider explicitly typing the logo property:

logo: (): React.ReactNode => Logo({ serviceProvider: m.serviceProvider, inao: m.inao }),

This explicit typing ensures that the return type of the function matches the expected type for the logo property in the buildForm function.

libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/equitiesAndLiabilitiesSubsection/index.ts (1)

3-3: Approved: Import path updated to use shared utilities.

The change aligns with the PR objective of sharing code between applications, which can improve maintainability and reduce duplication. However, consider using a more robust import method to avoid deep relative paths.

Consider using module aliases or a base import path to simplify imports from shared directories. For example:

import { EQUITIESANDLIABILITIESIDS } from '@shared/utils/constants'

This approach would require configuring module aliases in your TypeScript and build settings but could make imports more maintainable in the long run.

libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/individualKeyNumbersSection/equitiesAndLiabilitiesSubSection.ts (1)

7-7: Consider moving messages to shared directory.

For consistency with the recent changes and to further reduce code duplication, consider moving the messages import to the shared directory as well.

You could update the import like this:

-import { m } from '../../../lib/utils/messages'
+import { m } from '../../../../../shared/utils/messages'

This change would align with the PR's goal of enabling code sharing among applications.

libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/financialStatementSection/index.ts (1)

Line range hint 1-32: Confirm TypeScript usage and component reusability.

The file demonstrates good practices in terms of TypeScript usage and component reusability:

  1. It utilizes TypeScript for defining the financialStatementSection function.
  2. It imports utility functions from a core library (@island.is/application/core), promoting code reuse.

However, to further improve type safety and documentation:

Consider adding explicit type annotations for the answers and _externalData parameters in the condition function. This would enhance code readability and type checking. For example:

condition: (answers: YourAnswersType, _externalData: YourExternalDataType) => {
  // ... existing code ...
}

Replace YourAnswersType and YourExternalDataType with the appropriate types from your project.

libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/index.ts (1)

15-15: Approved: Dynamic logo rendering enhances flexibility.

The change to render the Logo component dynamically with specific parameters enhances the flexibility and reusability of the component. This aligns well with the project's coding guidelines, particularly in terms of TypeScript usage and effective tree-shaking.

For improved type safety, consider explicitly typing the function:

logo: (): JSX.Element => Logo({ serviceProvider: m.serviceProvider, inao: m.inao }),

This change would make the return type explicit and potentially catch any type-related issues early in development.

libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/cemeteryFinancialStatementSection/index.ts (2)

Line range hint 1-38: Good use of TypeScript, consider exposing prop types.

The use of TypeScript for type annotations (e.g., FinancialStatementCemetery) enhances type safety. The builder pattern with buildSection and buildFileUploadField provides a declarative and potentially reusable component structure.

To further improve type safety and documentation, consider exposing the prop types for the built components. This could be done by:

  1. Defining interfaces for the props of each component.
  2. Using these interfaces with the builder functions.
  3. Exporting the interfaces for use in other parts of the application.

Example:

interface CemeteryFinancialStatementSectionProps {
  // Define props here
}

export const cemeteryFinancialStatementSection = buildSection<CemeteryFinancialStatementSectionProps>({
  // ... existing configuration
})

export type { CemeteryFinancialStatementSectionProps }

This approach would improve documentation and enable better type checking when these components are used elsewhere.


Line range hint 13-28: Consider adding documentation for the complex condition logic.

The condition function for the file upload field uses multiple financial criteria to determine visibility. While the logic appears correct, its complexity might benefit from additional documentation.

Consider adding a comment explaining the business logic behind this condition. For example:

condition: (answers) => {
  // This condition determines if the file upload is required based on the following criteria:
  // 1. Total income is below the caretaker limit
  // 2. Fixed assets total is zero
  // 3. Long-term debt is zero
  // If all these conditions are met, the file upload is not required (returns false).
  const applicationAnswers = answers as FinancialStatementCemetery
  // ... rest of the existing code
},

This documentation would help future maintainers understand the purpose and requirements of this condition more easily.

libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/overviewSection/index.ts (1)

Line range hint 1-52: Code adheres to guidelines, with room for minor improvement.

The code follows the coding guidelines for files in the 'libs' directory:

  • It uses TypeScript for defining props and exporting types.
  • The component structure suggests reusability across different NextJS apps.

To further improve tree-shaking, consider using named imports instead of namespace imports for the messages.

Replace the namespace import of messages with named imports:

-import { m } from '../../../lib/utils/messages'
+import { statement, overviewSectionTitle, overviewReview, overviewDescription, electionStatement } from '../../../lib/utils/messages'

Then update the usage of these messages throughout the file.

libs/application/templates/inao/financial-statement-political-party/src/fields/PartyOperatingIncome/PartyExpenses.tsx (1)

Line range hint 1-67: Enhance component reusability and optimize imports

While the component adheres to TypeScript usage guidelines, there are opportunities to improve its reusability and optimize for tree-shaking:

  1. Consider generalizing the component to handle different types of expenses, not just party expenses. This could make it more reusable across different financial statement applications.

  2. To improve tree-shaking, replace the default import of debounce with a named import:

import { debounce } from 'lodash-es'
  1. Consider extracting the onInputChange logic into a custom hook to enhance reusability across similar components.

These changes would align better with the coding guidelines for reusability and effective tree-shaking practices.

libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/index.tsx (2)

13-14: Approve changes to import statements

The updated import statements for Total and OPERATINGCOST from shared directories align well with the PR objective of enabling code sharing among applications. This change improves maintainability and reduces code duplication.

Consider grouping related imports together for better readability. You could move the new imports next to other shared imports or group them by type (components, constants, etc.).


Line range hint 16-66: Enhance type safety with TypeScript

The component structure is clean and follows React best practices. To further improve the code quality and maintainability, consider adding TypeScript to this component.

Here are some suggestions to enhance type safety:

  1. Define prop types for the Total component if not already done in its implementation.
  2. Add return type annotations for the useTotals hook.
  3. Consider converting the file to TypeScript (.tsx) if it's not already, and add type annotations for the component props and state.

Example:

import React from 'react';
import { TotalProps } from '../../../../shared/components/Total';

type UseTotalsHook = [() => number, number];

const IndividualElectionOperatingIncome: React.FC = () => {
  // ... existing code ...
}

This will help catch potential errors early and improve the overall robustness of the code.

libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionInfoFields/IncomeLimitFields.tsx (1)

Line range hint 1-85: Code adheres to library guidelines with room for minor optimization.

The component follows the coding guidelines for library files:

  1. It uses TypeScript for defining props (IncomeLimitProps).
  2. The component logic is self-contained, potentially allowing reuse across different NextJS apps.
  3. The component is properly exported for use in other parts of the application.

To further optimize for tree-shaking, consider using named exports for constants from the shared utils:

import { FSIUSERTYPE } from '../../../../shared/utils/enums'
import { ABOUTIDS, GREATER, LESS } from '../../../../shared/utils/constants'

This change would allow for more granular imports and potentially better tree-shaking in consuming applications.

libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/clientInfoSection/index.ts (1)

9-9: Approved: Import path updated to use shared utilities.

The change to import ABOUTIDS from a shared utilities folder aligns with the PR objective of enabling code sharing among applications. This approach can reduce code duplication and improve maintainability.

Consider using path aliases (e.g., @shared/utils/constants) to make imports more readable and easier to maintain, especially for deeply nested paths like this one.

libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/clientInfoSection/index.ts (1)

10-10: Approved: Import path updated to use shared constants.

The change to import ABOUTIDS from a shared utilities directory aligns with the PR objective of enabling code sharing among applications. This can improve maintainability and reduce code duplication.

Consider using path aliases to simplify the import statement and make it more resilient to file structure changes. For example:

import { ABOUTIDS } from '@shared/utils/constants'

This would require configuring path aliases in your TypeScript and build settings, but it could make imports more manageable across the project.

libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/Expenses.tsx (2)

7-7: Approve changes with a minor suggestion.

The centralization of constants by importing from shared directories is a good practice that aligns with the PR objectives. It promotes code reuse and maintainability.

Consider grouping related imports together. You could move the import of INDIVIDUALOPERATIONIDS next to the import of INPUTCHANGEINTERVAL since they are both constants.

Also applies to: 9-9


Incorrect INDIVIDUALOPERATIONIDS used in onChange for advertisements InputController.

The onChange handler for the advertisements InputController is incorrectly using INDIVIDUALOPERATIONIDS.electionOffice. It should use INDIVIDUALOPERATIONIDS.advertisements to ensure the correct field is updated.

  • File: libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/Expenses.tsx
🔗 Analysis chain

Line range hint 61-61: Approve the bug fix with a suggestion for further verification.

The change correctly updates the onChange handler to use INDIVIDUALOPERATIONIDS.advertisements instead of INDIVIDUALOPERATIONIDS.electionOffice. This fixes a bug where the wrong field was being updated.

To ensure consistency, please verify that all other InputController components in this file are using the correct INDIVIDUALOPERATIONIDS. Run the following script to check:

This script will display all InputController components with their onChange and id props. Ensure that the INDIVIDUALOPERATIONIDS used in both props match for each component.


Further verification needed for INDIVIDUALOPERATIONIDS usage in InputController components.

Please run the following scripts to ensure all InputController components use matching INDIVIDUALOPERATIONIDS for both id and onChange props:

This will help identify all instances of InputController and verify that the id and onChange props use the correct and matching INDIVIDUALOPERATIONIDS.


Additional verification required for INDIVIDUALOPERATIONIDS usage in InputController components.

Please run the following scripts to list all id and onChange props used in InputController components:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify correct usage of INDIVIDUALOPERATIONIDS in InputController components

# Test: Check if all InputController components use the correct INDIVIDUALOPERATIONIDS
rg -U 'InputController.*?onChange=\{\(\) => onInputChange\((INDIVIDUALOPERATIONIDS\.[a-zA-Z]+)\)\}.*?id=\{(INDIVIDUALOPERATIONIDS\.[a-zA-Z]+)\}' libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/Expenses.tsx

Length of output: 276


Script:

#!/bin/bash
# Description: List all InputController components and their id and onChange props

# Extract lines with InputController components
rg -U 'InputController' libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/Expenses.tsx

# Extract id props
rg -U 'InputController.*id=\{INDIVIDUALOPERATIONIDS\.[a-zA-Z]+\}' libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/Expenses.tsx

# Extract onChange props
rg -U 'InputController.*onChange=\{\(\) => onInputChange\(INDIVIDUALOPERATIONIDS\.[a-zA-Z]+\)\}' libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/Expenses.tsx

Length of output: 744


Script:

#!/bin/bash
# Description: List all id and onChange props for InputController components

# Extract all id props in InputController components
rg -U 'InputController[^>]*id=\{([^}]+)\}' libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/Expenses.tsx

# Extract all onChange props in InputController components
rg -U 'InputController[^>]*onChange=\{\(\) => onInputChange\(([^)]+)\)\}' libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/Expenses.tsx

Length of output: 2174

libs/application/templates/inao/financial-statement-political-party/src/fields/ElectionStatement/ElectionStatement.tsx (1)

10-13: LGTM! Consider moving ELECTIONLIMIT to shared constants.

The changes to import statements improve code sharing and reusability across different NextJS apps, which aligns with the PR objectives. Great job on centralizing common utilities and components!

Consider moving the ELECTIONLIMIT constant to the shared constants file if it's used across multiple applications. This would further reduce code duplication and improve maintainability.

libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionStatement/index.tsx (1)

81-82: Improved localization support in BottomBar props

The changes to the BottomBar component props enhance localization support and align with the PR objectives:

  1. Replacing sendText with send and goBack props using predefined messages improves consistency and maintainability.
  2. This modification supports better code sharing across applications.

Suggestion for clarity:
Consider using more descriptive prop names, such as sendButtonText and goBackButtonText, to make their purpose immediately clear to other developers.

libs/application/templates/inao/financial-statement-cemetery/src/fields/PowerOfAttorney/index.tsx (2)

Line range hint 1-93: Adherence to coding guidelines and reusability considerations

The component adheres to the coding guidelines for libs/**/* files in terms of TypeScript usage for defining props and exporting types. However, consider the following points to enhance reusability and align better with the guidelines:

  1. The component's specific nature (power of attorney for cemeteries) might limit its reusability across different NextJS apps. Consider generalizing the component or extracting common logic into a more generic component.

  2. To improve tree-shaking and bundling practices, ensure that all imports are using named exports instead of default exports where possible.

  3. Consider extracting the GraphQL query into a separate file to enhance modularity and potential reusability of the query across components.


Line range hint 23-93: Suggestions for code improvements

While the overall structure of the component is sound, consider the following improvements:

  1. Update the useEffect dependency array to include currentActor and getIdentity to prevent unnecessary re-renders and potential stale closures:
useEffect(() => {
  if (currentActor) {
    getIdentity({
      variables: {
        input: {
          nationalId: currentActor,
        },
      },
    })
  }
}, [currentActor, getIdentity])
  1. Enhance error handling by providing more specific error messages. Consider creating a separate component or utility function for displaying different types of errors.

  2. To improve reusability, consider extracting the logic that depends on the application prop into a custom hook. This would allow the component to be more easily used in different contexts.

  3. Use a constant for the format string "######-####" to improve maintainability.

  4. Consider using the useMemo hook for the currentActor calculation to optimize performance, especially if the application object is large or frequently updated.

libs/application/templates/inao/financial-statement-political-party/src/fields/PowerOfAttorneyFields/PowerOfAttorneyFields.tsx (3)

Line range hint 39-47: Approved: Improved robustness in useEffect hook

The modification to the useEffect hook enhances the component's robustness by checking for the existence of currentActor before making the API call. This change prevents unnecessary API calls and potential errors.

Consider using optional chaining for a more concise syntax:

useEffect(() => {
  currentActor?.nationalId &&
    getIdentity({
      variables: {
        input: {
          nationalId: currentActor.nationalId,
        },
      },
    });
}, [currentActor, getIdentity]);

This suggestion also includes getIdentity in the dependency array to avoid potential issues with stale closures.


Line range hint 86-88: Approved: Enhanced error handling for identity query

The addition of error handling for the identity query improves the user experience by providing feedback when the fetch operation fails. The use of a localized error message is commendable.

Consider adding a retry mechanism or providing more specific error information if available. For example:

{queryError && (
  <InputError 
    errorMessage={
      queryError.networkError
        ? formatMessage(m.networkError)
        : formatMessage(m.errorFetchingName)
    }
  />
)}

This would provide more specific feedback to the user based on the type of error encountered.


Line range hint 1-90: Adherence to coding guidelines confirmed

The component adheres well to the coding guidelines:

  1. It's designed for reusability across different NextJS apps.
  2. TypeScript is used effectively for prop definitions (FieldBaseProps).
  3. The modular structure supports effective tree-shaking and bundling.

To further optimize for tree-shaking, consider using named exports for all imports from '@island.is/island-ui/core'. For example:

import { Box, GridColumn, GridContainer, GridRow, InputError } from '@island.is/island-ui/core'

This change would allow bundlers to more easily eliminate unused components during the tree-shaking process.

libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOperation/index.tsx (2)

Line range hint 72-76: Effective use of shared components and constants

The changes in the CemeteryOperation component demonstrate good practices:

  1. Utilizing the shared Total component enhances reusability and consistency across the application.
  2. Using CEMETERYOPERATIONIDS constants for naming improves maintainability and reduces the risk of typos.

These modifications align well with the coding guidelines for reusability and TypeScript usage.

For consistency, consider using a constant for the name prop in the Total component for expenses, similar to how it's done for income:

<Total
-  name={CEMETERYOPERATIONIDS.totalExpense}
+  name={CEMETERYOPERATIONIDS.totalExpenses}
  total={totalExpense}
  label={formatMessage(m.totalExpenses)}
/>

This assumes that CEMETERYOPERATIONIDS.totalExpenses exists. If not, consider adding it to maintain consistency in naming conventions.


Line range hint 89-95: Improved clarity in operating cost calculation

The changes in the operating cost calculation section demonstrate good practices:

  1. Using the shared Total component enhances consistency and reusability.
  2. Employing the OPERATINGCOST constant for naming improves maintainability.
  3. The calculation logic is clear and concise.

These modifications align well with the coding guidelines for reusability and TypeScript usage.

To further improve code clarity, consider extracting the calculation into a separate constant:

+ const operatingCost = totalIncome - totalExpense;

<Total
  name={OPERATINGCOST.total}
  label={formatMessage(m.operatingCost)}
  title={formatMessage(m.operatingCostBefore)}
-  total={totalIncome - totalExpense}
+  total={operatingCost}
/>

This small change would make the calculation more explicit and easier to understand at a glance.

libs/application/templates/inao/financial-statement-cemetery/src/fields/KeyNumbersCapital/index.tsx (1)

15-19: Approve changes with a suggestion for improvement

The updated import paths align with the PR objective of enabling code sharing among applications. This change enhances code reusability and reduces duplication.

However, consider using absolute imports instead of relative paths to improve maintainability. This can be achieved by configuring path aliases in your TypeScript configuration.

Example of using path aliases:

import { Total } from '@shared/components/Total'
import { CAPITALNUMBERS, INPUTCHANGEINTERVAL } from '@shared/utils/constants'

This approach would require updating your tsconfig.json to include path aliases.

libs/application/templates/inao/financial-statement-individual-election/src/fields/KeyNumbersCapital/index.tsx (1)

14-19: LGTM! Consider using absolute imports for better maintainability.

The changes to import statements align well with the PR objective of enabling code sharing among applications. This promotes reusability across different NextJS apps.

Consider using absolute imports instead of relative paths to improve maintainability. This can be achieved by configuring path aliases in your TypeScript and webpack configurations. For example:

import { CAPITALNUMBERS, INPUTCHANGEINTERVAL } from '@shared/utils/constants'
import { Total } from '@shared/components/Total'

This approach would make the imports more resilient to file relocations and easier to understand at a glance.

libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/Income.tsx (3)

9-9: Approve import change and suggest improvement

The change to import INPUTCHANGEINTERVAL from a shared utility folder aligns with the PR objective of code sharing between applications. This can improve maintainability by centralizing constants.

Consider using a barrel file (index.ts) in the shared utils folder to simplify imports further. This would allow importing multiple constants in a single line:

import { INPUTCHANGEINTERVAL, OTHER_CONSTANT } from '../../../../shared/utils'

Line range hint 1-101: Approve reusability with suggestion for improvement

The component demonstrates good reusability by utilizing shared UI components, utilities, and hooks. However, the use of specific IDs (INDIVIDUALOPERATIONIDS) might limit its applicability in different contexts.

Consider parameterizing the INDIVIDUALOPERATIONIDS to make the component more generic and reusable across different election types or financial statement contexts. This could be achieved by passing these IDs as props or through a context provider.


Line range hint 25-29: Suggest performance optimization

The use of debounce for input changes is a good practice. However, clearing errors on each input change might lead to unnecessary re-renders.

Consider optimizing the error clearing logic:

  1. Clear errors only when the input becomes valid, not on every change.
  2. Use React.useCallback to memoize the onInputChange function to prevent unnecessary re-creation on each render.

Example:

const onInputChange = React.useCallback(
  debounce((fieldId: string) => {
    getSum()
    if (isValid(fieldId)) {
      clearErrors(fieldId)
    }
  }, INPUTCHANGEINTERVAL),
  [getSum, clearErrors]
)
libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionInfoFields/index.tsx (2)

Line range hint 25-37: LGTM: Effective use of useMemo for performance optimization.

The introduction of useMemo hooks for financialStatementsInaoElections and options is a good practice for performance optimization. The use of TypeScript for type definitions is also commendable.

Consider adding a null check before mapping over financialStatementsInaoElections to improve robustness:

const options: Options = useMemo(
  () =>
    financialStatementsInaoElections?.map((option) => ({
      label: option.name,
      value: option.electionId
    })) ?? [],
  [financialStatementsInaoElections],
)

This change ensures that options is always an array, even if financialStatementsInaoElections is undefined.


Line range hint 41-61: LGTM: Improved election data handling and state management.

The updates to the getElectionInfo function enhance the handling of election data and maintain state consistency. The use of setValue from useFormContext is a good practice for form management.

Consider adding error handling for cases where currentElectionInfo is undefined:

const getElectionInfo = useCallback(
  (selectedElectionId: string | undefined) => {
    const currentElectionInfo = financialStatementsInaoElections?.find(
      (elections: FinancialStatementsInaoElection) =>
        elections.electionId === selectedElectionId,
    )
    if (!currentElectionInfo) {
      console.error(`No election info found for ID: ${selectedElectionId}`);
      return;
    }
    // ... rest of the function
  },
  [financialStatementsInaoElections, setValue],
)

This addition will help with debugging and prevent potential issues if an invalid election ID is provided.

libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryCareteker/index.tsx (2)

19-19: Improved code sharing with centralized constants.

The updated import path for constants aligns well with the PR objective of enabling code sharing among applications in the "inao" folder. This change enhances reusability and maintainability by centralizing shared utilities.

Consider documenting this new shared utilities structure in the project's README or architecture documentation to ensure consistent usage across the team.


Line range hint 1-158: Well-structured and type-safe component implementation.

The CemeteryCaretaker component is well-implemented with proper use of React hooks, form handling, and error management. The component's structure promotes reusability and maintainability. The use of TypeScript for props and exported types enhances type safety.

Consider extracting the error handling logic in setBeforeSubmitCallback into a separate utility function to improve readability and testability. For example:

const validateCaretakers = (values, application, currentActor) => {
  // ... error checking logic ...
  return { isValid, errorMessage };
};

// In the component
setBeforeSubmitCallback(async () => {
  const { isValid, errorMessage } = validateCaretakers(values, application, currentActor);
  if (!isValid) {
    setError(/* ... */);
  }
  return [isValid, errorMessage];
});
libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOperation/CemeteryIncome.tsx (1)

Line range hint 1-145: LGTM! Consider further optimization for tree-shaking.

The CemeteryIncome component adheres well to the coding guidelines:

  1. It uses TypeScript for prop definitions and type imports, enhancing type safety.
  2. The component structure allows for reusability across different cemetery financial statement applications.
  3. It imports specific utilities (like debounce) from lodash, which is good for tree-shaking.

To further optimize for tree-shaking, consider using the modular lodash import:

-import debounce from 'lodash/debounce'
+import debounce from 'lodash.debounce'

This change requires installing the lodash.debounce package, which is a smaller, standalone module.

libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOperation/CemeteryExpenses.tsx (2)

11-12: LGTM! Consider further centralization of constants.

The change to import INPUTCHANGEINTERVAL from a shared utils constants file aligns well with the PR objective of sharing code between applications. This should improve maintainability and reduce code duplication.

Consider moving CEMETERYOPERATIONIDS to the shared constants file as well if it's used across multiple components or applications. This would further centralize your constants and improve consistency.


Line range hint 1-165: LGTM! Consider named imports for better tree-shaking.

The component is well-structured, uses TypeScript for prop definitions, and seems reusable across different NextJS apps. The use of debounce for input changes is a good performance optimization.

For better tree-shaking, consider using named imports instead of default imports. For example, change:

import debounce from 'lodash/debounce'

to:

import { debounce } from 'lodash'

This can potentially reduce your bundle size if you're not using the entire lodash library elsewhere.

libs/application/templates/inao/financial-statement-political-party/src/fields/PartyOperatingIncome/PartyIncome.tsx (2)

Line range hint 14-22: Props type declaration improves TypeScript usage and potential for tree-shaking.

The change from a PropTypes interface to a Props type declaration is a good improvement. It aligns with our TypeScript usage guidelines and potentially enhances tree-shaking capabilities.

For consistency with other components, consider using the React.FC<Props> type for the component definition.


23-23: Function signature updated correctly, but consider adding explicit return type.

The function signature has been correctly updated to use the new Props type. However, for improved clarity and to catch potential errors, consider adding an explicit return type:

export const PartyIncome = ({ data, loading, errors, getSum }: Props): JSX.Element => {
libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionEquities/index.tsx (1)

24-24: Approved: Shared Total component enhances reusability.

The updated import path for the Total component from a shared directory increases its reusability across different parts of the application, aligning with the PR objectives and coding guidelines.

For consistency, consider using a named import instead of a default import:

import { Total } from '../../../../shared/components/Total'
libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryEquities/index.tsx (1)

Line range hint 1-285: Overall, changes align with PR objectives and coding guidelines.

The modifications to this file, primarily in import statements, successfully contribute to the PR's goal of enabling code sharing among applications. The component maintains its well-structured implementation while adhering to the coding guidelines for libs, including TypeScript usage and promoting reusability.

For future optimization, consider breaking down this large component into smaller, more focused components. This could potentially improve tree-shaking capabilities and make the code even more modular and reusable across different parts of the application.

libs/application/templates/inao/financial-statement-cemetery/src/utils/helpers.ts (1)

Line range hint 13-31: Correct the spelling of 'Cemetry' to 'Cemetery'

The term Cemetry in function names and variables is misspelled. The correct spelling is Cemetery. Please consider updating the following:

  • Function isCemetryUnderFinancialLimit to isCemeteryUnderFinancialLimit
  • Variable isCemetry to isCemetery
  • Any other occurrences of Cemetry in the code

Apply this diff to correct the misspellings:

-export const isCemetryUnderFinancialLimit = (
+export const isCemeteryUnderFinancialLimit = (

   answers: FormValue,
   externalData: ExternalData,
 ) => {
-  const isCemetry = userType === FSIUSERTYPE.CEMETRY
+  const isCemetery = userType === FSIUSERTYPE.CEMETERY

   const isUnderLimit = currencyStringToNumber(totalIncome) < careTakerLimit
   if (
-    isCemetry &&
+    isCemetery &&

     isUnderLimit &&
     fixedAssetsTotal === '0' &&
     longTermDebt === '0'
   ) {
     return true
   }
   return false
 }

Note: Ensure that FSIUSERTYPE.CEMETRY is also corrected to FSIUSERTYPE.CEMETERY if applicable. This may require updating the definition in the FSIUSERTYPE enum.

libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOverview/index.tsx (1)

Line range hint 1-396: Ensure effective tree-shaking and bundling practices

Since components are now imported from a shared directory, confirm that unused code is eliminated during the build process to optimize the application size. This will enhance performance across different NextJS apps that utilize these shared components.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 3936331 and 945268f.

📒 Files selected for processing (82)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryCareteker/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryEquities/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOperation/CemeteryExpenses.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOperation/CemeteryIncome.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOperation/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOverview/AboutOverview.tsx (0 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOverview/BottomBar.tsx (0 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOverview/CapitalNumbersOverview.tsx (0 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOverview/FileValueLine.tsx (0 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOverview/ValueLine.tsx (0 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOverview/index.tsx (5 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/DelegationCheck/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/KeyNumbers/index.tsx (0 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/KeyNumbersCapital/index.tsx (2 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/OperatingYear/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/PowerOfAttorney/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/Success/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/cemeteryFinancialStatementSection/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/cemeteryKeyNumbersSection/capitalNumberSubSection.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/clientInfoSection/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/forms/done/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/forms/prerequisites/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/hooks/useTotals.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/utils/constants.ts (0 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/utils/helpers.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/tsconfig.lib.json (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/components/Logo.tsx (0 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionEquities/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionInfoFields/ElectionSelect.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionInfoFields/IncomeLimitFields.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionInfoFields/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionStatement/index.tsx (2 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/Expenses.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/Income.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/Total.tsx (0 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/KeyNumbersCapital/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/Overview/AboutOverview.tsx (0 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/Overview/AssetDebtEquityOverview.tsx (0 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/Overview/BottomBar.tsx (0 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/Overview/CapitalNumbersOverview.tsx (0 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/Overview/FileValueLine.tsx (0 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/Overview/ValueLine.tsx (0 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/Overview/index.tsx (5 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/documentsSection/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/electionInfoSection/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/individualKeyNumbersSection/capitalNumbersSection.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/individualKeyNumbersSection/equitiesAndLiabilitiesSubSection.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/individualKeyNumbersSection/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/overviewSection/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/done/conclusionSection.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/done/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/prerequisites/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/hooks/useTotals.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/lib/financial-statement-individual-election.ts (0 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/lib/utils/constants.ts (0 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/lib/utils/dataSchema.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/types/types.ts (0 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/components/AboutOverview.tsx (0 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/components/AssetDebtEquityOverview.tsx (0 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/components/Logo.tsx (0 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/DelegationCheck/DelegationCheck.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/ElectionEquities/ElectionEquities.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/ElectionStatement/ElectionStatement.tsx (2 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/KeyNumbersCapital/KeyNumbersCapital.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/OperatingYear/OperatingYear.tsx (2 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/Overview/Overview.tsx (5 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/PartyOperatingIncome/PartyExpenses.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/PartyOperatingIncome/PartyIncome.tsx (5 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/PartyOperatingIncome/PartyOperatingIncome.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/PartyOverview/PartyOverview.tsx (5 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/PowerOfAttorneyFields/PowerOfAttorneyFields.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/clientInfoSection/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/capitalNumbersSubsection/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/equitiesAndLiabilitiesSubsection/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/financialStatementSection/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/overviewSection/overviewMultiField.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/forms/done/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/forms/prerequsites/index.ts (1 hunks)
⛔ Files not processed due to max files limit (15)
  • libs/application/templates/inao/financial-statement-political-party/src/hooks/useTotals.tsx
  • libs/application/templates/inao/financial-statement-political-party/src/lib/dataSchema.ts
  • libs/application/templates/inao/financial-statement-political-party/src/utils/constants.ts
  • libs/application/templates/inao/financial-statement-political-party/src/utils/helpers.ts
  • libs/application/templates/inao/shared/components/AboutOverview.tsx
  • libs/application/templates/inao/shared/components/AssetDebtEquityOverview.tsx
  • libs/application/templates/inao/shared/components/BottomBar.tsx
  • libs/application/templates/inao/shared/components/CapitalNumberOverview.tsx
  • libs/application/templates/inao/shared/components/FileValueLine.tsx
  • libs/application/templates/inao/shared/components/Logo.tsx
  • libs/application/templates/inao/shared/components/Total.tsx
  • libs/application/templates/inao/shared/components/ValueLine.tsx
  • libs/application/templates/inao/shared/utils/constants.ts
  • libs/application/templates/inao/shared/utils/enums.ts
  • libs/application/templates/inao/shared/utils/helpers.ts
💤 Files with no reviewable changes (21)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOverview/AboutOverview.tsx
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOverview/BottomBar.tsx
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOverview/CapitalNumbersOverview.tsx
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOverview/FileValueLine.tsx
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOverview/ValueLine.tsx
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/KeyNumbers/index.tsx
  • libs/application/templates/inao/financial-statement-cemetery/src/utils/constants.ts
  • libs/application/templates/inao/financial-statement-individual-election/src/components/Logo.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/Total.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/Overview/AboutOverview.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/Overview/AssetDebtEquityOverview.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/Overview/BottomBar.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/Overview/CapitalNumbersOverview.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/Overview/FileValueLine.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/Overview/ValueLine.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/lib/financial-statement-individual-election.ts
  • libs/application/templates/inao/financial-statement-individual-election/src/lib/utils/constants.ts
  • libs/application/templates/inao/financial-statement-individual-election/src/types/types.ts
  • libs/application/templates/inao/financial-statement-political-party/src/components/AboutOverview.tsx
  • libs/application/templates/inao/financial-statement-political-party/src/components/AssetDebtEquityOverview.tsx
  • libs/application/templates/inao/financial-statement-political-party/src/components/Logo.tsx
✅ Files skipped from review due to trivial changes (1)
  • libs/application/templates/inao/financial-statement-cemetery/src/hooks/useTotals.ts
🧰 Additional context used
📓 Path-based instructions (60)
libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryCareteker/index.tsx (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryEquities/index.tsx (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOperation/CemeteryExpenses.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/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOperation/CemeteryIncome.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/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOperation/index.tsx (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOverview/index.tsx (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-cemetery/src/fields/DelegationCheck/index.tsx (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-cemetery/src/fields/KeyNumbersCapital/index.tsx (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-cemetery/src/fields/OperatingYear/index.tsx (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-cemetery/src/fields/PowerOfAttorney/index.tsx (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-cemetery/src/fields/Success/index.tsx (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/cemeteryFinancialStatementSection/index.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/cemeteryKeyNumbersSection/capitalNumberSubSection.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/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/clientInfoSection/index.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/index.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-cemetery/src/forms/done/index.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-cemetery/src/forms/prerequisites/index.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-cemetery/src/utils/helpers.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/application/templates/inao/financial-statement-cemetery/tsconfig.lib.json (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/application/templates/inao/financial-statement-individual-election/src/fields/ElectionEquities/index.tsx (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionInfoFields/ElectionSelect.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/application/templates/inao/financial-statement-individual-election/src/fields/ElectionInfoFields/IncomeLimitFields.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/application/templates/inao/financial-statement-individual-election/src/fields/ElectionInfoFields/index.tsx (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionStatement/index.tsx (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/Expenses.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/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/Income.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/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/index.tsx (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-individual-election/src/fields/KeyNumbersCapital/index.tsx (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-individual-election/src/fields/Overview/index.tsx (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/documentsSection/index.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/electionInfoSection/index.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/index.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/individualKeyNumbersSection/capitalNumbersSection.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/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/individualKeyNumbersSection/equitiesAndLiabilitiesSubSection.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/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/individualKeyNumbersSection/index.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/overviewSection/index.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-individual-election/src/forms/done/conclusionSection.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/application/templates/inao/financial-statement-individual-election/src/forms/done/index.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-individual-election/src/forms/prerequisites/index.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-individual-election/src/hooks/useTotals.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/application/templates/inao/financial-statement-individual-election/src/lib/utils/dataSchema.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/application/templates/inao/financial-statement-political-party/src/fields/DelegationCheck/DelegationCheck.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/application/templates/inao/financial-statement-political-party/src/fields/ElectionEquities/ElectionEquities.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/application/templates/inao/financial-statement-political-party/src/fields/ElectionStatement/ElectionStatement.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/application/templates/inao/financial-statement-political-party/src/fields/KeyNumbersCapital/KeyNumbersCapital.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/application/templates/inao/financial-statement-political-party/src/fields/OperatingYear/OperatingYear.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/application/templates/inao/financial-statement-political-party/src/fields/Overview/Overview.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/application/templates/inao/financial-statement-political-party/src/fields/PartyOperatingIncome/PartyExpenses.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/application/templates/inao/financial-statement-political-party/src/fields/PartyOperatingIncome/PartyIncome.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/application/templates/inao/financial-statement-political-party/src/fields/PartyOperatingIncome/PartyOperatingIncome.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/application/templates/inao/financial-statement-political-party/src/fields/PartyOverview/PartyOverview.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/application/templates/inao/financial-statement-political-party/src/fields/PowerOfAttorneyFields/PowerOfAttorneyFields.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/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/clientInfoSection/index.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/index.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/capitalNumbersSubsection/index.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/equitiesAndLiabilitiesSubsection/index.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/financialStatementSection/index.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/overviewSection/overviewMultiField.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/application/templates/inao/financial-statement-political-party/src/forms/done/index.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-political-party/src/forms/prerequsites/index.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
🔇 Additional comments (86)
libs/application/templates/inao/financial-statement-cemetery/src/forms/done/index.ts (2)

5-5: LGTM: Import from shared components

The new import statement for the Logo component from a shared directory aligns well with the PR objective of enabling code sharing among applications. This change promotes reusability and reduces code duplication.


Line range hint 1-14: Overall assessment: Changes align with PR objectives

The modifications in this file successfully contribute to the goal of enabling code sharing among applications in the "inao" folder. The introduction of the shared Logo component and its integration into the form configuration demonstrate improved reusability and reduced code duplication. These changes adhere to the coding guidelines for library files, including TypeScript usage and component reusability across NextJS apps.

libs/application/templates/inao/financial-statement-individual-election/src/forms/done/conclusionSection.ts (1)

14-14: Consider the implications of removing dynamic title logic

The simplification of the title property improves code readability and aligns with the broader restructuring efforts. However, this change removes the dynamic title selection based on user type, which may impact the application's ability to provide context-specific information to different user types.

Please confirm if this change is intentional and that a static title is appropriate for all user types. If different titles are still needed, consider refactoring to maintain this functionality while still benefiting from shared utilities.

To verify the impact of this change, you can run the following script:

This will help identify if similar patterns exist elsewhere in the codebase that might need consistent treatment.

✅ Verification successful

Change Verified: Static title implementation confirmed

The title property in conclusionSection.ts has been successfully simplified to a static value without any dynamic logic based on user type. No other dynamic title assignments were found in this file, ensuring that the change is isolated and does not impact functionality.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for other occurrences of user type-based title selection

# Search for similar patterns of user type-based title selection
rg -p "title.*(?:userType|FSIUSERTYPE)" --type ts

# Check for any remaining uses of getCurrentUserType function
rg -p "getCurrentUserType" --type ts

Length of output: 5319


Script:

#!/bin/bash
# Description: Verify if `title` in `conclusionSection.ts` still uses `getCurrentUserType`

rg -p "title.*getCurrentUserType" -- "libs/application/templates/inao/financial-statement-individual-election/src/forms/done/conclusionSection.ts"

Length of output: 146

libs/application/templates/inao/financial-statement-political-party/src/forms/done/index.ts (1)

4-4: LGTM: Shared component import.

The new import statement for the Logo component from a shared directory aligns well with the PR objective of sharing code between applications. Using an absolute import path enhances maintainability.

libs/application/templates/inao/financial-statement-individual-election/src/forms/done/index.ts (2)

4-4: Excellent use of shared components!

The import of Logo from the shared components library aligns well with the PR objective of enabling code sharing among applications. This change promotes reusability and helps reduce code duplication across different NextJS apps.


4-10: Adherence to coding guidelines for libs/**/* files

The changes in this file generally adhere to the coding guidelines:

  1. The Logo component demonstrates reusability across different NextJS apps.
  2. TypeScript is used for defining props in the Logo component usage.

However, to fully evaluate the effectiveness of tree-shaking and bundling practices:

Could you provide information about the Logo component's implementation and export method? This will help assess its impact on tree-shaking and bundling. You can use the following script to check the Logo component's implementation:

libs/application/templates/inao/financial-statement-cemetery/src/forms/prerequisites/index.ts (2)

3-3: Excellent update to centralize shared components!

The change in the import path for Logo aligns well with the PR objective of enabling code sharing among applications. This centralization enhances reusability across different NextJS apps and contributes to reducing code duplication.


1-14: Excellent adherence to coding guidelines for shared libraries!

The changes in this file demonstrate good practices for reusability and TypeScript usage, aligning well with the coding guidelines for libs/**/* files. The centralization of the Logo component and the use of TypeScript for prop definitions are particularly noteworthy.

To ensure effective tree-shaking, let's verify that the Logo component is exported correctly from its source file:

libs/application/templates/inao/financial-statement-political-party/src/forms/prerequsites/index.ts (2)

4-4: Excellent update to use shared component.

The change to import Logo from a shared component directory aligns well with the PR objective of enabling code sharing among applications. This modification contributes to reducing code duplication and enhances the potential for reuse across different NextJS apps, which is in line with our coding guidelines.


1-14: Overall, excellent progress towards code sharing objectives.

The changes in this file successfully contribute to the PR's goal of enabling code sharing among applications in the "inao" folder. By utilizing a shared Logo component and implementing dynamic content through message parameters, the code becomes more reusable and maintainable. These modifications align well with our coding guidelines for reusability, TypeScript usage, and component structure in NextJS apps.

The suggested optimization for tree-shaking is a minor point that could further enhance the implementation. Great work on improving the overall structure and reducing code duplication!

libs/application/templates/inao/financial-statement-individual-election/src/forms/prerequisites/index.ts (1)

4-4: Excellent update to use shared component!

The change to import Logo from a shared components directory aligns well with the PR objective of enabling code sharing between applications. This approach enhances code reusability and maintainability across the project.

libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/equitiesAndLiabilitiesSubsection/index.ts (1)

Line range hint 1-18: LGTM: File structure and functionality are well-organized and maintainable.

The overall structure of the file adheres to good practices:

  • Utilizes TypeScript for type safety.
  • Employs reusable components and constants.
  • Follows a modular approach, allowing for effective tree-shaking and bundling.
  • Uses descriptive naming conventions.

The code successfully implements the shared utilities approach while maintaining its original functionality.

libs/application/templates/inao/financial-statement-cemetery/tsconfig.lib.json (1)

22-28: Excellent addition to support code sharing!

The inclusion of ../shared/components/Logo.tsx in the include array aligns perfectly with the PR's objective of enabling code sharing between applications. This change promotes reusability and helps reduce code duplication, which should lead to more maintainable and less bloated templates.

This modification also adheres to the coding guidelines for libs/**/* files:

  1. It supports reusability of components across different NextJS apps.
  2. By including a .tsx file, it maintains TypeScript usage for defining props and exporting types.
  3. The explicit inclusion of a specific shared component file can potentially improve tree-shaking and bundling practices.

Great job on implementing this change to support the broader restructuring effort!

libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/cemeteryKeyNumbersSection/capitalNumberSubSection.ts (1)

7-7: LGTM! Verify the new import path.

The updated import path for CAPITALNUMBERS aligns with the PR objective of enabling code sharing among applications in the "inao" folder. This change should reduce code duplication and improve maintainability.

To ensure the new import path is correct and the constant is properly exported, run the following script:

✅ Verification successful

Import path verified successfully.
The updated import path for CAPITALNUMBERS correctly points to libs/application/templates/inao/shared/utils/constants.ts, ensuring proper export and maintainability.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence and export of CAPITALNUMBERS in the new shared location

# Test: Check if the file exists and exports CAPITALNUMBERS
ast-grep --pattern 'export const CAPITALNUMBERS = $_' ../../../../../shared/utils/constants.ts

Length of output: 184


Script:

#!/bin/bash
# Description: Locate the export of CAPITALNUMBERS across the repository

# Search for the export statement of CAPITALNUMBERS in any constants.ts file
ast-grep --pattern 'export const CAPITALNUMBERS = $_' **/constants.ts

Length of output: 136


Script:

#!/bin/bash
# Description: Search for the export and declaration of CAPITALNUMBERS across all TypeScript files

# Search for the export statement of CAPITALNUMBERS in any TypeScript file
rg 'export\s+const\s+CAPITALNUMBERS\s*=' -t ts

Length of output: 244

libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/capitalNumbersSubsection/index.ts (2)

Line range hint 1-30: Approve the overall file structure and adherence to coding guidelines.

The file structure and implementation adhere to the coding guidelines for libs/**/* files:

  1. The component is potentially reusable across different NextJS apps.
  2. TypeScript is used for defining props and exporting types (implied by the use of builder functions).
  3. The import statement change supports effective tree-shaking and bundling practices.

The functionality of the capitalNumbersSubsection remains intact, with the CAPITALNUMBERS constant being used correctly in the childInputIds of a custom field.


7-7: Approve the import path update.

The change aligns with the PR objective of sharing code between applications in the "inao" folder. This modification reduces code duplication and improves maintainability by centralizing the CAPITALNUMBERS constant in a shared utility directory.

Let's verify the existence and correctness of the new import path:

✅ Verification successful

Import path update verified successfully.

The CAPITALNUMBERS constant is correctly imported from the shared utilities, ensuring consistency and reducing duplication.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of the CAPITALNUMBERS constant in the new shared utils directory

# Test: Check if the CAPITALNUMBERS constant exists in the new shared utils file
rg -q 'export const CAPITALNUMBERS' 'libs/application/templates/inao/shared/utils/constants.ts' && echo "CAPITALNUMBERS constant found in the shared utils file" || echo "CAPITALNUMBERS constant not found in the shared utils file"

# Test: Ensure the constant is being used correctly in this file
rg -q 'CAPITALNUMBERS' 'libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/capitalNumbersSubsection/index.ts' && echo "CAPITALNUMBERS is used in the file" || echo "CAPITALNUMBERS is not used in the file"

Length of output: 462

libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/individualKeyNumbersSection/index.ts (2)

Line range hint 1-24: Approve the overall structure and implementation.

The file structure and implementation adhere to good practices:

  • Proper use of TypeScript with named imports.
  • Utilization of the buildSection function for creating a structured section with appropriate typing.
  • Clear and concise logic in the condition function.

The code aligns with the coding guidelines for libs, ensuring reusability and proper TypeScript usage.


2-2: Approve the updated import path and suggest verification.

The change to import GREATER from a shared utility folder aligns with the PR objective of enabling code sharing among applications in the "inao" folder. This can potentially improve code reusability and reduce duplication.

To ensure the correctness of this change, please run the following script to verify the import path across the project:

libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/individualKeyNumbersSection/equitiesAndLiabilitiesSubSection.ts (2)

Line range hint 1-28: Overall, the changes improve code sharing and maintainability.

The updated import path for EQUITIESANDLIABILITIESIDS aligns well with the PR objectives. The file maintains good TypeScript usage, component reusability, and follows best practices for NextJS applications. Consider the suggestion to move the messages import to the shared directory for further consistency.


6-6: LGTM! Import path updated to use shared utilities.

The change aligns with the PR objective of enabling code sharing among applications. This update reduces code duplication and improves maintainability.

Let's verify the existence and correctness of the new import path:

✅ Verification successful

Verified! The EQUITIESANDLIABILITIESIDS constant exists in the shared utilities path.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of the EQUITIESANDLIABILITIESIDS constant in the new shared utils path

# Test: Search for the EQUITIESANDLIABILITIESIDS constant in the shared utils directory
rg -p 'export const EQUITIESANDLIABILITIESIDS' libs/application/templates/inao/shared/utils/constants.ts

Length of output: 152

libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/documentsSection/index.ts (1)

Line range hint 1-32: Code structure and implementation look good.

The overall structure of the documentsSection is well-implemented:

  • It uses utility functions from @island.is/application/core, promoting code reuse.
  • The condition logic and file upload field configuration are appropriate for the context.
  • The code adheres to TypeScript usage and supports effective tree-shaking and bundling.

The implementation aligns with the coding guidelines for files in the libs directory, ensuring reusability across different NextJS apps.

libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/financialStatementSection/index.ts (1)

7-7: Approve import path change with bundling consideration.

The updated import path for the LESS constant aligns with the PR objective of sharing code among applications. This change can improve maintainability and reduce code duplication.

To ensure this change doesn't negatively impact bundling, please run the following script:

This script will help identify if the LESS constant is being used efficiently and can be tree-shaken if unused.

libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/index.ts (1)

8-8: Approved: Import path change aligns with code sharing objective.

The updated import path for the Logo component from a shared directory aligns well with the PR's objective of enabling code sharing between applications. This change supports component reusability across different NextJS apps, which is a key coding guideline for this project.

libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/index.ts (3)

9-9: Excellent move towards code sharing and reusability!

The change in the import statement for the Logo component, moving it to a shared directory, aligns well with the PR objectives and coding guidelines. This promotes reusability across different NextJS apps and helps reduce code duplication.


Line range hint 1-24: Overall, excellent progress towards code sharing and reusability.

The changes in this file significantly contribute to the PR's objective of enabling code sharing among applications in the "inao" folder. The move to a shared Logo component and the more flexible logo rendering approach align well with the coding guidelines, promoting reusability and potentially improving maintainability.

A minor suggestion for memoization has been made to ensure effective tree-shaking. Please also ensure that proper TypeScript types are being used throughout, especially for the shared components.


16-16: Good improvement in logo rendering flexibility.

The change to a function call for the logo property allows for more dynamic rendering, which is a positive step. This aligns well with the coding guidelines for reusability and flexibility.

However, to ensure effective tree-shaking, consider memoizing the logo function:

import { useMemo } from 'react'

// ...

logo: useMemo(() => () => Logo({ serviceProvider: m.serviceProvider, inao: m.inao }), []),

Also, please verify that proper TypeScript types are being used for the Logo component props.

libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/index.ts (2)

9-9: LGTM: Import path change aligns with code sharing objective.

The updated import path for the Logo component from a shared directory structure aligns well with the PR's objective of enabling code sharing among applications in the "inao" folder. This change contributes to reducing code duplication and improving maintainability.


16-16: LGTM: Enhanced logo rendering with improved reusability.

The updated logo property now uses a function to dynamically render the Logo component with specific parameters. This change:

  1. Enhances reusability across different NextJS apps.
  2. Allows for dynamic logo rendering based on provided arguments.
  3. Aligns with effective tree-shaking practices by using lazy evaluation.

These improvements adhere to the coding guidelines for library files and contribute to the overall goal of code sharing and reduced duplication.

libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/overviewSection/overviewMultiField.ts (1)

7-7: Approved: Import path update aligns with code sharing objectives

The change to import GREATER and LESS constants from a shared utility directory ('../../../../../../shared/utils/constants') is a positive step. This modification:

  1. Aligns with the PR objective of enabling code sharing between applications in the "inao" folder.
  2. Enhances reusability of constants across different NextJS apps, as per the coding guidelines.
  3. Potentially improves tree-shaking and bundling practices by centralizing shared resources.

Good job on maintaining TypeScript usage for importing these constants, which adheres to the guideline of using TypeScript for defining props and exporting types.

libs/application/templates/inao/financial-statement-cemetery/src/fields/DelegationCheck/index.tsx (2)

Line range hint 1-46: Verify consistency of VALIDATOR constant.

While the component's logic remains unchanged, it's crucial to ensure that the VALIDATOR constant in the new shared location has the same value and type as its previous definition. This will guarantee that the component's functionality remains intact.

Let's verify the consistency of the VALIDATOR constant:

#!/bin/bash
# Description: Compare the VALIDATOR constant in the old and new locations

# Test: Extract and compare the VALIDATOR constant definition
old_validator=$(rg -N "export const VALIDATOR" libs/application/templates/inao/financial-statement-cemetery/src/utils/constants.ts || echo "Old VALIDATOR not found")
new_validator=$(rg -N "export const VALIDATOR" libs/application/templates/inao/shared/utils/constants.ts || echo "New VALIDATOR not found")

echo "Old VALIDATOR definition: $old_validator"
echo "New VALIDATOR definition: $new_validator"

if [ "$old_validator" = "$new_validator" ]; then
    echo "VALIDATOR constant is consistent"
else
    echo "VALIDATOR constant has changed, please review the differences"
fi

7-7: LGTM: Import path updated to use shared utilities.

The change aligns with the PR objective of enabling code sharing among applications in the "inao" folder. This contributes to reducing code duplication and improves reusability across different NextJS apps.

Let's verify that the VALIDATOR constant is correctly defined in the new shared location:

✅ Verification successful

Verified: VALIDATOR constant successfully moved to shared utilities.

The VALIDATOR constant is correctly defined in libs/application/templates/inao/shared/utils/constants.ts, and there are no remaining references to the old import path. This change aligns with the objective of centralizing shared utilities and ensures improved reusability across different NextJS applications.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the VALIDATOR constant in the shared utils file

# Test: Check if the VALIDATOR constant is defined in the shared utils file
rg -q 'VALIDATOR' libs/application/templates/inao/shared/utils/constants.ts && echo "VALIDATOR constant found in shared utils" || echo "VALIDATOR constant not found in shared utils"

# Test: Check for any remaining references to the old import path
rg -l "import.*VALIDATOR.*from '../../utils/constants'" libs/application/templates/inao

Length of output: 812

libs/application/templates/inao/financial-statement-political-party/src/fields/DelegationCheck/DelegationCheck.tsx (2)

5-5: Approved: Import path update enhances code sharing and maintainability

The change in the import path for the VALIDATOR constant from a local utility file to a shared one aligns well with the PR objectives. This modification contributes to:

  1. Reducing code duplication across applications in the "inao" folder.
  2. Improving maintainability by centralizing constants in a shared location.
  3. Enhancing reusability of components across different NextJS apps, as per the coding guidelines.

Line range hint 1-45: Approved: Component adheres to TypeScript and React best practices

The DelegationCheck component demonstrates good adherence to TypeScript and React best practices:

  1. Proper use of TypeScript for prop definitions and type imports.
  2. Correct implementation of React hooks (useLocale, useFormContext).
  3. Follows the functional component pattern.
  4. Effective error handling using form context and UI components.
  5. Modular design with a single, clear responsibility.
  6. Readable and well-structured code.

These practices contribute to the overall quality and maintainability of the codebase.

libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/overviewSection/index.ts (2)

Line range hint 16-52: Usage of imported constants is correct.

The imported constants (ABOUTIDS, GREATER, LESS) are used correctly throughout the file. Their usage remains unchanged despite the import path modification, maintaining the intended functionality of the code.


7-7: Approve import path change, but verify new location.

The updated import path aligns with the PR objective of enabling code sharing among applications. This change can potentially improve code reusability and reduce duplication.

Please verify that the constants exist in the new shared location. Run the following script to check:

✅ Verification successful

Import path successfully verified.

The constants ABOUTIDS, GREATER, and LESS are present in the new shared location, confirming that the import path change is correct and functional.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of constants in the new shared location

# Test: Check if the constants file exists and contains the required exports
rg -q 'export const (ABOUTIDS|GREATER|LESS)' libs/application/templates/inao/shared/utils/constants.ts && echo "Constants found in the new location" || echo "Constants not found in the new location"

Length of output: 185

libs/application/templates/inao/financial-statement-political-party/src/fields/PartyOperatingIncome/PartyExpenses.tsx (1)

10-11: Approved: Import path change aligns with code sharing objective

The updated import path for INPUTCHANGEINTERVAL from a shared utility module aligns well with the PR's objective of enabling code sharing among applications in the "inao" folder. This change promotes better code organization and potential reusability across different components or applications.

libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/index.tsx (1)

Line range hint 36-62: Correct usage of imported components and constants

The Total component and OPERATINGCOST constant are correctly used throughout the component, maintaining the existing functionality while benefiting from the new shared structure.

libs/application/templates/inao/financial-statement-cemetery/src/fields/Success/index.tsx (3)

Line range hint 1-72: Overall impact aligns with PR objectives.

The changes in this file contribute to code consistency and maintainability without affecting functionality. The use of shared utility functions (e.g., isCemetryUnderFinancialLimit) aligns with the PR objective of reducing code duplication across applications.

The component follows TypeScript best practices and uses reusable UI components from @island.is/island-ui/core, which supports the goal of component reusability across different NextJS apps.


18-18: Approve component signature update and check for unused imports.

The update of the Success component signature to use the new Props interface is consistent with the earlier interface renaming. This change maintains the component's functionality while improving code consistency.

To ensure there are no unused imports left after your changes, please run the following script:

#!/bin/bash
# Description: Check for unused imports in the file

# Test: Use TypeScript compiler to check for unused imports
npx tsc --noEmit --jsx react libs/application/templates/inao/financial-statement-cemetery/src/fields/Success/index.tsx

14-16: Approve interface renaming and verify its usage.

The renaming of PropTypes to Props aligns with common TypeScript naming conventions. This change improves code readability.

To ensure this change doesn't break any imports elsewhere in the codebase, please run the following script:

libs/application/templates/inao/financial-statement-political-party/src/fields/OperatingYear/OperatingYear.tsx (1)

20-20: Approved: Import from shared constants aligns with PR objectives

This change successfully implements the PR's goal of sharing code between applications. By importing ABOUTIDS from a shared constants file, you're reducing code duplication and improving maintainability. This modification is consistent with similar updates in other components, contributing to a more modular and efficient codebase.

libs/application/templates/inao/financial-statement-cemetery/src/fields/OperatingYear/index.tsx (2)

25-25: Approved: Import path change enhances code sharing

The modification of the import path for ABOUTIDS from a local module to a shared utility module is a positive change. This alteration aligns well with the PR's objective of enabling code sharing among applications in the "inao" folder. It promotes code reuse, reduces duplication, and contributes to a more maintainable and modular codebase.


Line range hint 1-85: Verify type exports and consider enhancing TypeScript usage

The component adheres well to the coding guidelines for libs/**/* files. It's a reusable component suitable for NextJS apps and demonstrates good practices for imports that facilitate effective tree-shaking. However, to fully comply with the TypeScript usage guideline, consider the following improvements:

  1. Define and export prop types for the OperatingYear component if it accepts any props.
  2. If this component is meant to be used in other parts of the application, consider exporting its type:
export type OperatingYearProps = {
  // Define props here if any
};

export const OperatingYear: React.FC<OperatingYearProps> = () => {
  // ... component implementation
};

These changes would enhance type safety and make the component more self-documenting.

Could you please confirm if there are any prop types or component types that should be exported from this file?

libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionInfoFields/ElectionSelect.tsx (1)

14-14: Excellent update to use shared constants!

This change aligns perfectly with the PR objective of enabling code sharing among applications in the "inao" folder. By importing ABOUTIDS from a shared constants file, you're promoting reusability and reducing code duplication across the project. This practice adheres to our coding guidelines for the libs directory, particularly in terms of component reusability across different NextJS apps.

libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionInfoFields/IncomeLimitFields.tsx (1)

11-12: Improved import structure enhances code sharing and maintainability.

The updated import paths now utilize a shared directory structure, which aligns well with the PR objective of enabling code sharing among applications. This change promotes better organization, improves maintainability, and reduces code duplication across different NextJS apps.

libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/clientInfoSection/index.ts (1)

Line range hint 1-89: File adheres to coding guidelines and PR objectives.

This file successfully implements the following guidelines:

  1. Reusability of components across different NextJS apps.
  2. Proper use of TypeScript for defining props and exporting types.
  3. The import change contributes to code sharing among applications.

The overall structure and implementation of the clientInfoSection remain robust and well-organized.

libs/application/templates/inao/financial-statement-political-party/src/fields/PartyOperatingIncome/PartyOperatingIncome.tsx (2)

17-19: LGTM! Import changes align with code sharing objectives.

The updated import statements effectively centralize shared components and constants, aligning with the PR's goal of reducing code duplication. This change enhances reusability across different NextJS apps within the project.

To ensure these shared components are being used consistently across the project, run the following script:

✅ Verification successful

Verified! All shared components and constants are consistently used across the project, aligning with the code-sharing objectives.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of shared components and constants across the project.

# Test: Check for consistent usage of Total component
echo "Checking usage of Total component:"
rg -p "import.*Total.*from.*shared/components/Total"

# Test: Check for consistent usage of OPERATINGCOST constant
echo "Checking usage of OPERATINGCOST constant:"
rg -p "import.*OPERATINGCOST.*from.*shared/utils/constants"

Length of output: 2435


Line range hint 1-85: Verify effective usage of exported types across the project.

The file complies with the coding guidelines for libs/**/*, using TypeScript for prop definitions and seeming to support reusability. To ensure optimal usage of exported types:

Run the following script to check for consistent usage of the FieldBaseProps type across the project:

This will help confirm that the exported types are being utilized effectively throughout the codebase, supporting type safety and consistency.

✅ Verification successful

FieldBaseProps Usage Verified Successfully

The FieldBaseProps type is consistently and effectively utilized across the project, ensuring type safety and adherence to coding guidelines.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of FieldBaseProps type across the project.

echo "Checking usage of FieldBaseProps type:"
rg -p "import.*FieldBaseProps.*from.*@island.is/application/types"

Length of output: 2435


Script:

#!/bin/bash
# Description: Verify the usage of FieldBaseProps type across the project.

echo "Checking usage of FieldBaseProps type:"
rg -p "import.*FieldBaseProps.*from\s+['\"]@island\.is/application/types['\"]"

Length of output: 51802

libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/clientInfoSection/index.ts (1)

Line range hint 1-89: LGTM: Code structure adheres to guidelines and best practices.

The overall structure of the file follows best practices:

  • Uses TypeScript for type definitions.
  • Employs a declarative pattern with build functions, enhancing maintainability.
  • Structured for potential reusability across different NextJS apps.
  • Follows consistent naming conventions and code organization.

These aspects align well with the coding guidelines for library files.

libs/application/templates/inao/financial-statement-political-party/src/fields/ElectionStatement/ElectionStatement.tsx (2)

Line range hint 1-85: LGTM! Good TypeScript usage and component structure.

The file maintains good TypeScript usage for defining props and types, adhering to the coding guidelines. The component structure is well-organized, promoting readability and maintainability. The changes don't introduce any apparent issues with tree-shaking or bundling.


81-82: LGTM! Verify BottomBar component interface.

The updates to the BottomBar component props improve flexibility and internationalization support. The use of the m object for messages is consistent with the rest of the code.

Let's verify that the BottomBar component's interface has been updated consistently across the project:

libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionStatement/index.tsx (3)

9-13: Excellent refactoring of imports to use shared modules

The changes to the import statements align well with the PR objectives and coding guidelines:

  1. Importing from shared modules (../../../../shared/) enhances code sharing and reusability across different NextJS apps.
  2. The use of TypeScript in imports adheres to the coding guidelines.
  3. This structure may improve tree-shaking and bundling practices.

Great job on improving modularity and consistency!


Line range hint 35-43: Consistent use of shared constants

The onBackButtonClick function now uses the GREATER constant from the shared module, which aligns with the PR objective of code sharing. The function's logic remains unchanged, maintaining its original functionality.


Line range hint 1-85: Well-structured and guideline-compliant component

The overall structure of the ElectionStatement component adheres to React and TypeScript best practices:

  1. It effectively uses hooks and utilities from both local and shared modules.
  2. The component is designed for potential reuse across different NextJS apps, aligning with the coding guidelines.
  3. The use of TypeScript for props and exports enhances type safety and code quality.

Great job on maintaining a clean and consistent structure while implementing the shared code objectives!

libs/application/templates/inao/financial-statement-cemetery/src/fields/PowerOfAttorney/index.tsx (1)

20-20: Approved: Import path change aligns with PR objectives

The updated import path for ABOUTIDS from a shared utilities directory aligns well with the PR's objective of enabling code sharing among applications in the "inao" folder. This change contributes to reducing code duplication and improving the overall structure of the codebase.

libs/application/templates/inao/financial-statement-political-party/src/fields/PowerOfAttorneyFields/PowerOfAttorneyFields.tsx (1)

15-15: Approved: Import path change aligns with code sharing objective

The updated import path for ABOUTIDS from a shared constants file aligns well with the PR's objective of enabling code sharing among applications in the "inao" folder. This change enhances reusability across different NextJS apps and contributes to reducing code duplication.

libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOperation/index.tsx (1)

17-17: Improved code organization and reusability

The changes in import statements align well with the coding guidelines:

  1. Importing Total from a shared components directory enhances reusability across different NextJS apps.
  2. Using CEMETERYOPERATIONIDS and OPERATINGCOST from shared locations reduces code duplication and improves maintainability.
  3. These imports likely include proper TypeScript definitions, adhering to the TypeScript usage guideline.

These modifications contribute to better code organization and facilitate easier maintenance of shared components and constants.

Also applies to: 19-20

libs/application/templates/inao/financial-statement-political-party/src/fields/KeyNumbersCapital/KeyNumbersCapital.tsx (2)

15-19: Improved import structure enhances reusability and maintainability.

The updated import paths for constants and components from shared locations align well with the PR objective of enabling code sharing among applications. This change:

  1. Enhances reusability of components and constants across different NextJS apps.
  2. Supports effective tree-shaking by importing specific entities.
  3. Improves maintainability by centralizing shared code.

Great job on restructuring the imports to achieve these benefits!


Line range hint 1-95: LGTM: Component adheres to coding guidelines and best practices.

The KeyNumbersCapital component:

  1. Uses TypeScript for defining props and types.
  2. Is designed for reusability across different NextJS apps.
  3. Implements effective tree-shaking practices with specific imports.

The component logic is well-structured and remains unchanged, maintaining its functionality while benefiting from the improved import structure.

libs/application/templates/inao/financial-statement-cemetery/src/fields/KeyNumbersCapital/index.tsx (1)

Line range hint 21-95: Component implementation approved

The KeyNumbersCapital component is well-implemented:

  • It effectively uses React hooks for state management and side effects.
  • The form handling with react-hook-form is appropriate for managing complex form state.
  • Performance optimization is considered with the use of debounce for input changes.
  • The component is modular and reusable, adhering to good React practices.
  • TypeScript is used effectively for type safety.

The component aligns well with the coding guidelines for reusability and TypeScript usage.

libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/Income.tsx (1)

Line range hint 11-13: Approve TypeScript usage

The component correctly uses TypeScript for prop definitions, enhancing type safety and documentation. This aligns with the coding guidelines for libs.

libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionInfoFields/index.tsx (2)

7-7: LGTM: Import changes improve modularity and type safety.

The changes to the import statements enhance the reusability of components and constants across different NextJS apps. The addition of the FinancialStatementsInaoElection type import from the API schema and the relocation of ABOUTIDS to a shared utilities path align well with the coding guidelines for this directory.

Also applies to: 9-9, 15-15


Line range hint 63-80: LGTM: Enhanced default election selection logic.

The modifications to the getDefaultElection function improve the process of selecting and setting the default election. The use of optional chaining and the integration with getElectionInfo function enhance the overall robustness of the component.

The changes align well with the coding guidelines, promoting reusability and maintainability of the component across different NextJS applications.

libs/application/templates/inao/financial-statement-individual-election/src/lib/utils/dataSchema.ts (3)

6-6: LGTM: Import path updated to use shared utility.

The change to import checkIfNegative from a shared utility path aligns well with the PR objectives of enabling code sharing among applications in the "inao" folder. This modification enhances reusability and reduces code duplication, which is in line with the coding guidelines for libs/**/* files.


Line range hint 1-190: LGTM: Effective use of TypeScript and Zod for type safety.

The file demonstrates excellent adherence to TypeScript best practices:

  • Utilizes Zod for schema definitions, providing both compile-time and runtime type checking.
  • Exports types like FinancialStatementIndividualElection and FSNFieldBaseProps.
  • Leverages TypeScript features for type inference and manipulation (e.g., z.TypeOf<typeof dataSchema>).

This approach aligns perfectly with the coding guideline emphasizing TypeScript usage for defining props and exporting types.


Line range hint 1-190: LGTM: Import and export practices facilitate effective tree-shaking.

The file demonstrates good practices for enabling effective tree-shaking:

  • Uses named imports from external libraries (e.g., import { z } from 'zod').
  • Exports specific types and constants rather than using default exports.

These practices allow bundlers to perform more effective dead code elimination, potentially reducing the final bundle size. This aligns well with the coding guideline emphasizing effective tree-shaking and bundling practices.

libs/application/templates/inao/financial-statement-political-party/src/fields/PartyOperatingIncome/PartyIncome.tsx (2)

Line range hint 1-12: Improved import structure enhances reusability and maintainability.

The changes to the import statements, particularly the use of shared constants (INPUTCHANGEINTERVAL) and local constants (PARTYOPERATIONIDS), align well with our coding guidelines. This approach enhances reusability across different NextJS apps and improves overall maintainability.


71-71: Improved JSX syntax with Fragment shorthand.

The use of Fragment shorthand (<> and </>) instead of the explicit Fragment component improves code readability. This is a recommended practice in React development.

Also applies to: 200-200

libs/application/templates/inao/financial-statement-political-party/src/fields/ElectionEquities/ElectionEquities.tsx (2)

22-24: Improved code sharing and reusability

The changes to import paths align well with the PR objective of enabling code sharing among applications. By centralizing constants, helpers, and components in a shared directory structure, we're improving reusability across different NextJS apps, which is in line with our coding guidelines.


Line range hint 26-214: Component complies with coding guidelines

The ElectionEquities component adheres to our coding guidelines:

  1. It uses TypeScript for prop definitions (FieldBaseProps).
  2. The component structure and use of shared utilities (e.g., useTotals hook) promote reusability across different NextJS apps.
  3. There are no apparent issues with tree-shaking or bundling practices.

The changes maintain these good practices while improving code sharing.

libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionEquities/index.tsx (3)

16-16: Approved: Import path update aligns with code sharing objective.

The updated import path for getTotal from a shared directory structure promotes code reusability across different NextJS apps, which is in line with the PR objectives and coding guidelines.


18-22: Approved: Centralized constants improve maintainability.

The updated import path for constants from a shared directory enhances maintainability and consistency across the codebase. This change supports effective tree-shaking and bundling practices, aligning with the coding guidelines.


16-24: Summary: Import updates successfully implement code sharing.

The changes in this file effectively implement the PR objective of enabling code sharing among applications. By updating import paths to use shared directories for utilities, constants, and components, the code becomes more modular and maintainable. These changes align well with the coding guidelines, promoting reusability and effective bundling practices.

No changes were made to the component logic, indicating that the refactoring was focused on structural improvements. This approach minimizes the risk of introducing new bugs while achieving the goal of reducing code duplication.

libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryEquities/index.tsx (2)

22-23: Improved import structure enhances code sharing and maintainability.

The updated import paths now use absolute imports from shared utility folders. This change aligns well with the PR objective of enabling code sharing among applications and follows the coding guidelines for libs. It promotes reusability across different NextJS apps and can help reduce the risk of circular dependencies.

Also applies to: 25-26


Line range hint 28-285: Component logic maintains good structure and adheres to guidelines.

The core logic of the CemeteryEquities component remains unchanged, which is positive as it suggests the existing implementation was already well-structured. The component continues to use React hooks, form context, and custom hooks effectively. It adheres to TypeScript usage for defining props and exporting types, aligning with the coding guidelines. The use of custom hooks like useTotals promotes code reuse across the application.

libs/application/templates/inao/financial-statement-cemetery/src/utils/helpers.ts (1)

7-10: Good use of shared utilities for code reuse

Importing getCurrentUserType and currencyStringToNumber from shared helpers promotes code reuse and reduces duplication.

libs/application/templates/inao/financial-statement-political-party/src/fields/PartyOverview/PartyOverview.tsx (4)

253-254: Props passed to BottomBar component are appropriate

The goBack and send props correctly use localized messages from m.


181-196: Verify that AssetDebtEquityOverview component accepts the new props

The AssetDebtEquityOverview component is now passed multiple props. Ensure that the component is updated to accept these props.

Run the following script to check the prop types of AssetDebtEquityOverview:

#!/bin/bash
# Description: Verify that AssetDebtEquityOverview component accepts the updated props

# Expected: The component's prop definitions include all the passed props
ast-grep --pattern $'interface AssetDebtEquityOverviewProps {
  liability: $_,
  asset: $_,
  equity: $_,
  equityAndLiabilities: $_,
  fixedAssetsTotal: $_,
  currentAssets: $_,
  totalAssets: $_,
  longTerm: $_,
  shortTerm: $_,
  totalLiabilities: $_,
  equityTitle: $_,
  debtsAndCash: $_,
  properties: $_,
  debtsAndEquity: $_,
}' $(fd 'AssetDebtEquityOverview.tsx')

70-78: Verify that AboutOverview component accepts the new props

The AboutOverview component now receives individual props instead of a single answers object. Ensure that AboutOverview has been updated accordingly to accept these props.

Run the following script to check the prop types of AboutOverview:


163-171: Verify that CapitalNumberOverview component accepts the new props

The CapitalNumberOverview component now receives multiple props. Ensure that the component's prop definitions have been updated to accept these props.

Run the following script to check the prop types of CapitalNumberOverview:

libs/application/templates/inao/financial-statement-individual-election/src/fields/Overview/index.tsx (2)

16-16: Adoption of shared utilities and components enhances reusability

The updated import statements now reference shared utilities and components from the shared directory. This change promotes code reusability across different NextJS applications and aligns with the project's objective to reduce code duplication.

Also applies to: 20-20, 22-27


76-84: Component prop updates improve data management and maintainability

By expanding the props passed to components like AboutOverview, CapitalNumberOverview, AssetDebtEquityOverview, FileValueLine, and BottomBar, the code now allows for more explicit and granular data handling within these components. This enhances clarity and maintainability of the codebase. Ensure that all new props are properly typed with TypeScript to maintain type safety.

Also applies to: 161-169, 178-193, 200-203, 254-255

libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOverview/index.tsx (4)

28-33: Confirm the correctness of import paths for shared components

The import statements for shared components and utilities have been updated to reference the shared directory. Please ensure that the relative paths are correct and that these components are properly exported from the shared location.


90-98: Validate prop types for <AboutOverview> component

Ensure that the props passed to the <AboutOverview> component match its TypeScript interface. Specifically, verify that:

  • about prop is of the expected type.
  • Label props such as fullName, nationalId, etc., correctly reference messages from the m object and are of type string.

187-195: Validate prop types for <CapitalNumberOverview> component

Please confirm that the props passed to <CapitalNumberOverview> align with its TypeScript definitions:

  • capitalNumbersMessage, capitalIncomeMessage, capitalCostMessage, and totalCapitalMessage should be of type string.
  • capitalIncome, capitalCost, and total should be numeric values or formatted appropriately.

395-396: Verify prop values for <BottomBar> component

Check that the goBack and send props passed to <BottomBar> correctly reference the intended messages from the m object. Ensure that m.goBack and m.send contain the correct string values for the button labels.

@@ -4,7 +4,7 @@ import {
buildCustomField,
} from '@island.is/application/core'
import { m } from '../../../lib/utils/messages'
import { ABOUTIDS } from '../../../lib/utils/constants'
import { ABOUTIDS } from '../../../../../shared/utils/constants'
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Inconsistent import paths for ABOUTIDS found.

Several files are still importing ABOUTIDS from '../../lib/constants' instead of the shared utils directory. Please update these import statements to ensure consistency across the codebase.

🔗 Analysis chain

LGTM! Verify the new import path.

The change to import ABOUTIDS from a shared utils directory aligns with the PR objective of enabling code sharing among applications. This promotes reusability and reduces code duplication.

To ensure the new import path is correct and consistent across the project, run the following script:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the import path for ABOUTIDS in other files

# Test: Search for ABOUTIDS imports. Expect: Consistent use of shared utils path.
rg -A 1 "import.*ABOUTIDS.*from" --glob '!**/node_modules/**'

Length of output: 5914

@@ -4,7 +4,7 @@ import {
buildSubSection,
} from '@island.is/application/core'
import { m } from '../../../lib/utils/messages'
import { CAPITALNUMBERS } from '../../../lib/utils/constants'
import { CAPITALNUMBERS } from '../../../../../shared/utils/constants'
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Issue: Outdated Import Paths for CAPITALNUMBERS Detected

Several files are still importing CAPITALNUMBERS from the old path '../../lib/utils/constants' instead of the updated shared utilities path.

  • libs/application/templates/financial-statements-inao/src/forms/application/shared/keyNumbers/capitalNumbers.ts
  • libs/application/templates/financial-statements-inao/src/fields/KeyNumbersCapital/index.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/index.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionStatement/index.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/Expenses.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/Income.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/individualKeyNumbersSection/operatingcostSubSection.ts
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionInfoFields/electionReducer.ts
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionInfoFields/index.tsx

Please update these import paths to use the shared utilities directory to ensure consistency and maintainability across the project.

🔗 Analysis chain

LGTM: Import path updated to use shared utilities.

The change to import CAPITALNUMBERS from a shared utilities directory aligns with the PR objectives of enabling code sharing and reducing duplication. This modification enhances reusability across different NextJS apps within the project.

A few points to consider:

  1. Ensure that the new import path is consistent across all files using these constants.
  2. Verify that the shared utilities are properly exported for tree-shaking to work effectively.
  3. Consider adding a comment explaining the purpose of the shared constants for better maintainability.

To ensure consistency across the project, run the following script:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of shared constants across the project

# Test: Search for imports of CAPITALNUMBERS. Expect: Only imports from shared utils.
rg -A 1 "import.*CAPITALNUMBERS" | grep -v "shared/utils/constants"

# Test: Check for any remaining imports from the old path
rg "from '.*lib/utils/constants'"

Length of output: 2552

@@ -4,7 +4,7 @@ import {
getValueViaPath,
} from '@island.is/application/core'
import { m } from '../../../lib/utils/messages'
import { LESS } from '../../../lib/utils/constants'
import { LESS } from '../../../../../shared/utils/constants'
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Migration Incomplete: Old import paths still in use.

Several files are still importing LESS from '../../lib/utils/constants'. Please update these import paths to use the shared utility path.

  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/individualKeyNumbersSection/operatingcostSubSection.ts
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/index.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/Income.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/Expenses.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionStatement/index.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionInfoFields/index.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionInfoFields/electionReducer.ts
🔗 Analysis chain

Import path updated to use shared constants.

The import path for the LESS constant has been updated to use a shared utility path. This change aligns with the PR objective of enabling code sharing between applications in the "inao" folder.

To ensure this change is consistent across the codebase and doesn't introduce any issues, let's verify the usage of this shared constant:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the shared LESS constant across the codebase.

# Test 1: Check if the new import path exists
if fd -p "shared/utils/constants.ts"; then
  echo "Shared constants file exists."
else
  echo "Warning: Shared constants file not found."
fi

# Test 2: Check for any remaining old import paths
rg "from '.*lib/utils/constants'" -t ts

# Test 3: Verify consistent usage of the LESS constant
rg "import.*LESS.*from '.*shared/utils/constants'" -t ts

Length of output: 2641

@@ -1,6 +1,6 @@
import { buildFileUploadField, buildSection } from '@island.is/application/core'
import { m } from '../../../lib/messages'
import { currencyStringToNumber } from '../../../utils/helpers'
import { currencyStringToNumber } from '../../../../../shared/utils/helpers'
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider using an absolute import path for shared utilities.

While the change to a shared utility folder aligns with the PR objective of code sharing, using such a deep relative path (../../../../../shared/utils/helpers) might make the code less maintainable. Consider using an absolute import path or creating an index file in the shared utils folder to simplify imports.

Example of an absolute import:

import { currencyStringToNumber } from '@island.is/application/shared/utils/helpers'

This approach would make the code more resilient to structural changes and improve readability.

PartiesBackwardLimit,
PartiesYearAllowed,
} from '../../utils/constants'
import { PartiesBackwardLimit, PartiesYearAllowed } from '../../utils/constants'
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider moving constants to a shared location

Given the PR's objective to share code between applications, it might be beneficial to move PartiesBackwardLimit and PartiesYearAllowed to a shared constants file. This would align with the changes made for ABOUTIDS and improve code reusability across the project.

Comment on lines +108 to +116
<CapitalNumberOverview
capitalNumbersMessage={m.capitalNumbers}
capitalIncomeMessage={m.capitalIncome}
capitalIncome={answers.capitalNumbers.capitalIncome}
capitalCostMessage={m.capitalCost}
capitalCost={answers.capitalNumbers.capitalCost}
totalCapitalMessage={m.totalCapital}
total={answers.capitalNumbers.total}
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Ensure correct data and messages in CapitalNumberOverview component

In the CapitalNumberOverview component, props like capitalNumbersMessage, capitalIncomeMessage, etc., are assigned message objects from m. Verify whether these props should receive formatted messages or data values. Passing message objects without formatting might not display the intended text.

Use formatMessage to pass the localized strings or provide the appropriate data.

Apply this diff to correct the props:

            <CapitalNumberOverview
-             capitalNumbersMessage={m.capitalNumbers}
-             capitalIncomeMessage={m.capitalIncome}
              capitalIncome={answers.capitalNumbers.capitalIncome}
-             capitalCostMessage={m.capitalCost}
              capitalCost={answers.capitalNumbers.capitalCost}
-             totalCapitalMessage={m.totalCapital}
              total={answers.capitalNumbers.total}
+             capitalNumbersMessage={formatMessage(m.capitalNumbers)}
+             capitalIncomeMessage={formatMessage(m.capitalIncome)}
+             capitalCostMessage={formatMessage(m.capitalCost)}
+             totalCapitalMessage={formatMessage(m.totalCapital)}
            />

Committable suggestion was skipped due to low confidence.

Comment on lines +148 to +149
label={answers.attachments?.file?.[0]?.name}
files={m.files}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Confirm props for FileValueLine component

The FileValueLine component is receiving label and files props. The files prop is assigned m.files, which appears to be a message object. If files expects an array of file data, passing a message object may cause issues.

Ensure files is receiving the correct data type. If it's intended to be a label, consider renaming the prop for clarity.

Apply this diff if the files prop should be data from answers:

                <FileValueLine
                  label={answers.attachments?.file?.[0]?.name}
-                 files={m.files}
+                 files={answers.attachments?.file}
                />

Committable suggestion was skipped due to low confidence.

Comment on lines +201 to +204
<FileValueLine
label={answers.attachments?.file?.[0]?.name}
files={m.files}
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix incorrect prop passed to FileValueLine component

The files prop is being assigned m.files, which appears to be a localization message. The files prop likely expects an array of files. Consider passing the actual file data instead.

Apply this diff to correct the prop:

<FileValueLine
  label={answers.attachments?.file?.[0]?.name}
- files={m.files}
+ files={answers.attachments?.file}
 />
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<FileValueLine
label={answers.attachments?.file?.[0]?.name}
files={m.files}
/>
<FileValueLine
label={answers.attachments?.file?.[0]?.name}
files={answers.attachments?.file}
/>

Comment on lines 19 to 29
import { formatCurrency } from '../../../../shared/utils/helpers'
import { FileValueLine } from '../../../../shared/components/FileValueLine'
import { AssetDebtEquityOverview } from '../../../../shared/components/AssetDebtEquityOverview'
import {
sectionColumn,
starterColumnStyle,
} from '../../components/css/overviewStyles.css'
import { CapitalNumberOverview } from '../../components/CapitalNumberOverview'
} from '../../../../shared/components/css/overviewStyles.css'
import { CapitalNumberOverview } from '../../../../shared/components/CapitalNumberOverview'
import { AboutOverview } from '../../../../shared/components/AboutOverview'
import { ValueLine } from '../../../../shared/components/ValueLine'
import { BottomBar } from '../../../../shared/components/BottomBar'
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider using absolute imports or module aliases for better maintainability

The import statements use deep relative paths like '../../../../shared/...', which can reduce readability and become difficult to manage as the project structure evolves. Consider configuring absolute imports or module aliases to simplify these paths and enhance maintainability.

You can update the import statements as follows:

-import { formatCurrency } from '../../../../shared/utils/helpers'
-import { FileValueLine } from '../../../../shared/components/FileValueLine'
-import { AssetDebtEquityOverview } from '../../../../shared/components/AssetDebtEquityOverview'
-import {
-  sectionColumn,
-  starterColumnStyle,
-} from '../../../../shared/components/css/overviewStyles.css'
-import { CapitalNumberOverview } from '../../../../shared/components/CapitalNumberOverview'
-import { AboutOverview } from '../../../../shared/components/AboutOverview'
-import { ValueLine } from '../../../../shared/components/ValueLine'
-import { BottomBar } from '../../../../shared/components/BottomBar'
+import { formatCurrency } from 'shared/utils/helpers'
+import { FileValueLine } from 'shared/components/FileValueLine'
+import { AssetDebtEquityOverview } from 'shared/components/AssetDebtEquityOverview'
+import {
+  sectionColumn,
+  starterColumnStyle,
+} from 'shared/components/css/overviewStyles.css'
+import { CapitalNumberOverview } from 'shared/components/CapitalNumberOverview'
+import { AboutOverview } from 'shared/components/AboutOverview'
+import { ValueLine } from 'shared/components/ValueLine'
+import { BottomBar } from 'shared/components/BottomBar'

This requires updating your project's TypeScript and bundler configurations to support module aliases.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { formatCurrency } from '../../../../shared/utils/helpers'
import { FileValueLine } from '../../../../shared/components/FileValueLine'
import { AssetDebtEquityOverview } from '../../../../shared/components/AssetDebtEquityOverview'
import {
sectionColumn,
starterColumnStyle,
} from '../../components/css/overviewStyles.css'
import { CapitalNumberOverview } from '../../components/CapitalNumberOverview'
} from '../../../../shared/components/css/overviewStyles.css'
import { CapitalNumberOverview } from '../../../../shared/components/CapitalNumberOverview'
import { AboutOverview } from '../../../../shared/components/AboutOverview'
import { ValueLine } from '../../../../shared/components/ValueLine'
import { BottomBar } from '../../../../shared/components/BottomBar'
import { formatCurrency } from 'shared/utils/helpers'
import { FileValueLine } from 'shared/components/FileValueLine'
import { AssetDebtEquityOverview } from 'shared/components/AssetDebtEquityOverview'
import {
sectionColumn,
starterColumnStyle,
} from 'shared/components/css/overviewStyles.css'
import { CapitalNumberOverview } from 'shared/components/CapitalNumberOverview'
import { AboutOverview } from 'shared/components/AboutOverview'
import { ValueLine } from 'shared/components/ValueLine'
import { BottomBar } from 'shared/components/BottomBar'

Comment on lines +329 to +332
<FileValueLine
label={answers.attachments?.file?.[0]?.name}
files={m.files}
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Possible mismatch in props for <FileValueLine> component

The label prop is set to answers.attachments?.file?.[0]?.name, which is likely a string, while the files prop is set to m.files, which appears to be a message object. Ensure that files prop receives the correct file data array and that m.files is the intended value.

Apply this diff if files should be the array of files:

<FileValueLine
  label={answers.attachments?.file?.[0]?.name}
- files={m.files}
+ files={answers.attachments?.file}

Committable suggestion was skipped due to low confidence.

@@ -1,3 +1,4 @@
import React from 'react'
Copy link
Member

Choose a reason for hiding this comment

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

Afhverju import-a react ef það er svo aldrei referenced í skránni? eh front end dót sem ég skil ekki? :P

Copy link
Member Author

Choose a reason for hiding this comment

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

Í .tsx skrám er React alltaf default import-að þannig að það ætti ekki að þurfa að vera með þetta import. Ég fékk hins vegar allt raut í skránni nema að ég import-aði þessu. Eitthvað skrýtið í gangi...

Copy link
Member

Choose a reason for hiding this comment

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

lol ok, allt í góðu þá

Copy link
Member

@HjorturJ HjorturJ 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
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 (5)
libs/application/templates/inao/shared/components/index.ts (1)

1-7: Excellent use of named exports for shared components.

The export structure in this file is well-organized and follows best practices:

  1. Named exports facilitate effective tree-shaking, allowing consumers to import only the components they need.
  2. Each component is exported from its own file, promoting modularity and easier maintenance.
  3. The consistent naming convention (file name matches export name) enhances readability and maintainability.

This shared components structure aligns well with the PR objective of enabling code sharing among applications in the "inao" folder, potentially reducing code duplication and improving maintainability.

To further improve type safety and developer experience, consider creating an index.d.ts file to explicitly define and export the types for these components if not already done.

libs/application/templates/inao/financial-statement-political-party/src/fields/PartyOverview/PartyOverview.tsx (4)

70-78: Improved AboutOverview component structure

The refactoring of the AboutOverview component to accept multiple specific props instead of a single 'answers' object enhances its reusability and type safety. This change aligns well with best practices for component design.

For consistency, consider destructuring the 'm' object in the component's props or at the beginning of the component to make the code more readable:

const { fullName, nationalId, powerOfAttorneyName, powerOfAttorneyNationalId, email, phoneNumber } = m;

<AboutOverview
  about={answers.about}
  fullName={fullName}
  nationalId={nationalId}
  powerOfAttorneyName={powerOfAttorneyName}
  powerOfAttorneyNationalId={powerOfAttorneyNationalId}
  email={email}
  phoneNumber={phoneNumber}
/>

This change would make the component usage cleaner and more consistent with typical React patterns.


163-171: Enhanced CapitalNumberOverview component structure

The refactoring of the CapitalNumberOverview component to accept specific props instead of a single object improves its reusability and type safety. This change aligns well with best practices for component design and the overall goal of the PR to enhance code sharing.

For consistency and improved readability, consider destructuring the 'm' object and 'answers.capitalNumbers' at the component level:

const { capitalNumbers, capitalIncome, capitalCost, totalCapital } = m;
const { capitalIncome: capitalIncomeValue, capitalCost: capitalCostValue, total } = answers.capitalNumbers;

<CapitalNumberOverview
  capitalNumbersMessage={capitalNumbers}
  capitalIncomeMessage={capitalIncome}
  capitalIncome={capitalIncomeValue}
  capitalCostMessage={capitalCost}
  capitalCost={capitalCostValue}
  totalCapitalMessage={totalCapital}
  total={total}
/>

This change would make the component usage cleaner and more consistent with typical React patterns.


181-196: Greatly improved AssetDebtEquityOverview component structure

The refactoring of the AssetDebtEquityOverview component to accept specific props instead of a single object significantly enhances its reusability and type safety. This change aligns perfectly with the PR's goal of improving code sharing and maintainability.

To further improve readability and consistency, consider destructuring the 'm' object and 'answers' at the component level:

const {
  fixedAssetsTotal, currentAssets, totalAssets, longTerm, shortTerm,
  totalLiabilities, equity: equityTitle, debtsAndCash, properties, debtsAndEquity
} = m;

const { liability, asset, equity, equityAndLiabilities } = answers;

<AssetDebtEquityOverview
  liability={liability}
  asset={asset}
  equity={equity}
  equityAndLiabilities={equityAndLiabilities}
  fixedAssetsTotal={fixedAssetsTotal}
  currentAssets={currentAssets}
  totalAssets={totalAssets}
  longTerm={longTerm}
  shortTerm={shortTerm}
  totalLiabilities={totalLiabilities}
  equityTitle={equityTitle}
  debtsAndCash={debtsAndCash}
  properties={properties}
  debtsAndEquity={debtsAndEquity}
/>

This change would enhance the component's readability and make it more consistent with React best practices.


Line range hint 1-257: Excellent refactoring for improved code sharing and maintainability

The changes made to this file significantly enhance code sharing and reduce duplication, aligning perfectly with the PR objectives. Key improvements include:

  1. Updated import statements using shared components
  2. Refactored components to accept more specific props, improving type safety and flexibility
  3. Consistent separation of data and localization messages in prop assignments

To further improve the code, consider implementing a custom hook for managing the form state and submission logic. This would help to separate concerns and make the component more focused on rendering. For example:

const usePartyOverviewForm = (application, refetch) => {
  const [approveOverview, setApproveOverview] = useState(false);
  const { setError, setValue, formState: { errors } } = useFormContext();
  const [submitApplication, { error: submitError, loading }] = useSubmitApplication({
    application,
    refetch,
    event: DefaultEvents.SUBMIT,
  });

  const onSendButtonClick = () => {
    if (approveOverview) {
      submitApplication();
    } else {
      setError('applicationApprove', { type: 'error' });
    }
  };

  return {
    approveOverview,
    setApproveOverview,
    errors,
    submitError,
    loading,
    onSendButtonClick,
    setValue,
  };
};

This hook could then be used in the PartyOverview component, making it more readable and maintainable.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 945268f and 64f5872.

📒 Files selected for processing (61)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryCareteker/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryEquities/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOperation/CemeteryExpenses.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOperation/CemeteryIncome.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOperation/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOverview/index.tsx (5 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/DelegationCheck/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/KeyNumbersCapital/index.tsx (2 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/OperatingYear/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/PowerOfAttorney/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/cemeteryFinancialStatementSection/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/cemeteryKeyNumbersSection/capitalNumberSubSection.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/clientInfoSection/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/forms/done/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/forms/prerequisites/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/hooks/useTotals.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/utils/helpers.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionEquities/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionInfoFields/ElectionSelect.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionInfoFields/IncomeLimitFields.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionInfoFields/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionStatement/index.tsx (2 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/Expenses.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/Income.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/KeyNumbersCapital/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/Overview/index.tsx (5 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/documentsSection/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/electionInfoSection/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/individualKeyNumbersSection/capitalNumbersSection.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/individualKeyNumbersSection/equitiesAndLiabilitiesSubSection.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/individualKeyNumbersSection/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/overviewSection/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/done/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/prerequisites/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/hooks/useTotals.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/lib/utils/dataSchema.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/DelegationCheck/DelegationCheck.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/ElectionEquities/ElectionEquities.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/ElectionStatement/ElectionStatement.tsx (2 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/KeyNumbersCapital/KeyNumbersCapital.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/OperatingYear/OperatingYear.tsx (2 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/Overview/Overview.tsx (5 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/PartyOperatingIncome/PartyExpenses.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/PartyOperatingIncome/PartyIncome.tsx (5 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/PartyOperatingIncome/PartyOperatingIncome.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/PartyOverview/PartyOverview.tsx (5 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/PowerOfAttorneyFields/PowerOfAttorneyFields.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/clientInfoSection/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/capitalNumbersSubsection/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/equitiesAndLiabilitiesSubsection/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/financialStatementSection/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/overviewSection/overviewMultiField.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/forms/done/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/forms/prerequsites/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/hooks/useTotals.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/lib/dataSchema.ts (1 hunks)
  • libs/application/templates/inao/shared/components/index.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • libs/application/templates/inao/financial-statement-individual-election/src/lib/utils/dataSchema.ts
🚧 Files skipped from review as they are similar to previous changes (52)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryCareteker/index.tsx
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryEquities/index.tsx
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOperation/CemeteryExpenses.tsx
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOperation/CemeteryIncome.tsx
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOperation/index.tsx
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/DelegationCheck/index.tsx
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/KeyNumbersCapital/index.tsx
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/OperatingYear/index.tsx
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/PowerOfAttorney/index.tsx
  • libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/cemeteryFinancialStatementSection/index.ts
  • libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/cemeteryKeyNumbersSection/capitalNumberSubSection.ts
  • libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/clientInfoSection/index.ts
  • libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/index.ts
  • libs/application/templates/inao/financial-statement-cemetery/src/forms/done/index.ts
  • libs/application/templates/inao/financial-statement-cemetery/src/forms/prerequisites/index.ts
  • libs/application/templates/inao/financial-statement-cemetery/src/hooks/useTotals.ts
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionEquities/index.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionInfoFields/ElectionSelect.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionInfoFields/IncomeLimitFields.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionInfoFields/index.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/Expenses.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/Income.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/index.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/KeyNumbersCapital/index.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/Overview/index.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/documentsSection/index.ts
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/electionInfoSection/index.ts
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/index.ts
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/individualKeyNumbersSection/capitalNumbersSection.ts
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/individualKeyNumbersSection/equitiesAndLiabilitiesSubSection.ts
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/individualKeyNumbersSection/index.ts
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/overviewSection/index.ts
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/done/index.ts
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/prerequisites/index.ts
  • libs/application/templates/inao/financial-statement-individual-election/src/hooks/useTotals.ts
  • libs/application/templates/inao/financial-statement-political-party/src/fields/DelegationCheck/DelegationCheck.tsx
  • libs/application/templates/inao/financial-statement-political-party/src/fields/ElectionEquities/ElectionEquities.tsx
  • libs/application/templates/inao/financial-statement-political-party/src/fields/ElectionStatement/ElectionStatement.tsx
  • libs/application/templates/inao/financial-statement-political-party/src/fields/KeyNumbersCapital/KeyNumbersCapital.tsx
  • libs/application/templates/inao/financial-statement-political-party/src/fields/OperatingYear/OperatingYear.tsx
  • libs/application/templates/inao/financial-statement-political-party/src/fields/PartyOperatingIncome/PartyExpenses.tsx
  • libs/application/templates/inao/financial-statement-political-party/src/fields/PartyOperatingIncome/PartyIncome.tsx
  • libs/application/templates/inao/financial-statement-political-party/src/fields/PartyOperatingIncome/PartyOperatingIncome.tsx
  • libs/application/templates/inao/financial-statement-political-party/src/fields/PowerOfAttorneyFields/PowerOfAttorneyFields.tsx
  • libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/clientInfoSection/index.ts
  • libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/index.ts
  • libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/capitalNumbersSubsection/index.ts
  • libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/equitiesAndLiabilitiesSubsection/index.ts
  • libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/financialStatementSection/index.ts
  • libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/overviewSection/overviewMultiField.ts
  • libs/application/templates/inao/financial-statement-political-party/src/forms/done/index.ts
  • libs/application/templates/inao/financial-statement-political-party/src/forms/prerequsites/index.ts
🧰 Additional context used
📓 Path-based instructions (8)
libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOverview/index.tsx (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-cemetery/src/utils/helpers.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/application/templates/inao/financial-statement-individual-election/src/fields/ElectionStatement/index.tsx (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-political-party/src/fields/Overview/Overview.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/application/templates/inao/financial-statement-political-party/src/fields/PartyOverview/PartyOverview.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/application/templates/inao/financial-statement-political-party/src/hooks/useTotals.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/application/templates/inao/financial-statement-political-party/src/lib/dataSchema.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/application/templates/inao/shared/components/index.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
🔇 Additional comments (28)
libs/application/templates/inao/financial-statement-political-party/src/hooks/useTotals.tsx (3)

3-3: Excellent move towards code sharing!

The change in the import statement for getTotal aligns perfectly with the PR objective of enabling code sharing among applications in the "inao" folder. By moving to a shared utility module, this change helps reduce code duplication and improves maintainability.


Line range hint 1-21: Adherence to coding guidelines confirmed

This file adheres well to the coding guidelines for libs/**/*:

  1. The useTotals hook is reusable across different NextJS apps.
  2. TypeScript is used effectively for defining the hook's signature and return type.
  3. The hook is exported, supporting effective tree-shaking and bundling practices.

Line range hint 5-21: Well-implemented hook with clean logic

The useTotals hook is well-implemented:

  • It makes appropriate use of React hooks (useState, useEffect, useCallback).
  • The logic is concise and focused on a single responsibility.
  • It integrates well with react-hook-form through useFormContext.

The overall implementation is clean and follows React best practices.

libs/application/templates/inao/financial-statement-cemetery/src/utils/helpers.ts (4)

7-10: LGTM: New imports from shared utilities.

The addition of imports from the shared utilities file aligns with the PR objective of enabling code sharing between applications. This change enhances reusability and reduces code duplication.


Line range hint 1-78: LGTM: Adherence to coding guidelines.

The file adheres to the coding guidelines for libs/**/*:

  • Components and hooks are reusable across different NextJS apps.
  • TypeScript is used for defining props and exporting types.
  • The code structure supports effective tree-shaking and bundling practices.

The remaining functions (getBoardmembersAndCaretakers, isCemetryUnderFinancialLimit, possibleOperatingYears, getConfigInfoForKey) are well-structured and maintain their functionality.


2-2: ⚠️ Potential issue

Fix the typo in 'BOARDMEMEBER' constant import.

The typo in the BOARDMEMEBER constant import persists from the previous review. This should be corrected to BOARDMEMBER.

Apply this diff to fix the typo:

-import { BOARDMEMEBER, CARETAKER } from './constants'
+import { BOARDMEMBER, CARETAKER } from './constants'

1-11: LGTM: Removal of redundant functions.

The removal of getTotal, currencyStringToNumber, getCurrentUserType, and formatCurrency functions, and their subsequent import from shared utilities, aligns with the PR objective of enabling code sharing between applications. This change reduces code duplication and improves maintainability.

Let's verify that these imported functions are correctly used throughout the codebase:

✅ Verification successful

Verified: Shared utility functions are correctly integrated.

The imported functions getCurrentUserType and currencyStringToNumber are correctly used across the codebase, ensuring that the removal of redundant functions enhances code sharing and maintainability.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

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

# Test: Search for usages of getCurrentUserType and currencyStringToNumber
echo "Checking usage of getCurrentUserType:"
rg "getCurrentUserType\(" --type ts
echo "Checking usage of currencyStringToNumber:"
rg "currencyStringToNumber\(" --type ts

Length of output: 6208

libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionStatement/index.tsx (4)

9-13: LGTM: Import statements updated to use shared components and utilities.

The changes in import statements align well with the PR objective of enabling code sharing among applications. The use of shared components (BottomBar) and utilities (formatNumber, GREATER) from centralized locations enhances reusability across different NextJS apps, which is a key aspect of the coding guidelines for this project.


Line range hint 35-43: LGTM: Consistent logic with shared constant usage.

The onBackButtonClick function maintains its original logic while now utilizing the GREATER constant from a shared location. This change aligns with the project's goal of code sharing and consistency across applications.


81-82: LGTM: Updated BottomBar props for improved localization.

The changes to the BottomBar component props (send and goBack instead of sendText) align with the previous discussions in the PR comments. This modification simplifies the component usage and potentially improves localization handling by directly using the messages from the m object. The use of the shared BottomBar component also supports the project's goal of enhancing reusability across applications.


Line range hint 1-85: LGTM: Successfully implemented code sharing and improved modularity.

The changes in this file effectively implement the PR objectives of enabling code sharing and reducing duplication. Key improvements include:

  1. Updated import statements to use shared utilities and components.
  2. Consistent usage of constants from shared locations.
  3. Modified BottomBar component usage for better localization support.

These changes enhance the reusability of components across different NextJS apps while maintaining the overall functionality of the ElectionStatement component. The modifications adhere to the project's coding guidelines, particularly in terms of TypeScript usage and effective bundling practices.

libs/application/templates/inao/financial-statement-political-party/src/lib/dataSchema.ts (1)

5-5: Import path updated to use shared utilities.

The import path for checkIfNegative has been updated to use a shared utility path. This change aligns with the PR objective of enabling code sharing among applications in the "inao" folder.

To ensure consistency across the project, let's verify if other files are using the same import path for shared utilities:

libs/application/templates/inao/financial-statement-political-party/src/fields/PartyOverview/PartyOverview.tsx (3)

19-29: Excellent refactoring of import statements

The updated import paths now utilize shared components from a centralized location. This change aligns perfectly with the PR objective of enabling code sharing among applications in the "inao" folder. It enhances code reusability, reduces duplication, and improves overall maintainability.


253-254: Improved BottomBar component with localization support

The addition of 'goBack' and 'send' props to the BottomBar component enhances its flexibility and reusability. By using values from the 'm' object, proper localization is ensured. This change aligns well with the PR's objective of improving code sharing and maintainability across applications.


201-204: ⚠️ Potential issue

Potential issue with FileValueLine component props

The addition of the 'files' prop to the FileValueLine component enhances its flexibility. However, there's a potential issue with the value being passed to this prop.

It appears that 'm.files' is being passed to the 'files' prop. If 'm' is an object containing localization messages, this might not be the correct data for the 'files' prop. The 'files' prop likely expects an array of file objects or similar file-related data.

Consider updating the prop assignment as follows:

<FileValueLine
  label={answers.attachments?.file?.[0]?.name}
  files={answers.attachments?.file}
/>

This change assumes that 'answers.attachments?.file' contains the actual file data. Please verify this and adjust accordingly based on your data structure.

libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOverview/index.tsx (7)

21-21: LGTM: Improved code sharing and reusability

The updated import statements now use shared components and utilities from a central location. This change aligns well with the PR objective of enabling code sharing between applications in the "inao" folder, reducing code duplication and improving maintainability.

Also applies to: 28-33


90-98: LGTM: Enhanced AboutOverview component usage

The AboutOverview component now receives more detailed props, improving its flexibility and reusability. This change allows for better data management and aligns with the goal of sharing code between applications.


187-195: LGTM: Improved CapitalNumberOverview component usage

The CapitalNumberOverview component now receives more detailed props, enhancing its flexibility and reusability. This change allows for better data management and aligns with the goal of sharing code between applications.


329-332: Verify the 'files' prop in FileValueLine component

The FileValueLine component now includes a 'files' prop, which is set to 'm.files'. This change partially addresses a previous comment about a potential mismatch in props. However, it's unclear if 'm.files' is the correct value for this prop.

Please verify that 'm.files' contains the expected file data array. If it doesn't, consider using 'answers.attachments?.file' instead, as suggested in the previous review.


395-396: LGTM: Enhanced BottomBar component customization

The BottomBar component now receives 'goBack' and 'send' props, allowing for customization of button labels. This change improves the component's flexibility and reusability across different contexts.


Line range hint 1-399: LGTM: Improved component structure and code sharing

The overall structure of the CemeteryOverview component has been updated to use shared components, improving code reusability and maintainability. The existing functionality and logic for rendering different sections have been preserved, ensuring that the changes don't introduce regressions.


Line range hint 1-399: Adherence to coding guidelines confirmed

The changes in this file adhere to the provided coding guidelines for files in the 'libs' directory:

  1. The components and hooks are designed for reusability across different NextJS apps.
  2. TypeScript is used for defining props and exporting types.
  3. The use of shared components and utilities supports effective tree-shaking and bundling practices.
libs/application/templates/inao/financial-statement-political-party/src/fields/Overview/Overview.tsx (6)

20-29: Imports updated to shared directories for improved reusability

The changes in the import statements enhance code reusability across different NextJS applications by referencing shared components and utilities.


79-87: Ensure correct data is passed to AboutOverview component


108-116: Ensure correct data and messages in CapitalNumberOverview component


125-140: Adjust message props in AssetDebtEquityOverview component


148-149: Confirm props for FileValueLine component


201-202: Format messages passed to BottomBar component

Comment on lines +330 to +331
label={answers.attachments?.file?.[0]?.name}
files={m.files}
Copy link
Member

Choose a reason for hiding this comment

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

CodeRabbit has some valid concerns here, for example this; shouldn't it be the other way around?
Also other things Coderabbit mentioned

@jonnigs jonnigs requested a review from a team as a code owner October 22, 2024 14:00
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 (12)
libs/application/templates/inao/shared/components/Logo.tsx (2)

10-23: LGTM: Logo component is well-implemented with good internationalization support.

The Logo component is efficiently implemented as a functional component, adhering to React best practices. It effectively uses the useLocale hook for internationalization and conditionally renders content based on provided props. The use of Box and Text components from the island-ui/core package ensures consistency with the project's design system.

Consider extracting the default strings ('Ríkisendurskoðun' and 'RÍKISENDURSKOÐUN') into constants at the top of the file. This would improve maintainability and make it easier to update these defaults if needed in the future.

const DEFAULT_SERVICE_PROVIDER = 'Ríkisendurskoðun';
const DEFAULT_INAO = 'RÍKISENDURSKOÐUN';

// Then in the component:
{serviceProvider ? formatMessage(serviceProvider) : DEFAULT_SERVICE_PROVIDER}
// and
{inao ? formatMessage(inao).toUpperCase() : DEFAULT_INAO}

1-23: Great job on implementing a reusable and flexible Logo component!

This new Logo component aligns perfectly with the PR objectives of enabling code sharing and reducing duplication. It's well-structured, uses TypeScript effectively, and supports internationalization. The component's design allows for easy reuse across different applications in the inao folder, which will help in reducing template bloat and improving overall code maintainability.

As you continue to develop shared components, consider creating a component library or a dedicated package for these shared elements. This approach can further enhance reusability and make it easier to manage and update shared components across the entire project.

libs/application/templates/inao/shared/index.ts (3)

8-16: LGTM: Component exports are well-structured.

The component exports are clearly defined and follow a consistent pattern. This structure enhances modularity and makes it easy to import shared components across the application.

Consider grouping related components (e.g., AboutOverview, AssetDebtEquityOverview, CapitalNumberOverview) together in the export list for better organization.


18-32: LGTM: Constant exports are well-defined.

The constant exports are clearly structured and follow naming conventions. Centralizing these constants in a shared file promotes consistency across the application.

Consider grouping related constants (e.g., GREATER, LESS, TOTAL) into objects or enums for better organization and to avoid potential naming conflicts in the global scope.


37-45: LGTM: Helper function exports are well-organized.

The helper function exports are clearly defined and follow a consistent naming convention. Centralizing these utilities in a shared file promotes code reuse and maintainability across the application.

Consider grouping related helper functions (e.g., formatNumber, formatCurrency) into separate utility modules (e.g., numberUtils, currencyUtils) for better organization and potential tree-shaking benefits.

libs/application/templates/inao/financial-statement-cemetery/src/utils/helpers.ts (2)

Line range hint 13-22: Update 'BOARDMEMEBER' usage in getBoardmembersAndCaretakers function

Once the import is corrected, update the usage of the constant in this function.

Apply this diff to fix the constant usage:

   const boardMembers = members
-    ?.filter((member) => member.role === BOARDMEMEBER)
+    ?.filter((member) => member.role === BOARDMEMBER)
     ?.map((member) => member.nationalId)

Line range hint 24-48: LGTM: Using shared utility functions in isCemetryUnderFinancialLimit

The function now uses shared utility functions, which aligns with the PR objectives. The core logic remains unchanged, preserving functionality.

Consider using object destructuring for a cleaner code structure:

-  const applicationAnswers = answers as FinancialStatementCemetery
-  const careTakerLimit =
-    applicationAnswers.cemeteryOperation?.incomeLimit ?? '0'
-  const fixedAssetsTotal = applicationAnswers.cemeteryAsset?.fixedAssetsTotal
+  const {
+    cemeteryOperation,
+    cemeteryAsset,
+    cemeteryIncome,
+    cemeteryLiability
+  } = answers as FinancialStatementCemetery
+  const careTakerLimit = cemeteryOperation?.incomeLimit ?? '0'
+  const fixedAssetsTotal = cemeteryAsset?.fixedAssetsTotal
   const isCemetry = userType === FSIUSERTYPE.CEMETRY
-  const totalIncome = isCemetry ? applicationAnswers.cemeteryIncome?.total : '0'
-  const longTermDebt = applicationAnswers.cemeteryLiability?.longTerm
+  const totalIncome = isCemetry ? cemeteryIncome?.total : '0'
+  const longTermDebt = cemeteryLiability?.longTerm
libs/application/templates/inao/financial-statement-political-party/src/fields/PartyOverview/PartyOverview.tsx (5)

20-29: LGTM! Consider adding type imports for better TypeScript integration.

The updated import statements from the shared directory align well with the coding guideline for reusability across different NextJS apps. This change promotes code reuse and maintainability.

To further improve TypeScript integration, consider explicitly importing types:

import type { FormatCurrency, FileValueLineProps /* ... other types */ } from '@island.is/application/templates/inao/shared'

This approach enhances type safety and can potentially improve tree-shaking.


70-78: LGTM! Consider adding explicit prop types for enhanced type safety.

The updated AboutOverview component with granular props improves reusability and flexibility. This aligns well with our coding guidelines.

To further enhance type safety and documentation, consider defining an explicit interface for the component props:

interface AboutOverviewProps {
  about: string;
  fullName: string;
  nationalId: string;
  powerOfAttorneyName: string;
  powerOfAttorneyNationalId: string;
  email: string;
  phoneNumber: string;
}

const AboutOverview: React.FC<AboutOverviewProps> = ({ ... }) => { ... }

This approach provides better IntelliSense support and makes the component's API more clear to other developers.


163-171: LGTM! Consider adding explicit prop types for better type safety.

The updated CapitalNumberOverview component with granular props enhances reusability and flexibility, aligning well with our coding guidelines.

To further improve type safety and documentation, consider defining an explicit interface for the component props:

interface CapitalNumberOverviewProps {
  capitalNumbersMessage: string;
  capitalIncomeMessage: string;
  capitalIncome: number;
  capitalCostMessage: string;
  capitalCost: number;
  totalCapitalMessage: string;
  total: number;
}

const CapitalNumberOverview: React.FC<CapitalNumberOverviewProps> = ({ ... }) => { ... }

This approach provides better IntelliSense support and makes the component's API more clear to other developers.


181-196: LGTM! Consider adding explicit prop types for improved type safety.

The updated AssetDebtEquityOverview component with granular props enhances reusability and flexibility, aligning well with our coding guidelines.

To further improve type safety and documentation, consider defining an explicit interface for the component props:

interface AssetDebtEquityOverviewProps {
  liability: any; // Replace 'any' with the actual type
  asset: any; // Replace 'any' with the actual type
  equity: any; // Replace 'any' with the actual type
  equityAndLiabilities: any; // Replace 'any' with the actual type
  fixedAssetsTotal: string;
  currentAssets: string;
  totalAssets: string;
  longTerm: string;
  shortTerm: string;
  totalLiabilities: string;
  equityTitle: string;
  debtsAndCash: string;
  properties: string;
  debtsAndEquity: string;
}

const AssetDebtEquityOverview: React.FC<AssetDebtEquityOverviewProps> = ({ ... }) => { ... }

This approach provides better IntelliSense support and makes the component's API more clear to other developers. Make sure to replace the 'any' types with the actual types used in your application.


253-254: LGTM! Consider adding explicit prop types for enhanced type safety.

The updated BottomBar component with 'goBack' and 'send' props improves reusability and flexibility, aligning well with our coding guidelines.

To further enhance type safety and documentation, consider updating the component's prop interface (if it exists) or creating one:

interface BottomBarProps {
  loading: boolean;
  onSendButtonClick: () => void;
  onBackButtonClick: () => void;
  goBack: string;
  send: string;
}

const BottomBar: React.FC<BottomBarProps> = ({ ... }) => { ... }

This approach provides better IntelliSense support and makes the component's API more clear to other developers.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 64f5872 and 55ffd7a.

📒 Files selected for processing (63)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryCareteker/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryEquities/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOperation/CemeteryExpenses.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOperation/CemeteryIncome.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOperation/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOverview/index.tsx (5 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/DelegationCheck/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/KeyNumbersCapital/index.tsx (2 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/OperatingYear/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/PowerOfAttorney/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/cemeteryFinancialStatementSection/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/cemeteryKeyNumbersSection/capitalNumberSubSection.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/clientInfoSection/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/forms/done/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/forms/prerequisites/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/hooks/useTotals.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-cemetery/src/utils/helpers.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionEquities/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionInfoFields/ElectionSelect.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionInfoFields/IncomeLimitFields.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionInfoFields/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionStatement/index.tsx (2 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/Expenses.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/Income.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/KeyNumbersCapital/index.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/Overview/index.tsx (5 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/documentsSection/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/electionInfoSection/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/individualKeyNumbersSection/capitalNumbersSection.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/individualKeyNumbersSection/equitiesAndLiabilitiesSubSection.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/individualKeyNumbersSection/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/overviewSection/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/done/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/prerequisites/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/hooks/useTotals.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-individual-election/src/lib/utils/dataSchema.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/DelegationCheck/DelegationCheck.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/ElectionEquities/ElectionEquities.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/ElectionStatement/ElectionStatement.tsx (2 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/KeyNumbersCapital/KeyNumbersCapital.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/OperatingYear/OperatingYear.tsx (2 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/Overview/Overview.tsx (5 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/PartyOperatingIncome/PartyExpenses.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/PartyOperatingIncome/PartyIncome.tsx (5 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/PartyOperatingIncome/PartyOperatingIncome.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/PartyOverview/PartyOverview.tsx (5 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/fields/PowerOfAttorneyFields/PowerOfAttorneyFields.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/clientInfoSection/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/capitalNumbersSubsection/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/equitiesAndLiabilitiesSubsection/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/financialStatementSection/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/overviewSection/overviewMultiField.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/forms/done/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/forms/prerequsites/index.ts (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/hooks/useTotals.tsx (1 hunks)
  • libs/application/templates/inao/financial-statement-political-party/src/lib/dataSchema.ts (1 hunks)
  • libs/application/templates/inao/shared/components/Logo.tsx (1 hunks)
  • libs/application/templates/inao/shared/index.ts (1 hunks)
  • tsconfig.base.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOperation/CemeteryIncome.tsx
🚧 Files skipped from review as they are similar to previous changes (54)
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryCareteker/index.tsx
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryEquities/index.tsx
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOperation/CemeteryExpenses.tsx
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOperation/index.tsx
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/DelegationCheck/index.tsx
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/KeyNumbersCapital/index.tsx
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/OperatingYear/index.tsx
  • libs/application/templates/inao/financial-statement-cemetery/src/fields/PowerOfAttorney/index.tsx
  • libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/cemeteryFinancialStatementSection/index.ts
  • libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/cemeteryKeyNumbersSection/capitalNumberSubSection.ts
  • libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/clientInfoSection/index.ts
  • libs/application/templates/inao/financial-statement-cemetery/src/forms/applicationForm/index.ts
  • libs/application/templates/inao/financial-statement-cemetery/src/forms/done/index.ts
  • libs/application/templates/inao/financial-statement-cemetery/src/forms/prerequisites/index.ts
  • libs/application/templates/inao/financial-statement-cemetery/src/hooks/useTotals.ts
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionEquities/index.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionInfoFields/ElectionSelect.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionInfoFields/IncomeLimitFields.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionInfoFields/index.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/ElectionStatement/index.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/Expenses.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/Income.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/IndividualElectionOperatingIncome/index.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/fields/KeyNumbersCapital/index.tsx
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/documentsSection/index.ts
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/electionInfoSection/index.ts
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/index.ts
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/individualKeyNumbersSection/capitalNumbersSection.ts
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/individualKeyNumbersSection/equitiesAndLiabilitiesSubSection.ts
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/individualKeyNumbersSection/index.ts
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/applicationForm/overviewSection/index.ts
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/done/index.ts
  • libs/application/templates/inao/financial-statement-individual-election/src/forms/prerequisites/index.ts
  • libs/application/templates/inao/financial-statement-individual-election/src/hooks/useTotals.ts
  • libs/application/templates/inao/financial-statement-individual-election/src/lib/utils/dataSchema.ts
  • libs/application/templates/inao/financial-statement-political-party/src/fields/DelegationCheck/DelegationCheck.tsx
  • libs/application/templates/inao/financial-statement-political-party/src/fields/ElectionEquities/ElectionEquities.tsx
  • libs/application/templates/inao/financial-statement-political-party/src/fields/ElectionStatement/ElectionStatement.tsx
  • libs/application/templates/inao/financial-statement-political-party/src/fields/KeyNumbersCapital/KeyNumbersCapital.tsx
  • libs/application/templates/inao/financial-statement-political-party/src/fields/OperatingYear/OperatingYear.tsx
  • libs/application/templates/inao/financial-statement-political-party/src/fields/PartyOperatingIncome/PartyExpenses.tsx
  • libs/application/templates/inao/financial-statement-political-party/src/fields/PartyOperatingIncome/PartyIncome.tsx
  • libs/application/templates/inao/financial-statement-political-party/src/fields/PartyOperatingIncome/PartyOperatingIncome.tsx
  • libs/application/templates/inao/financial-statement-political-party/src/fields/PowerOfAttorneyFields/PowerOfAttorneyFields.tsx
  • libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/clientInfoSection/index.ts
  • libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/index.ts
  • libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/capitalNumbersSubsection/index.ts
  • libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/equitiesAndLiabilitiesSubsection/index.ts
  • libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/financialStatementSection/index.ts
  • libs/application/templates/inao/financial-statement-political-party/src/forms/applicationForm/keyNumbersSection/overviewSection/overviewMultiField.ts
  • libs/application/templates/inao/financial-statement-political-party/src/forms/done/index.ts
  • libs/application/templates/inao/financial-statement-political-party/src/forms/prerequsites/index.ts
  • libs/application/templates/inao/financial-statement-political-party/src/hooks/useTotals.tsx
  • libs/application/templates/inao/financial-statement-political-party/src/lib/dataSchema.ts
🧰 Additional context used
📓 Path-based instructions (7)
libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOverview/index.tsx (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-cemetery/src/utils/helpers.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/application/templates/inao/financial-statement-individual-election/src/fields/Overview/index.tsx (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/inao/financial-statement-political-party/src/fields/Overview/Overview.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/application/templates/inao/financial-statement-political-party/src/fields/PartyOverview/PartyOverview.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/application/templates/inao/shared/components/Logo.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/application/templates/inao/shared/index.ts (1)

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

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
🔇 Additional comments (22)
libs/application/templates/inao/shared/components/Logo.tsx (2)

1-3: LGTM: Imports are well-structured and support reusability.

The imports are appropriately chosen, using named imports which support effective tree-shaking. The use of @island.is packages and react-intl aligns with the project's architecture and internationalization requirements.


5-8: LGTM: Props type is well-defined and supports flexibility.

The Props type is correctly defined using TypeScript, adhering to the coding guidelines. The optional properties allow for flexible usage of the component, and the use of MessageDescriptor type supports proper internationalization.

libs/application/templates/inao/shared/index.ts (3)

1-6: LGTM: CSS exports are well-organized.

The CSS exports are clearly defined and follow a logical structure. This approach promotes reusability across different components.


34-35: LGTM: Enum export is appropriate.

Exporting the FSIUSERTYPE enum from a dedicated enums file is a good practice. It centralizes type definitions and makes them easily accessible across the application.


1-45: Great job on centralizing shared resources!

This index file successfully centralizes shared resources for the INAO application, promoting code reuse and maintainability. The structure adheres to the coding guidelines by:

  1. Enhancing reusability of components and utilities across different NextJS apps.
  2. Using TypeScript for exporting types (implied by the .ts extension).
  3. Organizing exports in a way that supports effective tree-shaking and bundling.

The clear separation of concerns (CSS, components, constants, enums, and helpers) makes it easy for developers to locate and import the required resources.

libs/application/templates/inao/financial-statement-cemetery/src/utils/helpers.ts (1)

7-10: LGTM: Importing shared utility functions

The new imports from the shared utility file align with the PR objective of sharing code between applications, reducing duplication and improving maintainability.

libs/application/templates/inao/financial-statement-political-party/src/fields/Overview/Overview.tsx (5)

21-29: LGTM: Improved code organization with shared imports

The updated import statements now source components and constants from a shared directory, which aligns with the PR objective of enabling code sharing among applications. This change enhances code reusability and maintainability.


125-140: Format message props in AssetDebtEquityOverview component

The AssetDebtEquityOverview component is receiving several props directly from the m object, which likely contains message definitions. These props might need to be formatted using formatMessage to display the correct localized text.

Consider updating the props to use formatted messages:

<AssetDebtEquityOverview
  liability={answers.liability}
  asset={answers.asset}
  equity={answers.equity}
  equityAndLiabilities={answers.equityAndLiabilities}
- fixedAssetsTotal={m.fixedAssetsTotal}
- currentAssets={m.currentAssets}
- totalAssets={m.totalAssets}
- longTerm={m.longTerm}
- shortTerm={m.shortTerm}
- totalLiabilities={m.totalLiabilities}
- equityTitle={m.equity}
- debtsAndCash={m.debtsAndCash}
- properties={m.properties}
- debtsAndEquity={m.debtsAndEquity}
+ fixedAssetsTotal={formatMessage(m.fixedAssetsTotal)}
+ currentAssets={formatMessage(m.currentAssets)}
+ totalAssets={formatMessage(m.totalAssets)}
+ longTerm={formatMessage(m.longTerm)}
+ shortTerm={formatMessage(m.shortTerm)}
+ totalLiabilities={formatMessage(m.totalLiabilities)}
+ equityTitle={formatMessage(m.equity)}
+ debtsAndCash={formatMessage(m.debtsAndCash)}
+ properties={formatMessage(m.properties)}
+ debtsAndEquity={formatMessage(m.debtsAndEquity)}
/>

201-202: Format message props in BottomBar component

The BottomBar component is receiving 'goBack' and 'send' props directly from the m object. These props likely need to be formatted using formatMessage to display the correct localized text.

Consider updating the props:

<BottomBar
  loading={loading}
  onSendButtonClick={onSendButtonClick}
  onBackButtonClick={onBackButtonClick}
- goBack={m.goBack}
- send={m.send}
+ goBack={formatMessage(m.goBack)}
+ send={formatMessage(m.send)}
/>

108-116: ⚠️ Potential issue

Ensure correct prop types in CapitalNumberOverview component

The CapitalNumberOverview component is receiving a mix of message objects and data values as props. Ensure that the component is expecting the correct types for each prop.

Consider updating the props that receive message objects:

<CapitalNumberOverview
- capitalNumbersMessage={m.capitalNumbers}
- capitalIncomeMessage={m.capitalIncome}
  capitalIncome={answers.capitalNumbers.capitalIncome}
- capitalCostMessage={m.capitalCost}
  capitalCost={answers.capitalNumbers.capitalCost}
- totalCapitalMessage={m.totalCapital}
  total={answers.capitalNumbers.total}
+ capitalNumbersMessage={formatMessage(m.capitalNumbers)}
+ capitalIncomeMessage={formatMessage(m.capitalIncome)}
+ capitalCostMessage={formatMessage(m.capitalCost)}
+ totalCapitalMessage={formatMessage(m.totalCapital)}
/>

Likely invalid or redundant comment.


147-150: ⚠️ Potential issue

Verify the 'files' prop in FileValueLine component

The FileValueLine component is receiving a 'files' prop that is assigned m.files, which appears to be a message object. If this prop is intended to receive file data, passing a message object may cause issues.

Consider updating the prop if it should receive file data:

<FileValueLine
  label={answers.attachments?.file?.[0]?.name}
- files={m.files}
+ files={answers.attachments?.file}
/>

If 'files' is meant to be a label, consider renaming the prop for clarity.

Likely invalid or redundant comment.

libs/application/templates/inao/financial-statement-political-party/src/fields/PartyOverview/PartyOverview.tsx (1)

Line range hint 1-257: Overall, great job on improving component reusability and flexibility!

The changes in this file consistently enhance the modularity and reusability of components by breaking down props into more granular pieces. This aligns well with the coding guidelines for libs/**/* files, particularly in terms of reusability across different NextJS apps.

To further improve the code:

  1. Consider adding explicit TypeScript interfaces for all component props. This will enhance type safety, improve documentation, and provide better IntelliSense support.
  2. Ensure that any shared types are exported from the shared directory, promoting better type consistency across the application.
  3. Review the components in the shared directory to ensure they are truly reusable and don't contain any application-specific logic.

These changes set a good foundation for maintainable and reusable code. Great work!

tsconfig.base.json (1)

429-431: LGTM: New path mapping aligns with PR objectives.

The addition of the new path mapping for @island.is/application/templates/inao/shared is a positive change. It enables code sharing among applications in the "inao" folder, which aligns perfectly with the PR's objective of reducing code duplication and improving maintainability.

libs/application/templates/inao/financial-statement-individual-election/src/fields/Overview/index.tsx (5)

78-86: ⚠️ Potential issue

Verify prop types for AboutOverview component

Ensure that the props passed to AboutOverview match the expected types defined in the component's TypeScript interface. Specifically, check if props like fullName and nationalId should be message labels (m.fullName, m.nationalId) or actual data values from answers or another data source.


163-171: ⚠️ Potential issue

Ensure correct prop types for CapitalNumberOverview component

Verify that the props passed to CapitalNumberOverview are of the correct types. Confirm whether the component expects message labels (e.g., capitalNumbersMessage={m.capitalNumbers}) and data values (e.g., capitalIncome={answers.capitalNumbers.capitalIncome}), and ensure they are used appropriately.


180-195: ⚠️ Potential issue

Confirm prop alignment for AssetDebtEquityOverview component

Ensure that the props passed to AssetDebtEquityOverview are consistent with its TypeScript definitions. Check whether combining message labels (from m) and data values (from answers) is appropriate, and verify that all props are correctly typed and used.


202-205: ⚠️ Potential issue

Check prop types for FileValueLine component

Verify that the files prop passed to FileValueLine is correct. Confirm whether files={m.files} provides the expected data, or if it should be a data value from answers or another relevant source.


256-257: ⚠️ Potential issue

Validate prop usage for BottomBar component

Ensure that the props goBack and send passed to BottomBar are appropriate. Verify whether goBack={m.goBack} and send={m.send} are the correct values for these props, and confirm they align with BottomBar's TypeScript definitions.

libs/application/templates/inao/financial-statement-cemetery/src/fields/CemeteryOverview/index.tsx (4)

27-35: Consolidated shared imports look good

The imports have been updated to source components and utilities from the shared directory, enhancing reusability and reducing code duplication.


92-100: Verify that AboutOverview receives correct prop types

Ensure that the AboutOverview component expects the props being passed. Verify that m.fullName, m.nationalId, etc., correspond to the expected types (e.g., labels or data). If necessary, adjust the props or component interface accordingly.


189-197: Check prop types for CapitalNumberOverview component

Confirm that the CapitalNumberOverview component accepts the props capitalNumbersMessage, capitalIncomeMessage, etc., as provided. Ensure that the messages and data align with the component's expected prop types.


397-398: Addition of goBack and send props to BottomBar

The new props goBack={m.goBack} and send={m.send} enhance the BottomBar component's functionality by providing localized labels for the buttons.

@@ -1,48 +1,13 @@
import { ExternalData, FormValue } from '@island.is/application/types'
import { getValueViaPath } from '@island.is/application/core'
import { BOARDMEMEBER, CARETAKER, TOTAL } from './constants'
import { BOARDMEMEBER, CARETAKER } from './constants'
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix the typo in 'BOARDMEMEBER' constant import

The constant BOARDMEMEBER is still misspelled. It should be BOARDMEMBER.

Apply this diff to fix the typo:

-import { BOARDMEMEBER, CARETAKER } from './constants'
+import { BOARDMEMBER, CARETAKER } from './constants'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { BOARDMEMEBER, CARETAKER } from './constants'
import { BOARDMEMBER, CARETAKER } from './constants'

Comment on lines +79 to +87
<AboutOverview
about={answers.about}
fullName={m.fullName}
nationalId={m.nationalId}
powerOfAttorneyName={m.powerOfAttorneyName}
powerOfAttorneyNationalId={m.powerOfAttorneyNationalId}
email={m.email}
phoneNumber={m.phoneNumber}
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Consider formatting message props in AboutOverview component

The AboutOverview component is receiving several props directly from the m object, which likely contains message definitions. These props might need to be formatted using formatMessage to display the correct localized text.

Consider updating the props to use formatted messages:

<AboutOverview
  about={answers.about}
- fullName={m.fullName}
- nationalId={m.nationalId}
- powerOfAttorneyName={m.powerOfAttorneyName}
- powerOfAttorneyNationalId={m.powerOfAttorneyNationalId}
- email={m.email}
- phoneNumber={m.phoneNumber}
+ fullName={formatMessage(m.fullName)}
+ nationalId={formatMessage(m.nationalId)}
+ powerOfAttorneyName={formatMessage(m.powerOfAttorneyName)}
+ powerOfAttorneyNationalId={formatMessage(m.powerOfAttorneyNationalId)}
+ email={formatMessage(m.email)}
+ phoneNumber={formatMessage(m.phoneNumber)}
/>

Committable suggestion was skipped due to low confidence.

@jonnigs jonnigs added the deploy-feature Deploys features to dev label Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy-feature Deploys features to dev
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants