send app id when pressing on a app

This commit is contained in:
chip committed 2020-11-06 12:54:41 +01:00
1 parent c14577cd5d
commit e21c52c289
1 file changed
+8 -2
+8 -2
View File
@@ -3,6 +3,7 @@ import { makeStyles } from "@material-ui/core/styles";
import Avatar from "@material-ui/core/Avatar";
import { green } from "@material-ui/core/colors";
import { Button } from "@material-ui/core";
import Nui from "../../os/nui-events/utils/Nui";
interface IStyles {
root: any;
@@ -28,13 +29,18 @@ const useStyles = makeStyles(
})
);
export const AppIcon = ({ name, icon, backgroundColor, color }) => {
export const AppIcon = ({ id, name, icon, backgroundColor, color }) => {
const classes = useStyles({
backgroundColor: backgroundColor || green[50],
color: color || green[400],
});
const openAppCallback = () => {
Nui.send(`phone:app:${id}`)
}
return (
<Button className={classes.root}>
<Button onClick={openAppCallback} className={classes.root}>
<Avatar className={classes.avatar}>
{icon || name[0].toUpperCase()}
</Avatar>