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 app widgets to home screen #15902

Merged
merged 35 commits into from
Sep 9, 2024

Conversation

thoreyjona
Copy link
Contributor

@thoreyjona thoreyjona commented Sep 5, 2024

What

Add licenses, vehicles and air discount to home screen. Also adding an options screen that users can use to show/hide widgets on their home screen. When opening the app for the first time we do initialisation of the widgets based on the users data. The criteria is as follows:

  • Licenses: Only show module if user has a driving license
  • Vehicles: Only show if user has a vehicle that requires mileage registration (and order those vehicles first)
  • Applications: Only show if user has applications
  • Inbox: Only show if user has documents in inbox
  • Air Discount: Only show if user has rights for air discount

We only do the initialisation once. After that the user can turn on/off the widgets as he pleases and then we show an empty state if he does not have data to show but turned it on. On logout I set all the preferences that all widgets should be shown and they have not been initialised so it gets triggered again on next login.

When pulling down to refresh we only refetch data for the modules that are visible.

I also updated TableViewCell component to match new design changes. In relation to that I added sec. after the app lock configuration in the settings screen so it would look better.

Why

Show what is relevant for each and every user and allow for more customisation.

Caveats to discuss

  • If user suddenly gets a driving license or a vehicle with mileage registration, then we are not fetching the data again to check if anything has changed unless he logs out and in again. But he can always go into the options screen and turn widgets on and should then see his new data.
  • On first mount of the home screen after this change we fetch all the data once for all users (to do the initialisation) so we might se a spike in network requests once this goes live.

Screenshots / Gifs

Here you can see different users with different widgets shown after initialisation.

Screen.Recording.2024-09-05.at.10.17.22.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

  • New Features

    • Added a home options screen for users to customize widget visibility on the home screen.
    • Introduced an air discount module to manage and display air discount information.
    • Implemented a licenses module to manage user licenses and identity documents.
    • Added a vehicles module for displaying vehicle information and mileage registration.
  • Improvements

    • Enhanced clarity of timeout settings in the settings screen.
    • Improved user interface consistency with updated loading states and visual elements.
    • Expanded user preferences for home screen widget configurations.
    • Added new localization keys to enhance user experience and customization options.
    • Improved authentication process by resetting home screen widgets for a consistent interface.
  • Bug Fixes

    • Resolved issues with loading states and error handling across various modules.
    • Fixed the removal of redundant labels affecting user navigation.

@thoreyjona thoreyjona requested a review from a team as a code owner September 5, 2024 10:19
Copy link
Contributor

coderabbitai bot commented Sep 5, 2024

Walkthrough

The changes introduce a HomeOptionsScreen for configuring home screen widgets, enhancements to various modules for improved data handling, and updates to internationalization files. Additionally, there are modifications to the user interface, including styling updates and layout adjustments, as well as new props for better customization and flexibility in components. A new operation for resetting home screen widgets during authentication has also been added.

Changes

Files Change Summary
.../messages/en.ts, .../messages/is.ts Added new entries for app lock timeout and home options, removed 'home.inbox' translation, and expanded customization options for home screen settings.
.../home/home-options.tsx, .../home/home.tsx Introduced HomeOptionsScreen for configuring home screen widgets and updated MainHomeScreen for improved widget visibility based on user preferences.
.../home/inbox-module.tsx, .../home/licenses-module.tsx, .../home/vehicles-module.tsx Implemented new modules to display inbox, licenses, and vehicles with enhanced data fetching and error handling.
.../stores/auth-store.ts Added functionality to reset home screen widgets during the authentication process.
.../lifecycle/setup-routes.ts Added new routes for navigating to the home options screen, improving the application's navigation flow.
.../utils/test-ids.ts Introduced a new test ID for the home options button in the top bar for better testing capabilities.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant App
    participant HomeOptionsScreen

    User->>App: Navigate to Home Options
    App->>HomeOptionsScreen: Load Home Options Screen
    HomeOptionsScreen-->>App: Display Widget Configuration Options
    User->>HomeOptionsScreen: Toggle Widget Settings
    HomeOptionsScreen->>App: Update Preferences Store
    App-->>User: Reflect Changes on Home Screen
Loading

Possibly related PRs

  • fix(service-portal): Health Directorate - Fixes #15728: The changes in the main PR regarding the localization of app lock timeout and home options are related to the modifications in the is.ts file, which also includes similar updates for localization strings, including the app lock timeout and home options.

Suggested labels

automerge


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

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

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

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

CodeRabbit Commands (Invoked 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

codecov bot commented Sep 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 36.81%. Comparing base (bab1072) to head (d650f86).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #15902   +/-   ##
=======================================
  Coverage   36.81%   36.81%           
=======================================
  Files        6693     6693           
  Lines      137122   137122           
  Branches    38975    38975           
=======================================
  Hits        50475    50475           
  Misses      86647    86647           
Flag Coverage Δ
air-discount-scheme-backend 54.03% <ø> (ø)
air-discount-scheme-web 0.00% <ø> (ø)
api 3.39% <ø> (ø)
api-domains-air-discount-scheme 36.75% <ø> (ø)
api-domains-assets 26.71% <ø> (ø)
api-domains-auth-admin 53.90% <ø> (ø)
api-domains-communications 40.51% <ø> (ø)
api-domains-criminal-record 47.77% <ø> (ø)
api-domains-driving-license 44.31% <ø> (ø)
api-domains-education 31.22% <ø> (ø)
api-domains-health-insurance 34.58% <ø> (ø)
api-domains-mortgage-certificate 35.73% <ø> (ø)
api-domains-payment-schedule 41.05% <ø> (ø)
application-api-files 57.49% <ø> (ø)
application-core 71.95% <ø> (ø)
application-system-api 41.65% <ø> (-0.01%) ⬇️
application-template-api-modules 23.51% <ø> (+0.01%) ⬆️
application-templates-accident-notification 19.83% <ø> (ø)
application-templates-car-recycling 3.12% <ø> (ø)
application-templates-criminal-record 22.12% <ø> (ø)
application-templates-driving-license 15.96% <ø> (ø)
application-templates-estate 11.86% <ø> (ø)
application-templates-example-payment 20.79% <ø> (ø)
application-templates-financial-aid 12.09% <ø> (ø)
application-templates-general-petition 18.86% <ø> (ø)
application-templates-health-insurance 23.27% <ø> (ø)
application-templates-inheritance-report 4.63% <ø> (ø)
application-templates-marriage-conditions 10.47% <ø> (ø)
application-templates-mortgage-certificate 44.03% <ø> (ø)
application-templates-parental-leave 28.40% <ø> (ø)
application-types 6.74% <ø> (ø)
application-ui-components 1.52% <ø> (ø)
application-ui-shell 21.08% <ø> (ø)
auth-react 22.82% <ø> (ø)
clients-charge-fjs-v2 24.11% <ø> (ø)
clients-driving-license 40.62% <ø> (ø)
clients-driving-license-book 43.85% <ø> (ø)
clients-financial-statements-inao 49.10% <ø> (ø)
clients-license-client 1.83% <ø> (ø)
clients-middlewares 72.44% <ø> (-0.64%) ⬇️
clients-regulations 42.54% <ø> (ø)
clients-rsk-company-registry 29.76% <ø> (ø)
clients-syslumenn 49.75% <ø> (ø)
cms 0.42% <ø> (ø)
cms-translations 39.66% <ø> (ø)
contentful-apps 6.05% <ø> (ø)
download-service 44.51% <ø> (ø)
financial-aid-backend 56.48% <ø> (ø)
financial-aid-shared 19.03% <ø> (ø)
island-ui-core 28.59% <ø> (ø)
judicial-system-api 18.32% <ø> (ø)
judicial-system-backend 55.95% <ø> (-0.02%) ⬇️
judicial-system-web 28.72% <ø> (ø)
license-api 42.80% <ø> (+<0.01%) ⬆️
portals-admin-regulations-admin 1.96% <ø> (ø)
portals-core 16.14% <ø> (ø)
services-auth-admin-api 50.98% <ø> (-0.04%) ⬇️
services-auth-delegation-api 61.58% <ø> (+0.07%) ⬆️
services-auth-ids-api 53.78% <ø> (-0.02%) ⬇️
services-auth-personal-representative 48.00% <ø> (-0.04%) ⬇️
services-auth-personal-representative-public 43.89% <ø> (ø)
services-auth-public-api 51.89% <ø> (+0.01%) ⬆️
services-endorsements-api 54.94% <ø> (ø)
services-university-gateway 48.53% <ø> (+0.05%) ⬆️
services-user-notification 47.69% <ø> (+0.02%) ⬆️
services-user-profile 62.22% <ø> (+0.07%) ⬆️
shared-components 27.65% <ø> (ø)
shared-form-fields 31.58% <ø> (ø)
shared-utils 29.26% <ø> (ø)
web 1.85% <ø> (ø)

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

see 2 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 bab1072...d650f86. Read the comment docs.

@datadog-island-is
Copy link

Datadog Report

All test runs 0ac26d5 🔗

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

Test Services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
api 0 0 0 4 0 2.62s 1 no change Link
download-service 0 0 0 1 0 19.21s 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: 19

Outside diff range, codebase verification and nitpick comments (10)
apps/native/app/src/ui/lib/skeleton/general-card-skeleton.tsx (1)

5-5: Recommendation: Add a component description.

Adding a brief comment describing the purpose and usage of the GeneralCardSkeleton component would enhance code readability and maintainability, especially for new developers or when revisiting the code after some time.

+/**
+ * GeneralCardSkeleton is a React component that renders a skeleton screen card
+ * with customizable height based on the theme. It is used to display a loading
+ * placeholder for general card components.
+ */
 export const GeneralCardSkeleton = ({ height }: { height: number }) => {
apps/native/app/src/ui/lib/card/vehicle-card.tsx (1)

Line range hint 8-24: Refactor suggestion for minHeight handling in styled component.

The implementation of minHeight in the Host styled component is correct and functional. However, it can be optimized by directly using template literals for CSS values, which might improve readability and reduce the complexity of the expression.

Consider refactoring the min-height property to directly append 'px' in the template string:

- min-height: ${({ minHeight }) => (minHeight ? minHeight + 'px' : 'auto')};
+ min-height: ${({ minHeight }) => `${minHeight}px` || 'auto'};

This change ensures that minHeight is treated as a pixel value directly, and 'auto' is used as a fallback when minHeight is not provided.

apps/native/app/src/screens/home/hello-module.tsx (1)

Line range hint 26-102: Main functionality is sound, but improvements can be made for clarity.

The logic for handling images and conditional rendering based on preferences is implemented correctly. However, the code could benefit from more comments explaining the process, especially around caching and error handling.

Consider adding more detailed comments to improve code clarity and maintainability, especially around the image handling and caching logic.

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

Line range hint 1-65: General review of the entire file.

The file is well-organized and adheres to TypeScript best practices. The use of Zustand for state management is implemented correctly, and the persistence layer with AsyncStorage is appropriately configured. The functions setLocale, setAppearanceMode, setUseBiometrics, and dismiss are well-implemented, providing robust functionality for managing user preferences.

However, there are a couple of areas that could be improved:

  1. Error Handling: The error message in setLocale could be more descriptive. Instead of just "Not supported locale", it could specify which locale was attempted.
  2. Type Safety: The use of as PreferencesStore in the reset function and the initial spread of defaultPreferences could potentially hide type mismatches or errors. It would be safer to explicitly define the expected properties.

Consider enhancing the error message and reviewing the type safety of state assignments to ensure robustness and clarity.

apps/native/app/src/screens/home/inbox-module.tsx (1)

13-13: Add documentation for ApolloError import.

The import of ApolloError from @apollo/client is crucial for error handling in this module. Consider adding a comment explaining its use, especially for developers unfamiliar with Apollo.

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

16-23: Ensure consistent import grouping and ordering.

The imports from various libraries and local files are mixed together. Grouping and ordering imports can improve readability and maintainability. Consider separating third-party imports from local imports and grouping them logically.


Line range hint 55-184: Review of the main component ApplicationsModule.

  1. Error Handling: The component gracefully handles the error state by returning null when there is an error and no data, which is a good practice to prevent rendering with incomplete data.
  2. UI Logic: Limiting the number of displayed applications to three is a significant UI change. Ensure that this change is documented or communicated to the stakeholders as it affects the user interface directly.
  3. Accessibility: The use of TouchableOpacity with a disabled prop is a good practice for enhancing UI accessibility, preventing users from interacting with elements that would have no effect.
  4. Performance Consideration: Using React.memo is appropriate here to avoid unnecessary re-renders of the component, which is crucial in a potentially frequently updated area like a home screen.

Overall, the component is well-constructed with clear handling of various states (loading, error, empty, and normal cases). However, consider adding comments to complex logic sections to enhance maintainability, especially for other developers who might work on this code in the future.

apps/native/app/src/screens/home/air-discount-module.tsx (1)

16-16: Consider using a more descriptive file name for the illustration.

The illustration file le-jobs-s2.png is imported and used in this module. Consider renaming it to something more relevant to its usage here, such as air-discount-illustration.png, to improve readability and maintainability.

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

Line range hint 1-250: Adherence to NextJS and React best practices with suggestions for improvement.

The file generally adheres to React and NextJS best practices, including the use of hooks for state and effects management, and performance optimizations through useMemo and useCallback. However, consider enhancing type safety with more explicit TypeScript interfaces for props and state to prevent potential type mismatches and improve maintainability.

Enhance type definitions for props and state to ensure robust type checking and to facilitate easier maintenance and debugging.

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

76-79: Optimization of navigation options and right buttons.

The use of getRightButtons within createNavigationOptionHooks to dynamically set the right buttons based on the initialization state is a clever use of React's context features and hooks. This approach ensures that the UI elements are only rendered when they are relevant, which can improve the performance of the app on slower devices.

However, consider adding a comment explaining why the theme is cast to any in line 78. Using any can potentially lead to type safety issues, and it might be beneficial for future maintenance to either define a proper type or document the reason for this workaround.

Also applies to: 224-225

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e0f0050 and 2a933f9.

Files ignored due to path filters (19)
  • apps/native/app/src/assets/icons/options.png is excluded by !**/*.png
  • apps/native/app/src/assets/icons/[email protected] is excluded by !**/*.png
  • apps/native/app/src/assets/icons/[email protected] is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/le-company-s2x.png is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/le-jobs-s2.png is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/[email protected] is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/[email protected] is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/le-moving-s4.png is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/[email protected] is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/[email protected] is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/le-retirement-s3-large.png is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/[email protected] is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/[email protected] is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/le-retirement-s3.png is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/[email protected] is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/[email protected] is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/moving.png is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/[email protected] is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/[email protected] is excluded by !**/*.png
Files selected for processing (34)
  • apps/native/app/src/messages/en.ts (3 hunks)
  • apps/native/app/src/messages/is.ts (3 hunks)
  • apps/native/app/src/screens/applications/applications.tsx (1 hunks)
  • apps/native/app/src/screens/home/air-discount-module.tsx (1 hunks)
  • apps/native/app/src/screens/home/applications-module.tsx (4 hunks)
  • apps/native/app/src/screens/home/hello-module.tsx (2 hunks)
  • apps/native/app/src/screens/home/home-options.tsx (1 hunks)
  • apps/native/app/src/screens/home/home.tsx (6 hunks)
  • apps/native/app/src/screens/home/inbox-module.tsx (2 hunks)
  • apps/native/app/src/screens/home/licenses-module.tsx (1 hunks)
  • apps/native/app/src/screens/home/onboarding-module.tsx (1 hunks)
  • apps/native/app/src/screens/home/vehicles-module.tsx (1 hunks)
  • apps/native/app/src/screens/settings/settings.tsx (2 hunks)
  • apps/native/app/src/screens/vehicles/components/vehicle-item.tsx (4 hunks)
  • apps/native/app/src/screens/vehicles/vehicles-detail.tsx (3 hunks)
  • apps/native/app/src/screens/vehicles/vehicles.tsx (6 hunks)
  • apps/native/app/src/screens/wallet/components/wallet-item.tsx (4 hunks)
  • apps/native/app/src/screens/wallet/wallet.tsx (4 hunks)
  • apps/native/app/src/stores/auth-store.ts (1 hunks)
  • apps/native/app/src/stores/notifications-store.ts (1 hunks)
  • apps/native/app/src/stores/preferences-store.ts (2 hunks)
  • apps/native/app/src/ui/index.ts (1 hunks)
  • apps/native/app/src/ui/lib/card/air-discount-card.tsx (3 hunks)
  • apps/native/app/src/ui/lib/card/license-card.tsx (3 hunks)
  • apps/native/app/src/ui/lib/card/vehicle-card.tsx (3 hunks)
  • apps/native/app/src/ui/lib/empty-state/empty-card.tsx (3 hunks)
  • apps/native/app/src/ui/lib/skeleton/general-card-skeleton.tsx (1 hunks)
  • apps/native/app/src/ui/lib/tableview/tableview-cell.tsx (6 hunks)
  • apps/native/app/src/utils/component-registry.ts (2 hunks)
  • apps/native/app/src/utils/get-main-root.ts (2 hunks)
  • apps/native/app/src/utils/lifecycle/setup-components.tsx (2 hunks)
  • apps/native/app/src/utils/lifecycle/setup-event-handlers.ts (1 hunks)
  • apps/native/app/src/utils/lifecycle/setup-routes.ts (3 hunks)
  • apps/native/app/src/utils/test-ids.ts (1 hunks)
Files skipped from review due to trivial changes (3)
  • apps/native/app/src/screens/home/onboarding-module.tsx
  • apps/native/app/src/screens/vehicles/vehicles-detail.tsx
  • apps/native/app/src/ui/index.ts
Additional context used
Path-based instructions (31)
apps/native/app/src/ui/lib/skeleton/general-card-skeleton.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/empty-state/empty-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/card/vehicle-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/vehicles/components/vehicle-item.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/wallet/components/wallet-item.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/hello-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/utils/test-ids.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/stores/preferences-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/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/tableview/tableview-cell.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/air-discount-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/home/inbox-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/stores/notifications-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/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/screens/home/vehicles-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/utils/get-main-root.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/home/air-discount-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/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-event-handlers.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/vehicles/vehicles.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/home-options.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/home/licenses-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/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/screens/wallet/wallet.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/ui/lib/card/license-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/home/home.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/settings/settings.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/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."
Additional comments not posted (64)
apps/native/app/src/ui/lib/skeleton/general-card-skeleton.tsx (2)

5-26: Well-structured and themed React component.

The GeneralCardSkeleton component is well-implemented using functional component best practices and effective theming with styled-components/native. The use of TypeScript for props enhances type safety.


5-5: Suggestion: Add PropTypes for runtime type checking.

Although TypeScript is used for compile-time type checking, adding PropTypes can provide additional runtime type safety, which is beneficial especially when integrating with non-TypeScript codebases.

+import PropTypes from 'prop-types';

+GeneralCardSkeleton.propTypes = {
+  height: PropTypes.number.isRequired,
+};

Likely invalid or redundant comment.

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

12-12: Approved: Addition of min-height to Host styled component.

The addition of a min-height of 130px ensures visual consistency and may improve the layout on various devices. This change is well-aligned with the PR's objectives to enhance user interface elements.


40-40: Approved: Simplification by using Typography directly.

Removing the intermediary Message styled component and using Typography directly simplifies the component structure, making it easier to maintain and potentially improving performance by reducing the rendering complexity.

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

53-53: Add TypeScript type annotations for optional props.

The minHeight property in VehicleCardProps is correctly marked as optional with ?, which is good practice for optional props in TypeScript. This allows for better type safety and ensures that the component can be used flexibly in various contexts without providing a minHeight.

No changes are necessary here, but it's good to acknowledge the proper use of TypeScript features to enhance component flexibility and maintainability.


57-63: Ensure consistency in destructuring props in the VehicleCard function.

The destructuring of props in the VehicleCard function is done correctly. Each prop is individually extracted from VehicleCardProps, which makes the component easier to read and maintain. This approach also aligns with best practices in React component development by clearly showing which props are used in the component.

No changes are necessary here, but it's important to maintain this level of clarity and consistency in prop handling across all components.


65-65: Validate the dynamic rendering logic in the Host component.

The Host component correctly receives the minHeight prop and applies it as a style. This dynamic styling based on props is a powerful feature of styled-components and is implemented correctly here.

Ensure that during integration testing, the minHeight prop is tested with various values, including boundary cases like very small or very large numbers, to verify that the UI behaves as expected without breaking the layout.

Verification successful

Dynamic Rendering Logic for minHeight in Host Component Verified

The Host component in vehicle-card.tsx correctly implements the minHeight prop as part of its styling logic. The dynamic rendering logic is consistent with the intended design, confirming the review comment's accuracy. No issues were found with the implementation.

  • Host component definition and usage in vehicle-card.tsx confirms correct application of minHeight.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the dynamic rendering logic for `minHeight` in the `Host` component.

# Test: Check if the `minHeight` prop is correctly applied to the `Host` component.
rg --type typescript -A 5 $'minHeight={minHeight}'

Length of output: 166


Script:

#!/bin/bash
# Corrected script to verify the dynamic rendering logic for `minHeight` in the `Host` component.

# Search for the usage of `minHeight` in the `Host` component.
rg --type typescript -A 5 'minHeight=\{minHeight\}'

Length of output: 88


Script:

#!/bin/bash
# Search for the definition or implementation of the `Host` component to verify how `minHeight` is applied.

ast-grep --lang typescript --pattern $'const Host = styled.$_(props => $$$)' 

Length of output: 77


Script:

#!/bin/bash
# Retry the search for the usage of `minHeight` in the `Host` component without specifying the file type.
rg -A 5 'minHeight=\{minHeight\}'

Length of output: 1138


Script:

#!/bin/bash
# Broaden the search pattern to find any styled component named `Host`.
ast-grep --lang typescript --pattern $'const Host = styled.$$_'

Length of output: 64


Script:

#!/bin/bash
# Directly search in the `vehicle-card.tsx` file for `Host` component usage.
rg 'Host' apps/native/app/src/ui/lib/card/vehicle-card.tsx -A 5

Length of output: 502

apps/native/app/src/screens/vehicles/components/vehicle-item.tsx (4)

20-26: Review of new props and their usage in VehicleItem.

The addition of minHeight and style props enhances the component's flexibility in terms of layout and styling. These props are optional, which is appropriate for customization without breaking existing usages. The use of TypeScript for prop type definitions is consistent with best practices for type safety.


38-38: Simplification of mileage registration logic.

The logic for determining whether mileage registration is required has been simplified by directly accessing item.requiresMileageRegistration. This change removes unnecessary complexity and dependencies on other props, aligning with the PR's objective to streamline component logic.


41-49: Updated inline styles to utilize theme values.

The use of theme values for paddingHorizontal, marginBottom, and borderRadius enhances the consistency of the component with the overall design system. This approach not only makes the styles more maintainable but also ensures that the component adheres to the design guidelines set by the theme.


62-62: Proper handling of the minHeight prop in VehicleCard.

The minHeight prop is passed correctly to the VehicleCard component, ensuring that the customization provided by the new prop is effectively utilized. This change allows for better layout control based on external specifications, which is a positive enhancement.

apps/native/app/src/screens/wallet/components/wallet-item.tsx (3)

23-29: Review the updated function signature and destructuring for WalletItem.

The function signature has been correctly updated to include the new style prop with an optional type ViewStyle. This change allows for more flexible styling of the WalletItem component by passing custom styles. The destructuring is done properly, and TypeScript is used effectively to ensure type safety.


39-39: Ensure consistent application of the style prop.

The style prop is applied to both the Container and Pressable components within the render method. This ensures that any custom styles passed to the WalletItem are appropriately utilized in the layout. However, it's important to ensure that this does not lead to any unintended layout issues, especially since style is applied directly without any merging with existing styles.

Consider verifying the visual layout in various scenarios to ensure that the addition of the style prop does not cause any visual regressions or layout shifts. Testing should include scenarios where style is not provided to ensure that default styling is applied correctly.

Also applies to: 45-45, 72-72


39-45: Check the dynamic handling of cardHeight within the onLayout callback.

The cardHeight variable is dynamically updated based on the layout height of the Container. This is a good use of the onLayout event to adjust the layout dynamically based on content size. However, ensure that this dynamic sizing is tested thoroughly, especially in scenarios where the style prop might affect the height of the Container.

It would be beneficial to add unit tests or integration tests that verify the correct calculation and usage of cardHeight in various scenarios, including different style inputs that could affect the height.

Also applies to: 72-72

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

Line range hint 1-15: Imports and setup are appropriate.

The imports and initial setup are correctly aligned with the functionality of the HelloModule component.


102-102: Conditional rendering logic is correctly implemented.

The conditional rendering based on homeScreenEnableGraphicWidget and imageSrc aligns well with the PR objectives to allow user customization and enhance user experience by preventing unnecessary rendering.

apps/native/app/src/utils/test-ids.ts (1)

15-15: Approved: Addition of TOPBAR_HOME_OPTIONS_BUTTON identifier.

The addition of the TOPBAR_HOME_OPTIONS_BUTTON identifier is correctly implemented and follows the established naming conventions for test IDs. This change enhances the testability of the new home options button, aligning with the PR objectives.

apps/native/app/src/stores/preferences-store.ts (2)

22-28: Addition of new properties to PreferencesStore interface.

The new boolean properties added to the PreferencesStore interface (homeScreenEnableGraphicWidget, homeScreenEnableInboxWidget, homeScreenEnableApplicationsWidget, homeScreenEnableLicensesWidget, homeScreenEnableVehiclesWidget, homeScreenEnableAirDiscountWidget, homeScreenWidgetsInitialised) are well-defined and align with the PR objectives to enhance user customization on the home screen. Each property is clearly named, indicating its purpose and the widget it controls. The addition of homeScreenWidgetsInitialised is particularly noteworthy as it tracks the initialization state of the widgets, which is crucial for managing the setup process.


59-65: Initialization of new properties in defaultPreferences.

The initialization of the new properties in the defaultPreferences object sets all widget enablement flags to true and homeScreenWidgetsInitialised to false. This setup implies that all widgets are enabled by default but not yet initialized, which is a sensible default state that allows for immediate visibility upon first use while still requiring an initialization process. This approach supports the PR's goal of providing a customizable and user-centric interface right from the first launch.

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

18-18: New component registration is consistent and well-formed.

The addition of HomeOptionsScreen to ComponentRegistry follows the established pattern and correctly uses the prefix for namespace consistency. This ensures that the component can be dynamically referenced in the application based on the configuration.


69-69: New button registration is consistent and well-formed.

The addition of HomeScreenOptionsButton to ButtonRegistry is consistent with other entries and correctly uses the prefix for namespace consistency. This addition will facilitate the implementation of new functionalities related to home screen customization.

apps/native/app/src/ui/lib/tableview/tableview-cell.tsx (4)

6-6: Approved: Import of Typography component.

The addition of the Typography component from ../typography/typography is consistent with the changes made to the Title component, allowing for more flexible typography styling.


68-68: Approved: Responsive padding adjustment.

The padding-right property in the Center styled component now uses a value from the theme's spacing array, enhancing responsiveness and consistency with the theme.


84-89: Approved: Consistent margin usage for Title and Subtitle.

The Title and Subtitle styled components have been modified to include a left margin based on the theme's spacing. This ensures better alignment and spacing within the layout, aligning with the PR's objectives to enhance the component's adaptability to different themes.


139-139: Approved: Integration of Typography component in Title.

The Typography component is now used to render the title text, replacing the previous TitleText styled component. This change simplifies the component structure and allows for more flexible typography styling.

apps/native/app/src/ui/lib/card/air-discount-card.tsx (4)

9-9: Approved: Import of ViewStyle.

The import of ViewStyle from react-native is correctly placed and necessary for the new style prop in the AirDiscountProps interface.


88-88: Approved: Addition of style prop to AirDiscountProps.

The addition of the optional style prop to the AirDiscountProps interface is correctly typed and follows TypeScript best practices for optional properties.


97-97: Approved: Usage of style prop in Host component.

The style prop is correctly passed to the Host styled component, allowing for dynamic styling based on the prop. This change effectively utilizes the flexibility of styled-components with conditional styling.

Also applies to: 103-103


Line range hint 88-103: Approved: Overall component logic and structure.

The AirDiscountCard component is well-structured and follows React and TypeScript best practices. The use of internationalization, theming, and conditional rendering is appropriately implemented, enhancing the component's functionality and user experience.

apps/native/app/src/screens/home/inbox-module.tsx (3)

33-35: Refine the InboxModuleProps interface.

The InboxModuleProps interface now includes data, loading, and error properties. This is a significant change as it directly affects how the component handles state and error management. Ensure that the types are correct and that they are used consistently throughout the component.

Verification successful

InboxModuleProps Interface Usage Verified

The InboxModuleProps interface, including data, loading, and error properties, is used consistently and correctly within the InboxModule component. The properties are destructured and utilized in the component logic, ensuring proper state and error management. No issues found.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of InboxModuleProps in the module.

# Test: Search for InboxModuleProps usage. Expect: Consistent and correct usage.
rg --type typescript -A 5 $'InboxModuleProps' apps/native/app/src/screens/home/inbox-module.tsx

Length of output: 129


Script:

#!/bin/bash
# Description: Verify the usage of InboxModuleProps in the module.

# Test: Search for InboxModuleProps usage. Expect: Consistent and correct usage.
rg -A 5 'InboxModuleProps' apps/native/app/src/screens/home/inbox-module.tsx

Length of output: 422


18-20: Review GraphQL imports and usage.

The imports from ../../graphql/types/schema include ListDocumentsQuery and useListDocumentsQuery. Ensure these are used consistently and correctly throughout the module. It's good practice to keep GraphQL operations and types well-documented and aligned with the backend schema.

Verification successful

GraphQL Import Usage Verified

The ListDocumentsQuery type is used consistently in type definitions within the module. However, useListDocumentsQuery is imported and exported without internal usage. If the intention was to use it within this module, please verify its necessity. Otherwise, its current usage is consistent with re-exporting practices.

  • ListDocumentsQuery is used in type definitions.
  • useListDocumentsQuery is not used internally but is exported.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of GraphQL types and queries in the module.

# Test: Search for GraphQL types and queries usage. Expect: Consistent and correct usage.
rg --type typescript -A 5 $'ListDocumentsQuery|useListDocumentsQuery' apps/native/app/src/screens/home/inbox-module.tsx

Length of output: 155


Script:

#!/bin/bash
# Description: Verify the usage of GraphQL types and queries in the module.

# Test: Search for GraphQL types and queries usage in the specified file.
rg -A 5 'ListDocumentsQuery|useListDocumentsQuery' apps/native/app/src/screens/home/inbox-module.tsx

Length of output: 652


Script:

#!/bin/bash
# Description: Verify the specific usage of `useListDocumentsQuery` in the module.

# Test: Search for the usage of `useListDocumentsQuery` in the specified file.
rg 'useListDocumentsQuery' apps/native/app/src/screens/home/inbox-module.tsx

Length of output: 173


145-145: Confirm exports are correctly used.

The export statement includes InboxModule, useListDocumentsQuery, and validateInboxInitialData. Ensure these are used elsewhere in the application as intended, especially the hooks and validation functions which are critical for the module's functionality.

Verification successful

Exports are correctly used.

The exported entities InboxModule, useListDocumentsQuery, and validateInboxInitialData are utilized in the codebase as intended. They are used in contexts appropriate to their functionality, confirming their correct usage.

  • useListDocumentsQuery is used in a query context.
  • validateInboxInitialData is used for validation.
  • InboxModule is used as a component.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of exported entities in the application.

# Test: Search for exported entities usage. Expect: Correct and intended usage.
rg --type typescript -A 5 $'InboxModule|useListDocumentsQuery|validateInboxInitialData' apps/native/app/src

Length of output: 143


Script:

#!/bin/bash
# Description: Verify the usage of exported entities in the application.

# Find all TypeScript files and search for the usage of the exported entities.
fd --extension ts --extension tsx --exec rg 'InboxModule|useListDocumentsQuery|validateInboxInitialData' {}

Length of output: 644

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

122-122: Approve the addition of the 'options' icon.

The addition of the 'options' icon to the icons array enhances the functionality of the notifications store by providing additional user interface capabilities. This change aligns with the PR's objectives to enhance user customization and relevance.

Please ensure that the integration of the new 'options' icon with the UI is tested, particularly how it behaves when interacted with and its impact on the layout and accessibility.

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

30-32: Updated interface to accommodate new data structure.

The change from applications: Application[] to data: ListApplicationsQuery | undefined reflects a shift towards using a more complex data structure directly from a GraphQL query. This is a positive change as it likely simplifies the handling of data by working with the query result directly.


38-53: Introduction of a new validation function.

The validateApplicationsInitialData function encapsulates the logic for determining the initial visibility of the applications widget. This is a good practice as it abstracts complex conditions away from the main component logic, enhancing readability and maintainability.


180-184: Updated exports to include new utilities.

Exporting the new validateApplicationsInitialData function alongside the existing ones is a good practice. It allows other parts of the application to reuse this logic, promoting modularity and maintainability.

apps/native/app/src/screens/home/vehicles-module.tsx (1)

1-24: Check for unused imports.

The imports are appropriate for the module's functionality. However, ensure that all imported entities are used within the file to avoid unnecessary overhead.

apps/native/app/src/utils/get-main-root.ts (1)

13-13: Type definition expanded to include 'options'.

The expansion of the Icons type to include 'options' aligns with the PR objectives to enhance user interface functionality by allowing more customization. This change is straightforward and correctly implemented.

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

103-103: Approve the registration of HomeOptionsScreen.

The registration of HomeOptionsScreen with the identifier CR.HomeOptionsScreen is correctly implemented. This addition enhances the application's navigation capabilities by allowing for more comprehensive user interactions within the app.


16-16: Verify the import path for HomeOptionsScreen.

Ensure that the import path ../../screens/home/home-options correctly resolves to the HomeOptionsScreen component. This is crucial for maintaining the integrity of the application's module resolution and navigation capabilities.

Verification successful

Import path for HomeOptionsScreen is verified.

The import path ../../screens/home/home-options correctly resolves to the HomeOptionsScreen component, ensuring proper module resolution and navigation within the application. No further action is needed.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the import path for `HomeOptionsScreen`.

# Test: Check if the file exists at the specified path. Expect: The file should exist.
if [ -f "apps/native/app/src/screens/home/home-options.tsx" ]; then
  echo "Import path verified."
else
  echo "Import path does not exist."
fi

Length of output: 115

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

167-168: Approve the addition of the HomeScreenOptionsButton case.

The new case for navigating to /home-options when HomeScreenOptionsButton is clicked is correctly implemented within the registerNavigationButtonPressedListener. This enhances the application's navigation capabilities by providing users with direct access to home screen options.

Please ensure that the /home-options route is correctly configured in the application's routing setup. This can be verified by checking the route definitions or by navigating to the route in a development environment.

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

1-1: Update import statements to reflect new dependencies.

The import statement has been updated to include GeneralCardSkeleton from the @ui library, replacing the previous skeleton component. This change aligns with the PR's objective to enhance the UI consistency.


72-72: Refactor to use GeneralCardSkeleton for loading states.

The skeleton loading state has been refactored to use GeneralCardSkeleton from the @ui library. This change should provide a more consistent and visually appealing loading experience across the app. Ensure that the skeleton is appropriately sized and styled to match the vehicle items.

Also applies to: 123-127


132-132: Ensure robust key extraction logic.

The keyExtractor function uses a combination of vehicle VIN and index for items that are not skeletons. This approach ensures unique keys for React list rendering, which is crucial for performance optimization. However, ensure that all vehicle items have a VIN to avoid potential key conflicts.


14-14: Updated illustration source.

The source for the illustration used in the Empty component has been updated. Ensure that the new illustration is correctly displayed and aligns with the intended visual design of the app.

Verification successful

Illustration source update verified.

The illustration source le-moving-s4.png is correctly imported and used in the component, ensuring it is displayed as intended. No further action is required.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the new illustration file exists and is correctly referenced.

# Test: Check if the new illustration file exists.
fd --type file 'le-moving-s4.png'

Length of output: 91


Script:

#!/bin/bash
# Description: Verify the usage of the illustrationSrc variable in the Empty component.

# Search for the usage of illustrationSrc in the vehicles.tsx file.
rg 'illustrationSrc' -A 10 apps/native/app/src/screens/vehicles/vehicles.tsx

Length of output: 795


130-130: Simplified rendering logic in renderItem.

The renderItem function has been simplified by removing checks for the mileage feature flag. This change should streamline the rendering process but requires verification to ensure it aligns with the intended functionality, especially since the feature flag related to mileage display has been removed.

Verification successful

No remaining references to mileageFeatureFlag found.

The removal of the mileage feature flag has been verified, and no references to it exist in the codebase. This confirms that the change does not affect other parts of the application.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the removal of the mileage feature flag does not affect other parts of the app.

# Test: Search for any remaining references to the mileage feature flag.
rg --type python 'mileageFeatureFlag'

Length of output: 68


Script:

#!/bin/bash
# Description: Verify that the removal of the mileage feature flag does not affect other parts of the app.

# Test: Search for any remaining references to the mileage feature flag in TypeScript and JavaScript files.
rg 'mileageFeatureFlag' --type js --type ts --type tsx

Length of output: 82


Script:

#!/bin/bash
# Description: Verify that the removal of the mileage feature flag does not affect other parts of the app.

# Test: Search for any remaining references to the mileage feature flag across all files.
rg 'mileageFeatureFlag'

Length of output: 23

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

1-2: Review of imports and basic setup

The imports and basic setup are correctly implemented. Using react-intl for internationalization and styled-components for theming aligns with modern React practices. The import of NavigationFunctionComponent from react-native-navigation is appropriate for typing the component, which is good for maintaining type safety.

Also applies to: 4-6


8-25: Review of navigation options setup

The custom hook createNavigationOptionHooks is used to configure navigation options dynamically based on theme and internationalization settings. This is a good practice as it keeps the navigation configuration clean and maintainable. However, ensure that the theme and intl objects are properly typed to avoid any runtime errors and maintain type safety.

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

200-200: Simplify prop passing by using object spread.

The change to spread the applicationsRes object directly into the ApplicationsModule enhances code readability and maintainability. However, it's crucial to ensure that ApplicationsModule is equipped to handle all properties of applicationsRes effectively.

Please verify that all properties of applicationsRes are appropriately handled in the ApplicationsModule. This may involve checking the component's propTypes or TypeScript interfaces to ensure compatibility.

apps/native/app/src/screens/home/licenses-module.tsx (1)

1-8: Imports and Initial Setup: Approved

The imports and initial setup are correctly aligned with the functionality required for the licenses module. All components and utilities are appropriately used, supporting internationalization and styled components.

Also applies to: 10-15, 17-24

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

18-18: Verify updated illustration source.

The illustration source has been updated from le-moving-s6.png to le-retirement-s3.png. This change should be reflected in any related documentation or tests that might display or reference the old image.

Verification successful

Illustration source update verified.

The old illustration source le-moving-s6.png is not present in the codebase, indicating that the update to le-retirement-s3.png has been applied consistently across all files. No further action is required.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the old illustration source is updated in related documentation or tests.

# Test: Search for the old illustration source usage. Expect: No occurrences.
rg --type markdown -A 5 $'le-moving-s6.png'

Length of output: 42


Script:

#!/bin/bash
# Description: Verify that the old illustration source is updated across the entire codebase.

# Test: Search for the old illustration source usage in all files. Expect: No occurrences.
rg 'le-moving-s6.png' -A 5

Length of output: 26


208-209: Refined UI component for loading state.

The use of GeneralCardSkeleton for rendering the loading state in the WalletScreen is a specific enhancement. This change likely provides a more tailored visual representation for the loading state, improving the user experience. Ensure that the GeneralCardSkeleton component is adequately tested to handle various loading scenarios.


1-1: Update import statement for consistency and clarity.

The import statement at the top of the file has been modified to include GeneralCardSkeleton instead of the previous Skeleton. This change aligns with the PR's objective to refine the UI components. Ensure that all references to the old Skeleton component are updated throughout the project to maintain consistency.

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

71-81: Review of the new route /home-options.

This new route is well-implemented with asynchronous handling to ensure that all navigation actions are completed in the correct order. The use of await with Navigation.popToRoot and Navigation.push ensures that the navigation stack is correctly managed before moving to the new screen. This is crucial for preventing navigation issues in a mobile application where state management can often become complex.

The route handler correctly dismisses all modals before navigating, which is a good practice to ensure that no previous screens interfere with the new navigation context.

Overall, this addition aligns with the PR's objective to enhance user customization by providing a dedicated entry point for home options.


222-225: Review of the updated route /vehicle/:id.

The modification to this route introduces asynchronous handling, which is a significant improvement over the previous synchronous version. This change ensures that all modals are dismissed and the navigation stack is cleared before proceeding with the new navigation action. This is particularly important in mobile applications where navigation actions need to be managed carefully to avoid leaving the user in an unexpected state.

The use of await with Navigation.dismissAllModals, Navigation.popToRoot, and Navigation.push ensures that each step of the navigation process is completed before the next begins, which helps in maintaining a clean and predictable navigation flow.

This update is a good example of adopting more robust and reliable navigation patterns in the application.

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

41-41: Adjustments to Host styled component for better alignment and spacing.

The changes to the Host styled component include:

  • Reduction in min-height from 112px to 104px.
  • Addition of justify-content: center;.

These adjustments enhance the visual alignment and spacing within the card, contributing to a more centered and compact layout. The reduction in height might affect how content is perceived, so it's important to verify that this change integrates well with the rest of the UI without causing any overflow or clipping issues.

Also applies to: 46-46


134-135: Consistency in image dimensions across styled components and inline styles.

The changes ensure that the image dimensions are consistent across different parts of the component:

  • ImgWrap styled component now explicitly sets both height and width to 72px.
  • Inline styles for the Image component within ImgWrap also specify the same dimensions.

This consistency is crucial for maintaining a uniform appearance of images across the license card. It prevents discrepancies in image rendering which can lead to a less cohesive design. Ensuring that these dimensions are respected across all instances of image rendering within the component is a good practice for maintaining layout integrity.

Also applies to: 346-346

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

30-59: Review of new hooks and modules.

The addition of new hooks and modules (useListApplicationsQuery, useListDocumentsQuery, useListVehiclesQuery, useGetAirDiscountQuery, useGetLicensesData) is well-aligned with the PR objectives to enhance the home screen with new widgets. Each hook is used to fetch data conditionally based on the widget's visibility, which is a good practice to optimize network requests and load data relevant to the user's preferences.

However, ensure that these hooks handle errors appropriately and that there are fallbacks or error states in the UI components that consume these hooks. This is crucial for maintaining a good user experience in cases where data fetching fails.


292-321: Conditional rendering of widgets based on user preferences.

The conditional rendering logic for each widget (Inbox, Licenses, Applications, Vehicles, Air Discount) from lines 292 to 321 is well-implemented. It ensures that widgets are only rendered if they are enabled, which aligns with the PR's objectives of enhancing user customization.

This approach not only improves the user experience by loading only relevant content but also optimizes the performance by avoiding unnecessary rendering and data fetching. The use of the spread operator to pass props to the widgets enhances readability and maintainability of the code.


255-260: Review of refetch logic in the refetch function.

The refetch function is designed to refetch data for all enabled widgets, which is a necessary feature to ensure that the data displayed is up to date. However, there is a potential issue with line 258 where licensesRes.refetchPassport() is called. It's unclear from the provided context whether refetchPassport is a valid method on licensesRes. If this method does not exist, it could lead to runtime errors.

Please verify that refetchPassport is a defined and correctly implemented method within the licensesRes object. If it is not, either implement it or remove the call to avoid errors.

Verification successful

refetchPassport method is valid and implemented.

The refetchPassport method is defined and utilized within the licenses-module.tsx file, confirming its existence and implementation. This should prevent any runtime errors related to its usage in home.tsx. No further action is required regarding this method.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence and implementation of `refetchPassport` method in `licensesRes`.

# Test: Search for the method definition in the project. Expect: Definition and correct implementation.
rg --type typescript -A 5 $'refetchPassport'

Length of output: 78


Script:

#!/bin/bash
# Description: Verify the existence and implementation of `refetchPassport` method in `licensesRes`.

# Test: Search for the method definition in the project. Expect: Definition and correct implementation.
rg --type ts -A 5 $'refetchPassport'

Length of output: 1389

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

113-113: New translation key added for app lock timeout.

The addition of 'settings.security.appLockTimeoutSeconds': 'sec.' provides clarity on the unit of time used in the app lock timeout settings. This is a straightforward and useful addition for enhancing user understanding in the settings menu.


188-197: Review of new home screen options translations.

The addition of multiple new keys under the homeOptions namespace significantly enhances the customization capabilities of the home screen. These keys include:

  • 'homeOptions.screenTitle': 'Home screen'
  • 'homeOptions.heading.title': 'Configure home screen'
  • 'homeOptions.heading.subtitle': 'Here you can configure what is displayed on the home screen.'
  • 'homeOptions.graphic': 'Display graphic'
  • 'homeOptions.inbox': 'Latest in inbox'
  • 'homeOptions.licenses': 'Licenses'
  • 'homeOptions.applications': 'Applications'
  • 'homeOptions.vehicles': 'Vehicles'
  • 'homeOptions.airDiscount': 'Air discount scheme'

These additions align well with the PR objectives of enhancing user customization and relevance. Each key is clearly named and the values are descriptive, which should help in providing a clear user interface for configuring the home screen.

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

112-112: New localization string for app lock timeout.

The addition of 'settings.security.appLockTimeoutSeconds': 'sek.' provides clarity by specifying the unit of time (seconds) for the app lock timeout feature. This is a good practice as it enhances user understanding of the security settings.


187-198: Review of new localization strings for home options.

The addition of new localization strings from lines 187 to 198 supports the new home screen customization features introduced in this PR. These strings are well-defined and cover various aspects of the home options, such as titles, subtitles, and specific features like inbox and licenses. This aligns well with the PR's objectives to enhance user customization and relevance.

  • 'homeOptions.screenTitle': 'Heimaskjár' sets the title for the home options screen.
  • 'homeOptions.heading.title': 'Stilla heimaskjá' and 'homeOptions.heading.subtitle': 'Hér er hægt að stilla hvað birtist á heimaskjá.' provide clear instructions for customization.
  • Strings for 'homeOptions.graphic': 'Birta myndskreytingu', 'homeOptions.inbox': 'Nýjast í pósthólfinu', and others, define the toggle options available to the user.

These additions are crucial for supporting the new functionality and ensuring that the app remains user-friendly and adaptable to individual preferences.

apps/native/app/src/screens/home/hello-module.tsx Outdated Show resolved Hide resolved
apps/native/app/src/screens/home/inbox-module.tsx Outdated Show resolved Hide resolved
apps/native/app/src/screens/home/licenses-module.tsx Outdated Show resolved Hide resolved
apps/native/app/src/stores/auth-store.ts Outdated Show resolved Hide resolved
apps/native/app/src/screens/wallet/wallet.tsx Outdated Show resolved Hide resolved
apps/native/app/src/screens/home/home.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: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2a933f9 and c1b1669.

Files selected for processing (2)
  • apps/native/app/src/screens/home/applications-module.tsx (5 hunks)
  • apps/native/app/src/screens/home/vehicles-module.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • apps/native/app/src/screens/home/applications-module.tsx
  • apps/native/app/src/screens/home/vehicles-module.tsx

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.

Fantastic job! I enjoy reading your code. Nice structure and clean! 👏

apps/native/app/src/screens/home/home.tsx Show resolved Hide resolved
apps/native/app/src/screens/home/home.tsx Show resolved Hide resolved
apps/native/app/src/screens/home/home.tsx Show resolved Hide resolved
apps/native/app/src/screens/home/home.tsx Outdated Show resolved Hide resolved
apps/native/app/src/stores/auth-store.ts Outdated Show resolved Hide resolved
apps/native/app/src/stores/preferences-store.ts 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, codebase verification and nitpick comments (2)
apps/native/app/src/screens/home/hello-module.tsx (1)

Line range hint 23-101: Approve the use of hooks and new conditional rendering logic. Suggest refactor for image handling.

The integration of graphicWidgetEnabled for conditional rendering is well-implemented and aligns with the PR objectives to enhance user customization. The use of hooks is optimized and follows best practices.

However, the image handling logic within handleImage is quite complex and could benefit from a refactor to improve clarity and maintainability. Consider breaking down the function into smaller, more focused functions or using more descriptive variable names.

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

78-78: Type safety improvement suggestion.

The use of theme as any at line 78 could potentially lead to type safety issues. Consider refining the type definitions to avoid using any, which would enhance the robustness and maintainability of the code by leveraging TypeScript's type-checking features.

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c1b1669 and 7cd7104.

Files selected for processing (7)
  • apps/native/app/src/screens/home/hello-module.tsx (2 hunks)
  • apps/native/app/src/screens/home/home-options.tsx (1 hunks)
  • apps/native/app/src/screens/home/home.tsx (6 hunks)
  • apps/native/app/src/screens/home/vehicles-module.tsx (1 hunks)
  • apps/native/app/src/screens/wallet/wallet.tsx (3 hunks)
  • apps/native/app/src/stores/auth-store.ts (1 hunks)
  • apps/native/app/src/stores/preferences-store.ts (4 hunks)
Files skipped from review as they are similar to previous changes (3)
  • apps/native/app/src/screens/home/home-options.tsx
  • apps/native/app/src/screens/wallet/wallet.tsx
  • apps/native/app/src/stores/preferences-store.ts
Additional context used
Path-based instructions (4)
apps/native/app/src/screens/home/hello-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/screens/home/vehicles-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/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/screens/home/home.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 (2)
apps/native/app/src/stores/auth-store.ts (1)

204-206: Approve the integration of home screen widget reset in the logout process.

The addition of resetHomeScreenWidgets in the logout process is well-implemented and enhances the user experience by ensuring a consistent interface post-authentication. This change aligns with the PR objectives and is integrated effectively within the authStore.

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

225-225: Verify loading indicator behavior.

As suggested by snaerseljan, verifying that the loading indicator in the navigation is triggered by the refetching logic is crucial. This ensures that the UI reflects the current state accurately, especially during data fetching operations.

apps/native/app/src/screens/home/home.tsx Show resolved Hide resolved
apps/native/app/src/screens/home/home.tsx Outdated Show resolved Hide resolved
apps/native/app/src/screens/home/home.tsx 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: 1

Outside diff range, codebase verification and nitpick comments (1)
apps/native/app/src/screens/home/home.tsx (1)

78-79: Ensure proper typing for theme usage.

The usage of theme as any in line 78 could lead to potential type safety issues. Consider specifying a more precise type or enhancing the existing type definitions to ensure better type safety and to take full advantage of TypeScript's capabilities.

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7cd7104 and ccf0cd9.

Files selected for processing (2)
  • apps/native/app/src/screens/home/home-options.tsx (1 hunks)
  • apps/native/app/src/screens/home/home.tsx (6 hunks)
Files skipped from review as they are similar to previous changes (1)
  • apps/native/app/src/screens/home/home-options.tsx
Additional context used
Path-based instructions (1)
apps/native/app/src/screens/home/home.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 (2)
apps/native/app/src/screens/home/home.tsx (2)

265-274: Parallelize refetch operations for efficiency.

The current implementation of refetch operations in lines 265-274 could be optimized by executing them in parallel. This approach would reduce the overall time taken for these operations, improving the responsiveness of the application.

Consider implementing the following change to parallelize the refetch operations:

-      const promises = [
-        applicationsWidgetEnabled && applicationsRes.refetch(),
-        inboxWidgetEnabled && inboxRes.refetch(),
-        licensesWidgetEnabled && licensesRes.refetch(),
-        licensesWidgetEnabled && licensesRes.refetchPassport(),
-        airDiscountWidgetEnabled && airDiscountRes.refetch(),
-        vehiclesWidgetEnabled && vehiclesRes.refetch(),
-      ].filter(Boolean)
-      await Promise.all(promises)
+      const promises = [
+        applicationsWidgetEnabled ? applicationsRes.refetch() : null,
+        inboxWidgetEnabled ? inboxRes.refetch() : null,
+        licensesWidgetEnabled ? licensesRes.refetch() : null,
+        licensesWidgetEnabled ? licensesRes.refetchPassport() : null,
+        airDiscountWidgetEnabled ? airDiscountRes.refetch() : null,
+        vehiclesWidgetEnabled ? vehiclesRes.refetch() : null,
+      ].filter(Boolean)
+      await Promise.all(promises)

Likely invalid or redundant comment.


131-148: Optimize state management for re-rendering efficiency.

As noted by previous comments, extracting each preference individually from the store can prevent unnecessary re-renders of the component. This is particularly important in a React application where performance can be impacted by excessive rendering.

Consider refactoring the state management to pick out each state individually:

-  const {
-    inboxWidgetEnabled,
-    licensesWidgetEnabled,
-    applicationsWidgetEnabled,
-    vehiclesWidgetEnabled,
-    airDiscountWidgetEnabled,
-    widgetsInitialised,
-  } = usePreferencesStore()
+  const inboxWidgetEnabled = usePreferencesStore(state => state.inboxWidgetEnabled)
+  const licensesWidgetEnabled = usePreferencesStore(state => state.licensesWidgetEnabled)
+  const applicationsWidgetEnabled = usePreferencesStore(state => state.applicationsWidgetEnabled)
+  const vehiclesWidgetEnabled = usePreferencesStore(state => state.vehiclesWidgetEnabled)
+  const airDiscountWidgetEnabled = usePreferencesStore(state => state.airDiscountWidgetEnabled)
+  const widgetsInitialised = usePreferencesStore(state => state.widgetsInitialised)

Likely invalid or redundant comment.

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

Outside diff range, codebase verification and nitpick comments (1)
apps/native/app/src/screens/home/vehicles-module.tsx (1)

91-111: Review hardcoded values and improve responsiveness in VehicleItem style.

The styling for VehicleItem includes hardcoded values and conditional styles based on the count of items. Consider defining these values as constants or retrieving them from a theme or configuration to enhance maintainability and responsiveness.

Suggested improvements for better maintainability and responsiveness:

-        minHeight={176}
-        style={
-          count > 1
-            ? {
-                width: screenWidth - theme.spacing[2] * 3,
-                paddingHorizontal: 0,
-                paddingLeft: theme.spacing[2],
-                minHeight: 176,
-              }
-            : {
-                width: '100%',
-                paddingHorizontal: 0,
-              }
-        }
+        style={getItemStyle(count, theme)}

And define getItemStyle in a more central location to handle these styles based on count and theme, which can be reused across different components if needed.

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ccf0cd9 and 50df0df.

Files selected for processing (4)
  • apps/native/app/src/screens/home/air-discount-module.tsx (1 hunks)
  • apps/native/app/src/screens/home/applications-module.tsx (5 hunks)
  • apps/native/app/src/screens/home/licenses-module.tsx (1 hunks)
  • apps/native/app/src/screens/home/vehicles-module.tsx (1 hunks)
Files skipped from review due to trivial changes (1)
  • apps/native/app/src/screens/home/air-discount-module.tsx
Files skipped from review as they are similar to previous changes (2)
  • apps/native/app/src/screens/home/applications-module.tsx
  • apps/native/app/src/screens/home/licenses-module.tsx
Additional context used
Path-based instructions (1)
apps/native/app/src/screens/home/vehicles-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."

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, codebase verification and nitpick comments (1)
apps/native/app/src/stores/auth-store.ts (1)

Line range hint 1-400: Suggestions for improving code structure and error handling.

The file auth-store.ts handles a lot of responsibilities, including user authentication, session management, and UI interactions. Consider the following improvements to enhance modularity and maintainability:

  1. Separation of Concerns: Separate the UI logic (like alerts) from the authentication logic. This can be achieved by moving the UI-related code to a different module or layer that handles UI interactions, making the auth store purely for authentication and session management.

  2. Error Handling: Enhance error handling by centralizing it or using a more sophisticated method to handle different types of authentication errors. This could involve creating a utility function or service that handles all errors and decides whether to show alerts, log errors, or perform other actions.

  3. Type Safety: Ensure that all possible types are handled correctly, especially in asynchronous operations and where optional chaining is used. TypeScript can help prevent runtime errors due to unexpected types.

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 50df0df and eb298bc.

Files selected for processing (1)
  • apps/native/app/src/stores/auth-store.ts (1 hunks)
Additional context used
Path-based instructions (1)
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/stores/auth-store.ts 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: 3

Outside diff range, codebase verification and nitpick comments (1)
apps/native/app/src/screens/home/applications-module.tsx (1)

Line range hint 55-184: Approve changes with suggestions for maintainability.

The ApplicationsModule component has been significantly improved to handle new props and improve user interaction effectively. The handling of loading and error states, as well as the conditional rendering based on the presence of applications, aligns well with the PR objectives.

Suggestions:

  • Consider adding more detailed comments explaining the logic, especially for the conditional rendering sections, to improve maintainability.
  • Ensure that the navigateTo function is properly tested, especially since it's used in multiple places with different parameters.

Would you like me to help by writing some unit tests for this component or improving the documentation?

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between eb298bc and b4f8644.

Files selected for processing (5)
  • apps/native/app/src/screens/home/air-discount-module.tsx (1 hunks)
  • apps/native/app/src/screens/home/applications-module.tsx (6 hunks)
  • apps/native/app/src/screens/home/inbox-module.tsx (2 hunks)
  • apps/native/app/src/screens/home/licenses-module.tsx (1 hunks)
  • apps/native/app/src/screens/home/vehicles-module.tsx (1 hunks)
Files skipped from review due to trivial changes (1)
  • apps/native/app/src/screens/home/air-discount-module.tsx
Files skipped from review as they are similar to previous changes (1)
  • apps/native/app/src/screens/home/licenses-module.tsx
Additional context used
Path-based instructions (3)
apps/native/app/src/screens/home/inbox-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/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/screens/home/vehicles-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."

@thoreyjona thoreyjona force-pushed the feat/app-widgets-home-screen branch from b4f8644 to ecdfedc Compare September 9, 2024 10:59
@thoreyjona thoreyjona added the automerge Merge this PR as soon as all checks pass label Sep 9, 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 b4f8644 and ecdfedc.

Files ignored due to path filters (19)
  • apps/native/app/src/assets/icons/options.png is excluded by !**/*.png
  • apps/native/app/src/assets/icons/[email protected] is excluded by !**/*.png
  • apps/native/app/src/assets/icons/[email protected] is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/le-company-s2x.png is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/le-jobs-s2.png is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/[email protected] is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/[email protected] is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/le-moving-s4.png is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/[email protected] is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/[email protected] is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/le-retirement-s3-large.png is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/[email protected] is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/[email protected] is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/le-retirement-s3.png is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/[email protected] is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/[email protected] is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/moving.png is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/[email protected] is excluded by !**/*.png
  • apps/native/app/src/assets/illustrations/[email protected] is excluded by !**/*.png
Files selected for processing (34)
  • apps/native/app/src/messages/en.ts (3 hunks)
  • apps/native/app/src/messages/is.ts (3 hunks)
  • apps/native/app/src/screens/applications/applications.tsx (1 hunks)
  • apps/native/app/src/screens/home/air-discount-module.tsx (1 hunks)
  • apps/native/app/src/screens/home/applications-module.tsx (6 hunks)
  • apps/native/app/src/screens/home/hello-module.tsx (2 hunks)
  • apps/native/app/src/screens/home/home-options.tsx (1 hunks)
  • apps/native/app/src/screens/home/home.tsx (6 hunks)
  • apps/native/app/src/screens/home/inbox-module.tsx (2 hunks)
  • apps/native/app/src/screens/home/licenses-module.tsx (1 hunks)
  • apps/native/app/src/screens/home/onboarding-module.tsx (1 hunks)
  • apps/native/app/src/screens/home/vehicles-module.tsx (1 hunks)
  • apps/native/app/src/screens/settings/settings.tsx (2 hunks)
  • apps/native/app/src/screens/vehicles/components/vehicle-item.tsx (4 hunks)
  • apps/native/app/src/screens/vehicles/vehicles-detail.tsx (3 hunks)
  • apps/native/app/src/screens/vehicles/vehicles.tsx (6 hunks)
  • apps/native/app/src/screens/wallet/components/wallet-item.tsx (4 hunks)
  • apps/native/app/src/screens/wallet/wallet.tsx (3 hunks)
  • apps/native/app/src/stores/auth-store.ts (1 hunks)
  • apps/native/app/src/stores/notifications-store.ts (1 hunks)
  • apps/native/app/src/stores/preferences-store.ts (4 hunks)
  • apps/native/app/src/ui/index.ts (1 hunks)
  • apps/native/app/src/ui/lib/card/air-discount-card.tsx (3 hunks)
  • apps/native/app/src/ui/lib/card/license-card.tsx (3 hunks)
  • apps/native/app/src/ui/lib/card/vehicle-card.tsx (3 hunks)
  • apps/native/app/src/ui/lib/empty-state/empty-card.tsx (3 hunks)
  • apps/native/app/src/ui/lib/skeleton/general-card-skeleton.tsx (1 hunks)
  • apps/native/app/src/ui/lib/tableview/tableview-cell.tsx (6 hunks)
  • apps/native/app/src/utils/component-registry.ts (2 hunks)
  • apps/native/app/src/utils/get-main-root.ts (2 hunks)
  • apps/native/app/src/utils/lifecycle/setup-components.tsx (2 hunks)
  • apps/native/app/src/utils/lifecycle/setup-event-handlers.ts (1 hunks)
  • apps/native/app/src/utils/lifecycle/setup-routes.ts (3 hunks)
  • apps/native/app/src/utils/test-ids.ts (1 hunks)
Files skipped from review due to trivial changes (2)
  • apps/native/app/src/screens/applications/applications.tsx
  • apps/native/app/src/screens/home/onboarding-module.tsx
Files skipped from review as they are similar to previous changes (29)
  • apps/native/app/src/messages/en.ts
  • apps/native/app/src/messages/is.ts
  • apps/native/app/src/screens/home/applications-module.tsx
  • apps/native/app/src/screens/home/hello-module.tsx
  • apps/native/app/src/screens/home/home-options.tsx
  • apps/native/app/src/screens/home/licenses-module.tsx
  • apps/native/app/src/screens/home/vehicles-module.tsx
  • apps/native/app/src/screens/settings/settings.tsx
  • apps/native/app/src/screens/vehicles/components/vehicle-item.tsx
  • apps/native/app/src/screens/vehicles/vehicles-detail.tsx
  • apps/native/app/src/screens/vehicles/vehicles.tsx
  • apps/native/app/src/screens/wallet/components/wallet-item.tsx
  • apps/native/app/src/screens/wallet/wallet.tsx
  • apps/native/app/src/stores/auth-store.ts
  • apps/native/app/src/stores/notifications-store.ts
  • apps/native/app/src/stores/preferences-store.ts
  • apps/native/app/src/ui/index.ts
  • apps/native/app/src/ui/lib/card/air-discount-card.tsx
  • apps/native/app/src/ui/lib/card/license-card.tsx
  • apps/native/app/src/ui/lib/card/vehicle-card.tsx
  • apps/native/app/src/ui/lib/empty-state/empty-card.tsx
  • apps/native/app/src/ui/lib/skeleton/general-card-skeleton.tsx
  • apps/native/app/src/ui/lib/tableview/tableview-cell.tsx
  • apps/native/app/src/utils/component-registry.ts
  • apps/native/app/src/utils/get-main-root.ts
  • apps/native/app/src/utils/lifecycle/setup-components.tsx
  • apps/native/app/src/utils/lifecycle/setup-event-handlers.ts
  • apps/native/app/src/utils/lifecycle/setup-routes.ts
  • apps/native/app/src/utils/test-ids.ts
Additional context used
Path-based instructions (3)
apps/native/app/src/screens/home/inbox-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/screens/home/air-discount-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/screens/home/home.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 (1)
apps/native/app/src/screens/home/air-discount-module.tsx (1)

35-57: Refactor the validation function for clarity and efficiency.

The function validateAirDiscountInitialData checks if the user has any air discount rights. The logic can be simplified and made more efficient:

  • Combine the conditions to return early.
  • Use every instead of filter and length for checking conditions across all items.
-const noRights =
-  data?.airDiscountSchemeDiscounts?.filter(
-    (item) => item.user.fund?.credit === 0 && item.user.fund.used === 0,
-  ).length === data?.airDiscountSchemeDiscounts?.length
-
-if (!noRights) {
-  return true
-}
-return false
+return data?.airDiscountSchemeDiscounts?.every(
+  (item) => item.user.fund?.credit !== 0 || item.user.fund.used !== 0
+)

Likely invalid or redundant comment.

apps/native/app/src/screens/home/home.tsx Show resolved Hide resolved
@kodiakhq kodiakhq bot merged commit d1fbbda into main Sep 9, 2024
196 checks passed
@kodiakhq kodiakhq bot deleted the feat/app-widgets-home-screen branch September 9, 2024 12:54
jonnigs pushed a commit that referenced this pull request Sep 12, 2024
* feat: first version of vehicle module for home screen

* feat: add base for air discount module on home screen

* feat: first version of license widget

* feat: fix routing to vehicles and air discount

* feat: allow override styling for walletItems

* fix: correct size for all modules based on screensize

* feat: first version of home-options

* fix: better coordination for sizes of licenses

* feat: UI for home options screen ready

* feat: add empty states for home screen widgets

* feat: add loading states for cards

* chore: remove unused illustration

* feat: temp adding another illustration for card until better solution

* fix: finalize empty states for home screen widgets

* feat: show mileage vehicles first in vehicles module

* feat: disable pressable heading if no data, move inbox query into widget

* chore: rename singular to plural to match applications name

* feat: add minHeight for vehicle cards in vehicle module

* fix: add seconds to appLock label in settings

* feat: move all data fetching and validation to home screen

* fix: should be plural for licenses and vehicles everywhere

* feat: skip fetching data on home screen if widgets are disabled

* fix: remove duplicate translations

* fix: update feature flags to be plural in all places

* fix: don't set initializedWidget until queries have loaded

* fix: inbox check

* fix: spelling of initialised

* feat: resetting homescreen preferences on logout

* fix: final touches

* fix: rename preferences flags to be shorter

* fix: import preferences separately

* fix: renaming children to items

* feat: remove reset call even later

* fix: see all in widgets should be variant heading5

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
@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