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
Feature/refactoring project settings #476
Feature/refactoring project settings #476
Conversation
… into feature/refactoring-projectSettings
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.
Thank you very much @karimould! That's a very valuable contribution, it brings us really close to wrapping up v2 release.
I have a few suggestions, please tell if you think those make sense:
This one is regarding all the input fields:
Also, here's a suggestion that never was implemented - should we add a confirmation dialog before deleting a webhook?
@ImanMahmoudinasab feel free to tune in |
@karimould @agoldis What I had in mind to implement the hooks was something like this:
|
@agoldis Sticking to what @karimould has implemented, I think addressing your comments are enough to merge the pr. In the feature, @karimould or I will refactor it. |
added more spacing to the form added a modal for delete conformation before deleting a hook alignt info icon with the label text
@ImanMahmoudinasab this looks very good, i can take care of it :-) @agoldis I would suggest that if the code is okay, the current version could be merged. |
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.
@karimould Thank you for the migration. I put some comments for improving the code style.
import React, { PropsWithChildren } from 'react'; | ||
|
||
interface InputFieldLabelProps extends FormControlProps { | ||
helpText?: string; | ||
htmlFor: string; | ||
label?: string | React.ReactNode; |
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.
label?: string | React.ReactNode; | |
label?: string | ReactNode; |
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.
done
const hasError = errorMessage ? true : false; | ||
const Help = helpText && ( | ||
<Tooltip title={helpText}> | ||
<InfoOutlinedIcon fontSize="small" sx={{ marginRight: '0.25rem' }} /> |
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.
MUI recommends its spacing concept, for margins and paddings. Every space is 8px by default (can be changed in the theme options). So if you need 4px space you can use:
<InfoOutlinedIcon fontSize="small" sx={{ marginRight: '0.25rem' }} /> | |
<InfoOutlinedIcon fontSize="small" sx={{ mr: 0.5 }} /> |
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.
done
<Button | ||
variant="contained" | ||
color="error" | ||
onClick={() => setShowModal(true)} | ||
disabled={deleting} | ||
> | ||
<DeleteIcon /> | ||
<Typography variant="body1"> | ||
{deleting ? 'Deleting' : 'Delete'} | ||
</Typography> | ||
</Button> |
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.
<Button | |
variant="contained" | |
color="error" | |
onClick={() => setShowModal(true)} | |
disabled={deleting} | |
> | |
<DeleteIcon /> | |
<Typography variant="body1"> | |
{deleting ? 'Deleting' : 'Delete'} | |
</Typography> | |
</Button> | |
<Button | |
variant="contained" | |
color="error" | |
onClick={() => setShowModal(true)} | |
startIcon={<DeleteIcon /> | |
disabled={deleting} | |
> | |
{deleting ? 'Deleting' : 'Delete'} | |
</Button> |
This way icon and text will be aligned.
You don't need Typography. all icons should have same typography applied by the button itself.
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.
done
onClick={deleteProject} | ||
disabled={deleting} | ||
> | ||
<DeleteIcon /> |
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.
The same thing here, use startIcon
prop.
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.
done
</Cell> | ||
<Cell> | ||
</Grid> | ||
<Grid> |
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.
<Grid> | |
<Grid item> |
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.
done
return ( | ||
<Cell xs={12}> | ||
<Grid item xs={12}> |
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.
All <Grid item>
s should be wrapped with <Grid container>
s.
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.
done
@@ -40,13 +40,13 @@ export const GenericHook = ({ hook }: GenericHookProps) => { | |||
<FormProvider {...formMethods}> | |||
<form onSubmit={handleSubmit(onSubmit)}> | |||
<Grid> |
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.
No description provided.
<Box | ||
style={{ display: 'flex', cursor: 'pointer' }} | ||
onClick={() => toggleExpanded()} | ||
alignItems="center" | ||
> |
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.
<Box | |
style={{ display: 'flex', cursor: 'pointer' }} | |
onClick={() => toggleExpanded()} | |
alignItems="center" | |
> | |
<Box | |
display="'flex" | |
cursor="pointer" | |
onClick={() => toggleExpanded()} | |
alignItems="center" | |
> |
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.
Done, the cursor prop does not exist.
I styled the cursor with the sx prop.
</> | ||
); | ||
}; | ||
|
||
const HookDetails = ({ hook }: { hook: Hook }) => { | ||
return ( | ||
<Grid style={{ padding: '1rem' }}> | ||
<Cell xs={12}> | ||
<Grid sx={{ marginTop: '1rem' }}> |
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.
<Grid sx={{ marginTop: '1rem' }}> | |
<Grid container mt={2}> |
You don't need sx for styling components (Grid, Box, ... ).
use spacing instead of rem
. (2 is 16px set what you need here)
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.
done
@karimould @ImanMahmoudinasab I am fine with improving the code later, and thanks for implementing the visual changes. Please let me know if you want to tackle Iman's changes within this iteration. |
… into feature/refactoring-projectSettings
changed spacing to mui suggested spacing model
For new features: