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

refactor(login): refactor login page #916

Merged
merged 2 commits into from
Nov 25, 2020
Merged

refactor(login): refactor login page #916

merged 2 commits into from
Nov 25, 2020

Conversation

Oxiang
Copy link
Contributor

@Oxiang Oxiang commented Nov 17, 2020

Problem

Migrating jsx files in login folder to tsx files

Solution

  • change index, textbutton and loginform to tsx files
  • add explicit types for login form variants, including string enums for variants
  • change from higher order connect to redux hooks
  • change proptypes to typescript

- change index, textbutton and loginform to tsx files
- add explicit types for login form variants
- change from higher order connect to redux hooks
src/client/app/util/types.ts Outdated Show resolved Hide resolved
src/client/login/components/LoginForm.tsx Show resolved Hide resolved
src/client/app/util/types.ts Outdated Show resolved Hide resolved
src/client/app/util/types.ts Outdated Show resolved Hide resolved
src/client/login/index.tsx Outdated Show resolved Hide resolved
src/client/login/index.tsx Outdated Show resolved Hide resolved
src/client/login/widgets/TextButton.tsx Show resolved Hide resolved
@Oxiang Oxiang requested a review from LoneRifle November 24, 2020 02:27
Copy link
Contributor

@LoneRifle LoneRifle left a comment

Choose a reason for hiding this comment

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

lgtm otherwise

Comment on lines +106 to +117
const emailValidator = useSelector(
(state: GoGovReduxState) => state.login.emailValidator
)
const isLoggedIn = useSelector(
(state: GoGovReduxState) => state.login.isLoggedIn
)
const email = useSelector(
(state: GoGovReduxState) => state.login.email
)
const variant: VariantType = useSelector(
(state: GoGovReduxState) => state.login.formVariant
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Possible to do something like...

Suggested change
const emailValidator = useSelector(
(state: GoGovReduxState) => state.login.emailValidator
)
const isLoggedIn = useSelector(
(state: GoGovReduxState) => state.login.isLoggedIn
)
const email = useSelector(
(state: GoGovReduxState) => state.login.email
)
const variant: VariantType = useSelector(
(state: GoGovReduxState) => state.login.formVariant
)
const {
emailValidator,
isLoggedIn,
email,
formVariant: variant,
} = useSelector(
(state: GoGovReduxState) => state.login
)

@Oxiang Oxiang merged commit cc857f1 into develop Nov 25, 2020
@Oxiang Oxiang deleted the login-refactor branch November 25, 2020 02:36
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.

2 participants