styling: Enforced styling across all files (#55)

This commit is contained in:
Taso authored and GitHub committed 2021-01-12 21:31:03 -05:00
1 parent c9b3174505
commit 54daa42454
165 files changed
+1879 -1725

No files matched your search

+26 -26
View File
@@ -17,27 +17,27 @@ import {
faPhoneAlt,
faWonSign,
faStickyNote,
} from "@fortawesome/free-solid-svg-icons";
import { faTwitter } from "@fortawesome/free-brands-svg-icons";
} from '@fortawesome/free-solid-svg-icons';
import { faTwitter } from '@fortawesome/free-brands-svg-icons';
import ContactsIcon from "@material-ui/icons/Contacts";
import SettingsIcon from "@material-ui/icons/Settings";
import MessageIcon from "@material-ui/icons/Message";
import { atom } from "recoil";
import { CalculatorIcon } from "../../../apps/calculator/components/CalculatorIcon";
import ContactsIcon from '@material-ui/icons/Contacts';
import SettingsIcon from '@material-ui/icons/Settings';
import MessageIcon from '@material-ui/icons/Message';
import { atom } from 'recoil';
import { CalculatorIcon } from '../../../apps/calculator/components/CalculatorIcon';
import CameraAltIcon from '@material-ui/icons/CameraAlt';
import { Route } from "react-router-dom";
import { DialerApp } from "../../../apps/dialer/components/DialerApp";
import { ContactsApp } from "../../../apps/contacts/components/ContactsApp";
import { CalculatorApp } from "../../../apps/calculator/components/CalculatorApp";
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";
import { SelloutApp } from "../../../apps/sellout/components/SelloutApp";
import { NotesApp } from "../../../apps/notes/NotesApp";
import CameraApp from "../../../apps/camera/components/CameraApp";
import { Route } from 'react-router-dom';
import { DialerApp } from '../../../apps/dialer/components/DialerApp';
import { ContactsApp } from '../../../apps/contacts/components/ContactsApp';
import { CalculatorApp } from '../../../apps/calculator/components/CalculatorApp';
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';
import { SelloutApp } from '../../../apps/sellout/components/SelloutApp';
import { NotesApp } from '../../../apps/notes/NotesApp';
import CameraApp from '../../../apps/camera/components/CameraApp';
const appsState = atom({
key: 'apps',
@@ -125,18 +125,18 @@ const appsState = atom({
Route: () => <Route path='/notes' component={NotesApp} />,
},
{
id: "CAMERA",
id: 'CAMERA',
name: 'APPS_CAMERA',
icon: <CameraAltIcon fontSize="large"/>,
icon: <CameraAltIcon fontSize='large' />,
backgroundColor: grey['A400'],
color: common.white,
path: "/camera",
Route: () => <Route path="/camera" component={CameraApp} />
path: '/camera',
Route: () => <Route path='/camera' component={CameraApp} />,
},
{
id: "EXAMPLE",
nameLocale: "APPS_EXAMPLE",
icon: <FontAwesomeIcon icon={faPlaneArrival} size="sm" />,
id: 'EXAMPLE',
nameLocale: 'APPS_EXAMPLE',
icon: <FontAwesomeIcon icon={faPlaneArrival} size='sm' />,
backgroundColor: blue[500],
color: blue[50],
path: '/example',
+19 -19
View File
@@ -1,45 +1,45 @@
import { useEffect } from "react";
import { atom, useSetRecoilState, useRecoilValue } from "recoil";
import { useEffect } from 'react';
import { atom, useSetRecoilState, useRecoilValue } from 'recoil';
const keyboardState = {
ArrowRight: atom({
key: "ArrowRight",
key: 'ArrowRight',
default: null,
}),
ArrowLeft: atom({
key: "ArrowLeft",
key: 'ArrowLeft',
default: null,
}),
ArrowUp: atom({
key: "ArrowUp",
key: 'ArrowUp',
default: null,
}),
ArrowDown: atom({
key: "ArrowDown",
key: 'ArrowDown',
default: null,
}),
Backspace: atom({
key: "Backspace",
key: 'Backspace',
default: null,
}),
Enter: atom({
key: "Enter",
key: 'Enter',
default: null,
}),
Escape: atom({
key: "Escape",
key: 'Escape',
default: null,
}),
};
const validKeys = [
"ArrowRight",
"ArrowLeft",
"ArrowUp",
"ArrowDown",
"Backspace",
"Enter",
"Escape",
'ArrowRight',
'ArrowLeft',
'ArrowUp',
'ArrowDown',
'Backspace',
'Enter',
'Escape',
];
const isKeyValid = (key) => validKeys.indexOf(key) !== -1;
@@ -72,15 +72,15 @@ export const useInitKeyboard = () => {
}
}
window.addEventListener("keyup", onKeyUp);
return () => window.removeEventListener("keyup", onKeyUp);
window.addEventListener('keyup', onKeyUp);
return () => window.removeEventListener('keyup', onKeyUp);
},
[getters]
);
useEffect(
function registerEscapeHandler() {
setEscape({ handler: () => console.log("close phone") });
setEscape({ handler: () => console.log('close phone') });
},
[setEscape]
);
@@ -1,15 +1,15 @@
import React from "react";
import React from 'react';
import {
makeStyles,
BottomNavigation,
BottomNavigationAction,
} from "@material-ui/core";
import KeyboardArrowLeftIcon from "@material-ui/icons/KeyboardArrowLeft";
import AppsIcon from "@material-ui/icons/Apps";
import RadioButtonUncheckedIcon from "@material-ui/icons/RadioButtonUnchecked";
import { useHistory } from "react-router-dom";
} from '@material-ui/core';
import KeyboardArrowLeftIcon from '@material-ui/icons/KeyboardArrowLeft';
import AppsIcon from '@material-ui/icons/Apps';
import RadioButtonUncheckedIcon from '@material-ui/icons/RadioButtonUnchecked';
import { useHistory } from 'react-router-dom';
import Nui from "../../nui-events/utils/Nui";
import Nui from '../../nui-events/utils/Nui';
const useStyles = makeStyles((theme) => ({
root: {
@@ -20,8 +20,8 @@ const useStyles = makeStyles((theme) => ({
export const Navigation = () => {
const closePhone = () => {
console.log("Phone closed");
Nui.send("phone:close");
console.log('Phone closed');
Nui.send('phone:close');
};
const classes = useStyles();
@@ -32,17 +32,17 @@ export const Navigation = () => {
onChange={(_e, value) => value()}
>
<BottomNavigationAction
label="Home"
value={() => history.push("/")}
label='Home'
value={() => history.push('/')}
icon={<AppsIcon />}
/>
<BottomNavigationAction
label="Close"
label='Close'
value={() => closePhone()}
icon={<RadioButtonUncheckedIcon />}
/>
<BottomNavigationAction
label="Back"
label='Back'
value={() => history.goBack()}
icon={<KeyboardArrowLeftIcon />}
/>
@@ -1,5 +1,5 @@
import React from "react";
import React from 'react';
export const NotificationIcon = ({ Icon }) => {
return <Icon fontSize="small" />;
return <Icon fontSize='small' />;
};
+10 -6
View File
@@ -1,6 +1,5 @@
import { useEffect, useRef } from "react";
import { eventNameFactory } from "../utils/nuiUtils";
import { useEffect, useRef } from 'react';
import { eventNameFactory } from '../utils/nuiUtils';
interface IOptions {
capture?: boolean;
@@ -8,7 +7,12 @@ interface IOptions {
once?: boolean;
}
export const useNuiEvent = (app: any, method: any, handler: any, options: IOptions = {}) => {
export const useNuiEvent = (
app: any,
method: any,
handler: any,
options: IOptions = {}
) => {
const savedHandler: any = useRef();
const { capture, passive, once } = options;
@@ -18,7 +22,7 @@ export const useNuiEvent = (app: any, method: any, handler: any, options: IOptio
useEffect(() => {
const eventName = eventNameFactory(app, method);
const eventListener = (event: any ) => {
const eventListener = (event: any) => {
if (savedHandler.current && savedHandler.current.call) {
const { data } = event;
console.log(eventName, data);
@@ -29,4 +33,4 @@ export const useNuiEvent = (app: any, method: any, handler: any, options: IOptio
window.addEventListener(eventName, eventListener, opts);
return () => window.removeEventListener(eventName, eventListener, opts);
}, [app, method, capture, passive, once]);
};
};
@@ -1,5 +1,5 @@
import { useEffect } from "react";
import { eventNameFactory } from "../utils/nuiUtils";
import { useEffect } from 'react';
import { eventNameFactory } from '../utils/nuiUtils';
interface IOptions {
capture?: boolean;
@@ -21,7 +21,7 @@ export const useNuiService = (options: IOptions = {}) => {
};
useEffect(() => {
const opts = { capture, passive, once };
window.addEventListener("message", eventListener, opts);
return () => window.removeEventListener("message", eventListener, opts);
window.addEventListener('message', eventListener, opts);
return () => window.removeEventListener('message', eventListener, opts);
}, [capture, passive, once]);
};
};
+2 -2
View File
@@ -3,9 +3,9 @@ export default {
async send(event: any, data = {}) {
/* eslint-disable no-unreachable */
return fetch(`http://new-phone-who-dis/${event}`, {
method: "post",
method: 'post',
headers: {
"Content-Type": "application/json; charset=UTF-8",
'Content-Type': 'application/json; charset=UTF-8',
},
body: JSON.stringify(data),
});
+1 -1
View File
@@ -1,2 +1,2 @@
export const eventNameFactory = (app: any, method: any) => `${app}:${method}`;
export const eventNameMethod = (name: any) => name.split(":")[1] || null;
export const eventNameMethod = (name: any) => name.split(':')[1] || null;
+2 -2
View File
@@ -1,8 +1,8 @@
import { atom } from "recoil";
import { atom } from 'recoil';
export const simcardState = {
number: atom({
key: "simcardNumber",
key: 'simcardNumber',
default: null,
}),
};
+2 -2
View File
@@ -1,5 +1,5 @@
import { useRecoilValue } from "recoil";
import { simcardState } from "./state";
import { useRecoilValue } from 'recoil';
import { simcardState } from './state';
export const useSimcard = () => {
const number = useRecoilValue(simcardState.number);
@@ -1,10 +1,10 @@
import { useNuiEvent } from "../../nui-events/hooks/useNuiEvent";
import { useSetRecoilState } from "recoil";
import { simcardState } from "./state";
import { useSimcard } from "./useSimcard";
import { useNuiEvent } from '../../nui-events/hooks/useNuiEvent';
import { useSetRecoilState } from 'recoil';
import { simcardState } from './state';
import { useSimcard } from './useSimcard';
export const useSimcardService = () => {
const setNumber = useSetRecoilState(simcardState.number);
useNuiEvent("SIMCARD", "setNumber", setNumber);
useNuiEvent('SIMCARD', 'setNumber', setNumber);
return useSimcard();
};