-
Notifications
You must be signed in to change notification settings - Fork 26
[NEU-146] Replace connectComponent with hooks (3) #830
Conversation
} | ||
const DisplayMedia = () => { | ||
const classes = useStyles(); | ||
const [sources, setSource] = useState([]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setSources
, not setSource
There was a problem hiding this 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(); |
There was a problem hiding this comment.
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.
src/components/add-workspace/form.js
Outdated
@@ -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)}> |
There was a problem hiding this comment.
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())
src/components/add-workspace/form.js
Outdated
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)}> |
There was a problem hiding this comment.
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())
src/components/app-lock/index.js
Outdated
@@ -197,7 +199,7 @@ const AppLock = ({ | |||
className={classes.unlockButton} | |||
startIcon={<LockIcon />} | |||
disableElevation | |||
onClick={onValidateForm} | |||
onClick={dispatch(validateForm)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must be onClick={() => dispatch(...
src/components/auth/index.js
Outdated
/> | ||
</div> | ||
<div> | ||
<Button color="primary" variant="contained" disableElevation className={classes.button} onClick={dispatch(login)}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
login()
src/components/go-to-url/index.js
Outdated
/> | ||
</div> | ||
<div> | ||
<Button color="primary" variant="contained" disableElevation className={classes.button} onClick={dispatch(go())}> |
There was a problem hiding this comment.
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)} |
There was a problem hiding this comment.
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)} |
There was a problem hiding this comment.
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)}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deletePassword()
src/components/add-workspace/form.js
Outdated
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)); |
There was a problem hiding this comment.
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)}> |
There was a problem hiding this comment.
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)}> |
There was a problem hiding this comment.
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)}> |
There was a problem hiding this comment.
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}> |
There was a problem hiding this comment.
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)} |
There was a problem hiding this comment.
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)}> |
There was a problem hiding this comment.
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)}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
()
|
||
DialogCustomizeFonts.defaultProps = { | ||
open: false, | ||
defaultFontSize: 16, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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) => ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useStyles
not usestyles
No description provided.