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

Feature/refactoring project settings #476

Merged

Conversation

karimould
Copy link
Contributor

For new features:

  • Discuss feature: Material-UI 🙏🏻 Help Needed: boldui -> Material-UI #401
  • Describe the use-case in details: Migrated ProjectSettings and Hook editor to MUI
  • Ensure the solution is backwards-compatible
  • Test it. Submit screenshots / outputs / tests together with the PR.

Bildschirmfoto 2021-10-28 um 19 21 27

Bildschirmfoto 2021-10-28 um 19 21 35

Bildschirmfoto 2021-10-28 um 19 21 52

Bildschirmfoto 2021-10-28 um 19 22 23

Bildschirmfoto 2021-10-28 um 19 22 44

Copy link
Collaborator

@agoldis agoldis left a 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:
Screen Shot 2021-11-05 at 11 13 48 PM
Screen Shot 2021-11-05 at 11 12 40 PM

This one is regarding all the input fields:

Screen Shot 2021-11-05 at 11 10 08 PM

Also, here's a suggestion that never was implemented - should we add a confirmation dialog before deleting a webhook?

Kapture 2021-11-05 at 23 16 13

@agoldis
Copy link
Collaborator

agoldis commented Nov 6, 2021

@ImanMahmoudinasab feel free to tune in

@ImanMahmoudinasab
Copy link
Contributor

@karimould @agoldis What I had in mind to implement the hooks was something like this:

  • Having separate menu item for integrations
  • Paper for every hook added by user
  • Add button on top of page that opens a menu showing different types of hooks that user can add

2021-11-07 at 12 10 PM

@ImanMahmoudinasab
Copy link
Contributor

@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
@karimould
Copy link
Contributor Author

@ImanMahmoudinasab this looks very good, i can take care of it :-)

@agoldis
I have implemented the changes, with the exception of the better separation of the hooks in the unfolded state.

I would suggest that if the code is okay, the current version could be merged.
I would then take care of moving the hooks to 'intergrations' in a later refactoring :-)

Bildschirmfoto 2021-11-07 um 21 28 47

Bildschirmfoto 2021-11-07 um 21 28 18

Bildschirmfoto 2021-11-07 um 21 28 06

Bildschirmfoto 2021-11-07 um 21 27 54

Bildschirmfoto 2021-11-07 um 21 27 43

Bildschirmfoto 2021-11-07 um 21 27 29

Copy link
Contributor

@ImanMahmoudinasab ImanMahmoudinasab left a 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;
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
label?: string | React.ReactNode;
label?: string | 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.

done

const hasError = errorMessage ? true : false;
const Help = helpText && (
<Tooltip title={helpText}>
<InfoOutlinedIcon fontSize="small" sx={{ marginRight: '0.25rem' }} />
Copy link
Contributor

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:

Suggested change
<InfoOutlinedIcon fontSize="small" sx={{ marginRight: '0.25rem' }} />
<InfoOutlinedIcon fontSize="small" sx={{ mr: 0.5 }} />

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Comment on lines 60 to 70
<Button
variant="contained"
color="error"
onClick={() => setShowModal(true)}
disabled={deleting}
>
<DeleteIcon />
<Typography variant="body1">
{deleting ? 'Deleting' : 'Delete'}
</Typography>
</Button>
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
<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>

2021-11-07 at 6 02 PM

This way icon and text will be aligned.
You don't need Typography. all icons should have same typography applied by the button itself.

Copy link
Contributor Author

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 />
Copy link
Contributor

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.

Copy link
Contributor Author

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>
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
<Grid>
<Grid item>

Copy link
Contributor Author

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}>
Copy link
Contributor

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.

Copy link
Contributor Author

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>
Copy link
Contributor

Choose a reason for hiding this comment

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

No description provided.

Comment on lines 38 to 42
<Box
style={{ display: 'flex', cursor: 'pointer' }}
onClick={() => toggleExpanded()}
alignItems="center"
>
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
<Box
style={{ display: 'flex', cursor: 'pointer' }}
onClick={() => toggleExpanded()}
alignItems="center"
>
<Box
display="'flex"
cursor="pointer"
onClick={() => toggleExpanded()}
alignItems="center"
>

Copy link
Contributor Author

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' }}>
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
<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)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@agoldis
Copy link
Collaborator

agoldis commented Nov 8, 2021

@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.

changed spacing to mui suggested spacing model
@agoldis agoldis merged commit 36bffb8 into sorry-cypress:master Nov 10, 2021
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.

None yet

3 participants