Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(native-app): add health overview #16333

Merged
merged 13 commits into from
Oct 11, 2024
Merged

feat(native-app): add health overview #16333

merged 13 commits into from
Oct 11, 2024

Conversation

thoreyjona
Copy link
Contributor

@thoreyjona thoreyjona commented Oct 9, 2024

What

  • Add first screen for Health (Heilsa) in app.
  • Updating design of the More screen as well.
  • Adding necessary scopes for organ-donation, vaccinations and medicine as well for future implementation of that features.
  • Since this update of scopes will cause that all users will be logged out I added scopes for passkeys and barcodes as well.
  • Buttons now support ellipsis mode for the text
  • Inputs now can have a grey background

Screenshots / Gifs

Screen.Recording.2024-10-09.at.11.23.17.mov

Checklist:

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

Summary by CodeRabbit

Summary by CodeRabbit

Release Notes

  • New Features

    • Added new health-related scopes for enhanced permission requests.
    • Introduced new GraphQL queries for health insurance and payment information.
    • Launched the HealthOverviewScreen component for displaying health-related data.
    • Added new keys for health information in English and Icelandic.
  • Improvements

    • Updated the MoreScreen layout with a new card component for better user experience.
    • Enhanced Input and Button components for improved styling and functionality.
    • Introduced a new route for accessing the HealthOverviewScreen.
  • Bug Fixes

    • Corrected typographical error in the HomeOptionsScreen subtitle.

@thoreyjona thoreyjona requested a review from a team as a code owner October 9, 2024 11:32
Copy link
Contributor

coderabbitai bot commented Oct 9, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The changes in this pull request primarily enhance the application's healthcare functionality. New health-related scopes have been added to the configuration, and several GraphQL queries for health insurance and payment information have been introduced. Additionally, new language keys for health-related content have been added in both English and Icelandic. A new HealthOverviewScreen component has been created to display health information, and various UI components have been updated or added to support these enhancements.

Changes

File Path Change Summary
apps/native/app/src/config.ts Added new entries to the idsScopes array for healthcare: @island.is/health/healthcare, @island.is/health/payments, @island.is/health/rights-status, @island.is/health/medicines, @island.is/health/vaccinations, @island.is/health/organ-donation.
apps/native/app/src/graphql/queries/health.graphql Introduced new GraphQL queries: GetHealthInsuranceOverview, GetHealthCenter, GetPaymentOverview, GetPaymentStatus.
apps/native/app/src/messages/en.ts Added new keys related to health data and modified existing keys, including a new section for health.
apps/native/app/src/messages/is.ts Added new keys related to health data in Icelandic.
apps/native/app/src/screens/health/health-overview.tsx Introduced HealthOverviewScreen component for displaying health-related information using GraphQL queries.
apps/native/app/src/screens/home/home-options.tsx Corrected a typographical error in the subtitle text of HomeOptionsScreen.
apps/native/app/src/screens/more/more.tsx Replaced ListButton component with MoreCard and updated the layout.
apps/native/app/src/screens/wallet-passport/wallet-passport.tsx Added borderDark prop to the Input component for styling.
apps/native/app/src/stores/auth-store.ts Updated OPTIONAL_SCOPES to an empty array and modified fetchUserInfo method to check for skipRefresh parameter.
apps/native/app/src/ui/index.ts Added export for the more-card component.
apps/native/app/src/ui/lib/alert/alert.tsx Modified conditional rendering logic for Content component in Alert.
apps/native/app/src/ui/lib/button/button.tsx Added new optional property ellipsis to ButtonBaseProps interface.
apps/native/app/src/ui/lib/card/more-card.tsx Introduced new MoreCard component for displaying asset cards.
apps/native/app/src/ui/lib/heading/heading.tsx Updated HeadingProps interface to include an optional small property.
apps/native/app/src/ui/lib/input/input-row.tsx Updated Host styled component to accept a background prop.
apps/native/app/src/ui/lib/input/input.tsx Updated InputProps interface and changed logic for border color.
apps/native/app/src/utils/component-registry.ts Added HealthOverviewScreen to ComponentRegistry.
apps/native/app/src/utils/lifecycle/setup-components.tsx Registered HealthOverviewScreen with the component registry.
apps/native/app/src/utils/lifecycle/setup-routes.ts Added new route for /health-overview to navigate to HealthOverviewScreen.

Possibly related PRs

Suggested reviewers

  • thorkellmani
  • snaerseljan

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

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

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

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

CodeRabbit Commands (Invoked using PR comments)

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

Other keywords and placeholders

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

Documentation and Community

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Outside diff range and nitpick comments (22)
apps/native/app/src/ui/lib/input/input-row.tsx (2)

4-8: LGTM! Consider enhancing readability.

The addition of the background prop and its implementation in the Host styled component is well done. It allows for flexible styling and adheres to React and styled-components best practices.

For improved readability, consider using a ternary operator for the background color:

- background-color: ${({ theme, background }) =>
-   background ? theme.color.blueberry100 : 'transparent'};
+ background-color: ${({ theme, background }) => background ? theme.color.blueberry100 : 'transparent'};

16-17: LGTM! Consider using object destructuring for props.

The updates to the InputRow function are correct and consistent with the interface changes. The default value for the background prop ensures backward compatibility.

For consistency with React best practices and improved readability, consider using object destructuring for the props:

- export function InputRow({ children, background = false }: InputRowProps) {
+ export function InputRow({ children, background = false, ...props }: InputRowProps) {
-   return <Host background={background}>{children}</Host>
+   return <Host background={background} {...props}>{children}</Host>

This change allows for easier extension of the component in the future and ensures that any additional props are passed down to the Host component.

apps/native/app/src/ui/lib/heading/heading.tsx (2)

20-20: LGTM: Improved type safety with new prop

The addition of the small prop to the HeadingProps interface enhances type safety and explicitly documents the component's API. This is a good use of TypeScript.

Consider adding a JSDoc comment to explain the purpose of the small prop:

interface HeadingProps {
  children: React.ReactNode
  button?: React.ReactNode
  /** When true, renders a smaller heading variant */
  small?: boolean
}

23-29: LGTM: Improved component flexibility and consistency

The changes to the Heading component implementation are well-executed:

  1. The function signature update with a default value for small maintains backward compatibility.
  2. The use of the Typography component aligns with component-based architecture.
  3. The conditional rendering based on the small prop enhances the component's flexibility.

These changes adhere to React and NextJS best practices and improve the overall design of the component.

For consistency with the HeadingProps interface, consider using object destructuring with default values in the function signature:

export function Heading({ children, button, small = false }: HeadingProps) {
  // ... rest of the implementation
}

This approach makes it clear that all props are defined in the HeadingProps interface.

apps/native/app/src/graphql/queries/health.graphql (3)

14-21: LGTM: Well-structured query for current health center information

The GetHealthCenter query is correctly implemented, using an input type for flexible querying. It follows GraphQL best practices and retrieves essential information about the current health center registration.

Consider extending the query to optionally fetch historical health center registrations if this information might be useful in the future. This could be done by adding a parameter to control whether to fetch only the current registration or the full history.


23-30: LGTM: Well-structured query for payment overview

The GetPaymentOverview query is correctly implemented, using a required input type for necessary data provision. It follows GraphQL best practices and retrieves a list of payment items with credit and debt information.

Consider expanding the returned item structure to include more detailed information about each payment, such as date, description, or category. This could provide a more comprehensive overview of the user's payment history.


1-37: Overall: Well-implemented GraphQL queries for health features

This file contains four well-structured GraphQL queries that align perfectly with the PR objectives of introducing health features to the application. The queries follow best practices and provide comprehensive data for health insurance overview, health center information, payment overview, and payment status.

The implementation of these queries lays a solid foundation for the Health (Heilsa) feature mentioned in the PR objectives. They cover various aspects of health-related information, including insurance status, health center registration, and payment details, which will be crucial for building the health overview screen.

As the health feature develops, consider creating separate files for different categories of health-related queries (e.g., insurance.graphql, payments.graphql) to improve maintainability and organization of the GraphQL schema.

apps/native/app/src/ui/lib/card/more-card.tsx (2)

8-28: LGTM: Well-structured styled components with theme integration.

The styled components make good use of the theme properties and the dynamicColor utility, ensuring consistent and theme-aware styling. This approach aligns well with best practices for maintainable and flexible UI components.

Consider extracting the style values (like spacing and border radius) into theme constants if they're not already, to promote even more consistency across the application.


36-52: LGTM: Well-implemented component with theme awareness.

The MoreCard component is well-structured and makes good use of React hooks and styled-components. It correctly implements the props defined in the interface and responds appropriately to theme changes.

Consider enhancing accessibility by adding appropriate ARIA attributes to the TouchableHighlight component. For example:

 <TouchableHighlight
   underlayColor={
     theme.isDark ? theme.shades.dark.shade100 : theme.color.blue100
   }
   style={{ flex: 1, minHeight: 90 }}
   onPress={onPress}
+  accessibilityRole="button"
+  accessibilityLabel={title}
 >

This change would improve the component's accessibility for users relying on screen readers.

apps/native/app/src/ui/index.ts (1)

23-23: LGTM! Consider grouping related exports.

The addition of the more-card export is consistent with the file's structure and purpose. It follows the established pattern and maintains alphabetical order, which is good for readability and maintenance.

As a minor suggestion for future improvements, consider grouping related exports together (e.g., all card components). This could enhance the file's organization and make it easier to locate specific components.

apps/native/app/src/ui/lib/button/button.tsx (2)

20-20: LGTM! Consider adding JSDoc for the new prop.

The addition of the ellipsis prop is well-typed and consistent with the intended functionality. To improve maintainability, consider adding a JSDoc comment explaining the purpose of this prop.

Example JSDoc:

/**
 * If true, the button text will be truncated to a single line with an ellipsis.
 */
ellipsis?: boolean;

144-145: LGTM! Consider refactoring for improved readability.

The implementation of the ellipsis functionality is correct and achieves the desired text truncation behavior. To improve readability, consider refactoring these lines using object spread syntax:

{...(ellipsis && {
  numberOfLines: 1,
  ellipsizeMode: 'tail' as const,
})}

This refactoring would reduce repetition and make it easier to add more ellipsis-related props in the future if needed.

apps/native/app/src/screens/more/more.tsx (1)

115-147: LGTM: Updated UI with MoreCard components and added Health card

The replacement of ListButton components with MoreCard components improves UI consistency. The addition of the Health card aligns with the new health feature mentioned in the PR objectives. The use of Row components for layout and intl for translations follows best practices.

Consider extracting the repeated MoreCard structure into a separate component or utility function to reduce code duplication and improve maintainability.

Here's a suggested refactor to reduce duplication:

const renderMoreCard = (
  titleId: string,
  icon: ImageSourcePropType,
  route: string
) => (
  <MoreCard
    title={intl.formatMessage({ id: titleId })}
    icon={icon}
    onPress={() => navigateTo(route)}
  />
);

// Usage
<Row>
  {renderMoreCard('profile.family', familyIcon, '/family')}
  {renderMoreCard('profile.vehicles', vehicleIcon, '/vehicles')}
</Row>
apps/native/app/src/utils/lifecycle/setup-components.tsx (2)

109-109: LGTM: Component registration is consistent

The registration of HealthOverviewScreen follows the existing pattern and maintains the overall structure of the file.

For consistency with other registrations, consider adding a blank line before this new registration to group it with other screen components.


Line range hint 1-116: Overall structure aligns with best practices

The file structure and organization align well with NextJS best practices. The use of TypeScript and consistent component registration patterns contribute to maintainability and type safety.

Consider adding type annotations to the registerComponent function calls for improved type safety. For example:

registerComponent<typeof HealthOverviewScreen>(CR.HealthOverviewScreen, HealthOverviewScreen)

This change would ensure that the component type matches the registration key type.

apps/native/app/src/stores/auth-store.ts (1)

Line range hint 95-121: Approve changes with a suggestion for error handling.

The updates to fetchUserInfo improve the robustness of the authentication process by handling token expiration and 401 responses more effectively. This aligns well with best practices and the PR objectives.

Consider adding a specific error type for the 401 response to improve error handling:

class UnauthorizedError extends Error {
  constructor(message: string) {
    super(message);
    this.name = 'UnauthorizedError';
  }
}

// Then in the fetchUserInfo method:
if (res.status === 401) {
  // ...
  throw new UnauthorizedError(UNAUTHORIZED_USER_INFO);
}

This would allow for more precise error handling in the calling code.

apps/native/app/src/utils/lifecycle/setup-routes.ts (1)

153-163: LGTM! Consider adding a comment for consistency.

The new /health-overview route is implemented correctly and follows the existing patterns in the file. It properly handles modal dismissal, tab selection, and navigation to the HealthOverviewScreen.

For consistency with some other routes in the file, consider adding a brief comment describing the purpose of this route.

You could add a comment like this:

// Route to the Health Overview screen
addRoute('/health-overview', async (passProps) => {
  // ... (existing code)
})
apps/native/app/src/messages/en.ts (1)

608-627: LGTM! Consider a minor consistency improvement.

The new health-related translations are comprehensive and well-structured, aligning with the health overview feature mentioned in the PR objectives. They cover various aspects of health information clearly and concisely.

For consistency, consider changing 'Max monthly payment' to 'Maximum monthly payment' to match the style of other labels like 'Maximum weight' used elsewhere in the file.

-  'health.overview.maxMonthlyPayment': 'Max monthly payment',
+  'health.overview.maxMonthlyPayment': 'Maximum monthly payment',
apps/native/app/src/messages/is.ts (1)

607-626: Health-related translations look good overall.

The new health-related translations are well-structured and consistent with the existing translations. They provide a comprehensive set of keys for the health overview screen, covering important aspects such as health center, physician, insurance status, and payments.

For consistency with other sections, consider adding a period at the end of the description on line 611:

  'health.overview.description':
-    'Hér finnur þú þín heilsufarsgögn, heilsugæslu og sjúkratryggingar',
+    'Hér finnur þú þín heilsufarsgögn, heilsugæslu og sjúkratryggingar.',
apps/native/app/src/ui/lib/input/input.tsx (3)

12-13: Unused 'background' prop in Host component

The background prop is declared in the Host component but isn't utilized within its styles or logic. If this prop isn't necessary, consider removing it to clean up the code.


Line range hint 87-95: Provide user feedback when copying to clipboard

Currently, when users tap the copy icon, there's no indication that the value has been copied. Consider adding visual feedback, such as a toast message or alert, to inform users that the action was successful.


Line range hint 87-95: Add accessibility labels to interactive elements

To enhance accessibility, consider adding accessibilityLabel or accessibilityRole to the TouchableOpacity component wrapping the copy icon. This will assist screen reader users in understanding the purpose of the button.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 68290a6 and 1a8115f.

⛔ Files ignored due to path filters (3)
  • apps/native/app/src/assets/icons/health.png is excluded by !**/*.png
  • apps/native/app/src/assets/icons/health@2x.png is excluded by !**/*.png
  • apps/native/app/src/assets/icons/health@3x.png is excluded by !**/*.png
📒 Files selected for processing (19)
  • apps/native/app/src/config.ts (1 hunks)
  • apps/native/app/src/graphql/queries/health.graphql (1 hunks)
  • apps/native/app/src/messages/en.ts (2 hunks)
  • apps/native/app/src/messages/is.ts (2 hunks)
  • apps/native/app/src/screens/health/health-overview.tsx (1 hunks)
  • apps/native/app/src/screens/home/home-options.tsx (1 hunks)
  • apps/native/app/src/screens/more/more.tsx (5 hunks)
  • apps/native/app/src/screens/wallet-passport/wallet-passport.tsx (0 hunks)
  • apps/native/app/src/stores/auth-store.ts (1 hunks)
  • apps/native/app/src/ui/index.ts (1 hunks)
  • apps/native/app/src/ui/lib/alert/alert.tsx (1 hunks)
  • apps/native/app/src/ui/lib/button/button.tsx (3 hunks)
  • apps/native/app/src/ui/lib/card/more-card.tsx (1 hunks)
  • apps/native/app/src/ui/lib/heading/heading.tsx (2 hunks)
  • apps/native/app/src/ui/lib/input/input-row.tsx (1 hunks)
  • apps/native/app/src/ui/lib/input/input.tsx (5 hunks)
  • apps/native/app/src/utils/component-registry.ts (1 hunks)
  • apps/native/app/src/utils/lifecycle/setup-components.tsx (2 hunks)
  • apps/native/app/src/utils/lifecycle/setup-routes.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • apps/native/app/src/screens/wallet-passport/wallet-passport.tsx
✅ Files skipped from review due to trivial changes (1)
  • apps/native/app/src/screens/home/home-options.tsx
🧰 Additional context used
📓 Path-based instructions (17)
apps/native/app/src/config.ts (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/graphql/queries/health.graphql (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/messages/en.ts (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/messages/is.ts (1)

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

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

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

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

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/stores/auth-store.ts (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/ui/index.ts (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/ui/lib/alert/alert.tsx (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/ui/lib/button/button.tsx (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/ui/lib/card/more-card.tsx (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/ui/lib/heading/heading.tsx (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/ui/lib/input/input-row.tsx (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/ui/lib/input/input.tsx (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/utils/component-registry.ts (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/utils/lifecycle/setup-components.tsx (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/utils/lifecycle/setup-routes.ts (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
🔇 Additional comments (22)
apps/native/app/src/ui/lib/input/input-row.tsx (1)

12-12: LGTM! Good use of TypeScript.

The addition of the optional background prop to the InputRowProps interface is correct and consistent with the component's implementation. It provides good type safety for the component's props.

apps/native/app/src/ui/lib/heading/heading.tsx (1)

3-3: LGTM: Improved component-based architecture

The change from importing a font utility to using a Typography component aligns well with React and NextJS best practices. This approach can lead to more consistent styling across the application and improved maintainability.

apps/native/app/src/graphql/queries/health.graphql (2)

1-12: LGTM: Well-structured query for health insurance overview

The GetHealthInsuranceOverview query is well-implemented, fetching comprehensive information about the user's health insurance status. It follows GraphQL best practices and provides all necessary fields for a complete overview.


32-37: LGTM: Concise and effective query for payment status

The GetPaymentStatus query is well-implemented, fetching essential information about copayment status, including maximum payment and maximum monthly payment. It follows GraphQL best practices and provides the necessary data for understanding payment limits.

apps/native/app/src/ui/lib/card/more-card.tsx (3)

1-6: LGTM: Imports are appropriate and well-organized.

The imports cover all necessary dependencies for the component, including React, React Native components, styled-components, and custom utilities. This demonstrates good code organization and adherence to best practices.


30-34: LGTM: Well-defined TypeScript interface for component props.

The AssetCardProps interface provides clear and appropriate type definitions for the component's props. This enhances type safety and improves the overall reliability of the component.


1-52: Overall: Excellent implementation of the MoreCard component.

This file demonstrates a high-quality React component implementation that adheres to NextJS best practices, makes efficient use of styled-components, and leverages TypeScript for enhanced type safety. The code is well-structured, readable, and maintainable.

Key strengths:

  1. Proper use of functional components and React hooks.
  2. Effective integration with the application's theming system.
  3. Clear and appropriate TypeScript interfaces.
  4. Consistent use of styled-components for styling.

The minor suggestions provided earlier (theme constant extraction and accessibility improvements) would further enhance an already solid implementation.

apps/native/app/src/config.ts (2)

Line range hint 1-115: Overall structure and TypeScript usage look good.

The configuration file is well-structured and follows TypeScript best practices. The use of environment-specific settings and the exported functions useConfig() and getConfig() provide a clean way to access configuration values throughout the application.

🧰 Tools
🪛 Gitleaks

81-81: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


71-78: LGTM! Consider grouping similar scopes for better organization.

The addition of health-related scopes aligns well with the PR objectives to introduce health features. However, consider grouping similar scopes together for better organization and readability. For example:

idsScopes: [
  // ... other scopes
  '@island.is/health/healthcare',
  '@island.is/health/payments',
  '@island.is/health/rights-status',
  '@island.is/health/medicines',
  '@island.is/health/vaccinations',
  '@island.is/health/organ-donation',
  // ... other scopes
  '@island.is/licenses:barcode',
  '@island.is/auth/passkeys',
]

As mentioned in the PR objectives, these scope changes will result in all users being logged out. Ensure that the application handles this gracefully and that users are informed about the need to re-authenticate. You may want to verify the impact with the following script:

✅ Verification successful

Verified! The scope changes will result in all users being logged out, and the application handles this gracefully. Users are informed about the need to re-authenticate. Consider grouping similar scopes together for better organization and readability.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for authentication handling in the codebase

# Test: Search for authentication-related code that might handle logouts or re-authentication
rg --type typescript -i '(logout|reauthenticate|auth.*error)'

Length of output: 98


Script:

#!/bin/bash
# Description: Check for authentication handling in the codebase

# Test: Search for authentication-related code that might handle logouts or re-authentication
rg --type ts -i '(logout|reauthenticate|auth.*error)'

Length of output: 47535

apps/native/app/src/ui/lib/button/button.tsx (2)

119-119: LGTM! Prop correctly added to function signature.

The ellipsis prop has been correctly added to the Button function component's destructured props. This change is consistent with the interface update and allows the prop to be used within the component.


20-20: Overall, great implementation of the ellipsis functionality!

The changes successfully add the ability to truncate button text with an ellipsis. This enhancement improves the flexibility of the Button component, allowing it to handle long titles more gracefully. The implementation is consistent with TypeScript and React Native best practices.

A few minor suggestions have been made to further improve documentation and code readability. Great job on this feature addition!

Also applies to: 119-119, 144-145

apps/native/app/src/utils/component-registry.ts (1)

52-52: LGTM: New screen component added correctly

The addition of HealthOverviewScreen to the ComponentRegistry follows the existing pattern and naming conventions. It uses the prefix variable consistently with other entries, which aligns with the file's structure and NextJS best practices for component registration.

A few points to consider:

  1. Ensure that the corresponding HealthOverviewScreen component file exists in the screens directory.
  2. If this is a major new feature, consider grouping related screens together in the registry for better organization.
  3. Verify that any necessary routing updates have been made to incorporate this new screen.

To ensure the HealthOverviewScreen component exists, run:

✅ Verification successful

Verified: HealthOverviewScreen component exists and is correctly registered

The HealthOverviewScreen component is present in the screens/health/health-overview.tsx file and is properly referenced in the ComponentRegistry using the ${prefix}.screens.HealthOverviewScreen pattern. All imports and registrations align with project conventions and NextJS best practices.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if HealthOverviewScreen component file exists
fd --type f "HealthOverviewScreen.(tsx|ts|js|jsx)" apps/native/app/src/screens

Length of output: 80


Script:

#!/bin/bash
# Search for all references to HealthOverviewScreen in the codebase
rg "HealthOverviewScreen" apps/native/app/src

Length of output: 752

apps/native/app/src/ui/lib/alert/alert.tsx (1)

211-214: Improved rendering logic for better flexibility

The changes to the Content rendering logic enhance the component's flexibility and maintain good practices:

  1. The new condition (message || title) allows the Content to render if either prop is present, improving reusability.
  2. Conditional rendering of the Message component ensures it only appears when necessary.
  3. These changes maintain type safety and align with React and NextJS best practices.

Great job on improving the component without compromising its structure or efficiency!

apps/native/app/src/screens/more/more.tsx (6)

1-1: LGTM: Import changes align with component updates

The import changes correctly reflect the replacement of ListButton with MoreCard. This update is consistent with the modifications in the component's structure and follows TypeScript best practices.


4-4: LGTM: SafeAreaView import added

The addition of SafeAreaView to the imports is consistent with its usage in the component. This change follows React Native best practices for handling safe areas on different devices.


13-13: LGTM: Health icon import added

The addition of the healthIcon import is consistent with the new health-related functionality mentioned in the PR objectives. The import follows the established pattern for icon imports in this file.


25-27: LGTM: Improved Row component styling

The updates to the Row styled component enhance the layout by adding vertical margin and column gap. The use of theme variables ensures consistency with the design system. The change to flex-direction: row aligns with the transition from a column to a row format mentioned in the AI summary.


99-99: LGTM: Improved SafeAreaView spacing

The addition of bottom margin to the SafeAreaView enhances the layout and spacing. The use of theme spacing ensures consistency with the overall design system.


Line range hint 1-153: Overall LGTM: Improved UI and added Health feature

The changes in this file successfully implement the objectives outlined in the PR. Key improvements include:

  1. Replacing ListButton with MoreCard components for a more consistent UI.
  2. Adding a new Health card, aligning with the new health feature.
  3. Updating the layout to use Row components for better organization.
  4. Maintaining good practices in terms of internationalization, TypeScript usage, and React Native/NextJS conventions.

These changes enhance the user interface and successfully introduce the first screen for the Health (Heilsa) feature. The code is well-structured and maintainable.

apps/native/app/src/utils/lifecycle/setup-components.tsx (1)

29-29: LGTM: Import statement follows existing patterns

The new import statement for HealthOverviewScreen is consistent with the existing import structure and follows good practices for relative imports.

apps/native/app/src/messages/is.ts (1)

Line range hint 1-626: Overall, the changes to the translation file are well-implemented.

The new health-related translations have been seamlessly integrated into the existing structure of the file. They maintain consistency with the established patterns and provide a comprehensive set of keys for the new health overview feature. The changes adhere to TypeScript and NextJS best practices.

apps/native/app/src/ui/lib/input/input.tsx (1)

72-72: Ensure consistent styling after switching to Typography components

By replacing custom components with Typography components for the Label and value display, there may be changes in text styling or layout. Please verify that the updated components align with the design specifications and maintain the intended visual consistency.

Also applies to: 81-85

apps/native/app/src/stores/auth-store.ts Show resolved Hide resolved
apps/native/app/src/messages/en.ts Show resolved Hide resolved
apps/native/app/src/screens/health/health-overview.tsx Outdated Show resolved Hide resolved
apps/native/app/src/screens/health/health-overview.tsx Outdated Show resolved Hide resolved
@snaerseljan
Copy link
Member

@thoreyjona Can you re upload the video :)

Copy link

codecov bot commented Oct 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 36.76%. Comparing base (8e6c0e3) to head (09e3d48).
Report is 18 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #16333      +/-   ##
==========================================
- Coverage   36.86%   36.76%   -0.10%     
==========================================
  Files        6803     6804       +1     
  Lines      140646   140792     +146     
  Branches    39995    40151     +156     
==========================================
- Hits        51852    51768      -84     
- Misses      88794    89024     +230     
Flag Coverage Δ
air-discount-scheme-web 0.00% <ø> (ø)
api 3.37% <ø> (ø)
api-domains-auth-admin 48.48% <ø> (-0.29%) ⬇️
api-domains-mortgage-certificate 34.92% <ø> (-0.76%) ⬇️
application-api-files 57.97% <ø> (ø)
application-core 71.51% <ø> (-0.12%) ⬇️
application-system-api 41.44% <ø> (-0.22%) ⬇️
application-template-api-modules 27.97% <ø> (+3.68%) ⬆️
application-templates-accident-notification 29.29% <ø> (-0.16%) ⬇️
application-templates-car-recycling 3.12% <ø> (ø)
application-templates-criminal-record 26.35% <ø> (-0.29%) ⬇️
application-templates-driving-license 18.29% <ø> (-0.12%) ⬇️
application-templates-estate 12.31% <ø> (-0.02%) ⬇️
application-templates-example-payment 25.14% <ø> (-0.28%) ⬇️
application-templates-financial-aid 14.27% <ø> (-0.07%) ⬇️
application-templates-general-petition 23.43% <ø> (-0.25%) ⬇️
application-templates-health-insurance 26.41% <ø> (-0.22%) ⬇️
application-templates-inheritance-report 6.43% <ø> (-0.03%) ⬇️
application-templates-marriage-conditions 15.09% <ø> (-0.15%) ⬇️
application-templates-mortgage-certificate 43.75% <ø> (-0.22%) ⬇️
application-templates-parental-leave 29.97% <ø> (-0.07%) ⬇️
application-types 6.71% <ø> (ø)
application-ui-components 1.28% <ø> (ø)
application-ui-shell 21.27% <ø> (+<0.01%) ⬆️
clients-charge-fjs-v2 24.11% <ø> (ø)
clients-syslumenn 49.42% <ø> (-0.08%) ⬇️
services-auth-admin-api 51.84% <ø> (-0.29%) ⬇️
services-auth-delegation-api 57.32% <ø> (-0.35%) ⬇️
services-auth-ids-api 51.43% <ø> (-0.28%) ⬇️
services-auth-personal-representative 45.15% <ø> (-0.24%) ⬇️
services-auth-personal-representative-public 41.27% <ø> (-0.25%) ⬇️
services-auth-public-api 48.91% <ø> (-0.30%) ⬇️
services-user-notification 47.01% <ø> (ø)
services-user-profile 62.17% <ø> (+0.07%) ⬆️
web 1.83% <ø> (ø)

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

see 127 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 68290a6...09e3d48. Read the comment docs.

@datadog-island-is
Copy link

Datadog Report

All test runs a9e2ba5 🔗

33 Total Test Services: 0 Failed, 33 Passed
➡️ Test Sessions change in coverage: 113 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 8.2s 1 no change Link
api 0 0 0 4 0 2.95s 1 no change Link
api-domains-auth-admin 0 0 0 18 0 13.83s 1 no change Link
api-domains-mortgage-certificate 0 0 0 5 0 19.68s 1 no change Link
application-api-files 0 0 0 12 0 7.16s 1 no change Link
application-core 0 0 0 92 0 22s 1 no change Link
application-system-api 0 0 0 120 2 3m 42.26s 1 no change Link
application-template-api-modules 0 0 0 123 0 2m 43.07s 1 no change Link
application-templates-accident-notification 0 0 0 148 0 17.99s 1 no change Link
application-templates-criminal-record 0 0 0 2 0 10.8s 1 no change Link

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (1)
apps/native/app/src/screens/health/health-overview.tsx (1)

65-66: Fix typo in comment

There's a typo in the comment on line 65: "fethcing" should be "fetching".

Apply this diff to correct the typo:

- // The items we are fethcing are static and are not using the dates for calculation,
+ // The items we are fetching are static and are not using the dates for calculation,
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 1a8115f and 4a244df.

📒 Files selected for processing (1)
  • apps/native/app/src/screens/health/health-overview.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
apps/native/app/src/screens/health/health-overview.tsx (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."

apps/native/app/src/screens/health/health-overview.tsx Outdated Show resolved Hide resolved
apps/native/app/src/screens/health/health-overview.tsx Outdated Show resolved Hide resolved
Copy link
Member

@snaerseljan snaerseljan left a comment

Choose a reason for hiding this comment

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

Excellent work! Nice refactor and structure 👏

apps/native/app/src/messages/is.ts Show resolved Hide resolved
apps/native/app/src/screens/more/more.tsx Show resolved Hide resolved
apps/native/app/src/stores/auth-store.ts Show resolved Hide resolved
apps/native/app/src/ui/lib/card/more-card.tsx Show resolved Hide resolved
apps/native/app/src/ui/lib/card/more-card.tsx Show resolved Hide resolved
apps/native/app/src/screens/health/health-overview.tsx Outdated Show resolved Hide resolved
apps/native/app/src/screens/health/health-overview.tsx Outdated Show resolved Hide resolved
apps/native/app/src/screens/health/health-overview.tsx Outdated Show resolved Hide resolved
apps/native/app/src/screens/health/health-overview.tsx Outdated Show resolved Hide resolved
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: 4

🧹 Outside diff range and nitpick comments (2)
apps/native/app/src/ui/lib/input/input.tsx (1)

82-88: LGTM: Improved value rendering with Typography component

The replacement of the Value styled component with a Typography component enhances consistency and flexibility in text styling. The addition of the 'selectable' prop improves user interaction possibilities.

Consider extracting the variant logic into a separate constant or function for improved readability:

const valueVariant = size === 'normal' ? 'heading5' : 'heading3';

<Typography
  testID={valueTestID}
  selectable
  variant={valueVariant}
>
  {tvalue === '' || !value ? '-' : value}
</Typography>

This minor refactoring would enhance code clarity without changing functionality.

apps/native/app/src/screens/health/health-overview.tsx (1)

47-72: Component setup and data fetching look good

The component is correctly defined as a NavigationFunctionComponent, and the use of GraphQL queries for data fetching is appropriate. The memoization of the now variable is a good optimization.

However, consider moving the now variable declaration closer to where it's used in the paymentOverviewRes query for better code readability.

Consider moving the now variable declaration:

- const now = useMemo(() => new Date().toISOString(), [])

  const healthInsuranceRes = useGetHealthInsuranceOverviewQuery()
  const healthCenterRes = useGetHealthCenterQuery()
  const paymentStatusRes = useGetPaymentStatusQuery()
+ const now = useMemo(() => new Date().toISOString(), [])
  const paymentOverviewRes = useGetPaymentOverviewQuery({
    variables: {
      input: {
        dateFrom: now,
        dateTo: now,
        serviceTypeCode: '',
      },
    },
  })
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 4a244df and 400b36d.

📒 Files selected for processing (2)
  • apps/native/app/src/screens/health/health-overview.tsx (1 hunks)
  • apps/native/app/src/ui/lib/input/input.tsx (5 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
apps/native/app/src/screens/health/health-overview.tsx (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/ui/lib/input/input.tsx (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
🔇 Additional comments (10)
apps/native/app/src/ui/lib/input/input.tsx (6)

8-8: LGTM: Improved component reusability

The addition of the Typography import enhances component reusability and consistency in text styling across the application. This aligns well with NextJS best practices.


10-23: LGTM: Improved prop naming and styling flexibility

The changes to the Host component enhance its flexibility and improve naming consistency:

  1. Renaming 'borderDark' to 'darkBorder' aligns with the suggestion in the past review comment, making the prop name more intuitive.
  2. The addition of the 'background' prop allows for more versatile styling options.
  3. The updated color assignment logic correctly implements the new 'darkBorder' prop.

These changes contribute to a more maintainable and flexible component.


38-40: LGTM: Enhanced text styling with Typography component

The update to use the Typography component for the Label improves consistency in text styling across the application. This change aligns well with the best practices of using reusable components in NextJS applications.


51-51: LGTM: Consistent prop naming

The replacement of 'borderDark' with 'darkBorder' in the InputProps interface maintains consistency with the changes made to the Host component. This improves the overall clarity and maintainability of the code.


64-64: LGTM: Consistent parameter naming

The replacement of 'borderDark' with 'darkBorder' in the Input function parameters maintains consistency with the InputProps interface changes. The default value is correctly set to false, preserving the expected behavior.


71-71: LGTM: Correct implementation of new styling prop

The addition of the 'darkBorder' prop to the Host component in the render function correctly implements the new styling option. This change is consistent with the updates made to the Host styled component and the Input function parameters.

apps/native/app/src/screens/health/health-overview.tsx (4)

1-36: Imports and styled components look good

The imports cover all necessary components and hooks for the HealthOverviewScreen. The styled components are well-defined and promote consistent styling throughout the component.


38-45: Navigation options are well-configured

The use of createNavigationOptionHooks for setting up navigation options is appropriate. The screen title is correctly internationalized, which is a good practice for multi-language support.


108-428: Well-structured component with consistent internationalization

The overall structure of the HealthOverviewScreen component is well-organized, with a clear separation of different health information sections. The consistent use of internationalization for text content is commendable.


433-433: Component options are correctly set

The use of getNavigationOptions for setting the component options is consistent with the navigation setup at the beginning of the file. This ensures that the navigation options are applied correctly to the HealthOverviewScreen component.

@thoreyjona thoreyjona added the automerge Merge this PR as soon as all checks pass label Oct 11, 2024
Copy link
Contributor

kodiakhq bot commented Oct 11, 2024

This PR currently has a merge conflict. Please resolve this and then re-add the automerge label.

@kodiakhq kodiakhq bot removed the automerge Merge this PR as soon as all checks pass label Oct 11, 2024
@thoreyjona thoreyjona added the automerge Merge this PR as soon as all checks pass label Oct 11, 2024
@kodiakhq kodiakhq bot merged commit 06968c0 into main Oct 11, 2024
23 checks passed
@kodiakhq kodiakhq bot deleted the feat/add-heilsa-section branch October 11, 2024 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants