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] Create a useResponsiveLayout hook #31476

Closed

Conversation

rayane-djouah
Copy link
Contributor

@rayane-djouah rayane-djouah commented Nov 17, 2023

Details

Related Eslint rule PR: Expensify/eslint-config-expensify#82

Fixed Issues

$ #30528
PROPOSAL: #30528 (comment)

Tests

Needs to be tested on web/mweb:

  1. Logout from the application.
  2. Try to access any public room(eg. http://localhost:8082/r/3207869973997783).
  3. Click on sign in button either from header or footer and it opens the sign page in modal and it looks proper.
  4. Scroll down and verify the footer of the sign in page looks proper and items are aligned vertically.
  • Verify that no errors appear in the JS console

Offline tests

N/A

QA Steps

Same as above tests.

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native

N/A (Only testable on Web and mWeb)

Android: mWeb Chrome
mWeb.Chrome.Recording.2023-11-29.225403.mp4
iOS: Native

N/A (Only testable on Web and mWeb)

iOS: mWeb Safari
mWeb.Safari.Recording.2023-11-29.224722.mp4
MacOS: Chrome / Safari
Recording.2023-11-17.092409.mp4
MacOS: Desktop

N/A (Only testable on Web and mWeb)

@rayane-djouah rayane-djouah requested a review from a team as a code owner November 17, 2023 08:02
@melvin-bot melvin-bot bot requested review from getusha and removed request for a team November 17, 2023 08:02
Copy link

melvin-bot bot commented Nov 17, 2023

@getusha Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@getusha
Copy link
Contributor

getusha commented Nov 21, 2023

@rayane-djouah can you fix conflict and complete the checklist? additionally it would be great if you could explain why the first PR is closed.

@rayane-djouah
Copy link
Contributor Author

I'm OOO for now, I will follow up in the evening.

@rayane-djouah
Copy link
Contributor Author

@getusha sorry for the delay, I was OOO in this period

@rayane-djouah
Copy link
Contributor Author

Updated @getusha

@getusha
Copy link
Contributor

getusha commented Dec 4, 2023

@rayane-djouah i am seeing a ton of usage from useWindowDimensions

Screenshot 2023-12-04 at 12 54 45 PM

@getusha
Copy link
Contributor

getusha commented Dec 4, 2023

BUG 1: Unable to open context menu

  1. Open any chat
  2. Right click on report item
Screen.Recording.2023-12-04.at.1.12.55.PM.mov

@getusha
Copy link
Contributor

getusha commented Dec 4, 2023

BUG 2: Emoji picker not opening from mini context menu

Screen.Recording.2023-12-04.at.1.12.55.PM.mov

@getusha
Copy link
Contributor

getusha commented Dec 4, 2023

BUG 3: Emoji picker on small screen looks strange

  1. Resize screen
  2. Open emoji picker.
Screenshot 2023-12-04 at 1 16 15 PM

@getusha
Copy link
Contributor

getusha commented Dec 4, 2023

BUG 4: Unable to open any kind of popover (Same root cause as BUG 2)

Screen.Recording.2023-12-04.at.1.21.43.PM.mov

@getusha
Copy link
Contributor

getusha commented Dec 8, 2023

@rayane-djouah the progress is really slow, is there anything we should know?

@rayane-djouah
Copy link
Contributor Author

Sorry for the delay @getusha, I was passing exams. I'm updating today.

@rayane-djouah
Copy link
Contributor Author

Conflicts resolved

@getusha
Copy link
Contributor

getusha commented Dec 14, 2023

@rayane-djouah Lint is failing lets fix it.

@rayane-djouah
Copy link
Contributor Author

@getusha lint error is fixed now

@roryabraham
Copy link
Contributor

Anything I can do to help here? If you think it would be helpful we can split this into multiple PRs so that there's fewer conflicts and a lower chance of regressions in each PR

@getusha
Copy link
Contributor

getusha commented Dec 18, 2023

@rayane-djouah i think we should also rename props named isSmallScreenWidth

Screenshot 2023-12-18 at 4 42 26 PM

@rayane-djouah
Copy link
Contributor Author

@getusha this props are coming from the withWindowDimensions HOC here, should we rename it?

@getusha
Copy link
Contributor

getusha commented Dec 18, 2023

@getusha this props are coming from the withWindowDimensions HOC here, should we rename it?

In that case we should leave it, wdyt @roryabraham?

@roryabraham
Copy link
Contributor

I think for the scope of those PR we can ignore making any changes to withWindowDimensions and as we migrate to functional components we can get rid of any remaining uses of withWindowDimensions in favor of useResponsiveLayout. If there are any uses of withWindowDimensions in a functional component, I'd say those are in-scope to be migrated to useResponsiveLayout.

Does that sound good?

@getusha
Copy link
Contributor

getusha commented Dec 20, 2023

I agree with @roryabraham, @rayane-djouah lets replace the usages of withWindowDimensions in functional components/pages.

@roryabraham
Copy link
Contributor

Mentioned this above, but I'd advise that we split this up into a few smaller PRs to make it easier to get stuff over the finish line and reduce the likelihood of conflicts or regressions

@getusha
Copy link
Contributor

getusha commented Dec 20, 2023

Based on the changes in this PR, we could break it down into several PRs as follows:

  1. A PR introducing useResponsiveLayout.
  2. A PR to add the inRHP prop
  3. A PR to replace usages of isSmallScreenWidth in components.
  4. A PR to remove inModal prop, which i think will be redundant after inRHP is introduced.
  5. A PR to rename parameter names in various functions (which doesn't have much effect).

However, I'm not sure if this approach would help. @roryabraham @rayane-djouah What are your thoughts on it?

@roryabraham
Copy link
Contributor

yeah, maybe also a separate PR to migrate any remaining uses of withWindowDimensions in functional components? I'm not going to enforce any separation of PRs, so it's up to @rayane-djouah what they think is best. My advice would be to split this task up though.

@roryabraham
Copy link
Contributor

Looks like we've got two new PRs that this one will HOLD on. @rayane-djouah can you please put the [HOLD] prefix in the title of any PRs that should be on HOLD so that the order of operations here is clear?

@rayane-djouah rayane-djouah changed the title Create a useResponsiveLayout hook [HOLD] Create a useResponsiveLayout hook Dec 23, 2023
@rayane-djouah rayane-djouah marked this pull request as draft February 23, 2024 21:29
@rayane-djouah rayane-djouah deleted the useResponsiveLayout-hook branch May 28, 2024 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants