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

fix(native-app): minor fixes #16391

Merged
merged 4 commits into from
Oct 15, 2024
Merged

fix(native-app): minor fixes #16391

merged 4 commits into from
Oct 15, 2024

Conversation

thoreyjona
Copy link
Contributor

@thoreyjona thoreyjona commented Oct 14, 2024

What

  • Remove mailto link from onboarding card since the app does not support opening it.
  • Removing star from inbox card
  • Add link icon to air discount link

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

Release Notes

  • New Features

    • Updated feedback prompts in English and Icelandic to include a specific email address for user suggestions.
  • Improvements

    • Enhanced visual representation in the AirDiscountScreen with an external link icon next to the terms of service.
    • Refined filtering and state management in the InboxScreen for improved document handling.
  • Bug Fixes

    • Removed unused properties and hooks in the InboxCard and ListItem components to streamline functionality.

@thoreyjona thoreyjona requested a review from a team as a code owner October 14, 2024 16:36
Copy link
Contributor

coderabbitai bot commented Oct 14, 2024

Walkthrough

The pull request includes updates to localization strings in English and Icelandic translation files, specifically enhancing user feedback clarity by including a complete email address. Additionally, several components have been modified: the AirDiscountScreen now displays an external link icon, while the InboxModule and InboxScreen components have had the bookmarked property removed. The OnboardingModule has also removed a mailto link. Other components have seen adjustments in their props and state management.

Changes

File Path Change Summary
apps/native/app/src/messages/en.ts Updated home.onboardingModule.card3 to include the email island@island.is.
apps/native/app/src/messages/is.ts Modified home.onboardingModule.card3 to include the email island@island.is.
apps/native/app/src/screens/air-discount/air-discount.tsx Added import for Image and externalLinkIcon; updated LinkText to include an image next to the terms of service link.
apps/native/app/src/screens/home/inbox-module.tsx Removed bookmarked property from InboxCard component's props.
apps/native/app/src/screens/home/onboarding-module.tsx Removed link prop from WelcomeCard associated with key="card-3".
`apps/native/app/src/screens/inbox/inbox.tsx Removed bookmarked prop from InboxCard; updated applyFilters function; refined state management for filters; enhanced loading and fetching logic.
`apps/native/app/src/ui/lib/card/inbox-card.tsx Removed unused useEffect and useState imports; updated InboxCardProps to remove optional bookmarked property; eliminated star press logic.
`apps/native/app/src/ui/lib/list/list-item.tsx Removed Pressable and useTheme imports; eliminated StarImage styled component and associated logic; removed onStarPress and starred from ListItemProps.

Possibly related PRs

Suggested labels

automerge

Suggested reviewers

  • snaerseljan

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

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

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

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

CodeRabbit Commands (Invoked using PR comments)

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

Other keywords and placeholders

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

Documentation and Community

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (6)
apps/native/app/src/ui/lib/card/inbox-card.tsx (1)

Line range hint 21-46: LGTM: InboxCard component simplified and aligned with NextJS best practices

The removal of the starred state and related logic simplifies the InboxCard component, focusing it solely on displaying inbox card information. These changes adhere to React and NextJS best practices by:

  1. Removing unused state, improving performance and readability.
  2. Simplifying the component's logic, making it easier to maintain.
  3. Maintaining efficient use of TypeScript for type safety in props and component definition.

The component now better follows the principle of single responsibility, which is a key aspect of maintainable React components.

Consider documenting this change in the component's comments or in a separate documentation file to inform other developers about the removal of the bookmarking feature.

apps/native/app/src/ui/lib/list/list-item.tsx (2)

Line range hint 72-80: LGTM: ListItemProps interface updated

The removal of onStarPress and starred properties from the ListItemProps interface is consistent with the elimination of the star icon functionality. The remaining properties accurately reflect the current component's needs.

Consider adding JSDoc comments to the interface properties for better code documentation. For example:

interface ListItemProps {
  /** The main text to display in the list item */
  title: string;
  /** The date to display (optional) */
  date?: Date | string;
  // ... (add comments for other properties)
}

Line range hint 90-145: LGTM: Rendering logic updated

The removal of the star icon rendering logic is consistent with the previous changes. The remaining structure and rendering logic of the component are appropriate and follow React and React Native best practices.

To improve TypeScript usage and make the code more robust, consider using more specific types for some of the props. For example:

icon?: ImageSourcePropType | React.ReactElement

This change would make it clear that the icon prop can be either an image source or a React element, improving type safety.

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

156-157: Approved with suggestion: Consider adding accessibility props

The addition of the external link icon improves the UI and aligns with the PR objectives. However, to enhance accessibility, consider adding the accessibilityLabel prop to the Image component. This will provide context for screen readers.

Example:

<Image 
  source={externalLinkIcon} 
  accessibilityLabel={intl.formatMessage({ id: 'airDiscount.externalLinkIconLabel' })}
/>

Don't forget to add the corresponding translation string.

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

179-179: Approved: Email address update looks good.

The change correctly updates the feedback email to a specific address (island@island.is), which aligns with the PR objectives. This update improves user experience by providing a direct point of contact.

Consider adding "at" before the email address for improved readability:

-    'If you have comments or suggestions about something that is missing or that could be improved, feel free to contact us via email at island@island.is',
+    'If you have comments or suggestions about something that is missing or that could be improved, feel free to contact us via email at island@island.is',
apps/native/app/src/messages/is.ts (1)

179-179: LGTM! Consider adding an accessibility improvement.

The change looks good and aligns with the PR objectives. The updated string now provides a clear email address for user feedback, which improves usability.

To enhance accessibility, consider wrapping the email address in brackets or adding a prefix like "email:" to make it easier for screen readers to identify it as an email address. For example:

-    'Hafir þú athugasemdir eða ábendingar um eitthvað sem vantar eða sem má betur fara viljum við gjarnan fá frá þér línu á island@island.is',
+    'Hafir þú athugasemdir eða ábendingar um eitthvað sem vantar eða sem má betur fara viljum við gjarnan fá frá þér línu á netfangið: island@island.is',
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

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

📒 Files selected for processing (8)
  • apps/native/app/src/messages/en.ts (1 hunks)
  • apps/native/app/src/messages/is.ts (1 hunks)
  • apps/native/app/src/screens/air-discount/air-discount.tsx (3 hunks)
  • apps/native/app/src/screens/home/inbox-module.tsx (0 hunks)
  • apps/native/app/src/screens/home/onboarding-module.tsx (0 hunks)
  • apps/native/app/src/screens/inbox/inbox.tsx (0 hunks)
  • apps/native/app/src/ui/lib/card/inbox-card.tsx (1 hunks)
  • apps/native/app/src/ui/lib/list/list-item.tsx (1 hunks)
💤 Files with no reviewable changes (3)
  • apps/native/app/src/screens/home/inbox-module.tsx
  • apps/native/app/src/screens/home/onboarding-module.tsx
  • apps/native/app/src/screens/inbox/inbox.tsx
🧰 Additional context used
📓 Path-based instructions (5)
apps/native/app/src/messages/en.ts (1)

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

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

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/screens/air-discount/air-discount.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/inbox-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/list/list-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."
🔇 Additional comments (6)
apps/native/app/src/ui/lib/card/inbox-card.tsx (2)

1-1: LGTM: Import statement simplified

The simplification of the React import and removal of unused hooks (useEffect and useState) improves code cleanliness and reflects the component's reduced complexity after removing the starred functionality.


Line range hint 8-19: LGTM: InboxCardProps interface simplified

The removal of the bookmarked property from the InboxCardProps interface aligns with the component's reduced functionality and simplifies its API. This change maintains type safety and adheres to TypeScript best practices by keeping the interface in sync with the component's actual usage.

apps/native/app/src/ui/lib/list/list-item.tsx (3)

4-5: LGTM: Import statements cleaned up

The removal of unused imports (Pressable and useTheme) and the consolidation of react-native imports improve code cleanliness and organization. These changes are consistent with the removal of the star icon functionality.


Line range hint 82-89: LGTM: Component props updated

The removal of onStarPress and starred from the component's destructured props is consistent with the interface changes and the elimination of the star icon functionality. The remaining props accurately reflect the current component's needs and match the updated interface.


Line range hint 1-145: Overall assessment: Changes improve code clarity and maintain best practices

The removal of the star icon functionality has been consistently applied throughout the component, including imports, interface, props, and rendering logic. These changes improve code clarity by removing unused features.

The component continues to adhere to NextJS and React Native best practices, maintaining efficient state management and type safety. The suggested minor improvements (adding JSDoc comments and more specific TypeScript types) would further enhance the code quality.

These changes align well with the PR objectives of implementing minor adjustments in the native application, specifically the removal of the star icon from the inbox card.

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

11-11: LGTM: Image import added correctly

The addition of the Image import from 'react-native' is correct and necessary for its usage in the component. This change follows React Native best practices.

Copy link

codecov bot commented Oct 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

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

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #16391   +/-   ##
=======================================
  Coverage   36.73%   36.73%           
=======================================
  Files        6808     6808           
  Lines      141061   141064    +3     
  Branches    40217    40215    -2     
=======================================
+ Hits        51817    51822    +5     
+ Misses      89244    89242    -2     
Flag Coverage Δ
web 1.82% <ø> (ø)

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

see 11 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a0d9ae7...a05850d. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Oct 14, 2024

Datadog Report

Branch report: fix/minor-app-fixes
Commit report: d846bb9
Test service: web

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

Copy link
Member

@snaerseljan snaerseljan left a comment

Choose a reason for hiding this comment

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

Ahhh always nice to see some code removed 🙂

@thoreyjona thoreyjona added the automerge Merge this PR as soon as all checks pass label Oct 15, 2024
@kodiakhq kodiakhq bot merged commit 9a11ba4 into main Oct 15, 2024
33 checks passed
@kodiakhq kodiakhq bot deleted the fix/minor-app-fixes branch October 15, 2024 13:28
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