Skip to content

[Due for payment 2025-03-31] [$250] Enable copy action on mobile for select travel details (minimally address and confirmation number) #57800

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

Closed
blimpich opened this issue Mar 4, 2025 · 54 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Daily KSv2 Design External Added to denote the issue can be worked on by a contributor NewFeature Something to build that is a new item.

Comments

@blimpich
Copy link
Contributor

blimpich commented Mar 4, 2025

At the moment, it's not possible to copy key travel information. Minimally this is the hotel address and confirmation number, though there could be more examples. To address this issue, let's add a "copy" icon next to common travel info. This both communicates that copying is possible, and gives users a one-tap way to take that action.

Here's a screenshot of what the hotel trip details currently looks like, for reference.

Image

Example of our copy icon used elsewhere:

Screen.Recording.2025-03-04.at.3.11.13.PM.mov
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021897065395249352167
  • Upwork Job ID: 1897065395249352167
  • Last Price Increase: 2025-03-04
  • Automatic offers:
    • gijoe0295 | Contributor | 106480233
Issue OwnerCurrent Issue Owner: @strepanier03
@blimpich blimpich added the NewFeature Something to build that is a new item. label Mar 4, 2025
@blimpich blimpich self-assigned this Mar 4, 2025
Copy link

melvin-bot bot commented Mar 4, 2025

Triggered auto assignment to @strepanier03 (NewFeature), see https://stackoverflowteams.com/c/expensify/questions/14418#:~:text=BugZero%20process%20steps%20for%20feature%20requests for more details. Please add this Feature request to a GH project, as outlined in the SO.

@melvin-bot melvin-bot bot added the Weekly KSv2 label Mar 4, 2025
@blimpich blimpich added the External Added to denote the issue can be worked on by a contributor label Mar 4, 2025
@melvin-bot melvin-bot bot changed the title Enable copy action on mobile for select travel details (minimally address and confirmation number) [$250] Enable copy action on mobile for select travel details (minimally address and confirmation number) Mar 4, 2025
Copy link

melvin-bot bot commented Mar 4, 2025

Job added to Upwork: https://www.upwork.com/jobs/~021897065395249352167

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 4, 2025
Copy link

melvin-bot bot commented Mar 4, 2025

Triggered auto assignment to Contributor-plus team member for initial proposal review - @ntdiary (External)

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Mar 4, 2025
@gijoe0295
Copy link
Contributor

@blimpich Missing the screenshot:

Image

@blimpich
Copy link
Contributor Author

blimpich commented Mar 4, 2025

Should be fixed now, @gijoe0295 can you see it now?

@gijoe0295
Copy link
Contributor

gijoe0295 commented Mar 4, 2025

🚨 Edited by proposal-police: This proposal was edited at 2025-03-06 03:37:20 UTC.

Proposal

Please re-state the problem that we are trying to solve in this issue.

Enable copy action on mobile for select travel details (minimally address and confirmation number)

What is the root cause of that problem?

New feature

What changes do you think we should make in order to solve the problem?

We need to update confirmation and address menu items, and optionally record locator, flight/train code, seat in flight/train trips, vendor, confirmation number in car trips,.. to include the copy icon.

<MenuItemWithTopDescription
description={translate('travel.hotelDetails.confirmation')}
title={reservation.confirmations?.at(0)?.value}
interactive={false}

For the design, we have several options:

1️⃣ Center the copy button with the content itself

If we want to show the copy icon right next to the address text, we can leverage the MenuItem's titleComponent prop and use CommunicationsLink component as we already used in ProfilePage:

<CommunicationsLink value={phoneOrEmail ?? ''}>
<UserDetailsTooltip accountID={details?.accountID ?? CONST.DEFAULT_NUMBER_ID}>
<Text
numberOfLines={1}
style={styles.w100}
>
{isSMSLogin ? formatPhoneNumber(phoneNumber ?? '') : login}
</Text>
</UserDetailsTooltip>
</CommunicationsLink>

titleComponent={
    <CommunicationsLink value={reservation.start.address ?? ''}>
        <Text style={styles.w100}>
            {reservation.start.address ?? ''}
        </Text>
    </CommunicationsLink>
}
Image

We might want to suppress the fixed height of the CommunicationsLink here by introducing a new prop shouldSuppressHeight to make sure it works well in case the address spans into more than 1 line. The copy icon will be middle-aligned (can be customized later):

Image

We might need further style adjustments to align the copy icon position. Maybe middle align the copy icon, or move it closer to the inner text... This needs design team confirmation.

2️⃣ Center the copy button with the entire row (and right align the icon)

In HotelTripDetails, use MenuItem's rightComponent & shouldShowRightComponent props to insert a copy icon following this implementation:

<ContextMenuItem
icon={Expensicons.Copy}
text={translate('reportActionContextMenu.copyToClipboard')}
successIcon={Expensicons.Checkmark}
successText={translate('reportActionContextMenu.copied')}
isMini
onPress={() => Clipboard.setString(value)}
/>

To make it middle-aligned, we can wrap it inside a View with alignSelf: center style.

Image

3️⃣ Show a smaller copy icon next to the push row label (or menu item's description)

Introduce new props for MenuItem: shouldShowCopyIcon and copyValue. Then use the same ContextMenuItem component as above. Wrap it and the description Text here inside a flex-row, end-aligned View.

<View style={[styles.flexRow, styles.alignItemsEnd, styles.w100]}>
    <Text
        style={descriptionTextStyles}
        numberOfLines={numberOfLinesDescription}
    >
        {description}
    </Text>
    {shouldShowCopyIcon && !!copyValue && (
        <ContextMenuItem
            icon={Expensicons.Copy}
            ...
            onPress={() => Clipboard.setString(copyValue)}
        />
    )}
</View>

To make the copy icon smaller, introduce iconWidth & iconHeight to ContextMenuItem and pass them to the Icon component.

We can extract the ContextMenuItem to a variable and use it for the case description shown below the title here.

Image

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

NA - UI improvement

What alternative solutions did you explore? (Optional)

  1. We might want to use a larger copy button like this:

Image

In this case, we can use PressableWithDelayToggle like this:

<PressableWithDelayToggle
text={translate('twoFactorAuth.copy')}
textChecked={translate('common.copied')}
icon={Expensicons.Copy}
inline={false}
onPress={() => {
Clipboard.setString(account?.recoveryCodes ?? '');
setError('');
setCodesAreCopied();
}}

  1. We might want to incorporate the copy button into the MenuItem component for reusability. To do that, we can introduce a prop to enable showing the copy icon with similar implementation as above.

@ntdiary
Copy link
Contributor

ntdiary commented Mar 6, 2025

I feel the copy icon should be right next to the address rather than in the top right corner of the menu item.
BTW, @blimpich, does your address contain line breaks? I mocked the data and saw that the address wasn’t split into two lines. 😂

Image

@gijoe0295
Copy link
Contributor

gijoe0295 commented Mar 6, 2025

copy icon should be right next to the address

@ntdiary I updated my proposal.

does your address contain line breaks

It does contain the line breaks but should be stripped out after #57801 is completed.

@blimpich
Copy link
Contributor Author

blimpich commented Mar 6, 2025

Hmm good point, there are a couple cases here I hadn't considered. Lets bring a member of the design team here to get their opinion on how it should look.

Copy link

melvin-bot bot commented Mar 6, 2025

Triggered auto assignment to @dannymcclain (Design), see these Stack Overflow questions for more details.

@blimpich
Copy link
Contributor Author

blimpich commented Mar 6, 2025

👋 @dannymcclain hello! We have a couple questions about how this new copy functionality should look in the trip preview UI:

  1. should the address contain line breaks?
  2. if the address has line breaks, where should the icon for copying the address to the clipboard go?

@dannymcclain
Copy link
Contributor

Definitely going to need @Expensify/design and specifically @shawnborton to weigh in on this one, but I think we could approach it one of two ways:

Center the copy button with the entire row (and right align the icon)

This does not follow the same pattern for copying a user's email from their profile, but does kinda jive with our general patterns regarding alignment. The copy button does feel a bit disconnected from the content though...

Image

Center the copy button with the content itself

This more closely follows the pattern from profile, and seems to work pretty well with one line and multi-line content, so this is probably the way to go. I'd like a gut check from the design team, but I think this is what I would recommend.

Image

@dannymcclain
Copy link
Contributor

should the address contain line breaks?

Oh also, for this question, I think it could go either way depending on what data we get, right? I was under the impression we didn't have much control over this.

@blimpich
Copy link
Contributor Author

blimpich commented Mar 6, 2025

We definitely have the power to remove line breaks from the address in the trip preview. Adding line breaks if the address doesn't come with them would be more of a pain since we'd have to parse the address and figure out where to put them. Getting rid of them is totally doable though 👍

@blimpich
Copy link
Contributor Author

blimpich commented Mar 6, 2025

Asked here if the newline is intentional on our side or if it just happens to be how the data is coming in from Spotnana.

@dannymcclain
Copy link
Contributor

Same same! 🤝

Also, can we get a sense of how this is applied to all components that use something like this?

We just enable it with an optional prop.

So will this be available for any read-only push row?

@gijoe0295
Copy link
Contributor

gijoe0295 commented Mar 11, 2025

Will this be available for any read-only push row

I think to apply this to ALL read-only menu items are out of scope of this issue. A majority of them can be "copiable" by default but we still need to go through all the MenuItem instances for safety.

The general idea is that: Read-only menu items are marked with interactive=false. We can use this prop to detect a read-only menu item:

  • Enable the copy feature by default in MenuItem if interactive=false and its default value would be title, without the need to pass copyValue.
  • For more complicated cases where the title is a component (titleComponent), we still need to pass copyValue. So the fallback chain of copyValue should be:
const copyValue = copyValueProp ?? (!interactive && title);

@blimpich It's up to you to decide whether we want to incorporate this improvement globally in this issue or to resolve them in a separate one. I'm happy with any option though.

cc @ntdiary

@ntdiary
Copy link
Contributor

ntdiary commented Mar 11, 2025

Same same! 🤝

Also, can we get a sense of how this is applied to all components that use something like this?

We just enable it with an optional prop.

So will this be available for any read-only push row?

@dannymcclain, not sure if there was a similar definition for the read-only push row before. 😂

So far, the information in trip detail page uses MenuItem component, while the email in the profile page uses UserDetailsTooltip component.

BTW, as a fundamental and widely used component, MenuItem has grown to nearly a thousand lines of code. It has so many custom render options that it doesn’t feel as easy to use as it should be. ( Not opposing @gijoe0295's proposal, just have a minor gripe about this component 😅 )

Finally, If there are no other thoughts, let's proceed with @gijoe0295's proposal.

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Mar 11, 2025

Current assignee @blimpich is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

@blimpich
Copy link
Contributor Author

Lets keep is scoped to just the trip preview UI for now. And handle the rest of the read-only push rows in a different issue 👍

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 11, 2025
Copy link

melvin-bot bot commented Mar 11, 2025

📣 @gijoe0295 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

Copy link

melvin-bot bot commented Mar 22, 2025

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Mar 24, 2025
@melvin-bot melvin-bot bot changed the title [$250] Enable copy action on mobile for select travel details (minimally address and confirmation number) [Due for payment 2025-03-31] [$250] Enable copy action on mobile for select travel details (minimally address and confirmation number) Mar 24, 2025
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Mar 24, 2025
Copy link

melvin-bot bot commented Mar 24, 2025

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Mar 24, 2025

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.17-1 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2025-03-31. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Mar 24, 2025

BugZero Checklist: The PR adding this new feature has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@ntdiary] Please propose regression test steps to ensure the new feature will work correctly on production in further releases.
  • [@strepanier03] Link the GH issue for creating/updating the regression test once above steps have been agreed upon.

@ntdiary
Copy link
Contributor

ntdiary commented Mar 31, 2025

Select only one test case for regression test.

Precondition:

Test:

  1. Book a hotel trip.
  2. Open the hotel trip details
  3. Right-click (desktop) or long-press (mobile) the address information.
  4. Verify the Copy to clipboard context menu will appear.
  5. Select it and verify the address will copy successfully.

Do we agree 👍 or 👎

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Mar 31, 2025
@strepanier03
Copy link
Contributor

strepanier03 commented Mar 31, 2025

Payment summary

@strepanier03
Copy link
Contributor

@ntdiary - Payment summary above, please feel free to request payment.

@gijoe0295 - I paid and closed your Upwork contract.

Thank you both for your work on this!

@JmillsExpensify
Copy link

$250 approved for @ntdiary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Daily KSv2 Design External Added to denote the issue can be worked on by a contributor NewFeature Something to build that is a new item.
Projects
Development

No branches or pull requests

8 participants