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): update applications screen #15964

Merged
merged 32 commits into from
Sep 19, 2024

Conversation

thoreyjona
Copy link
Contributor

@thoreyjona thoreyjona commented Sep 11, 2024

What

Update applications screen to match new design. Also updating application status card design and creating a lot of reusable components that can be used in all places we need to show this information.

Screenshots / Gifs

Screen.Recording.2024-09-11.at.15.29.28.mov

Checklist:

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

Summary by CodeRabbit

  • New Features

    • Transitioned to a ScrollView for a more flexible layout of application statuses.
    • Introduced a sorting function to categorize applications into incomplete, in-progress, and completed states.
    • Improved the display of applications using the ApplicationsPreview component for better organization.
    • Enhanced the refresh functionality to ensure the latest application data is displayed.
    • Refined the empty state messaging for clearer user guidance.
  • Bug Fixes

    • Improved handling of loading and error states in application lists.
  • Documentation

    • Updated localization strings for better clarity and context.
  • Style

    • Enhanced styling of UI components for improved user experience.

@thoreyjona thoreyjona requested a review from a team as a code owner September 11, 2024 15:57
Copy link
Contributor

coderabbitai bot commented Sep 11, 2024

Walkthrough

The pull request introduces significant changes to the ApplicationsScreen component in the applications.tsx file. It replaces the FlatList with a ScrollView to improve layout flexibility and allows for better organization of applications based on their statuses. A new function categorizes applications into three states, and the rendering logic has been refactored to enhance maintainability. Updates to the refresh functionality ensure the latest data is displayed, and the handling of empty states has been improved for better user guidance.

Changes

Files Change Summary
apps/native/app/src/screens/applications/applications.tsx Transitioned from FlatList to ScrollView, added sortApplicationsStatus function, and refactored rendering logic using ApplicationsPreview. Updated onRefresh function and improved empty state handling.
apps/native/app/src/screens/applications/applications.tsx Added interface SortedApplication for better type management.

Possibly related PRs

Suggested reviewers

  • 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: 1

Outside diff range and nitpick comments (4)
apps/native/app/src/graphql/queries/applications.graphql (1)

1-2: LGTM! The changes enhance the query's functionality and flexibility.

The addition of the $input and $locale parameters allows for filtering, modifying, and localizing the retrieved applications, which is a great improvement.

Suggestions:

  1. Confirm if the ApplicationFragment fragment includes all the necessary fields required by the application screens. If not, consider updating the fragment to include the missing fields.
  2. Consider adding pagination support to the query using the first and after parameters to enable efficient retrieval of large datasets. For example:
query ListApplications($input: ApplicationApplicationsInput, $locale: String, $first: Int, $after: String) {
  applicationApplications(input: $input, locale: $locale, first: $first, after: $after) {
    ...ApplicationFragment
  }
}

This allows the client to specify the number of items to retrieve ($first) and the cursor ($after) to start the retrieval from, enabling pagination of the results.

apps/native/app/src/screens/applications/applications-incomplete.tsx (1)

30-60: LGTM with suggestions!

The ApplicationsIncompleteScreen component is well-structured and follows the necessary conventions. However, consider the following suggestions:

  1. If the refetching functionality is not used, remove the refetching state and onRefetch prop to simplify the code.
  2. If the displayDescription prop is not used in the ApplicationsList component, remove it to avoid confusion.
apps/native/app/src/screens/applications/applications-in-progress.tsx (1)

30-61: LGTM with a minor suggestion!

The component follows the NextJS best practices for functional components and uses TypeScript for type safety. The use of custom hooks for fetching data and handling connectivity indication promotes code reusability and maintainability. The component efficiently manages the refetching state and passes it down to the ApplicationsList component. The ApplicationsList component is rendered with appropriate props for displaying in-progress applications.

Consider removing the console.log statement on line 35 before merging the code to production.

- console.log({ refetching })
apps/native/app/src/ui/lib/progress-meter/progress-meter.tsx (1)

55-105: The ProgressMeter component looks great! Here are a few suggestions:

  1. Consider adding a prop for customizing the border radius of the progress bar and steps. This would allow for more flexibility in styling.

  2. The component adheres to NextJS best practices by:

    • Being placed in the ui/lib directory, following the recommended structure.
    • Using TypeScript for type safety.
    • Using styled-components for efficient styling and theming.
  3. The component efficiently maps over an array of steps to render the progress bar, ensuring flexibility in the number of steps.

  4. The colorSchemes object is a great way to map variants to color schemes, promoting reusability.

Overall, the component is well-structured, typed, and styled. It follows best practices and provides a reusable solution for rendering progress meters. Great job!

Consider adding a prop for customizing the border radius of the progress bar and steps. This would allow for more flexibility in styling. Here's an example of how you could implement it:

interface ProgressMeterProps {
  draftTotalSteps: number
  draftFinishedSteps: number
  containerWidth?: number
  variant?: ProgressMeterVariant
  progressMessage?: string
+ borderRadius?: number
}

// ...

<Host
  style={{
    backgroundColor: theme.color[colorSchemes[variant].outer],
+   borderRadius: borderRadius ?? theme.border.radius.extraLarge,
  }}
>
  <InnerHost>
    {steps.map((i) => (
      <View
        style={{
          backgroundColor:
            draftFinishedSteps > i
              ? theme.color[colorSchemes[variant].inner]
              : theme.color[colorSchemes[variant].unfinished],
-         borderRadius: 8,
+         borderRadius: borderRadius ?? theme.border.radius.large,
          width: stepWidth,
        }}
        key={`draft-progress-meter-${i}`}
      />
    ))}
  </InnerHost>
</Host>
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 72fc394 and b9eba45.

Files selected for processing (19)
  • apps/native/app/src/graphql/fragments/application.fragment.graphql (1 hunks)
  • apps/native/app/src/graphql/queries/applications.graphql (1 hunks)
  • apps/native/app/src/messages/en.ts (1 hunks)
  • apps/native/app/src/messages/is.ts (1 hunks)
  • apps/native/app/src/screens/applications/applications-completed.tsx (1 hunks)
  • apps/native/app/src/screens/applications/applications-in-progress.tsx (1 hunks)
  • apps/native/app/src/screens/applications/applications-incomplete.tsx (1 hunks)
  • apps/native/app/src/screens/applications/applications.tsx (3 hunks)
  • apps/native/app/src/screens/applications/components/applications-list.tsx (1 hunks)
  • apps/native/app/src/screens/applications/components/applications-preview.tsx (1 hunks)
  • apps/native/app/src/screens/home/applications-module.tsx (3 hunks)
  • apps/native/app/src/ui/index.ts (1 hunks)
  • apps/native/app/src/ui/lib/badge/badge.tsx (1 hunks)
  • apps/native/app/src/ui/lib/card/status-card.tsx (6 hunks)
  • apps/native/app/src/ui/lib/problem/problem-template.tsx (2 hunks)
  • apps/native/app/src/ui/lib/progress-meter/progress-meter.tsx (1 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 skipped from review due to trivial changes (1)
  • apps/native/app/src/ui/index.ts
Additional context used
Path-based instructions (18)
apps/native/app/src/graphql/queries/applications.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/graphql/fragments/application.fragment.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/ui/lib/badge/badge.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/applications/applications-incomplete.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/applications/applications-completed.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/applications/applications-in-progress.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/home/applications-module.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/progress-meter/progress-meter.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/problem/problem-template.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/ui/lib/card/status-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/screens/applications/applications.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/applications/components/applications-preview.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-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/screens/applications/components/applications-list.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."
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."
Biome
apps/native/app/src/ui/lib/card/status-card.tsx

[error] 60-60: Do not shadow the global "Date" property.

Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global.

(lint/suspicious/noShadowRestrictedNames)

Additional comments not posted (54)
apps/native/app/src/graphql/fragments/application.fragment.graphql (1)

Line range hint 1-31: LGTM! The GraphQL fragment is well-structured and includes relevant fields.

The ApplicationFragment is a well-designed GraphQL fragment that includes various fields related to an application. The addition of the actionCard field and its nested fields provides a comprehensive set of data for managing and displaying the application's state and actions.

The fragment adheres to the GraphQL syntax and structure, making it easy to understand and use in queries.

It's important to note that the fragment itself does not directly relate to NextJS best practices, state management, server-side rendering, or TypeScript usage. These aspects would be more relevant in the components and pages that utilize this fragment to fetch and display data.

When using this fragment in your NextJS application, ensure that you follow the best practices for file structure, API routes, and static generation methods. Also, consider efficient state management techniques and leverage TypeScript for type safety in your components and utilities.

apps/native/app/src/ui/lib/badge/badge.tsx (5)

2-3: LGTM!

The import statements adhere to the NextJS best practices for file structure and are correctly used in the code.


13-13: LGTM!

The addition of the variant property to the BadgeProps interface is a great way to enhance the component's flexibility and customization capabilities. The use of TypeScript for the property type ensures type safety and adheres to the optimal use of TypeScript for component prop types.


16-29: LGTM!

The colorSchemes object is a clean and efficient way to manage the styling options for the Badge component. It promotes code reusability and maintainability by centralizing the color schemes in one place. This approach aligns with the best practices for efficient state management and component styling.


31-42: LGTM!

The changes to the Badge function significantly enhance the visual presentation and configurability of the component. The use of the useTheme hook and the colorSchemes object promotes efficient state management and theme-based styling, aligning with the NextJS best practices. The utilization of TypeScript for the variant prop ensures type safety and adheres to the optimal use of TypeScript for component props.

The dynamic setting of the background color and typography color based on the selected variant is a clean and maintainable approach to customizing the component's appearance.

Overall, these changes greatly improve the flexibility and usability of the Badge component.


1-44: Code adheres to the additional instructions.

After reviewing the code changes in the context of the additional instructions, I can confirm that the code adheres to the following:

  • NextJS best practices, including file structure and component styling.
  • Efficient state management techniques through the use of the useTheme hook and the colorSchemes object.
  • Optimal use of TypeScript for component prop types and utility type safety, as evident in the variant prop and the BadgeProps interface.

The code changes align with the best practices and guidelines specified in the additional instructions.

apps/native/app/src/screens/applications/applications-incomplete.tsx (3)

1-29: LGTM!

The imports and component setup look good. The code follows the necessary conventions and best practices.


62-62: LGTM!

The component options are set correctly using the getNavigationOptions function.


1-62: Verify server-side rendering.

The file structure follows the NextJS best practices by organizing the component in the screens directory. It also uses TypeScript for type safety, which is a good practice.

However, to fully adhere to NextJS best practices, verify if the component can be server-side rendered for improved performance and SEO. If server-side rendering is not possible or necessary, consider adding a comment to explain the reason.

apps/native/app/src/screens/applications/applications-completed.tsx (2)

36-42: GraphQL query usage looks good!

The useListApplicationsQuery hook is correctly used to fetch applications with the "Completed" status. The query variables are properly set and the query result is passed to the ApplicationsList component for rendering.

The code changes related to the GraphQL query are approved.

Also applies to: 51-58


12-28: Navigation options implementation looks good!

The navigation options for the screen are correctly defined using the createNavigationOptionHooks function. The options include a title and hide the bottom tabs. The useNavigationOptions hook is properly used to apply the navigation options to the screen component.

The code changes related to the navigation options are approved.

Also applies to: 33-33

apps/native/app/src/screens/applications/applications-in-progress.tsx (3)

1-11: LGTM!

The imports are well-organized and follow the NextJS file structure best practices. The state management using the useState hook is appropriate for this component.


12-28: LGTM!

The use of a custom hook for defining navigation options promotes code reusability and maintainability. The navigation options are properly configured for the screen.


63-63: LGTM!

Setting the component options using the getNavigationOptions function ensures consistency with the navigation options defined earlier in the file.

apps/native/app/src/screens/home/applications-module.tsx (2)

Line range hint 1-92: LGTM! The component changes align with the new design requirements.

The ApplicationsModule component has been significantly refactored to improve clarity, maintainability, and user experience:

  • Unused imports have been removed, indicating a shift in the component's functionality.
  • The ApplicationsModuleProps interface has been simplified by removing optional properties, reducing the component's configurability.
  • The rendering logic has been streamlined by introducing a new ApplicationsPreview component, which consolidates application displays and enhances the user experience.
  • The handling of loading and error states has been retained, ensuring a consistent user experience.
  • The display of applications when there are no active applications has been modified to use a different message identifier, reflecting a change in the user interface text.

Overall, the changes align with the new design requirements and enhance the component's functionality.


Line range hint 1-92: Confirmed: The code adheres to the relevant additional instructions.

The ApplicationsModule component is a React Native component and does not involve NextJS, server-side rendering, or API routes. However, the component uses TypeScript for type safety, which aligns with the additional instructions.

apps/native/app/src/ui/lib/problem/problem-template.tsx (3)

86-94: LGTM!

The changes to the Tag component look good. Using View instead of Typography and removing the color prop promotes better separation of concerns between background and text styling. This can improve maintainability and flexibility in styling.


96-98: LGTM!

Introducing the TagText component is a good change. It encapsulates the text rendering within its own component, allowing for more granular control over text styling while separating it from the background styling of the Tag. This enhances the component's structure and promotes better separation of concerns.


124-127: LGTM!

The updated rendering logic in the ProblemTemplate component looks good. It reflects the changes made to the Tag and TagText components, ensuring that the Tag wraps the TagText and the tagColor is passed to the TagText component. This aligns with the new component structure and promotes better separation of concerns.

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

21-23: LGTM!

The new entries in the ComponentRegistry object follow the established naming convention and are consistent with the existing structure. The additions expand the available components, likely to support additional screens related to the status of applications.

The changes are approved.

apps/native/app/src/ui/lib/card/status-card.tsx (10)

4-4: LGTM!

The change is approved.


7-7: LGTM!

The change is approved.


8-8: LGTM!

The change is approved.


9-9: LGTM!

The change is approved.


12-12: LGTM!

The style changes are approved.

Also applies to: 26-27, 48-51, 56-57


77-80: LGTM!

The new props are approved.


93-96: LGTM!

The changes are approved.

Also applies to: 98-100


110-112: LGTM!

The changes are approved.

Also applies to: 117-125


126-134: LGTM!

The changes are approved.


136-136: LGTM!

The changes are approved.

Also applies to: 141-143

apps/native/app/src/screens/applications/applications.tsx (3)

59-63: LGTM!

The SortedApplication interface is correctly defined and helps in improving the type safety and readability of the code.


65-92: LGTM!

The sortApplicationsStatus function is correctly implemented and helps in improving the organization and clarity of the application data.


Line range hint 99-183: LGTM!

The changes to the ApplicationsScreen component are well-implemented and adhere to the 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.

The changes enhance the functionality and user experience of the ApplicationsScreen by providing a more organized display of application statuses and improving the component's structure.

apps/native/app/src/screens/applications/components/applications-preview.tsx (4)

1-28: LGTM!

The imports and ApplicationsPreviewProps interface are well-defined and follow best practices.


48-180: LGTM!

The ApplicationsPreview component is well-implemented and follows best practices. It effectively renders the application status cards based on the provided props and conditionally renders the heading and "See All" button.

The component adheres to the NextJS best practices, efficiently manages the state, and utilizes TypeScript for type safety.


56-57: LGTM!

The usage of useIntl, useTheme, and useBrowser hooks is appropriate and follows best practices.

  • useIntl is used for internationalization and formatting localized messages.
  • useTheme is used to access the theme object and apply theme-based styles.
  • useBrowser is a custom hook used to open external URLs, which keeps the component focused on its main responsibility.

62-133: LGTM!

The getApplications function is well-implemented and follows best practices.

  • It correctly slices the array based on the numberOfItems to limit the number of rendered applications.
  • It effectively maps over the sliced array and renders StatusCard components for each application.
  • The props passed to the StatusCard component are correctly derived from the application data.
  • The function uses TypeScript effectively to ensure type safety.
apps/native/app/src/utils/lifecycle/setup-components.tsx (3)

7-9: LGTM!

The imports for the new application screens are correctly added and follow the existing import pattern in the file.


107-107: LGTM!

The ApplicationsCompletedScreen component is correctly registered with the CR.ApplicationsCompletedScreen identifier, following the existing registration pattern in the file.


108-115: LGTM!

The ApplicationsInProgressScreen and ApplicationsIncompleteScreen components are correctly registered with their respective identifiers, following the existing registration pattern in the file.

apps/native/app/src/screens/applications/components/applications-list.tsx (1)

1-223: Excellent work on the ApplicationsList component!

The component is well-structured, modular, and follows best practices. It efficiently handles different states (loading, error, empty) and provides a good user experience. The use of reusable UI components enhances code maintainability.

Some key highlights:

  • Effective use of GraphQL query to fetch the list of applications.
  • Proper handling of loading, error, and empty states.
  • Efficient rendering of the list using FlatList and RefreshControl for pull-to-refresh functionality.
  • Adherence to NextJS best practices, including file structure and efficient state management.
  • Optimal use of TypeScript for component and utility type safety.

Overall, the code changes are of high quality and align with the project's objectives.

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

54-56: LGTM!

The addition of the async keyword to the /applications route aligns it with the newly added routes and enables support for asynchronous operations.


59-69: LGTM!

The /applications-completed route is well-structured and follows a clear sequence of navigation actions. The use of passProps enhances the functionality by allowing dynamic data to be sent to the component.


71-81: LGTM!

The /applications-in-progress route is well-structured and follows a clear sequence of navigation actions. The use of passProps enhances the functionality by allowing dynamic data to be sent to the component.


83-93: LGTM!

The /applications-incomplete route is well-structured and follows a clear sequence of navigation actions. The use of passProps enhances the functionality by allowing dynamic data to be sent to the component.

apps/native/app/src/messages/en.ts (4)

477-479: LGTM!

The new localized messages for the applications screen are clear and concise.


480-482: LGTM!

The new localized messages for the applications screen provide useful information to the user.


486-492: LGTM!

The modified localized message for the application status card description is clear and provides useful information to the user.


499-503: LGTM!

The new localized message for the application status card status and the modified draft progress message are clear and provide useful information to the user.

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

476-478: Changes look good!

The added localization strings for the empty state in the applications screen are appropriate and align well with the context.


479-481: LGTM!

The added localization strings provide clear and concise labels for the different application states. The changes are approved.


485-491: Changes approved!

The modifications to the localization string for the application status card description provide appropriate descriptions based on the application state. The changes look good.


495-499: LGTM!

The modifications to the localization string for the application status provide clear and appropriate labels based on the application state. The changes are approved.


501-502: Changes look good!

The added localization string for the draft application progress provides a clear and informative message to indicate the progress of draft applications. The changes are approved.

@thoreyjona thoreyjona force-pushed the feat/update-applications-screen branch from dd0b38d to b04f525 Compare September 11, 2024 16:33
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 (1)
apps/native/app/src/ui/lib/card/status-card.tsx (1)

Line range hint 98-149: LGTM, but address the static analysis hint.

The code changes are approved.

However, the static analysis tool has flagged a potential issue:

[error] 60-60: Do not shadow the global "Date" property.

Consider renaming the Date styled component to avoid confusion with the global Date object.

Apply this diff to fix the naming:

-const Date = styled.View`
+const DateContainer = styled.View`
  flex-direction: row;
  align-items: center;
`
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 07b9192 and dd0b38d.

Files selected for processing (2)
  • apps/native/app/src/graphql/fragments/application.fragment.graphql (1 hunks)
  • apps/native/app/src/ui/lib/card/status-card.tsx (6 hunks)
Files skipped from review as they are similar to previous changes (1)
  • apps/native/app/src/graphql/fragments/application.fragment.graphql
Additional context used
Path-based instructions (1)
apps/native/app/src/ui/lib/card/status-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."
Biome
apps/native/app/src/ui/lib/card/status-card.tsx

[error] 60-60: Do not shadow the global "Date" property.

Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global.

(lint/suspicious/noShadowRestrictedNames)

Additional comments not posted (3)
apps/native/app/src/ui/lib/card/status-card.tsx (3)

Line range hint 12-27: LGTM!

The code changes are approved.


48-57: LGTM!

The code changes are approved.


Line range hint 77-96: LGTM!

The code changes are approved.

Tools
Biome

[error] 60-60: Do not shadow the global "Date" property.

Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global.

(lint/suspicious/noShadowRestrictedNames)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between dd0b38d and 141b33b.

Files selected for processing (19)
  • apps/native/app/src/graphql/fragments/application.fragment.graphql (1 hunks)
  • apps/native/app/src/graphql/queries/applications.graphql (1 hunks)
  • apps/native/app/src/messages/en.ts (1 hunks)
  • apps/native/app/src/messages/is.ts (1 hunks)
  • apps/native/app/src/screens/applications/applications-completed.tsx (1 hunks)
  • apps/native/app/src/screens/applications/applications-in-progress.tsx (1 hunks)
  • apps/native/app/src/screens/applications/applications-incomplete.tsx (1 hunks)
  • apps/native/app/src/screens/applications/applications.tsx (3 hunks)
  • apps/native/app/src/screens/applications/components/applications-list.tsx (1 hunks)
  • apps/native/app/src/screens/applications/components/applications-preview.tsx (1 hunks)
  • apps/native/app/src/screens/home/applications-module.tsx (3 hunks)
  • apps/native/app/src/ui/index.ts (1 hunks)
  • apps/native/app/src/ui/lib/badge/badge.tsx (1 hunks)
  • apps/native/app/src/ui/lib/card/status-card.tsx (5 hunks)
  • apps/native/app/src/ui/lib/problem/problem-template.tsx (2 hunks)
  • apps/native/app/src/ui/lib/progress-meter/progress-meter.tsx (1 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 skipped from review due to trivial changes (1)
  • apps/native/app/src/ui/index.ts
Files skipped from review as they are similar to previous changes (11)
  • apps/native/app/src/graphql/fragments/application.fragment.graphql
  • apps/native/app/src/graphql/queries/applications.graphql
  • apps/native/app/src/messages/en.ts
  • apps/native/app/src/screens/applications/applications-completed.tsx
  • apps/native/app/src/screens/applications/applications-in-progress.tsx
  • apps/native/app/src/screens/applications/applications-incomplete.tsx
  • apps/native/app/src/screens/applications/components/applications-list.tsx
  • apps/native/app/src/screens/applications/components/applications-preview.tsx
  • apps/native/app/src/ui/lib/progress-meter/progress-meter.tsx
  • apps/native/app/src/utils/component-registry.ts
  • apps/native/app/src/utils/lifecycle/setup-components.tsx
Additional context used
Path-based instructions (7)
apps/native/app/src/ui/lib/badge/badge.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/home/applications-module.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/problem/problem-template.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/status-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/screens/applications/applications.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."
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."
Biome
apps/native/app/src/ui/lib/card/status-card.tsx

[error] 60-60: Do not shadow the global "Date" property.

Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global.

(lint/suspicious/noShadowRestrictedNames)

Additional comments not posted (40)
apps/native/app/src/ui/lib/badge/badge.tsx (6)

2-3: LGTM!

The imports are correctly used and adhere to the NextJS best practices, enabling efficient styling with useTheme and text rendering with the Typography component.


8-8: LGTM!

The padding update correctly uses the theme.spacing[1] value for consistent spacing.


13-13: LGTM!

The new variant property enhances the component's flexibility by allowing different styling options. The variant values are correctly typed as string literals.


16-29: LGTM!

The colorSchemes object is correctly implemented and typed using as const for type safety. The color values are correctly referenced from the theme object, enabling dynamic styling based on the selected variant.


31-32: LGTM!

The Badge function update correctly accepts the variant prop with a default value and uses the useTheme hook for styling. The changes align with the component's enhanced functionality.


34-42: LGTM!

The Host and Typography component updates correctly leverage the colorSchemes object for dynamic styling based on the selected variant. The background color and title color are correctly set using the backgroundColor style property and the color prop, respectively.

apps/native/app/src/screens/home/applications-module.tsx (5)

1-5: LGTM!

The import statements have been updated appropriately:

  • Unused imports have been removed, which improves code clarity and reduces bundle size.
  • Image and SafeAreaView imports have been added, suggesting that the component will use these React Native components.

9-12: LGTM!

The import statements have been updated appropriately:

  • Application, ListApplicationsQuery, and useListApplicationsQuery imports have been added, suggesting that the component will use GraphQL queries and types related to applications.

14-14: LGTM!

The import statement has been updated appropriately:

  • ApplicationsPreview component import has been added, suggesting that the ApplicationsModule component will use this component.

Line range hint 41-85: LGTM!

The ApplicationsModule component has been updated appropriately:

  • The component now uses the ApplicationsPreview component to display applications, which enhances the clarity and maintainability of the component while also improving the user experience by consolidating application displays into a single component.
  • The rendering logic has been streamlined and the handling of loading and error states has been retained.
  • The way applications are displayed when there are no active applications has been modified.
  • The component adheres to React best practices by using functional components, hooks, and conditional rendering.
  • The component uses TypeScript for type safety.

Line range hint 88-94: LGTM!

The component exports have been updated appropriately:

  • ApplicationsModule, useListApplicationsQuery, and validateApplicationsInitialData are being exported, which is consistent with the component's implementation.
apps/native/app/src/ui/lib/problem/problem-template.tsx (4)

86-94: LGTM!

The changes to the Tag component's structure and styling are well-implemented and align with the AI-generated summary. Separating the background and text styling enhances the component's maintainability and flexibility.


96-98: LGTM!

The introduction of the TagText component is a great addition. It promotes better separation of concerns between background and text styling, improving the overall structure and maintainability of the code.


124-128: LGTM!

The updated rendering logic within the ProblemTemplate component is consistent with the modifications made to the Tag and TagText components. It's great to see that the previous issue with applying border-radius to the Tag component has been resolved by using the View component instead of the Typography component.


Line range hint 1-144: Code adheres to best practices and effectively utilizes TypeScript.

After reviewing the entire file, I can confirm that the code adheres to the following:

  • The file structure and naming conventions follow best practices for React components.
  • The component is a presentational component and does not require state management or server-side rendering techniques.
  • TypeScript is used effectively to define component prop types and styled component prop types, enhancing type safety.

Overall, the code is well-structured, maintainable, and follows best practices.

apps/native/app/src/ui/lib/card/status-card.tsx (10)

4-4: LGTM!

The import of useTheme from styled-components/native is valid and necessary for using the theme in the component.


7-8: LGTM!

The imports of Typography and useOrganizationsStore are valid and necessary for using the Typography component and accessing the useOrganizationsStore hook in the component.


9-9: LGTM!

The import of ProgressMeter from ../progress-meter/progress-meter is valid and necessary for using the ProgressMeter component in the component.


Line range hint 12-27: LGTM!

The changes to the Host and ActionsContainer styled components are valid and improve the layout and alignment of the component.


48-51: LGTM!

The changes to the Title styled component are valid and improve the layout and alignment of the title section.


56-57: LGTM!

The changes to the Content styled component are valid and adjust the padding of the content section.


77-80: LGTM!

The new optional props added to the StatusCardProps interface are valid and necessary for the enhanced functionality and layout of the component.


Line range hint 93-134: LGTM!

The changes to the component's implementation, including the usage of the new props, the restructuring of the Title component, the updates to the Description and Progress sections, and the replacement of the Progress component with a ProgressMeter component, are all valid and enhance the component's usability, visual appeal, and integration with the application's state management.


141-143: LGTM!

The changes to the Typography component used for rendering the action button text, including the usage of the "heading5" variant and the theme.color.blue400 color, are valid and improve the visual hierarchy and consistency of text styling across the component.


Line range hint 1-150: Overall assessment

The changes introduced in this file, including the new props, the restructuring of the component's layout, the usage of the Typography component, and the integration with the useOrganizationsStore hook, are all valid and enhance the component's functionality, visual appeal, and integration with the application's state management.

The only suggestion is to consider renaming the Date styled component to avoid potential confusion with the global Date property, as pointed out by the static analysis hint.

Overall, the changes are well-structured, follow best practices, and improve the component's reusability and maintainability. Great job!

apps/native/app/src/screens/applications/applications.tsx (5)

59-89: LGTM!

The new SortedApplication interface and sortApplicationsStatus function are well-implemented and improve code organization by encapsulating the sorting logic. Using the ApplicationResponseDtoStatusEnum to determine the application status is a good practice.


96-103: LGTM!

The refetching state variable and the memoized applications variable are well-implemented. Memoizing the applications variable is a good practice to avoid unnecessary re-renders, and using the optional chaining operator to safely access the applicationApplications property is a good practice as well.


111-114: LGTM!

The memoized sortedApplications variable is well-implemented. Memoizing the variable is a good practice to avoid unnecessary re-computations, and using the sortApplicationsStatus function to sort the applications is the correct approach.


139-180: LGTM!

The changes made to the rendering logic of the ApplicationsScreen component are well-implemented:

  • Replacing the FlatList with a ScrollView is a significant change that alters the way the applications are displayed, but it seems to be intentional and aligns with the new design requirements.
  • The RefreshControl component is correctly used to provide pull-to-refresh functionality.
  • The EmptyList component is rendered with the correct props when there are no applications.
  • The ApplicationsPreview component is used multiple times to render the different categories of sorted applications, which is a good practice for code reusability.

124-124: LGTM!

The update to the onRefresh function is well-implemented:

  • The refetch method is correctly used to refetch the applications when the user refreshes the screen.
  • The refetching state variable is correctly set to true before refetching and set back to false after refetching is completed.
  • The try-catch block is used to handle any errors that may occur during refetching, which is a good practice.
apps/native/app/src/utils/lifecycle/setup-routes.ts (5)

54-57: LGTM!

The update to the /applications route to use an async callback function is consistent with the other route updates in this file.


59-69: Looks good!

The implementation of the /applications-completed route follows the established pattern and effectively uses passProps to pass data to the screen component. The code is clean and well-structured.


71-81: LGTM!

The /applications-in-progress route is implemented consistently with the other new routes, following the established pattern. The code looks good.


83-93: Looks good!

The /applications-incomplete route follows the same implementation pattern as the other new application routes. The code is clean and consistent.


54-93: Overall assessment: Approved!

The changes in this file introduce three new routes (/applications-completed, /applications-in-progress, and /applications-incomplete) to handle different application statuses. The route implementations follow a consistent pattern, effectively use passProps to pass data to the screen components, and adhere to best practices.

The code is clean, well-structured, and aligns with the established conventions in the codebase. No issues or potential improvements were identified during the review.

Great job with these enhancements to the application routing logic!

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

476-478: LGTM!

The added localization strings for the applications screen title and empty state are clear and concise.


479-481: Looks good!

The added localization strings for the different application statuses provide clear information to the user.


485-491: Great improvement!

Updating the applicationStatusCard.description localization string to utilize a more dynamic format through interpolation enhances the contextual representation of application states. This change aligns with the list of alterations provided in the summary.


495-499: Nice work!

Modifying the applicationStatusCard.status localization string to utilize a more dynamic format through interpolation allows for better representation of different application statuses. This change aligns with the list of alterations provided in the summary.


501-502: Excellent addition!

The new applicationStatusCard.draftProgress localization string provides users with clear information about their progress in draft applications. This change aligns with the list of alterations provided in the summary.

Copy link
Contributor

@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.

Really nice work 👏 . I enjoyed reading your code. The refactoring looks awesome!
Few nits but nothing blocking that I could see.

Note! I did not start up the app 🙈

apps/native/app/src/screens/home/applications-module.tsx Outdated Show resolved Hide resolved
apps/native/app/src/ui/lib/badge/badge.tsx Outdated Show resolved Hide resolved
apps/native/app/src/ui/lib/card/status-card.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: 5

Outside diff range and nitpick comments (4)
apps/native/app/src/screens/home/applications-module.tsx (2)

68-69: Simplify by omitting the unnecessary link prop

Since the link prop is set to null in the EmptyCard component, and if link is optional with a default value of null, you can omit it to clean up the code.

Apply this diff to remove the unnecessary prop:

               image={
                 <Image
                   source={leJobss3}
                   resizeMode="contain"
                   style={{ height: 87, width: 69 }}
                 />
               }
-              link={null}
             />

73-73: Avoid unnecessary type assertion on applications

The applications variable is already an array. Explicitly typing it can eliminate the need for a type assertion when passing it to ApplicationsPreview.

Apply the following changes to improve type safety:

     const applications = data?.applicationApplications ?? []
+    const applications: Application[] = data?.applicationApplications ?? []

     ...

                 {count !== 0 && (
                   <ApplicationsPreview
-                    applications={applications as Application[]}
+                    applications={applications}
                     headingTitleId="home.applicationsStatus"
apps/native/app/src/screens/applications/applications.tsx (2)

124-124: Handle Errors in onRefresh Function

Currently, errors caught in the onRefresh function are silently ignored. For better debugging and user feedback, consider logging the error or handling it appropriately.

Here's how you might log the error:

   try {
     await applicationsRes.refetch()
   } catch (e) {
-    // noop
+    console.error('Error refetching applications:', e)
   } finally {
     setRefetching(false)
   }

144-159: Improve Conditional Rendering of Empty State

The condition !applications.length works correctly but can be less readable. For clarity, consider using applications.length === 0.

Apply this minor change:

         {!
-          applications.length ? (
+          applications.length === 0 ? (
           <View style={{ marginTop: 80, paddingHorizontal: 16 }}>
             <EmptyList
               title={intl.formatMessage({ id: 'applications.emptyTitle' })}
               description={intl.formatMessage({
                 id: 'applications.emptyDescription',
               })}
               image={
                 <Image
                   source={illustrationSrc}
                   style={{ height: 210, width: 167 }}
                 />
               }
             />
           </View>
         ) : null}
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 141b33b and fa2dd6c.

Files selected for processing (9)
  • apps/native/app/src/screens/applications/applications-completed.tsx (1 hunks)
  • apps/native/app/src/screens/applications/applications-in-progress.tsx (1 hunks)
  • apps/native/app/src/screens/applications/applications-incomplete.tsx (1 hunks)
  • apps/native/app/src/screens/applications/applications.tsx (3 hunks)
  • apps/native/app/src/screens/applications/components/applications-list.tsx (1 hunks)
  • apps/native/app/src/screens/applications/components/applications-preview.tsx (1 hunks)
  • apps/native/app/src/screens/home/applications-module.tsx (3 hunks)
  • apps/native/app/src/ui/lib/card/status-card.tsx (4 hunks)
  • apps/native/app/src/ui/lib/progress-meter/progress-meter.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (6)
  • apps/native/app/src/screens/applications/applications-completed.tsx
  • apps/native/app/src/screens/applications/applications-in-progress.tsx
  • apps/native/app/src/screens/applications/applications-incomplete.tsx
  • apps/native/app/src/screens/applications/components/applications-list.tsx
  • apps/native/app/src/screens/applications/components/applications-preview.tsx
  • apps/native/app/src/ui/lib/progress-meter/progress-meter.tsx
Additional context used
Path-based instructions (3)
apps/native/app/src/screens/home/applications-module.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/status-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/screens/applications/applications.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."
Biome
apps/native/app/src/ui/lib/card/status-card.tsx

[error] 60-60: Do not shadow the global "Date" property.

Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global.

(lint/suspicious/noShadowRestrictedNames)

Additional comments not posted (3)
apps/native/app/src/screens/home/applications-module.tsx (1)

Line range hint 1-78: Confirm applicability of Next.js best practices to React Native code

The additional instructions mention adhering to Next.js best practices. However, this code is part of a React Native application. Please verify whether Next.js guidelines are applicable here or if React Native best practices should be followed instead.

To ensure the code aligns with the appropriate best practices, please confirm the intended framework for these guidelines.

apps/native/app/src/ui/lib/card/status-card.tsx (1)

1-1: Confirm applicability of NextJS best practices

The additional instructions mention NextJS best practices, but this file is part of a React Native application. Please confirm whether NextJS guidelines are applicable here.

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

96-97: Verify Initial State of hiddenContent

The hiddenContent state is initialized with isIos. Verify that this correctly initializes the state based on your application's requirements. If hiddenContent should only be true on iOS devices due to a known issue, consider adding a comment for clarity.

Is isIos the intended initial value for hiddenContent? Ensure it aligns with the platform-specific behavior you expect.

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

Outside diff range and nitpick comments (4)
apps/native/app/src/ui/lib/problem/problem-template.tsx (1)

Line range hint 28-33: Potential missing 'error' icon in getIcon function

The getIcon function does not handle the 'error' variant, which may result in an undefined icon when variant is 'error'. Ensure that all variants are accounted for to prevent runtime errors.

Apply this diff to add the 'error' case:

 const getIcon = (variant: Variant) => {
   switch (variant) {
+    case 'error':
+      return require('../../assets/icons/error.png')
     case 'warning':
       return require('../../assets/icons/warning.png')

     case 'info':
       return require('../../assets/icons/info.png')
   }
 }
apps/native/app/src/ui/lib/card/status-card.tsx (2)

109-111: Ensure consistent usage of spacing units in styles

There's inconsistent use of spacing units between theme.spacing.smallGutter and theme.spacing[1] in the styles of the Image components. For consistency and maintainability, consider using a unified approach to spacing units throughout the component.

Also applies to: 124-124


56-57: Avoid overriding padding-top after setting padding

Setting padding and then overriding padding-top: 0 can be confusing. Consider specifying individual padding values to improve clarity.

Apply this diff to define padding more explicitly:

-  padding: ${({ theme }) => theme.spacing[2]}px;
-  padding-top: 0;
+  padding: ${({ theme }) => `0 ${theme.spacing[2]}px ${theme.spacing[2]}px`};
apps/native/app/src/utils/lifecycle/setup-routes.ts (1)

54-56: Unnecessary async keyword in function without await

The route handler for /applications is now declared as async, but it doesn't contain any await expressions. While this doesn't cause functional issues, it's unnecessary to use async if no asynchronous operations are performed.

Apply this diff to remove the unnecessary async keyword:

-addRoute('/applications', async () => {
+addRoute('/applications', () => {
  Navigation.dismissAllModals()
  selectTab(3)
})
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0482a9e and 39fefbd.

Files selected for processing (20)
  • apps/native/app/src/graphql/fragments/application.fragment.graphql (1 hunks)
  • apps/native/app/src/graphql/queries/applications.graphql (1 hunks)
  • apps/native/app/src/messages/en.ts (1 hunks)
  • apps/native/app/src/messages/is.ts (1 hunks)
  • apps/native/app/src/screens/applications/applications-completed.tsx (1 hunks)
  • apps/native/app/src/screens/applications/applications-in-progress.tsx (1 hunks)
  • apps/native/app/src/screens/applications/applications-incomplete.tsx (1 hunks)
  • apps/native/app/src/screens/applications/applications.tsx (3 hunks)
  • apps/native/app/src/screens/applications/components/applications-list.tsx (1 hunks)
  • apps/native/app/src/screens/applications/components/applications-preview.tsx (1 hunks)
  • apps/native/app/src/screens/home/applications-module.tsx (3 hunks)
  • apps/native/app/src/screens/vehicles/components/vehicle-item.tsx (1 hunks)
  • apps/native/app/src/ui/index.ts (1 hunks)
  • apps/native/app/src/ui/lib/badge/badge.tsx (1 hunks)
  • apps/native/app/src/ui/lib/card/status-card.tsx (4 hunks)
  • apps/native/app/src/ui/lib/problem/problem-template.tsx (2 hunks)
  • apps/native/app/src/ui/lib/progress-meter/progress-meter.tsx (1 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 skipped from review due to trivial changes (1)
  • apps/native/app/src/screens/vehicles/components/vehicle-item.tsx
Files skipped from review as they are similar to previous changes (12)
  • apps/native/app/src/graphql/fragments/application.fragment.graphql
  • apps/native/app/src/graphql/queries/applications.graphql
  • apps/native/app/src/messages/en.ts
  • apps/native/app/src/screens/applications/applications-completed.tsx
  • apps/native/app/src/screens/applications/applications-in-progress.tsx
  • apps/native/app/src/screens/applications/applications-incomplete.tsx
  • apps/native/app/src/screens/applications/components/applications-list.tsx
  • apps/native/app/src/screens/applications/components/applications-preview.tsx
  • apps/native/app/src/ui/index.ts
  • apps/native/app/src/ui/lib/progress-meter/progress-meter.tsx
  • apps/native/app/src/utils/component-registry.ts
  • apps/native/app/src/utils/lifecycle/setup-components.tsx
Additional context used
Path-based instructions (7)
apps/native/app/src/ui/lib/badge/badge.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/home/applications-module.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/problem/problem-template.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/status-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/screens/applications/applications.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."
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."
Biome
apps/native/app/src/ui/lib/card/status-card.tsx

[error] 60-60: Do not shadow the global "Date" property.

Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global.

(lint/suspicious/noShadowRestrictedNames)

Additional comments not posted (10)
apps/native/app/src/ui/lib/badge/badge.tsx (1)

31-42: Component updates are well-implemented

The Badge component correctly incorporates the variant prop to dynamically adjust styling and uses useTheme appropriately.

apps/native/app/src/screens/home/applications-module.tsx (2)

77-77: Confirm the usage of the slider prop without a value.

Passing slider without a value sets it to true in JSX. Ensure that ApplicationsPreview expects a boolean slider prop and that this is the intended behavior.


75-75: Ensure proper navigation handling for headingTitleNavigationLink in React Native.

The headingTitleNavigationLink prop is set to the string "/applications". In React Native, navigation typically uses navigation actions or component IDs rather than URL paths. Verify that ApplicationsPreview handles this prop correctly in a React Native context.

Run the following script to check how headingTitleNavigationLink is used in ApplicationsPreview:

Verification successful

headingTitleNavigationLink is properly handled, but verify navigateTo function.

The ApplicationsPreview component correctly uses the headingTitleNavigationLink prop. It's passed to a navigateTo function, which suggests a navigation system is in place. However, to ensure full compatibility with React Native:

  • Verify that the navigateTo function can handle URL-like paths ("/applications") in a React Native context.
  • If navigateTo is a custom function, review its implementation to confirm it translates URL-like paths to appropriate React Native navigation actions.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check the usage of `headingTitleNavigationLink` in `ApplicationsPreview`.

# Search for the prop definition and usage in `ApplicationsPreview` component.
rg --type tsx 'ApplicationsPreview' -A 50 | rg -A 5 'headingTitleNavigationLink'

Length of output: 106


Script:

#!/bin/bash
# Find TypeScript/JavaScript files in the relevant directory
echo "Searching for TypeScript/JavaScript files:"
fd '\.(ts|tsx|js|jsx)$' apps/native/app/src/screens/home/

# Search for ApplicationsPreview in those files
echo -e "\nSearching for ApplicationsPreview component:"
rg --type-add 'typescript:*.{ts,tsx}' --type-add 'javascript:*.{js,jsx}' -t typescript -t javascript 'ApplicationsPreview' apps/native/app/src/screens/home/

# Examine the usage of headingTitleNavigationLink prop
echo -e "\nExamining headingTitleNavigationLink prop usage:"
rg --type-add 'typescript:*.{ts,tsx}' --type-add 'javascript:*.{js,jsx}' -t typescript -t javascript 'headingTitleNavigationLink' apps/native/app/src/screens/home/

Length of output: 1511


Script:

#!/bin/bash
# Locate the applications-preview file
echo "Locating applications-preview file:"
fd 'applications-preview\.(ts|tsx|js|jsx)$' apps/native/app/src/

# Examine the ApplicationsPreview component implementation
echo -e "\nExamining ApplicationsPreview component implementation:"
rg --type-add 'typescript:*.{ts,tsx}' --type-add 'javascript:*.{js,jsx}' -t typescript -t javascript -A 20 'export (const|function) ApplicationsPreview' $(fd 'applications-preview\.(ts|tsx|js|jsx)$' apps/native/app/src/)

# Search for headingTitleNavigationLink usage within ApplicationsPreview
echo -e "\nSearching for headingTitleNavigationLink usage:"
rg --type-add 'typescript:*.{ts,tsx}' --type-add 'javascript:*.{js,jsx}' -t typescript -t javascript 'headingTitleNavigationLink' $(fd 'applications-preview\.(ts|tsx|js|jsx)$' apps/native/app/src/)

Length of output: 1800

apps/native/app/src/ui/lib/problem/problem-template.tsx (5)

86-94: Refactored Tag component enhances styling flexibility

Changing the Tag component from Typography to View allows for proper application of border-radius, and separating text styling into TagText improves maintainability by clearly distinguishing between container styling and text styling.


96-96: TagText component effectively separates text styling

Introducing the TagText component styled with Typography enhances the modularity of the code, allowing for more precise control over text properties independent of the tag container.


124-127: Rendering Tag and TagText components correctly

The updated rendering logic properly nests TagText within Tag, utilizing the backgroundColor and color props as intended, and ensuring consistent styling aligned with the variant.


124-127: Ensure sufficient color contrast for accessibility

Verify that the combination of tagColor and tagBackgroundColor provides adequate contrast to meet accessibility standards, ensuring the text within the tag is easily readable for all users.


Line range hint 1-139: Clarify applicability of NextJS best practices to React Native code

The additional instructions mention adhering to NextJS best practices, including file structure and server-side rendering techniques. Since this file is part of a React Native application, please confirm if these practices are intended to be applied here or if there are specific React Native guidelines to follow.

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

112-112: Avoid Unnecessary Type Casting

The cast to Application[] may be unnecessary if applications is already typed correctly. If the type inference is accurate, you can remove the type casting to simplify the code.

Apply this diff to remove the unnecessary cast:

 const sortedApplications = useMemo(
-  () => sortApplicationsStatus(applications as Application[]),
+  () => sortApplicationsStatus(applications),
   [applications],
 )

Likely invalid or redundant comment.

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

54-93: Ensure TypeScript type safety and state management best practices

To align with the additional instructions for files matching the apps/**/* pattern, please verify the following:

  • TypeScript Type Safety: Ensure that all passProps are accurately typed. Define interfaces or types for the props to enhance type safety and prevent potential runtime errors.
  • Efficient State Management: Confirm that state changes within the navigation functions do not lead to unintended side effects. Utilize state management best practices to maintain application performance and reliability.

apps/native/app/src/ui/lib/badge/badge.tsx Outdated Show resolved Hide resolved
apps/native/app/src/screens/applications/applications.tsx Outdated Show resolved Hide resolved
apps/native/app/src/screens/applications/applications.tsx Outdated Show resolved Hide resolved
apps/native/app/src/messages/is.ts Show resolved Hide resolved
apps/native/app/src/messages/is.ts Outdated Show resolved Hide resolved
Copy link

codecov bot commented Sep 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 36.66%. Comparing base (e9ebcaf) to head (3784b0d).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #15964   +/-   ##
=======================================
  Coverage   36.66%   36.66%           
=======================================
  Files        6748     6748           
  Lines      138733   138733           
  Branches    39407    39407           
=======================================
  Hits        50862    50862           
  Misses      87871    87871           
Flag Coverage Δ
api 3.39% <ø> (ø)
api-domains-auth-admin 49.89% <ø> (ø)
api-domains-communications 39.98% <ø> (ø)
application-system-api 41.50% <ø> (ø)
application-template-api-modules 23.45% <ø> (-0.01%) ⬇️
cms 0.43% <ø> (ø)
cms-translations 39.12% <ø> (ø)
content-search-toolkit 8.50% <ø> (ø)
judicial-system-api 18.61% <ø> (ø)
judicial-system-backend 54.71% <ø> (ø)
services-user-notification 47.16% <ø> (ø)

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


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 e9ebcaf...3784b0d. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Sep 17, 2024

Datadog Report

Branch report: feat/update-applications-screen
Commit report: cb73350
Test service: web

✅ 0 Failed, 84 Passed, 0 Skipped, 32.48s Total Time
➡️ Test Sessions change in coverage: 1 no change

@thoreyjona thoreyjona removed the automerge Merge this PR as soon as all checks pass label Sep 18, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 39fefbd and 64fc45a.

Files selected for processing (1)
  • apps/native/app/src/screens/applications/applications.tsx (3 hunks)
Additional context used
Path-based instructions (1)
apps/native/app/src/screens/applications/applications.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."

@thoreyjona thoreyjona added the automerge Merge this PR as soon as all checks pass label Sep 19, 2024
@thoreyjona thoreyjona removed the automerge Merge this PR as soon as all checks pass label Sep 19, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 32b75c1 and 64b7e90.

Files selected for processing (4)
  • apps/native/app/src/screens/applications/applications-completed.tsx (1 hunks)
  • apps/native/app/src/screens/applications/applications-in-progress.tsx (1 hunks)
  • apps/native/app/src/screens/applications/applications-incomplete.tsx (1 hunks)
  • apps/native/app/src/screens/applications/applications.tsx (3 hunks)
Files skipped from review as they are similar to previous changes (2)
  • apps/native/app/src/screens/applications/applications-completed.tsx
  • apps/native/app/src/screens/applications/applications-in-progress.tsx
Additional context used
Path-based instructions (2)
apps/native/app/src/screens/applications/applications-incomplete.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/applications/applications.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 not posted (11)
apps/native/app/src/screens/applications/applications-incomplete.tsx (6)

1-11: LGTM!

The imports are relevant and necessary for the component. The code segment looks good.


13-29: Navigation options are configured correctly.

The code segment uses a custom function createNavigationOptionHooks to configure the navigation options, which promotes code reusability. The top bar title and bottom tabs visibility are set appropriately.


31-48: The component is defined and uses hooks correctly.

The ApplicationsIncompleteScreen component is defined correctly as a NavigationFunctionComponent. It uses the useListApplicationsQuery hook to fetch applications with specific statuses and manages the refetching state locally. The locale is retrieved from the usePreferencesStore hook to determine the language for the query.


50-54: Connectivity indicator hook is used correctly.

The code segment uses the useConnectivityIndicator hook to monitor connectivity status and manage the refetching state. The necessary parameters, such as componentId, refetching state, and applicationsRes query result, are passed to the hook correctly.


56-65: ApplicationsList component is rendered correctly.

The code segment renders the ApplicationsList component with the necessary props. The applicationsRes is passed to display the fetched applications, and the onRefetch callback is passed to trigger data refetching. The displayProgress and displayDescription props are set to control the display behavior.


67-67: Screen options are configured correctly.

Assigning the getNavigationOptions function to the options property of the ApplicationsIncompleteScreen component is a common pattern in React Native Navigation. It allows the screen to have dynamic options based on the component's props and state.

apps/native/app/src/screens/applications/applications.tsx (5)

179-179: Nice Refactoring with ApplicationsPreview Component

The refactoring of application previews into a separate ApplicationsPreview component is a great improvement. It enhances code modularity, reusability, and readability. Well done!


82-83: Correct Enum Value for Application Status

It appears that the enum value ApplicationResponseDtoStatusEnum.Inprogress might be incorrect. Typically, enum values use PascalCase, so ensure that the status is correctly spelled as InProgress. This will prevent any unexpected behavior when sorting applications.

Apply this diff to correct the enum value:

     } else if (
-      application.status === ApplicationResponseDtoStatusEnum.Inprogress
+      application.status === ApplicationResponseDtoStatusEnum.InProgress
     ) {
       inProgress.push(application)

Likely invalid or redundant comment.


123-123: Unnecessary Type Casting with as Application[]

The cast to Application[] may be unnecessary here since applications is already inferred as an array. If the type is correctly defined, you can omit the type casting for cleaner code.

Update the code to remove the unnecessary cast:

 const sortedApplications = useMemo(
-  () => sortApplicationsStatus(applications as Application[]),
+  () => sortApplicationsStatus(applications),
   [applications],
 )

Likely invalid or redundant comment.


77-78: Correct Enum Value for Application Status

It appears that the enum value ApplicationResponseDtoStatusEnum.Notstarted might be incorrect. Typically, enum values use PascalCase, so ensure that the status is correctly spelled as NotStarted. This will prevent any unexpected behavior when sorting applications.

Apply this diff to correct the enum value:

     if (
       application.status === ApplicationResponseDtoStatusEnum.Draft ||
-      application.status === ApplicationResponseDtoStatusEnum.Notstarted
+      application.status === ApplicationResponseDtoStatusEnum.NotStarted
     ) {
       incomplete.push(application)

Likely invalid or redundant comment.


135-138: Handle Errors in the Catch Block

The catch block in the onRefresh function is currently empty, which means any errors during the refetch are silently ignored. To improve error handling, consider adding logic to notify the user or log the error for debugging purposes.

Apply this diff to handle errors:

   try {
     await applicationsRes.refetch()
   } catch (e) {
-    // noop
+    console.error('Failed to refetch applications:', e)
   } finally {
     setRefetching(false)
   }

Likely invalid or redundant comment.

apps/native/app/src/screens/applications/applications.tsx Outdated Show resolved Hide resolved
@thoreyjona thoreyjona added the automerge Merge this PR as soon as all checks pass label Sep 19, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c81a945 and 2701130.

Files selected for processing (1)
  • apps/native/app/src/screens/applications/applications.tsx (3 hunks)
Additional context used
Path-based instructions (1)
apps/native/app/src/screens/applications/applications.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."

@kodiakhq kodiakhq bot merged commit da112ed into main Sep 19, 2024
24 checks passed
@kodiakhq kodiakhq bot deleted the feat/update-applications-screen branch September 19, 2024 17:26
@coderabbitai coderabbitai bot mentioned this pull request Dec 3, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants