Merge pull request #29 from Re-Ignited-Development/improv/events

Improv/events
This commit is contained in:
Christopher Gjelten authored and GitHub committed 2020-11-06 12:56:25 +01:00
commit 095bc663e3
3 files changed
+40 -13

No files matched your search

+8 -2
View File
@@ -3,6 +3,7 @@ import { makeStyles } from "@material-ui/core/styles";
import Avatar from "@material-ui/core/Avatar"; import Avatar from "@material-ui/core/Avatar";
import { green } from "@material-ui/core/colors"; import { green } from "@material-ui/core/colors";
import { Button } from "@material-ui/core"; import { Button } from "@material-ui/core";
import Nui from "../../os/nui-events/utils/Nui";
interface IStyles { interface IStyles {
root: any; 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({ const classes = useStyles({
backgroundColor: backgroundColor || green[50], backgroundColor: backgroundColor || green[50],
color: color || green[400], color: color || green[400],
}); });
const openAppCallback = () => {
Nui.send(`phone:app:${id}`)
}
return ( return (
<Button className={classes.root}> <Button onClick={openAppCallback} className={classes.root}>
<Avatar className={classes.avatar}> <Avatar className={classes.avatar}>
{icon || name[0].toUpperCase()} {icon || name[0].toUpperCase()}
</Avatar> </Avatar>
+24 -10
View File
@@ -235,11 +235,6 @@ async function Phone() {
isPhoneOpen = true; isPhoneOpen = true;
await phoneOpenAnim(); // Animation starts before the phone is open await phoneOpenAnim(); // Animation starts before the phone is open
emitNet('phone:getCredentials') emitNet('phone:getCredentials')
emitNet(events.CONTACTS_GET_CONTACTS);
emitNet(events.SELLOUT_FETCH_LISTING);
emitNet(events.BANK_FETCH_TRANSACTIONS);
emitNet(events.BANK_GET_CREDENTIALS);
emitNet(events.NOTE_FETCH_ALL_NOTES);
console.log("Sellout fetched from client side")// Gets the credentials. Will eventually most likely only get the phone number and name, idk. console.log("Sellout fetched from client side")// Gets the credentials. Will eventually most likely only get the phone number and name, idk.
SetCursorLocation(0.90, 0.922) //Experimental SetCursorLocation(0.90, 0.922) //Experimental
let res = GetActiveScreenResolution() let res = GetActiveScreenResolution()
@@ -275,11 +270,6 @@ async function Phone() {
isPhoneOpen = true; isPhoneOpen = true;
await phoneOpenAnim(); // Animation starts before the phone is open await phoneOpenAnim(); // Animation starts before the phone is open
emitNet('phone:getCredentials') emitNet('phone:getCredentials')
emitNet(events.CONTACTS_GET_CONTACTS);
emitNet(events.SELLOUT_FETCH_LISTING);
emitNet(events.BANK_FETCH_TRANSACTIONS);
emitNet(events.BANK_GET_CREDENTIALS);
emitNet(events.NOTE_FETCH_ALL_NOTES);
console.log("Sellout fetched from client side") console.log("Sellout fetched from client side")
SetCursorLocation(0.936, 0.922) //Experimental SetCursorLocation(0.936, 0.922) //Experimental
let res = GetActiveScreenResolution() let res = GetActiveScreenResolution()
@@ -308,6 +298,30 @@ async function Phone() {
} }
} }
// DO NOT CHANGE THIS EITHER, PLEASE - CHIP
// contacts app
RegisterNuiCallbackType(events.OPEN_APP_CONTACTS);
on(`__cfx_nui:${events.OPEN_APP_CONTACTS}`, () => {
emitNet(events.CONTACTS_GET_CONTACTS);
})
RegisterNuiCallbackType(events.OPEN_APP_LISTINGS);
on(`__cfx_nui:${events.OPEN_APP_LISTINGS}`, () => {
emitNet(events.SELLOUT_FETCH_LISTING);
})
RegisterNuiCallbackType(events.OPEN_APP_NOTES);
on(`__cfx_nui:${events.OPEN_APP_NOTES}`, () => {
emitNet(events.NOTE_FETCH_ALL_NOTES);
})
RegisterNuiCallbackType(events.OPEN_APP_BANK);
on(`__cfx_nui:${events.OPEN_APP_BANK}`, () => {
emitNet(events.BANK_FETCH_TRANSACTIONS);
emitNet(events.BANK_GET_CREDENTIALS);
})
RegisterCommand( RegisterCommand(
"phone", "phone",
() => { () => {
+8 -1
View File
@@ -61,5 +61,12 @@ export default {
NOTE_DELETE_NOTE: 'phone:deleteNote', NOTE_DELETE_NOTE: 'phone:deleteNote',
NOTE_UPDATE_NOTE: 'phone:updateNote', NOTE_UPDATE_NOTE: 'phone:updateNote',
NOTE_UPDATE_NOTE_SUCCESS: 'phone:updateNoteSuccess', NOTE_UPDATE_NOTE_SUCCESS: 'phone:updateNoteSuccess',
NOTE_UPDATE_NOTE_FAILURE: 'phone:updateNoteFailure' NOTE_UPDATE_NOTE_FAILURE: 'phone:updateNoteFailure',
// DO NOT CHANGE WHATS BELOW, PLEASE - CHIP
OPEN_APP_CONTACTS: 'phone:app:CONTACTS',
OPEN_APP_BANK: 'phone:app:BANK',
OPEN_APP_NOTES: 'phone:app:NOTES',
OPEN_APP_LISTINGS: 'phone:app:SELLOUT'
} }