mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
Feat(Nui): Nui send event | Close button
This commit is contained in:
1 parent
3a213ea308
commit
5ae9f99f42
3 files changed
+31
-1
No files matched your search
+1
-1
@@ -56,7 +56,7 @@ import { useContactsService } from "./apps/contacts/hooks/useContactsService";
|
|||||||
// data: {
|
// data: {
|
||||||
// app: "PHONE",
|
// app: "PHONE",
|
||||||
// method: "setVisibility",
|
// method: "setVisibility",
|
||||||
// data: false,
|
// data: true,
|
||||||
// },
|
// },
|
||||||
// })
|
// })
|
||||||
// );
|
// );
|
||||||
|
|||||||
@@ -7,8 +7,11 @@ import {
|
|||||||
import KeyboardArrowLeftIcon from "@material-ui/icons/KeyboardArrowLeft";
|
import KeyboardArrowLeftIcon from "@material-ui/icons/KeyboardArrowLeft";
|
||||||
import AppsIcon from "@material-ui/icons/Apps";
|
import AppsIcon from "@material-ui/icons/Apps";
|
||||||
import PhoneIcon from "@material-ui/icons/Phone";
|
import PhoneIcon from "@material-ui/icons/Phone";
|
||||||
|
import RadioButtonUncheckedIcon from "@material-ui/icons/RadioButtonUnchecked";
|
||||||
import { useHistory } from "react-router-dom";
|
import { useHistory } from "react-router-dom";
|
||||||
|
|
||||||
|
import Nui from "../../nui-events/utils/Nui";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => ({
|
const useStyles = makeStyles((theme) => ({
|
||||||
root: {
|
root: {
|
||||||
zIndex: 2,
|
zIndex: 2,
|
||||||
@@ -17,6 +20,11 @@ const useStyles = makeStyles((theme) => ({
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
export const Navigation = () => {
|
export const Navigation = () => {
|
||||||
|
const closePhone = () => {
|
||||||
|
console.log("Phone closed");
|
||||||
|
Nui.send("phone:close");
|
||||||
|
};
|
||||||
|
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
return (
|
return (
|
||||||
@@ -34,6 +42,11 @@ export const Navigation = () => {
|
|||||||
value={() => history.push("/")}
|
value={() => history.push("/")}
|
||||||
icon={<AppsIcon className={classes.icon} />}
|
icon={<AppsIcon className={classes.icon} />}
|
||||||
/>
|
/>
|
||||||
|
<BottomNavigationAction
|
||||||
|
label="Close"
|
||||||
|
value={() => closePhone()}
|
||||||
|
icon={<RadioButtonUncheckedIcon className={classes.icon} />}
|
||||||
|
/>
|
||||||
<BottomNavigationAction
|
<BottomNavigationAction
|
||||||
label="Back"
|
label="Back"
|
||||||
value={() => history.goBack()}
|
value={() => history.goBack()}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
export default {
|
||||||
|
async send(event, data = {}) {
|
||||||
|
// /// #if DEBUG
|
||||||
|
//return new Promise(resolve => setTimeout(resolve, 100));
|
||||||
|
// /// #endif
|
||||||
|
|
||||||
|
/* eslint-disable no-unreachable */
|
||||||
|
return fetch(`http://new-phone-who-dis/${event}`, {
|
||||||
|
method: "post",
|
||||||
|
headers: {
|
||||||
|
"Content-type": "application/json; charset=UTF-8",
|
||||||
|
},
|
||||||
|
body: JSON.stringify(data),
|
||||||
|
});
|
||||||
|
/* eslint-enable no-unreachable */
|
||||||
|
},
|
||||||
|
};
|
||||||
Reference in new issue
Block a user