Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.54k stars 2.88k forks source link

[HOLD for payment 2024-10-30] [$1000] Create a useResponsiveLayout hook #30528

Closed roryabraham closed 2 days ago

roryabraham commented 1 year ago

Slack context: https://expensify.slack.com/archives/C01GTK53T8Q/p1698364514493649

Problem

There are some times when we want to use the same layout on mobile devices or in the RHP on wide screens. In these cases, we can't rely on isSmallScreenWidth from useWindowDimensions to determine which layout to use, so we have hard-coded and/or different solutions we use to address the same problem.

Solution

  1. In the navigation stack, add an isInRHP route prop to all screens in the RHP.

  2. Write a custom hook called useResponsiveLayout that does something like this:

    function useResponsiveLayout() {
        const {isSmallScreenWidth} = useWindowDimensions();
        const {params} = useRoute();
        return {
            shouldUseNarrowLayout = isSmallScreenWidth || params.isInRHP,
        };
    }
  3. Replace most layout-motivated uses of useWindowDimensions with useResponsiveLayout like so:

    - const {isSmallScreenWidth} = useWindowDimensions();
    + const {shouldUseNarrowLayout} = useResponsiveLayout();
  4. Introduce a new lint rule that prohibits using isSmallScreenWidth from useWindowDimensions, advising developers to use shouldUseNarrowLayout instead.

    Upwork Automation - Do Not Edit
    • Upwork Job URL: https://www.upwork.com/jobs/~01f36dcb081cdf74b2
    • Upwork Job ID: 1717949899365408768
    • Last Price Increase: 2023-12-29
Issue OwnerCurrent Issue Owner: @alexpensify
alexpensify commented 7 months ago

Weekly Update: the PR is moving forward.

alexpensify commented 7 months ago

Weekly Update: The PR is going through reviews but moving along.

alexpensify commented 7 months ago

Weekly Update: The PR is in review to make sure testing passes.

alexpensify commented 6 months ago

Weekly Update: The PR went through another review process and more testing.

alexpensify commented 6 months ago

Weekly Update: More discussion in the PR due to recent findings

alexpensify commented 6 months ago

@roryabraham can I get feedback regarding which Wave or VIP to associate this one with? -- thanks!

alexpensify commented 6 months ago

Weekly Update: We are in a focus period, I'll check in next week.

roryabraham commented 6 months ago

This is a pretty old issue, and I'm not sure which wave or VIP I'd associate it with. It's basically a low-level code improvement to help avoid a semi-common developer mistake and make the code more consistent. Some recent discussion about it in slack here.

alexpensify commented 5 months ago

Thanks for the context @roryabraham!

Weekly Update: The PR is moving in review again: https://github.com/Expensify/App/pull/36292

alexpensify commented 5 months ago

Heads up, I will be offline until Tuesday, May 28, 2024, and will not actively watch over this GitHub during that period.

If anything urgent is needed here, please ask for help in the #expensify-open-source Slack Room-- thanks!

rayane-djouah commented 5 months ago

Heads up, I'll be mostly offline until June 5th, 2024. I can still review this issue, but my response might be slower. If there is something urgent, please reassign it. Thanks!

alexpensify commented 5 months ago

Catching up from being OOO, it looks like this one was on hold due to the freeze but we can carry on now.

roryabraham commented 5 months ago

PR merged today

alexpensify commented 5 months ago

Weekly Update: It looks like there was regression, but that has been addressed. I'll check again next week to confirm if we can move forward with the payment process.

alexpensify commented 5 months ago

Automation failed here, I need to start the payment process tomorrow since today marks 7 days in production.

getusha commented 5 months ago

@alexpensify there are still other PRs we need to get merged https://github.com/Expensify/App/issues/30528#issuecomment-1868485991

alexpensify commented 5 months ago

@getusha, thanks for flagging; I appreciate it. With that said, are we still striking the completed ones? If not, we should to keep a better record of what's left. For now, I'll hold on the payment process.

rayane-djouah commented 4 months ago

I have returned from being out of office, I will prepare the next PR this week

rayane-djouah commented 4 months ago

PR ready for review

melvin-bot[bot] commented 3 months ago

This issue has not been updated in over 15 days. @alexpensify, @roryabraham, @getusha, @rayane-djouah eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

rayane-djouah commented 3 months ago

@getusha - Could you please continue the review of the PR when you get a chance. Thank you!

getusha commented 3 months ago

@rayane-djouah i think we can put the remaining changes in a single PR except the eslint-config-expensify changes

rayane-djouah commented 3 months ago

PR ready for review

rayane-djouah commented 3 months ago

@getusha @roryabraham - In my PR, useWindowDimensions now exports only windowWidth and windowHeight, and useResponsiveLayout is responsible for any logic determining the correct layout. The lint rule prohibiting the use of isSmallScreenWidth from useWindowDimensions is now unnecessary. However, we could introduce a lint rule advising developers to preferably use shouldUseNarrowLayout over isSmallScreenWidth from useResponsiveLayout, with a warning level. wdyt?

roryabraham commented 3 months ago

sounds good 👍🏼

rayane-djouah commented 2 months ago

Update: PR under review.

melvin-bot[bot] commented 2 months ago

⚠️ 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.

alexpensify commented 2 months ago

@getusha and @rayane-djouah - can either of you confirm if this notice is accurate or not? Thanks!

melvin-bot[bot] commented 2 months ago

⚠️ 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.

rayane-djouah commented 1 month ago

We've fixed the above bugs in a follow-up PR: https://github.com/Expensify/App/pull/48723

rayane-djouah commented 1 month ago

Update:

There are still other PRs we need to create and merge:

  1. A PR to Introduce the new lint rule advising developers to preferably use shouldUseNarrowLayout over isSmallScreenWidth from useResponsiveLayout, with a warning level.
  2. A PR to upgrade the version of eslint in App to use the new lint rule. We might also include necessary changes after introducing the rule

Updated the PRs list summary: https://github.com/Expensify/App/issues/30528#issuecomment-1868485991

rayane-djouah commented 1 month ago
rayane-djouah commented 1 month ago

https://github.com/Expensify/eslint-config-expensify/pull/116 in review

alexpensify commented 1 month ago

Ok, waiting on https://github.com/Expensify/eslint-config-expensify/pull/116 to go into production

roryabraham commented 1 month ago

pulling in @mountiny to take over while I'm on parental leave

mountiny commented 1 month ago

ESLint rule merged @rayane-djouah can you raise App PR now please?

rayane-djouah commented 3 weeks ago

PR ready for review: https://github.com/Expensify/App/pull/50935

alexpensify commented 3 weeks ago

Heads up, I will be offline until Tuesday, October 22, 2024, and will not actively watch over this GitHub during that period.

If this GitHub requires an urgent update, please ask for help in the #expensify-open-source Slack Room. If the inquiry can wait, I'll review it when I return online.

alexpensify commented 2 weeks ago

Waiting for this one to move to production

melvin-bot[bot] commented 2 weeks ago

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

melvin-bot[bot] commented 2 weeks ago

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

If no regressions arise, payment will be issued on 2024-10-30. :confetti_ball:

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

melvin-bot[bot] commented 2 weeks ago

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:

mountiny commented 2 weeks ago

No regression tests required this is a tool for developers

The payment summary is $1000 to @rayane-djouah and to @getusha

melvin-bot[bot] commented 1 week ago

Payment Summary

Upwork Job

BugZero Checklist (@alexpensify)

alexpensify commented 1 week ago

Payouts due: 2024-10-30

Upwork job is here. I had to create a new job in Upwork. Please accept and I can complete the payment process. Thanks!

rayane-djouah commented 1 week ago

@alexpensify The payment amount for this issue is $1000 - https://github.com/Expensify/App/issues/30528#issuecomment-2434278370

rayane-djouah commented 1 week ago

@alexpensify Offer accepted, thanks!

alexpensify commented 1 week ago

🤦🏼 good catch - Upwork was right. I've updated the summary here and paid @rayane-djouah via Upwork. I'm waiting for @getusha to accept.

alexpensify commented 1 week ago

Status: Waiting for @getusha to accept in Upwork

rayane-djouah commented 6 days ago

@alexpensify I think that @getusha is being paid in NewDot, we can close this issue