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

[TS migration] Migrate 'NewChatSelector' page to TypeScript #34859

Conversation

MahmudjonToraqulov
Copy link
Contributor

@MahmudjonToraqulov MahmudjonToraqulov commented Jan 21, 2024

Details

Migrated 'NewChatSelector' page to TypeScript

Fixed Issues

$ #31989
PROPOSAL: #31989 (comment)

Tests

  1. Open website
  2. On the home page, click on plus icon
  3. Click on Start Chat
  4. Write any username that you didn't chatted yet
  5. Click on Enter
  • Verify that no errors appear in the JS console

Offline tests

  1. Open website
  2. On the home page, click on plus icon
  3. Click on Start Chat
  4. Write any username that you didn't chatted yet
  5. Click on Enter

QA Steps

  1. Open website
  2. On the home page, click on plus icon
  3. Click on Start Chat
  4. Write any username that you didn't chatted yet
  5. Click on Enter
  • 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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
2024-01-22.05-28-21.mp4
MacOS: Desktop
2024-01-22.05-35-14.mp4

@MahmudjonToraqulov MahmudjonToraqulov requested a review from a team as a code owner January 21, 2024 11:07
@melvin-bot melvin-bot bot removed the request for review from a team January 21, 2024 11:07
Copy link

melvin-bot bot commented Jan 21, 2024

@sobitneupane 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]

@melvin-bot melvin-bot bot requested a review from sobitneupane January 21, 2024 11:07
Copy link
Contributor

github-actions bot commented Jan 21, 2024

CLA Assistant Lite bot:
Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


0 out of 2 committers have signed the CLA.
❌ @macstore.uz
@MahmudjonToraqulov
macstore.uz seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request

@@ -13,7 +13,7 @@ import CONST from '@src/CONST';
import type IconAsset from '@src/types/utils/IconAsset';
import TabSelectorItem from './TabSelectorItem';

type TabSelectorProps = {
export type TabSelectorProps = {
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't use inline exports, please add export to the bottom of this file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey blazekustra. Ok I'll fix it.

@@ -24,11 +25,14 @@ type OnyxTabNavigatorProps = OnyxTabNavigatorOnyxProps &
/** A function triggered when a tab has been selected */
onTabSelected?: (newIouType: string) => void;

tabBar: (props: TabSelectorProps) => React.JSX.Element
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
tabBar: (props: TabSelectorProps) => React.JSX.Element
tabBar: (props: TabSelectorProps) => ReactNode;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll fix it.


// eslint-disable-next-line rulesdir/no-inline-named-export
export const TopTab = createMaterialTopTabNavigator();
export const TopTab:any = createMaterialTopTabNavigator();
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this PR WIP?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ohh, Sorry. I think it's left accidently. Let me fix it.

@@ -42,7 +46,7 @@ function OnyxTabNavigator({id, selectedTab = '', children, onTabSelected = () =>
backBehavior="initialRoute"
keyboardDismissMode="none"
screenListeners={{
state: (e) => {
state: (e:Event) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this is needed?

@blazejkustra
Copy link
Contributor

I think eslint might be failing for this one.

@blazejkustra
Copy link
Contributor

Please sync this branch with the newest main. Context here, thanks!

@blazejkustra
Copy link
Contributor

@MahmudjonToraqulov Bump

@MahmudjonToraqulov
Copy link
Contributor Author

@MahmudjonToraqulov Bump

Hey. Sorry for the delay. I'll make it soon. Thanks

@blazejkustra
Copy link
Contributor

Let me know if you have any questions or problems!

@MahmudjonToraqulov
Copy link
Contributor Author

Let me know if you have any questions or problems!

Hey @blazejkustra. I have had some problems with my Mac but not with the project so far. I made all changes. Could u pls check it and tell me? Thanks.

@blazejkustra
Copy link
Contributor

CLA Assistant is failing @MahmudjonToraqulov
Screenshot 2024-02-12 at 17 16 55

@@ -46,25 +32,17 @@ function NewChatSelectorPage(props) {
>
<TopTab.Screen
name={CONST.TAB.NEW_CHAT}
component={NewChatPage}
component={NewChatPage as React.ComponentType}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
component={NewChatPage as React.ComponentType}
component={NewChatPage}

/>
<TopTab.Screen
name={CONST.TAB.NEW_ROOM}
component={WorkspaceNewRoomPage}
component={WorkspaceNewRoomPage as React.ComponentType}
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's wait for this to be merged first: #34742

OR add @ts-expect-error here as described in TS guidelines

Suggested change
component={WorkspaceNewRoomPage as React.ComponentType}
component={WorkspaceNewRoomPage}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's wait for this to be merged first: #34742

OR add @ts-expect-error here as described in TS guidelines

Yes, I think we should wait for it. There was an issue with "WorkspaceNewRoomPage".

@sobitneupane
Copy link
Contributor

@MahmudjonToraqulov Is this ready for review? Please let me know if it is ready for review.

@blazejkustra
Copy link
Contributor

@sobitneupane We decided to wait till #34742 is merged

@blazejkustra
Copy link
Contributor

@MahmudjonToraqulov Let's continue now!

@MahmudjonToraqulov
Copy link
Contributor Author

@MahmudjonToraqulov Let's continue now!

Hey @blazejkustra. I updated my branch and the error for "WorkspaceNewRoomPage" is disappeared. But there is an error for "NewChatPage" after it's migrated into typescript.

Do you have any Suggestion?

"NewChatPage" page:
qq1 1

The issue in "NewChatSelectorPage" page:
qq1 2

@blazejkustra
Copy link
Contributor

Push your changes to the branch, so I can checkout and test @MahmudjonToraqulov. Meanwhile I think you need to use StackScreenProps type as in other pages (also define correct props in src/libs/Navigation/types.ts)

@blazejkustra
Copy link
Contributor

CLA Assistant is still failing 🤔

@MahmudjonToraqulov
Copy link
Contributor Author

CLA Assistant is still failing 🤔

I'll fix CLA issue. Right now could you check new changes and give me any suggestion with an error that is related to "NewChatPage" pls?

@blazejkustra
Copy link
Contributor

I recommend dealing with CLA now, this can become cumbersome if you leave it for a longer period of time (I see some of your commits are unsigned)

@blazejkustra
Copy link
Contributor

Thanks for pushing the code! I think you can use //@ts-expect-error like in TS guidelines (search for it in the codebase you'll find a lot of similar cases)

@blazejkustra
Copy link
Contributor

@MahmudjonToraqulov I would like to move this PR further, please have a look at my last comment.

@MahmudjonToraqulov
Copy link
Contributor Author

@MahmudjonToraqulov I would like to move this PR further, please have a look at my last comment.

Hey @blazejkustra. Reall sorry for the delay. I made what you asked. Right now I'm having an issue when I make commit and do "git push origin main". Do u know what to do?

Here is the error I'm getting ->

git1 1

@blazejkustra
Copy link
Contributor

Did you read the hint from your screenshot @MahmudjonToraqulov? 🤣 I think this should help

@MahmudjonToraqulov
Copy link
Contributor Author

Did you read the hint from your screenshot @MahmudjonToraqulov? 🤣 I think this should help

Yes, but it didn't help so far.

@blazejkustra
Copy link
Contributor

Probably you corrupted your branch and it's not compatible with what is on main, I would propose to reset your branch with git reset, or remove your branch locally and git pull from main

@blazejkustra
Copy link
Contributor

Still some unverified commits:
image

@blazejkustra
Copy link
Contributor

You may need to sign them manually with GPG or force push all these changes as one commit

@MahmudjonToraqulov
Copy link
Contributor Author

You may need to sign them manually with GPG or force push all these changes as one commit

Do you know Why is CLA failing again? What should I do to solve it?

@blazejkustra
Copy link
Contributor

You need to resign first commits on this PR with GPG, here are some tips. If you aren't sure, please ask on #open-source channel for guidance 😄

@blazejkustra
Copy link
Contributor

@sobitneupane Seems like contributor isn't responding, what can we do now?

@sobitneupane
Copy link
Contributor

sobitneupane commented Mar 12, 2024

@MahmudjonToraqulov If you won't be available, we will have to assign the issue to someone else. We're aiming to have it resolved within the next day or two.

@sobitneupane
Copy link
Contributor

Bump @MahmudjonToraqulov

@MahmudjonToraqulov
Copy link
Contributor Author

@MahmudjonToraqulov If you won't be available, we will have to assign the issue to someone else. We're aiming to have it resolved within the next day or two.

Hey @sobitneupane. I'm available and have finished the work already.But I'm just having an issue with CLA when making commits. Could you help me with that?

@blazejkustra
Copy link
Contributor

Have you seen my comment @MahmudjonToraqulov? Did it help by any chance?

@MahmudjonToraqulov
Copy link
Contributor Author

MahmudjonToraqulov commented Mar 14, 2024

Have you seen my comment @MahmudjonToraqulov? Did it help by any chance?

Hey @blazejkustra. The main problem is that I made 3 initial commits from my browser directly So these commits got me "unverified" issue.

If I revert all commits and make new commits again, What do u think, will it help?

@MahmudjonToraqulov
Copy link
Contributor Author

Have you seen my comment @MahmudjonToraqulov? Did it help by any chance?

BTW, this way didn't help.

@blazejkustra
Copy link
Contributor

If I revert all commits and make new commits again, What do u think, will it help?

You will lose commit history, but this should work!

@MahmudjonToraqulov
Copy link
Contributor Author

If I revert all commits and make new commits again, What do u think, will it help?

You will lose commit history, but this should work!

Blazejkustra This is my first time making PR for Expensify.

Should I just comment as CLA assistent asked here to sign the CLA?

Maybe I'm getting CLA issue as I didn't CLA yet. Can it happen?

@sobitneupane
Copy link
Contributor

There are two issues:

@MahmudjonToraqulov
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@MahmudjonToraqulov
Copy link
Contributor Author

I asked on Slack. I'll wait for respond till tomorrow morning if you don't mind. Thanks.

@MahmudjonToraqulov
Copy link
Contributor Author

Hey @blazejkustra @sobitneupane! I got reply on Slack to solve the issue.
I liked second solution.

What is your opinion about that?

111

@blazejkustra
Copy link
Contributor

Both solutions are fine with me, go for a safer approach - meaning Solution 2 😄

@MahmudjonToraqulov
Copy link
Contributor Author

I'm closing this PR. I'm gonna create new one as I we discussed here.

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