-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/user management #8
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
Open
tomaszstefaniuk
wants to merge
5
commits into
practice-base
Choose a base branch
from
feature/user-management
base: practice-base
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0ebb8cf
feat: user administration views
tomaszstefaniuk f2780b6
remove maxWidth from container
tomaszstefaniuk 04c018a
feat: 'User management views
tomaszstefaniuk d43e45f
fix: user management refactor and improvements
tomaszstefaniuk 6d22d76
fix: remove unnecessary keys in Routes
tomaszstefaniuk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| import { render } from "@testing-library/react"; | ||
|
|
||
| import App from "./App"; | ||
|
|
||
| describe("<App />", () => { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import { FC } from "react"; | ||
|
|
||
| import { Button as MuiButton, Theme, ButtonProps } from "@mui/material"; | ||
| import { useTheme } from "@mui/material/styles"; | ||
| import { rgbaColors } from "@themes/palette"; | ||
|
|
||
| export const Button: FC<ButtonProps> = ({ children, ...buttonProps }) => { | ||
| const theme = useTheme<Theme>(); | ||
|
|
||
| return ( | ||
| <MuiButton | ||
| {...buttonProps} | ||
| variant="contained" | ||
| sx={{ | ||
| borderRadius: "4px", | ||
| py: 1.25, | ||
| px: 2, | ||
| lineHeight: theme.spacing(2), | ||
| color: "common.white", | ||
| borderColor: theme.palette.secondary.main, | ||
| textDecoration: "none", | ||
| ":hover": { | ||
| textDecoration: "none", | ||
| borderColor: theme.palette.secondary.main, | ||
| }, | ||
| "&.Mui-disabled": { | ||
| color: rgbaColors.grey.main, | ||
| border: `1px solid ${rgbaColors.grey.lighter}`, | ||
| background: "none", | ||
| py: 1.125, | ||
| }, | ||
| ...buttonProps.sx, | ||
| }} | ||
| > | ||
| {children} | ||
| </MuiButton> | ||
| ); | ||
| }; | ||
85 changes: 85 additions & 0 deletions
85
web/src/components/ConfirmationDialog/ConfirmationDialog.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| import { FC, ReactNode } from "react"; | ||
|
|
||
| import { | ||
| Dialog, | ||
| DialogTitle, | ||
| DialogContent, | ||
| DialogActions, | ||
| Theme, | ||
| Button, | ||
| } from "@mui/material"; | ||
| import { useTheme } from "@mui/material/styles"; | ||
|
|
||
| interface Props { | ||
| children: ReactNode; | ||
| isOpen: boolean; | ||
| onSubmit: () => void; | ||
| onCancelClick: () => void; | ||
| submitButtonTitle: string; | ||
| } | ||
|
|
||
| const ConfirmationDialogTitle: FC = ({ children }) => { | ||
| const theme = useTheme<Theme>(); | ||
|
|
||
| return ( | ||
| <DialogTitle | ||
| sx={{ fontSize: 24, lineHeight: theme.spacing(3), pt: 2.5, pb: 1.75 }} | ||
| > | ||
| {children} | ||
| </DialogTitle> | ||
| ); | ||
| }; | ||
|
|
||
| const ConfirmationDialogContent: FC = ({ children }) => { | ||
| const theme = useTheme<Theme>(); | ||
|
|
||
| return ( | ||
| <DialogContent sx={{ pb: 7.5, color: theme.palette.secondary.dark }}> | ||
| {children} | ||
| </DialogContent> | ||
| ); | ||
| }; | ||
|
|
||
| export const ConfirmationDialog = ({ | ||
| children, | ||
| isOpen, | ||
| onSubmit, | ||
| onCancelClick, | ||
| submitButtonTitle, | ||
| }: Props) => { | ||
| const theme = useTheme<Theme>(); | ||
|
|
||
| return ( | ||
| <Dialog | ||
| onClose={onCancelClick} | ||
| open={isOpen} | ||
| sx={{ | ||
| "& .MuiPaper-root": { | ||
| // TODO: Static width need to be removed while implementing RWD | ||
| width: "560px", | ||
| }, | ||
| }} | ||
| > | ||
| {children} | ||
| <DialogActions sx={{ px: 1, pb: 1 }}> | ||
| <Button | ||
| sx={{ lineHeight: theme.spacing(2), p: 1 }} | ||
| variant="text" | ||
| onClick={onCancelClick} | ||
| > | ||
| Cancel | ||
| </Button> | ||
| <Button | ||
| sx={{ lineHeight: theme.spacing(2), p: 1 }} | ||
| variant="text" | ||
| onClick={onSubmit} | ||
| > | ||
| {submitButtonTitle} | ||
| </Button> | ||
| </DialogActions> | ||
| </Dialog> | ||
| ); | ||
| }; | ||
|
|
||
| ConfirmationDialog.Title = ConfirmationDialogTitle; | ||
| ConfirmationDialog.Content = ConfirmationDialogContent; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
web/src/components/ErrorNotification/ErrorNotification.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import { VFC } from "react"; | ||
|
|
||
| import { Theme, Snackbar, Alert } from "@mui/material"; | ||
| import { useTheme } from "@mui/material/styles"; | ||
|
|
||
| interface Props { | ||
| content?: string; | ||
| show: boolean; | ||
| onClose: () => void; | ||
| } | ||
|
|
||
| export const ErrorNotification: VFC<Props> = ({ content, show, onClose }) => { | ||
| const theme = useTheme<Theme>(); | ||
|
|
||
| return ( | ||
| <Snackbar | ||
| anchorOrigin={{ vertical: "bottom", horizontal: "center" }} | ||
| open={show} | ||
| onClose={onClose} | ||
| // TODO: Static width need to be removed while implementing RWD | ||
| sx={{ width: "764px", "& .MuiPaper-root": { py: 0.75 } }} | ||
tomaszstefaniuk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| > | ||
| <Alert | ||
| onClose={onClose} | ||
| severity="error" | ||
| sx={{ | ||
| width: "100%", | ||
| backgroundColor: theme.palette.error.main, | ||
| color: "common.white", | ||
| }} | ||
| icon={false} | ||
| > | ||
| {content || "Something went wrong. Please try again."} | ||
| </Alert> | ||
| </Snackbar> | ||
| ); | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import { VFC } from "react"; | ||
|
|
||
| import { TextField, StandardTextFieldProps } from "@mui/material"; | ||
|
|
||
| interface Props extends StandardTextFieldProps { | ||
| errorMessage?: string | undefined; | ||
| } | ||
|
|
||
| export const FormInput: VFC<Props> = ({ | ||
| errorMessage, | ||
| ...restProps | ||
| }: Props) => ( | ||
| <TextField | ||
| fullWidth | ||
| error={Boolean(errorMessage)} | ||
| helperText={errorMessage} | ||
| variant="filled" | ||
| {...restProps} | ||
| /> | ||
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import { VFC } from "react"; | ||
|
|
||
| import { Box, Typography, Theme } from "@mui/material"; | ||
| import { useTheme } from "@mui/material/styles"; | ||
|
|
||
| interface Props { | ||
| label: string; | ||
| value: string; | ||
| } | ||
|
|
||
| export const ListElement: VFC<Props> = ({ label, value }) => { | ||
| const theme = useTheme<Theme>(); | ||
|
|
||
| return ( | ||
| <Box display="flex"> | ||
| <Typography | ||
| width="120px" | ||
| color={theme.palette.secondary.dark} | ||
| fontSize={14} | ||
| lineHeight={theme.spacing(3)} | ||
| > | ||
| {label} | ||
| </Typography> | ||
| <Typography fontSize={14} fontWeight={600}> | ||
| {value} | ||
| </Typography> | ||
| </Box> | ||
| ); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why is it different Y-padding for disabled button? Text inside might flicker when button will change from active to disabled
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 reason is that disabled button gets 1px border on top and bottom. And to stay with the same height as on not disabled button I need to subtract this extra 2px added from border by making smaller padding.