Notification alert stays on if it is an incoming call and phone is closed (#115)

* Phone now shows all the time slide a bit if incoming call exists | can close alerts!

* Improve animation

* Improve call controls

* Make alerts not overflow | Call modal is navigable out :)

* Open modal when accepting call

* Cant navigate back from homepage

* Avoid call route if no call active + rename things

* Impprove main apps icons sizes

* hover effect to app icons :)

* Revert interface change

* fix(phone/dialer): resolve not calling when adding contacts

Co-authored-by: Christopher <[email protected]>
This commit is contained in:
J Francisco RaderandChristopher authored and GitHub committed 2021-02-26 21:45:01 -05:00
1 parent d2461bab16
commit 41674968ab
24 files changed
+396 -206

No files matched your search

+38 -26
View File
@@ -1,56 +1,68 @@
import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import { fade, makeStyles, Theme } from '@material-ui/core/styles';
import Avatar from '@material-ui/core/Avatar';
import { green } from '@material-ui/core/colors';
import { Badge, Button } from '@material-ui/core';
import { Badge, Button, Tooltip, Zoom } from '@material-ui/core';
import { useTranslation } from 'react-i18next';
interface IStyles {
root: any;
avatar: any;
}
const useStyles = makeStyles(
(theme): IStyles => ({
const useStyles = makeStyles<Theme, { color: string; backgroundColor: string }>(
(theme) => ({
root: {
display: 'flex',
'& > *': {
margin: theme.spacing(1),
},
padding: 0,
marginTop: theme.spacing(3),
},
avatar: {
'&:hover': {
backgroundColor: ({ backgroundColor }) => fade(backgroundColor, 0.6),
},
backgroundColor: ({ backgroundColor }) => backgroundColor,
color: ({ color }) => color,
width: theme.spacing(7),
height: theme.spacing(7),
boxShadow: theme.shadows[2],
width: theme.spacing(8),
height: theme.spacing(8),
fontSize: theme.typography.h4.fontSize,
},
tooltip: {
fontSize: 12,
},
})
);
export const AppIcon = ({
id,
nameLocale,
name,
icon,
backgroundColor,
color,
notification,
}) => {
const { t } = useTranslation();
const classes = useStyles({
backgroundColor: backgroundColor || green[50],
color: color || green[400],
});
return (
<Button className={classes.root}>
<Badge
color="error"
badgeContent={notification?.badge}
invisible={!notification || notification.badge < 2}
>
<Avatar className={classes.avatar}>
{icon || name[0].toUpperCase()}
</Avatar>
</Badge>
</Button>
<Tooltip
arrow
key={id}
title={t(nameLocale)}
placement='top'
classes={{ tooltip: classes.tooltip }}
TransitionComponent={Zoom}
>
<Button className={classes.root}>
<Badge
color='error'
badgeContent={notification?.badge}
invisible={!notification || notification.badge < 2}
>
<Avatar className={classes.avatar}>
{icon || name[0].toUpperCase()}
</Avatar>
</Badge>
</Button>
</Tooltip>
);
};
+23 -44
View File
@@ -1,53 +1,32 @@
import React from 'react';
import { AppIcon } from './AppIcon';
import { useTranslation } from 'react-i18next';
import { Grid, makeStyles, Tooltip, Zoom } from '@material-ui/core';
import { Box, Grid } from '@material-ui/core';
import { Link } from 'react-router-dom';
const useStyles = makeStyles((theme) => ({
root: {
marginTop: theme.spacing(3),
},
item: {
marginTop: theme.spacing(3),
width: '20%',
},
tooltip: {
fontSize: 12,
},
}));
export const GridMenu = ({ items, Component = AppIcon }) => {
const classes = useStyles();
const { t } = useTranslation();
// TODO: Fix tooltip position to be closer to app icon
export const GridMenu = ({
items,
Component = AppIcon,
xs = undefined,
}) => {
return (
<Grid container justify='center'>
<Grid container item>
{items &&
items.length &&
items.map((item) => (
<Tooltip
arrow
key={item.id}
title={t(item.nameLocale)}
placement='top'
classes={{ tooltip: classes.tooltip }}
TransitionComponent={Zoom}
>
<Grid
key={item.id}
item
className={classes.item}
component={Link}
to={item.path}
>
<Grid container alignItems='center' direction='row'>
{items &&
items.length &&
items.map((item) => (
<Grid
item
xs={xs}
key={item.id}
alignItems='center'
justify='center'
>
<Box textAlign='center'>
<Link to={item.path}>
<Component {...item} />
</Grid>
</Tooltip>
))}
</Grid>
</Link>
</Box>
</Grid>
))}
</Grid>
);
};
@@ -0,0 +1,60 @@
import {
fade,
IconButton,
IconButtonProps,
makeStyles,
} from '@material-ui/core';
import React from 'react';
type StatusButtonStyleColor = 'success' | 'error' | 'warning' | 'info';
interface IStatusButtonStyleProps {
color: StatusButtonStyleColor;
}
const useStyles = makeStyles(
(theme) => ({
root: {
color: ({ color }: IStatusButtonStyleProps) =>
theme.palette[color].contrastText,
backgroundColor: ({ color }: IStatusButtonStyleProps) =>
theme.palette[color].main,
'&:hover': {
backgroundColor: ({ color }: IStatusButtonStyleProps) =>
theme.palette[color].light,
},
},
outlined: {
border: ({ color }: IStatusButtonStyleProps) =>
`1px solid ${fade(theme.palette[color].main, 0.5)}`,
'&:hover': {
border: ({ color }: IStatusButtonStyleProps) =>
`1px solid ${theme.palette[color].main}`,
},
'&$disabled': {
border: `1px solid ${theme.palette.action.disabled}`,
},
},
contained: {
color: ({ color }: IStatusButtonStyleProps) =>
theme.palette[color].contrastText,
backgroundColor: ({ color }: IStatusButtonStyleProps) =>
theme.palette[color].main,
'&:hover': {
backgroundColor: ({ color }: IStatusButtonStyleProps) =>
theme.palette[color].dark,
},
},
}),
{ name: 'MuiIconButton' }
);
export const StatusIconButton = ({
color = 'info',
size,
className,
...props
}: Omit<IconButtonProps, 'color'> & { color: StatusButtonStyleColor }) => {
const classes = useStyles({ color });
return <IconButton className={`${classes.root} ${className}`} size={size} {...props} />;
};