mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-05 06:28:51 +00:00
change in phone.tsx
This commit is contained in:
1 parent
1f5da994a5
commit
a415301145
1 file changed
+108
-109
+108
-109
@@ -1,38 +1,39 @@
|
|||||||
import React from "react";
|
import React from 'react';
|
||||||
import "./Phone.css";
|
import './Phone.css';
|
||||||
import "./i18n";
|
import './i18n';
|
||||||
import { Route } from "react-router-dom";
|
import { Route } from 'react-router-dom';
|
||||||
import { useSettings } from "./apps/settings/hooks/useSettings";
|
import { useSettings } from './apps/settings/hooks/useSettings';
|
||||||
import MessageIcon from "@material-ui/icons/Email";
|
import MessageIcon from '@material-ui/icons/Email';
|
||||||
import { CallModal } from "./modal/components/CallModal";
|
import { CallModal } from './modal/components/CallModal';
|
||||||
import { HomeApp } from "./apps/home/components/Home";
|
import { HomeApp } from './apps/home/components/Home';
|
||||||
import { ThemeProvider } from "@material-ui/core";
|
import { ThemeProvider } from '@material-ui/core';
|
||||||
import { useInitKeyboard } from "./os/keyboard/hooks/useKeyboard";
|
import { useInitKeyboard } from './os/keyboard/hooks/useKeyboard';
|
||||||
import { NotificationIcon } from "./os/notifications/components/NotificationIcon";
|
import { NotificationIcon } from './os/notifications/components/NotificationIcon';
|
||||||
import { NotificationBar } from "./os/notifications/components/NotificationBar";
|
import { NotificationBar } from './os/notifications/components/NotificationBar';
|
||||||
import { Navigation } from "./os/navigation-bar/components/Navigation";
|
import { Navigation } from './os/navigation-bar/components/Navigation';
|
||||||
import { useNuiService } from "./os/nui-events/hooks/useNuiService";
|
import { useNuiService } from './os/nui-events/hooks/useNuiService';
|
||||||
import { useSimcardService } from "./os/simcard/hooks/useSimcardService";
|
import { useSimcardService } from './os/simcard/hooks/useSimcardService';
|
||||||
import { usePhoneService } from "./os/phone/hooks/usePhoneService";
|
import { usePhoneService } from './os/phone/hooks/usePhoneService';
|
||||||
import { useApps } from "./os/apps/hooks/useApps";
|
import { useApps } from './os/apps/hooks/useApps';
|
||||||
|
|
||||||
import { useContactsService } from "./apps/contacts/hooks/useContactsService";
|
import { useContactsService } from './apps/contacts/hooks/useContactsService';
|
||||||
import { useTwitterService } from "./apps/twitter/hooks/useTwitterService";
|
import { useTwitterService } from './apps/twitter/hooks/useTwitterService';
|
||||||
import { useSelloutService } from "./apps/sellout/hooks/useSelloutService";
|
import { useSelloutService } from './apps/sellout/hooks/useSelloutService';
|
||||||
import { useBankService } from './apps/bank/hooks/useBankService';
|
import { useBankService } from './apps/bank/hooks/useBankService';
|
||||||
import { useMessagesService } from "./apps/messages/hooks/useMessageService";
|
import { useMessagesService } from './apps/messages/hooks/useMessageService';
|
||||||
import { useNotesService } from "./apps/notes/hooks/useNotesService";
|
import { useNotesService } from './apps/notes/hooks/useNotesService';
|
||||||
import { usePhotoService } from "./apps/camera/hooks/usePhotoService";
|
import { usePhotoService } from './apps/camera/hooks/usePhotoService';
|
||||||
import Nui from "./os/nui-events/utils/Nui";
|
import Nui from './os/nui-events/utils/Nui';
|
||||||
|
import { usePhone } from './os/phone/hooks/usePhone';
|
||||||
|
|
||||||
// Inject mock data when in development env.
|
// Inject mock data when in development env.
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.dispatchEvent(
|
window.dispatchEvent(
|
||||||
new MessageEvent("message", {
|
new MessageEvent('message', {
|
||||||
data: {
|
data: {
|
||||||
app: "CAMERA",
|
app: 'CAMERA',
|
||||||
method: "setPhotos",
|
method: 'setPhotos',
|
||||||
data: [
|
data: [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
@@ -40,8 +41,8 @@ if (process.env.NODE_ENV === 'development') {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
image: 'https://i.imgur.com/pqGBiST.jpg'
|
image: 'https://i.imgur.com/pqGBiST.jpg',
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -50,24 +51,22 @@ if (process.env.NODE_ENV === 'development') {
|
|||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.dispatchEvent(
|
window.dispatchEvent(
|
||||||
new MessageEvent("message", {
|
new MessageEvent('message', {
|
||||||
data: {
|
data: {
|
||||||
app: "SIMCARD",
|
app: 'SIMCARD',
|
||||||
method: "setNumber",
|
method: 'setNumber',
|
||||||
data: "111-1134",
|
data: '111-1134',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.dispatchEvent(
|
window.dispatchEvent(
|
||||||
new MessageEvent("message", {
|
new MessageEvent('message', {
|
||||||
data: {
|
data: {
|
||||||
app: "PHONE",
|
app: 'PHONE',
|
||||||
method: "setVisibility",
|
method: 'setVisibility',
|
||||||
data: true,
|
data: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -76,7 +75,7 @@ if (process.env.NODE_ENV === 'development') {
|
|||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.dispatchEvent(
|
window.dispatchEvent(
|
||||||
new MessageEvent("message", {
|
new MessageEvent('message', {
|
||||||
data: {
|
data: {
|
||||||
app: 'NOTES',
|
app: 'NOTES',
|
||||||
method: 'setNotes',
|
method: 'setNotes',
|
||||||
@@ -84,56 +83,55 @@ if (process.env.NODE_ENV === 'development') {
|
|||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
title: 'First note',
|
title: 'First note',
|
||||||
content: 'Hello, this is my shitty note'
|
content: 'Hello, this is my shitty note',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
title: 'Second note',
|
title: 'Second note',
|
||||||
content: 'Hello, this is another shitty note'
|
content: 'Hello, this is another shitty note',
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
]
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
)
|
);
|
||||||
}, 1000)
|
}, 1000);
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
new MessageEvent("messsage", {
|
new MessageEvent('messsage', {
|
||||||
data: {
|
data: {
|
||||||
app: "BANK",
|
app: 'BANK',
|
||||||
method: "setNotification",
|
method: 'setNotification',
|
||||||
data: {
|
data: {
|
||||||
id: 1,
|
id: 1,
|
||||||
message: "ahhaha"
|
message: 'ahhaha',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
}, 1000)
|
}, 1000);
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
new MessageEvent("messsage", {
|
new MessageEvent('messsage', {
|
||||||
data: {
|
data: {
|
||||||
app: "TWITTER",
|
app: 'TWITTER',
|
||||||
method: "setNotification",
|
method: 'setNotification',
|
||||||
data: {
|
data: {
|
||||||
id: 1,
|
id: 1,
|
||||||
message: "ahhaha"
|
message: 'ahhaha',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
}, 1000)
|
}, 1000);
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.dispatchEvent(
|
window.dispatchEvent(
|
||||||
new MessageEvent("message", {
|
new MessageEvent('message', {
|
||||||
data: {
|
data: {
|
||||||
app: "BANK",
|
app: 'BANK',
|
||||||
method: "setCredentials",
|
method: 'setCredentials',
|
||||||
data:
|
data: {
|
||||||
{
|
name: 'Firstname Lastname',
|
||||||
name: "Firstname Lastname",
|
balance: 2000,
|
||||||
balance: 2000
|
},
|
||||||
}
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@@ -141,7 +139,7 @@ if (process.env.NODE_ENV === 'development') {
|
|||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.dispatchEvent(
|
window.dispatchEvent(
|
||||||
new MessageEvent("message", {
|
new MessageEvent('message', {
|
||||||
data: {
|
data: {
|
||||||
app: 'BANK',
|
app: 'BANK',
|
||||||
method: 'setTransaction',
|
method: 'setTransaction',
|
||||||
@@ -150,66 +148,66 @@ if (process.env.NODE_ENV === 'development') {
|
|||||||
id: 1,
|
id: 1,
|
||||||
amount: 200,
|
amount: 200,
|
||||||
type: 'Deposit',
|
type: 'Deposit',
|
||||||
source: "chip"
|
source: 'chip',
|
||||||
},{
|
},
|
||||||
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
amount: 200,
|
amount: 200,
|
||||||
type: 'Withdraw',
|
type: 'Withdraw',
|
||||||
source: "chip"
|
source: 'chip',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
amount: 200,
|
amount: 200,
|
||||||
type: 'Withdraw',
|
type: 'Withdraw',
|
||||||
source: "chip"
|
source: 'chip',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 4,
|
id: 4,
|
||||||
amount: 50,
|
amount: 50,
|
||||||
type: 'Deposit',
|
type: 'Deposit',
|
||||||
source: "chip"
|
source: 'chip',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 4,
|
id: 4,
|
||||||
amount: 50,
|
amount: 50,
|
||||||
type: 'Deposit',
|
type: 'Deposit',
|
||||||
source: "chip"
|
source: 'chip',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 4,
|
id: 4,
|
||||||
amount: 50,
|
amount: 50,
|
||||||
type: 'Deposit',
|
type: 'Deposit',
|
||||||
source: "chip"
|
source: 'chip',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
)
|
);
|
||||||
}, 1000)
|
}, 1000);
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.dispatchEvent(
|
window.dispatchEvent(
|
||||||
new MessageEvent("message", {
|
new MessageEvent('message', {
|
||||||
data: {
|
data: {
|
||||||
app: "SELLOUT",
|
app: 'SELLOUT',
|
||||||
method: "setListings",
|
method: 'setListings',
|
||||||
data: [
|
data: [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
name: "Some guy",
|
name: 'Some guy',
|
||||||
number: "123-4567",
|
number: '123-4567',
|
||||||
title: "Car",
|
title: 'Car',
|
||||||
description:
|
description: 'Selling this cool car',
|
||||||
"Selling this cool car",
|
url: 'https://i.imgur.com/ROmGTwi.jpeg',
|
||||||
url: "https://i.imgur.com/ROmGTwi.jpeg",
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
name: "Some other dude",
|
name: 'Some other dude',
|
||||||
number: "666-6666",
|
number: '666-6666',
|
||||||
title: "Material",
|
title: 'Material',
|
||||||
description: "Selling my wife",
|
description: 'Selling my wife',
|
||||||
url: "",
|
url: '',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -220,7 +218,8 @@ if (process.env.NODE_ENV === 'development') {
|
|||||||
|
|
||||||
function Phone() {
|
function Phone() {
|
||||||
useNuiService();
|
useNuiService();
|
||||||
const { visibility } = usePhoneService();
|
usePhoneService();
|
||||||
|
const { visibility } = usePhone();
|
||||||
const { settings, currentTheme } = useSettings();
|
const { settings, currentTheme } = useSettings();
|
||||||
const { allApps } = useApps();
|
const { allApps } = useApps();
|
||||||
useSimcardService();
|
useSimcardService();
|
||||||
@@ -229,7 +228,7 @@ function Phone() {
|
|||||||
useInitKeyboard();
|
useInitKeyboard();
|
||||||
useSelloutService();
|
useSelloutService();
|
||||||
useBankService();
|
useBankService();
|
||||||
useMessagesService()
|
useMessagesService();
|
||||||
useNotesService();
|
useNotesService();
|
||||||
usePhotoService();
|
usePhotoService();
|
||||||
|
|
||||||
@@ -241,24 +240,24 @@ function Phone() {
|
|||||||
|
|
||||||
document.onkeyup = function (data) {
|
document.onkeyup = function (data) {
|
||||||
if (data.which == 27) {
|
if (data.which == 27) {
|
||||||
Nui.send("phone:close");
|
Nui.send('phone:close');
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ThemeProvider theme={currentTheme()}>
|
<ThemeProvider theme={currentTheme()}>
|
||||||
<div className="PhoneWrapper">
|
<div className='PhoneWrapper'>
|
||||||
<div style={{ zoom: "80%" }}>
|
<div style={{ zoom: '80%' }}>
|
||||||
<div className="Phone">
|
<div className='Phone'>
|
||||||
<div
|
<div
|
||||||
className="PhoneFrame"
|
className='PhoneFrame'
|
||||||
style={{
|
style={{
|
||||||
backgroundImage: `url(./media/frames/${settings.frame})`,
|
backgroundImage: `url(./media/frames/${settings.frame})`,
|
||||||
}}
|
}}
|
||||||
></div>
|
></div>
|
||||||
<div
|
<div
|
||||||
id="phone"
|
id='phone'
|
||||||
className="PhoneScreen"
|
className='PhoneScreen'
|
||||||
style={{
|
style={{
|
||||||
backgroundImage: `url(./media/backgrounds/${settings.wallpaper})`,
|
backgroundImage: `url(./media/backgrounds/${settings.wallpaper})`,
|
||||||
}}
|
}}
|
||||||
@@ -267,17 +266,17 @@ function Phone() {
|
|||||||
<NotificationBar
|
<NotificationBar
|
||||||
notifications={[
|
notifications={[
|
||||||
{
|
{
|
||||||
key: "newMessage",
|
key: 'newMessage',
|
||||||
icon: <NotificationIcon Icon={MessageIcon} />,
|
icon: <NotificationIcon Icon={MessageIcon} />,
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
<div className="PhoneAppContainer">
|
<div className='PhoneAppContainer'>
|
||||||
{calling ? (
|
{calling ? (
|
||||||
<CallModal />
|
<CallModal />
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<Route exact path="/" component={HomeApp} />
|
<Route exact path='/' component={HomeApp} />
|
||||||
|
|
||||||
{allApps.map((App) => (
|
{allApps.map((App) => (
|
||||||
<App.Route key={App.id} />
|
<App.Route key={App.id} />
|
||||||
|
|||||||
Reference in new issue
Block a user