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

[HOLD for payment 2024-04-25] [$125] No spacing between explanatory text and toggle button in "settings" #38370

Closed
1 of 6 tasks
m-natarajan opened this issue Mar 15, 2024 · 53 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@m-natarajan
Copy link

m-natarajan commented Mar 15, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 1.4.52-6
Reproducible in staging?: y
Reproducible in production?: new feature
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @JmillsExpensify
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1710461880379559

Action Performed:

  1. Open app and switch the language to spanish
  2. Go to any "collect" workspace
  3. Click categories >settings

Expected Result:

There should be spacing between the explanatory text and toggle switch

Actual Result:

No enough spacing

Workaround:

unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~014169e1c9001cba30
  • Upwork Job ID: 1768677955202637824
  • Last Price Increase: 2024-03-15
@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Mar 15, 2024
Copy link

melvin-bot bot commented Mar 15, 2024

Triggered auto assignment to @joekaufmanexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@tienifr
Copy link
Contributor

tienifr commented Mar 15, 2024

Proposal

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

No enough spacing

What is the root cause of that problem?

We don't have margin/ padding for text or switch button

<Text>{translate('workspace.categories.enableCategory')}</Text>
<Switch
isOn={policyCategory.enabled}
accessibilityLabel={translate('workspace.categories.enableCategory')}
onToggle={updateWorkspaceRequiresCategory}
/>

we also don't have any logic to break new line for long text

Screenshot 2024-03-15 at 11 25 07

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

  1. We can add marginRight: 8 and flexShrink: 1 in
<Text style={[styles.textNormal, styles.colorMuted, {marginRight: 8, flexShrink: 1}]}>{translate('workspace.categories.requiresCategory')}</Text>

What alternative solutions did you explore? (Optional)

NA

Result

Screenshot 2024-03-15 at 11 24 42 Screenshot 2024-03-15 at 11 24 50

@joekaufmanexpensify
Copy link
Contributor

Reproduced.

@joekaufmanexpensify joekaufmanexpensify added the External Added to denote the issue can be worked on by a contributor label Mar 15, 2024
@melvin-bot melvin-bot bot changed the title No spacing between explanatory text and toggle button in "settings" [$500] No spacing between explanatory text and toggle button in "settings" Mar 15, 2024
Copy link

melvin-bot bot commented Mar 15, 2024

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

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

melvin-bot bot commented Mar 15, 2024

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

@joekaufmanexpensify
Copy link
Contributor

This is a super minor change/spacing issue. Feels like this might be a $125 issue, but we should fix it.

@joekaufmanexpensify joekaufmanexpensify changed the title [$500] No spacing between explanatory text and toggle button in "settings" [$125] No spacing between explanatory text and toggle button in "settings" Mar 15, 2024
Copy link

melvin-bot bot commented Mar 15, 2024

Upwork job price has been updated to $125

@brandonhenry
Copy link
Contributor

brandonhenry commented Mar 15, 2024

Proposal

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

The problem is that in multiple places throughout the codebase, the text next to a switch component is not properly formatted or aligned, causing inconsistent styling and layout issues.

What is the root cause of that problem?

The main issue here, is there is no margin. You normally don't see this because we are doing text wrapping. However, if the viewport width lines up just right it will be way to close to the switch. See example screens below.

Case reported in original post root can be found here

<Text style={[styles.textNormal, styles.colorMuted]}>{translate('workspace.categories.requiresCategory')}</Text>

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

To address this issue, I propose we audit the codebase and update all instances where we have text next to a switch that is not properly formatted.

Specifically, we should:

  1. Locate all usages of the Switch component that have adjacent text
  2. Ensure there is a View wrapping the text and Switch
  3. Apply the styles.mr2 style to the text, to add consistent right margin between the text and switch (we might need padding but I recognized styles.mr2 as being used on other Text next to a Switch in the codebase)
<Text style={[styles.mr2]}>

Cases I've found

<Text style={[styles.textNormal, styles.colorMuted]}>{translate('workspace.categories.requiresCategory')}</Text>

<Text>{translate('workspace.categories.enableCategory')}</Text>

<Text>{translate('timezonePage.getLocationAutomatically')}</Text>

<Text color={!iouIsBillable ? theme.textSupporting : undefined}>{translate('common.billable')}</Text>

<Text color={!iouIsBillable ? theme.textSupporting : undefined}>{translate('common.billable')}</Text>

Example Screens With Viewport Adjusted To Show Issue

WorkspaceCategoriesSettingsPage.tsx

image

TimezoneInitialPage.tsx

image

CategorySettingsPage

image

What alternative solutions did you explore? (Optional)

An alternative could be to build the margin into Switch itself. Though, this might interfere with the text wrapping we're already doing

@nayabatir1
Copy link

nayabatir1 commented Mar 17, 2024

Proposal

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

No spacing between explanatory text and toggle button in Categories Settings page

What is the root cause of that problem?

Gap between both element is not mentioned. If explanatory text is long then it can push switch button out of view. If text grows it should automatically wrap to next link without disturbing position of switch. I'm using flex gap so that it can be screen responsive.

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

  • In View wrapper added gap. So there is some spacing in both elements.
  • explanatory text should wrap to next line if text grows.
  • In Utils index added spacing in staticStyleUtils.
  • use useStyleUtils hook for flex gap
Code Preview
<View style={[styles.mt2, styles.mh4]}>
	<View style={[styles.flexRow, styles.mb5, styles.mr2, styles.alignItemsCenter, styles.justifyContentBetween, stylesUtils.spacing.gap5]}>
		<Text style={[styles.textNormal, styles.colorMuted, styles.flexShrink1]}>{translate('workspace.categories.requiresCategory')}</Text>

		<Switch
        	isOn={policy?.requiresCategory ?? false}
			accessibilityLabel={translate('workspace.categories.requiresCategory')}
			onToggle={updateWorkspaceRequiresCategory}
		/>
</View>
Image preview

Screenshot 2024-03-17 at 12 57 43

What alternative solutions did you explore? (Optional)

Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

@melvin-bot melvin-bot bot added the Overdue label Mar 18, 2024
@parasharrajat
Copy link
Member

@brandonhenry Are you saying that same problem exists on all of these pages?

@melvin-bot melvin-bot bot removed the Overdue label Mar 18, 2024
@brandonhenry
Copy link
Contributor

@parasharrajat yes, can provide screens shortly

@Victor-Nyagudi
Copy link
Contributor

Proposal

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

No spacing between text and toggle button in "settings".

What is the root cause of that problem?

The View housing the text and toggle button has a justifyContent: "space-between" style that's supposed to create the space between the text and the toggle button.

<View style={[styles.flexRow, styles.mb5, styles.mr2, styles.alignItemsCenter, styles.justifyContentBetween]}>

However, when the text gets too long, the text expands its container until it touches the toggle button's container leaving no space between them.

space-between only works if the total size of both children containers (text and toggle button) is less than 100% of the parent (the View).

I'm noticing this issue also on web when viewing the setting on the RHP.

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

Since the text is the one that grows and shrinks based on the amount of words, I propose giving the Text component a maxWidth e.g. maxWidth: "85%" on smaller devices, and maxWidth: "80%" on larger devices.

// This is just for demo. We can create a class if needed or use an existing one if it exists for 'maxWidth'.
<Text style={[styles.textNormal, styles.colorMuted, {maxWidth: '85%'}]}>{translate('workspace.categories.requiresCategory')}</Text>

This will ensure the text container's width only grows to a certain portion of its parent such that space-between still works properly.

These percentages/numbers can be adjusted according to what's agreed upon by the design team.

iOS demo after changes

expensify-spanish-text-toggle-spacing-ios

Chrome demo after changes

expensify-spanish-text-toggle-spacing-chrome

I've noticed there are a couple of other places such as TimezoneInitialPage where the toggle button is preceded by text, so we can apply a similar approach in those areas for consistency.

In addition, some of the Views housing the text and toggle button in these other places have the exact same value for the style prop, so we could optionally create one style for the text and toggle container and reuse it where necessary to keep code DRY.

What alternative solutions did you explore? (Optional)

None so far.

@parasharrajat
Copy link
Member

@brandonhenry Yes please, present some visuals to confirm.

@brandonhenry
Copy link
Contributor

@parasharrajat done. updated proposal.

Also, since this took some deep dive and also affects multiple parts of the app - I think the bounty should be raised (at least to $250). Thoughts? @joekaufmanexpensify

@parasharrajat
Copy link
Member

parasharrajat commented Mar 19, 2024

I like the idea of auditing the app and fixing this issue everywhere in the App in one go. Thus @brandonhenry's proposal sounds good to me.

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Mar 19, 2024

Triggered auto assignment to @tylerkaraszewski, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@Victor-Nyagudi
Copy link
Contributor

Any feedback on my proposal or why using maxWidth is bad in this case, @parasharrajat?

@parasharrajat
Copy link
Member

I think flexbox should be more flexible. There might be still be a case where percentage unit will take more than the necessary space. It usually happens when screen dimensions changes.

@joekaufmanexpensify
Copy link
Contributor

Also, since this took some deep dive and also affects multiple parts of the app - I think the bounty should be raised (at least to $250). Thoughts?

@brandonhenry mind sharing the various places we're going to be updating this?

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Apr 18, 2024
@melvin-bot melvin-bot bot changed the title [$125] No spacing between explanatory text and toggle button in "settings" [HOLD for payment 2024-04-25] [$125] No spacing between explanatory text and toggle button in "settings" Apr 18, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Apr 18, 2024
Copy link

melvin-bot bot commented Apr 18, 2024

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

Copy link

melvin-bot bot commented Apr 18, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.62-17 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 2024-04-25. 🎊

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

Copy link

melvin-bot bot commented Apr 18, 2024

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

@parasharrajat
Copy link
Member

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

Regression Test Steps

  1. Open the Expensify app and switch the language to Spanish.
  2. Navigate to any "collect" workspace.
  3. Click on the categories option and then select settings.
  4. Check that the text is wrapped properly and well aligned.

Do you agree 👍 or 👎 ?

@joekaufmanexpensify
Copy link
Contributor

Great. TY! I'll complete my portion of the checklist.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Apr 24, 2024
@joekaufmanexpensify
Copy link
Contributor

IMO this is a very niche bug and does not require a regression test.

@joekaufmanexpensify
Copy link
Contributor

Checklist is all set.

@joekaufmanexpensify
Copy link
Contributor

We need to issue the following payments:

@joekaufmanexpensify
Copy link
Contributor

opened new job since other one is closed: https://www.upwork.com/jobs/~011f3cc2ed89c19798

@joekaufmanexpensify
Copy link
Contributor

@brandonhenry offer sent for $125!

@joekaufmanexpensify
Copy link
Contributor

@parasharrajat could you please request $125 via NewDot and confirm here once complete?

@parasharrajat
Copy link
Member

parasharrajat commented Apr 25, 2024

@joekaufmanexpensify I will request it later. Feel free to close it.

@joekaufmanexpensify
Copy link
Contributor

@brandonhenry $125 sent and contract ended!

@joekaufmanexpensify
Copy link
Contributor

Payment summary is here for when @parasharrajat later requests payment. All set!

@parasharrajat
Copy link
Member

Based on the thread https://expensify.slack.com/archives/C02NK2DQWUX/p1715710167738659?thread_ts=1715190852.677769&cid=C02NK2DQWUX, I think the price set on the issue is incorrect. It should be the base price at that time which was 500 at that time.

Given that we think it is a small issue, 250 sounds better. @joekaufmanexpensify thoughts?

@joekaufmanexpensify
Copy link
Contributor

Brought to slack to discuss

@joekaufmanexpensify
Copy link
Contributor

Discussed and landed on keeping the price as $125 here since I intentionally adjusted the price here because this was a very minor fix.

@joekaufmanexpensify
Copy link
Contributor

Payment summary is here.

@parasharrajat
Copy link
Member

Payment requested as per #38370 (comment)

@JmillsExpensify
Copy link

$125 approved for @parasharrajat

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 Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
Archived in project
Development

No branches or pull requests

10 participants