Merge branch 'master' of github.com:Re-Ignited-Development/new-phone-who-dis into feature/twitter

This commit is contained in:
erik-sn committed 2020-10-03 16:19:48 -04:00
commit b180c4c655
18 files changed
+223 -77

No files matched your search

+59 -51
View File
@@ -4,8 +4,7 @@ import "./i18n";
import { Route } from "react-router-dom";
import { useSettings } from "./apps/settings/hooks/useSettings";
import MessageIcon from "@material-ui/icons/Email";
import Nui from "./os/nui-events/utils/Nui"
import { CallModal } from "./modal/components/CallModal";
import { HomeApp } from "./apps/home/components/Home";
import { ThemeProvider } from "@material-ui/core";
import { useInitKeyboard } from "./os/keyboard/hooks/useKeyboard";
@@ -20,53 +19,53 @@ import { useApps } from "./os/apps/hooks/useApps";
import { useContactsService } from "./apps/contacts/hooks/useContactsService";
import { useTwitterService } from "./apps/twitter/hooks/useTwitterService";
// These events are just for testing. Comment it out before building.
//setTimeout(() => {
// window.dispatchEvent(
// new MessageEvent("message", {
// data: {
// app: "SIMCARD",
// method: "setNumber",
// data: "111-1134",
// },
// })
// );
//}, 1000);
//These events are just for testing. Comment it out before building.
setTimeout(() => {
window.dispatchEvent(
new MessageEvent("message", {
data: {
app: "SIMCARD",
method: "setNumber",
data: "111-1134",
},
})
);
}, 1000);
//setTimeout(() => {
// window.dispatchEvent(
// new MessageEvent("message", {
// data: {
// app: "BANK",
// method: "setContacts",
// data: [
// {
// id: 1,
// number: "345-4366",
// display: "Kevin",
// },
// {
// id: 2,
// number: "345-4366",
// display: "Kevin",
// },
// ],
// },
// })
// );
//}, 1000);
setTimeout(() => {
window.dispatchEvent(
new MessageEvent("message", {
data: {
app: "BANK",
method: "setContacts",
data: [
{
id: 1,
number: "345-4366",
display: "Kevin",
},
{
id: 2,
number: "345-4366",
display: "Kevin",
},
],
},
})
);
}, 1000);
//setTimeout(() => {
// window.dispatchEvent(
// new MessageEvent("message", {
// data: {
// app: "PHONE",
// method: "setVisibility",
// data: true,
// },
// })
// );
//}, 1000);
setTimeout(() => {
window.dispatchEvent(
new MessageEvent("message", {
data: {
app: "PHONE",
method: "setVisibility",
data: true,
},
})
);
}, 1000);
function Phone() {
useNuiService();
@@ -82,6 +81,8 @@ function Phone() {
return null;
}
const calling = false;
return (
<ThemeProvider theme={currentTheme()}>
<div className="PhoneWrapper">
@@ -110,10 +111,17 @@ function Phone() {
]}
/>
<div className="PhoneAppContainer">
<Route exact path="/" component={HomeApp} />
{allApps.map((App) => (
<App.Route key={App.id} />
))}
{calling ? (
<CallModal />
) : (
<>
<Route exact path="/" component={HomeApp} />
{allApps.map((App) => (
<App.Route key={App.id} />
))}
</>
)}
</div>
<Navigation />
</>
@@ -0,0 +1,18 @@
import React from "react";
import { AppWrapper } from "../../../ui/components";
import { AppTitle } from "../../../ui/components/AppTitle";
import { AppContent } from "../../../ui/components/AppContent";
import { useApp } from "../../../os/apps/hooks/useApps";
export const ExampleApp = () => {
const example = useApp("EXAMPLE");
return (
<AppWrapper>
<AppTitle app={example} />
<AppContent>
<h1>This is an example</h1>
</AppContent>
</AppWrapper>
);
};
+4 -4
View File
@@ -1,5 +1,5 @@
{
"wallpaper": "default.png",
"frame": "default.png",
"theme": "default-dark"
}
"wallpaper": "default.png",
"frame": "s10.png",
"theme": "default-dark"
}
+1
View File
@@ -7,6 +7,7 @@
"APPS_CALCULATOR": "Calculator",
"APPS_SETTINGS": "Settings",
"APPS_BANK": "WhoDis Banking",
"APPS_EXAMPLE": "Example app",
"APPS_BANK_DEPOSIT": "Deposit",
"APPS_BANK_WITHDRAW": "Withdraw",
"APPS_BANK_TRANSFER": "Transfer",
+24
View File
@@ -0,0 +1,24 @@
import React from "react";
import { makeStyles } from "@material-ui/core";
import { AppWrapper } from "../../ui/components/AppWrapper";
import { AppTitle } from "../../ui/components/AppTitle";
import { AppContent } from "../../ui/components/AppContent";
import { Button } from "../../ui/components/Button";
export const CallModal = () => {
return (
<AppWrapper>
<AppTitle app="Call" />
<AppContent>
<h1
style={{
display: "flex",
justifyContent: "center",
}}
>
Call
</h1>
</AppContent>
</AppWrapper>
);
};
+8
View File
@@ -0,0 +1,8 @@
import { atom } from "recoil";
export const callerState = {
caller: atom({
key: "callerList",
default: [],
}),
};
+7
View File
@@ -0,0 +1,7 @@
import { useRecoilValue } from "recoil";
import { callerState } from "./state";
export const useCall = () => {
const caller = useRecoilState(callerState.caller);
return { caller };
};
+10
View File
@@ -0,0 +1,10 @@
import { useNuiEvent } from "../../os/nui-events/hooks/useNuiEvent";
import { useSetRecoilState } from "recoil";
import { callerState } from "./state";
import { useCall } from "./useCall";
export const useCallService = () => {
const setCaller = useSetRecoilState(callerState.caller);
useNuiEvent("CALL", "setCaller", setCaller);
return useCall();
};
+11
View File
@@ -12,6 +12,7 @@ import {
import ContactsIcon from "@material-ui/icons/Contacts";
import SettingsIcon from "@material-ui/icons/Settings";
import PhoneIcon from "@material-ui/icons/Phone";
import CalendarTodayIcon from "@material-ui/icons/CalendarToday";
import AccountBalanceIcon from "@material-ui/icons/AccountBalance";
import MessageIcon from "@material-ui/icons/Message";
import TwitterIcon from "@material-ui/icons/Twitter";
@@ -25,6 +26,7 @@ import { SettingsApp } from "../../../apps/settings/components/SettingsApp";
import { BankApp } from "../../../apps/bank/components/BankApp";
import { MessagesApp } from "../../../apps/messages/components/MessagesApp";
import { TwitterApp } from "../../../apps/twitter/components/TwitterApp";
import { ExampleApp } from "../../../apps/example/components/ExampleApp";
const appsState = atom({
key: "apps",
@@ -93,6 +95,15 @@ const appsState = atom({
path: "/twitter",
Route: () => <Route path="/twitter" component={TwitterApp} />,
},
{
id: "EXAMPLE",
nameLocale: "APPS_EXAMPLE",
icon: <CalendarTodayIcon />,
backgroundColor: blue[500],
color: blue[50],
path: "/example",
Route: () => <Route path="/example" component={ExampleApp} />,
},
],
},
});