Skip to content
This repository was archived by the owner on May 18, 2022. It is now read-only.

[NEU-146] Replace connectComponent with hooks (3) #830

Merged
merged 70 commits into from
Mar 22, 2022
Merged

Conversation

dotrongkhang2000
Copy link
Contributor

No description provided.

@linear
Copy link

linear bot commented Mar 16, 2022

}
const DisplayMedia = () => {
const classes = useStyles();
const [sources, setSource] = useState([]);
Copy link
Member

Choose a reason for hiding this comment

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

setSources, not setSource

@quanglam2807 quanglam2807 marked this pull request as draft March 17, 2022 04:29
@quanglam2807 quanglam2807 marked this pull request as ready for review March 18, 2022 03:28
Copy link
Member

@quanglam2807 quanglam2807 left a comment

Choose a reason for hiding this comment

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

Re-check all dispatch implementations.

});
}));

const classes = useStyles();
Copy link
Member

Choose a reason for hiding this comment

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

Hooks must always be run inside React component function.

@@ -416,75 +417,15 @@ const AddWorkspaceCustom = ({
</div>
<Divider />
<div className={classes.actions}>
<Button color="primary" variant="contained" disableElevation className={classes.button} onClick={onSave}>
<Button color="primary" variant="contained" disableElevation className={classes.button} onClick={dispatch(save)}>
Copy link
Member

Choose a reason for hiding this comment

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

Must be onClick={() => dispatch(save())

Add
</Button>
<Button color="default" variant="text" disableElevation className={classes.button} onClick={onResetForm}>
<Button color="default" variant="text" disableElevation className={classes.button} onClick={dispatch(resetForm)}>
Copy link
Member

Choose a reason for hiding this comment

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

Must be onClick={() => dispatch(resetForm())

@@ -197,7 +199,7 @@ const AppLock = ({
className={classes.unlockButton}
startIcon={<LockIcon />}
disableElevation
onClick={onValidateForm}
onClick={dispatch(validateForm)}
Copy link
Member

Choose a reason for hiding this comment

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

Must be onClick={() => dispatch(...

/>
</div>
<div>
<Button color="primary" variant="contained" disableElevation className={classes.button} onClick={dispatch(login)}>
Copy link
Member

Choose a reason for hiding this comment

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

login()

/>
</div>
<div>
<Button color="primary" variant="contained" disableElevation className={classes.button} onClick={dispatch(go())}>
Copy link
Member

Choose a reason for hiding this comment

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

Must be onClick={() => dispatch(...

@@ -151,7 +151,7 @@ const DialogLicenseRegistration = ({
</Button>
<Button
color="primary"
onClick={onRegister}
onClick={dispatch(register)}
Copy link
Member

Choose a reason for hiding this comment

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

register()

@@ -85,7 +85,7 @@ const DialogAppLock = ({

return (
<Dialog
onClose={onClose}
onClose={dispatch(close)}
Copy link
Member

Choose a reason for hiding this comment

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

close()

@@ -182,7 +182,7 @@ const DialogAppLock = ({
<div className={classes.actions}>
<div className={classes.actionsLeft}>
{hasPassword && !requireCurrentPassword && (
<Button variant="contained" disableElevation onClick={onDeletePassword}>
<Button variant="contained" disableElevation onClick={dispatch(deletePassword)}>
Copy link
Member

Choose a reason for hiding this comment

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

deletePassword()

const preferredIconType = useSelector((state) => state.dialogAddWorkspace.form.preferredIconType);
const shouldUseDarkColors = useSelector((state) => state.general.shouldUseDarkColors);
// eslint-disable-next-line max-len
const transparentBackground = useSelector((state) => Boolean(state.dialogAddWorkspace.form.transparentBackground));
Copy link
Member

@quanglam2807 quanglam2807 Mar 18, 2022

Choose a reason for hiding this comment

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

Do not disable ESLINT rule. Instead try to make the code look nice.

useSelector(
  (state) => Boolean(state.dialogAddWorkspace.form.transparentBackground),
);

@@ -202,15 +202,15 @@ const DialogAppLock = ({
)}
</div>
<div className={classes.actionsRight}>
<Button variant="contained" className={classes.button} disableElevation onClick={onClose}>
<Button variant="contained" className={classes.button} disableElevation onClick={dispatch(close)}>
Copy link
Member

Choose a reason for hiding this comment

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

close()

Cancel
</Button>
{!requireCurrentPassword ? (
<Button color="primary" className={classes.button} variant="contained" disableElevation onClick={onSave}>
<Button color="primary" className={classes.button} variant="contained" disableElevation onClick={dispatch(save)}>
Copy link
Member

Choose a reason for hiding this comment

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

save()

Save
</Button>
) : (
<Button color="primary" className={classes.button} variant="contained" disableElevation onClick={onValidateCurrentPassword}>
<Button color="primary" className={classes.button} variant="contained" disableElevation onClick={dispatch(validateCurrentPassword)}>
Copy link
Member

Choose a reason for hiding this comment

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

()

/>
</ListItemSecondaryAction>
</ListItem>
<ListItem button onClick={dispatch(openDialogCustomUserAgent)} disabled={forceMobileView}>
Copy link
Member

Choose a reason for hiding this comment

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

()

save,
return (
<Dialog
onClose={dispatch(close)}
Copy link
Member

Choose a reason for hiding this comment

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

()

Cancel
</Button>
<Button color="primary" variant="contained" disableElevation onClick={onSave}>
<Button color="primary" variant="contained" disableElevation onClick={dispatch(save)}>
Copy link
Member

Choose a reason for hiding this comment

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

()

<List disablePadding dense>
<ListItemOpenProtocolUrl />
<Divider />
<ListItem button onClick={dispatch(openDialogExternallUrls)}>
Copy link
Member

Choose a reason for hiding this comment

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

()

@quanglam2807 quanglam2807 marked this pull request as draft March 18, 2022 03:40

DialogCustomizeFonts.defaultProps = {
open: false,
defaultFontSize: 16,
Copy link
Member

Choose a reason for hiding this comment

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

defaultProps data is lost when moving to hooks


DialogCustomizeFonts.defaultProps = {
open: false,
defaultFontSize: 16,
Copy link
Member

Choose a reason for hiding this comment

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

defaultProps data is lost when moving to hooks


import { updateForm } from '../../../state/dialog-workspace-preferences/actions';

const styles = (theme) => ({
const usestyles = makeStyles((theme) => ({
Copy link
Member

Choose a reason for hiding this comment

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

useStyles not usestyles

@quanglam2807 quanglam2807 marked this pull request as ready for review March 22, 2022 04:24
@quanglam2807 quanglam2807 merged commit 662206d into master Mar 22, 2022
@quanglam2807 quanglam2807 deleted the NEU-146 branch March 22, 2022 04:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants