From 3e03993d5bf8964cdfa959dbe2261a377b0421d1 Mon Sep 17 00:00:00 2001 From: Christopher Date: Sun, 13 Dec 2020 21:59:10 +0100 Subject: [PATCH 01/23] feat(settings): using local storage to save settings Need to ensure that when a new setting is set, we re-render the phone. --- phone/src/Phone.tsx | 12 +++++-- .../apps/settings/components/SettingsApp.tsx | 34 ++++++++++++------- phone/src/apps/settings/hooks/useSettings.ts | 17 ++++++---- phone/src/config/hooks/useConfig.ts | 14 ++++---- phone/src/os/phone/hooks/useLocalStorage.ts | 22 +++++++++--- 5 files changed, 65 insertions(+), 34 deletions(-) diff --git a/phone/src/Phone.tsx b/phone/src/Phone.tsx index 5ae11c6..09a5bb6 100644 --- a/phone/src/Phone.tsx +++ b/phone/src/Phone.tsx @@ -25,6 +25,7 @@ import { useNotesService } from './apps/notes/hooks/useNotesService'; import { usePhotoService } from './apps/camera/hooks/usePhotoService'; import Nui from './os/nui-events/utils/Nui'; import { usePhone } from './os/phone/hooks/usePhone'; +import useLocalStorage from './os/phone/hooks/useLocalStorage'; // Inject mock data when in development env. if (process.env.NODE_ENV === 'development') { @@ -245,6 +246,7 @@ function Phone() { useNuiService(); usePhoneService(); const { visibility } = usePhone(); + const [, , getStorageItem] = useLocalStorage(); const { settings, currentTheme } = useSettings(); const { allApps } = useApps(); useSimcardService(); @@ -272,19 +274,23 @@ function Phone() { return (
-
+
<> diff --git a/phone/src/apps/settings/components/SettingsApp.tsx b/phone/src/apps/settings/components/SettingsApp.tsx index f8071ca..ac7eaeb 100644 --- a/phone/src/apps/settings/components/SettingsApp.tsx +++ b/phone/src/apps/settings/components/SettingsApp.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useState } from 'react'; import { AppWrapper } from '../../../ui/components'; import { AppTitle } from '../../../ui/components/AppTitle'; import { AppContent } from '../../../ui/components/AppContent'; @@ -24,6 +24,7 @@ import { } from '@material-ui/icons'; import { ListSubheader } from '@material-ui/core'; +import useLocalStorage from '../../../os/phone/hooks/useLocalStorage'; const SubHeaderComp = (props: { text: string }) => ( @@ -35,26 +36,33 @@ export const SettingsApp = () => { const settingsApp = useApp('SETTINGS'); const [config] = useConfig(); const { setSettings, settings } = useSettings(); + const [, setVal, getStorageItem] = useLocalStorage(); const simcard = useSimcard(); const wallpapers = config.wallpapers.map( - MapStringOptions(settings.wallpaper, (val: string) => - setSettings('wallpaper', val) + MapStringOptions(getStorageItem('wallpaper'), (val: string) => + setVal('wallpaper', val) ) ); const frames = config.frames.map( - MapStringOptions(settings.frame, (val: string) => setSettings('frame', val)) + MapStringOptions(getStorageItem('frame'), (val: string) => + setVal('frame', val) + ) ); const themes = Object.keys(config.themes).map( - MapStringOptions(settings.theme, (val: string) => setSettings('theme', val)) + MapStringOptions(getStorageItem('theme'), (val: string) => + setVal('theme', val) + ) ); const zoomOptions = config.zoomOptions.map( - MapStringOptions(settings.zoom, (val: string) => setSettings('zoom', val)) + MapStringOptions(getStorageItem('zoom'), (val: string) => + setVal('zoom', val) + ) ); // Doesn't actually do anything for the time being const ringtones = config.ringtones.map( - MapStringOptions(settings.ringtone, (val: string) => - setSettings('ringtone', val) + MapStringOptions(getStorageItem('ringtone'), (val: string) => + setVal('ringtone', val) ) ); // * Probably gonna make this a slider component in the future @@ -77,7 +85,7 @@ export const SettingsApp = () => { /> } @@ -97,28 +105,28 @@ export const SettingsApp = () => { }> } /> } /> } /> } diff --git a/phone/src/apps/settings/hooks/useSettings.ts b/phone/src/apps/settings/hooks/useSettings.ts index 61def22..8ef1312 100644 --- a/phone/src/apps/settings/hooks/useSettings.ts +++ b/phone/src/apps/settings/hooks/useSettings.ts @@ -1,16 +1,19 @@ -import Default from "../default.json"; -import { useConfig } from "../../../config/hooks/useConfig"; -import { atom } from "recoil"; -import { createMuiTheme } from "@material-ui/core"; +import Default from '../default.json'; +import { useConfig } from '../../../config/hooks/useConfig'; +import { atom } from 'recoil'; +import { createMuiTheme } from '@material-ui/core'; +import useLocalStorage from '../../../os/phone/hooks/useLocalStorage'; const settingsState = atom({ - key: "settings", + key: 'settings', default: Default, }); export const useSettings = (): any => { - const [settings, setSettings] = useConfig(settingsState); + const [, , getStorageItem] = useLocalStorage('theme', 'taso-dark'); + const [settings, setSettings] = useLocalStorage(); const [config] = useConfig(); - const currentTheme = () => createMuiTheme(config.themes[settings.theme]); + const currentTheme = () => + createMuiTheme(config.themes[getStorageItem('theme')]); return { settings, setSettings, currentTheme }; }; diff --git a/phone/src/config/hooks/useConfig.ts b/phone/src/config/hooks/useConfig.ts index 87e2fcf..617940e 100644 --- a/phone/src/config/hooks/useConfig.ts +++ b/phone/src/config/hooks/useConfig.ts @@ -1,19 +1,19 @@ -import Default from "../default.json"; -import { atom, useRecoilState } from "recoil"; +import Default from '../default.json'; +import { atom, useRecoilState } from 'recoil'; +import useLocalStorage from '../../os/phone/hooks/useLocalStorage'; const configState = atom({ - key: "config", + key: 'config', default: Default, }); export const useConfig = (state: any = configState): any => { + const [, setVal] = useLocalStorage(); const [config, _setConfig] = useRecoilState(state); const setConfig = (key, value) => { - _setConfig((oldConfig) => ({ - ...oldConfig, - [key]: value, - })); + console.log(`setConfig: ${key} ${value}`); + setVal(key, value); }; return [config, setConfig]; diff --git a/phone/src/os/phone/hooks/useLocalStorage.ts b/phone/src/os/phone/hooks/useLocalStorage.ts index ab5a4b0..9c8bd80 100644 --- a/phone/src/os/phone/hooks/useLocalStorage.ts +++ b/phone/src/os/phone/hooks/useLocalStorage.ts @@ -9,7 +9,7 @@ import { useState } from 'react'; * if there is no savedState */ -function useLocalStorage(key: string, initialValue: T) { +function useLocalStorage(key?: string, initialValue?: T) { // Serves as a nice identifying prefix for the key const UNIQ_PREFIX = 'npwd_phone_'; const [localVal, setLocalVal] = useState(() => { @@ -25,8 +25,22 @@ function useLocalStorage(key: string, initialValue: T) { } }); + const getStorageItem = (localKey: string) => { + try { + const data = window.localStorage.getItem(UNIQ_PREFIX + localKey); + // return stored or initValue if none stored + return data ? JSON.parse(data) : initialValue; + } catch (e) { + // TODO: Integrate debug error state here + console.log(e); + // We still return initVal if error is thrown + return initialValue; + } + }; + // Trying to rep useState setter pretty close just with localStorage - const setVal = (value: T | ((val: T) => T)) => { + const setVal = (localKey, value: T | ((val: T) => T)) => { + console.log(localKey, value); try { // Same API as useState meaning we can accept a function for value const valForStore = value instanceof Function ? value(localVal) : value; @@ -34,7 +48,7 @@ function useLocalStorage(key: string, initialValue: T) { setLocalVal(valForStore); // Set that localStorage yo window.localStorage.setItem( - UNIQ_PREFIX + key, + UNIQ_PREFIX + localKey, JSON.stringify(valForStore) ); } catch (e) { @@ -43,7 +57,7 @@ function useLocalStorage(key: string, initialValue: T) { } }; - return [localVal, setVal]; + return [localVal, setVal, getStorageItem] as const; } export default useLocalStorage; From 14223c9800cf7efbc4e0432d50e89ca987f0a2f2 Mon Sep 17 00:00:00 2001 From: Christopher Date: Mon, 14 Dec 2020 20:27:59 +0100 Subject: [PATCH 02/23] feat(idontknowwhatthisis) --- phone/src/apps/settings/components/SettingsApp.tsx | 9 +++++++-- phone/src/config/hooks/useConfig.ts | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/phone/src/apps/settings/components/SettingsApp.tsx b/phone/src/apps/settings/components/SettingsApp.tsx index ac7eaeb..5d589e7 100644 --- a/phone/src/apps/settings/components/SettingsApp.tsx +++ b/phone/src/apps/settings/components/SettingsApp.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { AppWrapper } from '../../../ui/components'; import { AppTitle } from '../../../ui/components/AppTitle'; import { AppContent } from '../../../ui/components/AppContent'; @@ -36,9 +36,14 @@ export const SettingsApp = () => { const settingsApp = useApp('SETTINGS'); const [config] = useConfig(); const { setSettings, settings } = useSettings(); - const [, setVal, getStorageItem] = useLocalStorage(); + const [localVal, setVal, getStorageItem] = useLocalStorage(); const simcard = useSimcard(); + useEffect(() => { + console.log('new localstorage'); + // this will be used to trigger a alert that gives feedback when the a setting is changed + }, [localVal]); + const wallpapers = config.wallpapers.map( MapStringOptions(getStorageItem('wallpaper'), (val: string) => setVal('wallpaper', val) diff --git a/phone/src/config/hooks/useConfig.ts b/phone/src/config/hooks/useConfig.ts index 617940e..ab2b06e 100644 --- a/phone/src/config/hooks/useConfig.ts +++ b/phone/src/config/hooks/useConfig.ts @@ -9,7 +9,7 @@ const configState = atom({ export const useConfig = (state: any = configState): any => { const [, setVal] = useLocalStorage(); - const [config, _setConfig] = useRecoilState(state); + const [config] = useRecoilState(state); const setConfig = (key, value) => { console.log(`setConfig: ${key} ${value}`); From dddddc01f83116316ce8bc83a48adc83cf76bd5c Mon Sep 17 00:00:00 2001 From: Christopher Date: Mon, 4 Jan 2021 20:33:53 +0100 Subject: [PATCH 03/23] feat(localstorage): resolved issue with phone not re-rendering --- phone/src/apps/settings/components/SettingItem.tsx | 1 + phone/src/apps/settings/components/SettingsApp.tsx | 10 ++++------ phone/src/os/phone/hooks/forceUpdate.ts | 7 +++++++ phone/src/os/phone/hooks/state.ts | 4 ++++ phone/src/os/phone/hooks/useLocalStorage.ts | 3 +++ 5 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 phone/src/os/phone/hooks/forceUpdate.ts diff --git a/phone/src/apps/settings/components/SettingItem.tsx b/phone/src/apps/settings/components/SettingItem.tsx index 8dd485c..6665acf 100644 --- a/phone/src/apps/settings/components/SettingItem.tsx +++ b/phone/src/apps/settings/components/SettingItem.tsx @@ -6,6 +6,7 @@ import { ListItemIcon, } from '@material-ui/core'; import { SvgIconProps } from '@material-ui/core'; + interface IProps { options?: any; label: string; diff --git a/phone/src/apps/settings/components/SettingsApp.tsx b/phone/src/apps/settings/components/SettingsApp.tsx index 5d589e7..fc307e1 100644 --- a/phone/src/apps/settings/components/SettingsApp.tsx +++ b/phone/src/apps/settings/components/SettingsApp.tsx @@ -35,15 +35,9 @@ const SubHeaderComp = (props: { text: string }) => ( export const SettingsApp = () => { const settingsApp = useApp('SETTINGS'); const [config] = useConfig(); - const { setSettings, settings } = useSettings(); const [localVal, setVal, getStorageItem] = useLocalStorage(); const simcard = useSimcard(); - useEffect(() => { - console.log('new localstorage'); - // this will be used to trigger a alert that gives feedback when the a setting is changed - }, [localVal]); - const wallpapers = config.wallpapers.map( MapStringOptions(getStorageItem('wallpaper'), (val: string) => setVal('wallpaper', val) @@ -77,6 +71,10 @@ export const SettingsApp = () => { // TODO: These new settings all work + useEffect(() => { + // this will be used to trigger a alert that gives feedback when the a setting is changed + }, [setVal]); + const [openMenu, closeMenu, ContextMenu, isMenuOpen] = useContextMenu(); return ( diff --git a/phone/src/os/phone/hooks/forceUpdate.ts b/phone/src/os/phone/hooks/forceUpdate.ts new file mode 100644 index 0000000..ebf5e3c --- /dev/null +++ b/phone/src/os/phone/hooks/forceUpdate.ts @@ -0,0 +1,7 @@ +import { useRecoilState } from 'recoil'; +import { phoneState } from './state'; + +export const useForceUpdate = () => { + const [update, setUpdate] = useRecoilState(phoneState.forceUpdateState); + return { update, setUpdate }; +}; diff --git a/phone/src/os/phone/hooks/state.ts b/phone/src/os/phone/hooks/state.ts index 5c37fb6..1dc0ad3 100644 --- a/phone/src/os/phone/hooks/state.ts +++ b/phone/src/os/phone/hooks/state.ts @@ -9,4 +9,8 @@ export const phoneState = { key: 'phoneConfig', default: undefined, }), + forceUpdateState: atom({ + key: 'fuckingupdate', + default: 0, + }), }; diff --git a/phone/src/os/phone/hooks/useLocalStorage.ts b/phone/src/os/phone/hooks/useLocalStorage.ts index 9c8bd80..fab9019 100644 --- a/phone/src/os/phone/hooks/useLocalStorage.ts +++ b/phone/src/os/phone/hooks/useLocalStorage.ts @@ -1,4 +1,5 @@ import { useState } from 'react'; +import { useForceUpdate } from '../../../os/phone/hooks/forceUpdate'; // TODO: Integrate debug log to fetch when that branch is merged @@ -10,6 +11,7 @@ import { useState } from 'react'; */ function useLocalStorage(key?: string, initialValue?: T) { + const { update, setUpdate } = useForceUpdate(); // Serves as a nice identifying prefix for the key const UNIQ_PREFIX = 'npwd_phone_'; const [localVal, setLocalVal] = useState(() => { @@ -42,6 +44,7 @@ function useLocalStorage(key?: string, initialValue?: T) { const setVal = (localKey, value: T | ((val: T) => T)) => { console.log(localKey, value); try { + setUpdate(update + 1); // Same API as useState meaning we can accept a function for value const valForStore = value instanceof Function ? value(localVal) : value; // Save that state so we repli useState From 07dc73f0cbb4c3eae4e5ac47aed17d11195260c3 Mon Sep 17 00:00:00 2001 From: Christopher Date: Thu, 7 Jan 2021 21:17:44 +0100 Subject: [PATCH 04/23] minor changes in localStorage - nothing to see here --- phone/src/Phone.tsx | 3 +-- phone/src/apps/settings/hooks/useSettings.ts | 6 ++--- phone/src/config/hooks/useConfig.ts | 11 ++++++---- phone/src/os/phone/hooks/getLocalStorage.ts | 12 ++++++++++ phone/src/os/phone/hooks/settingState.ts | 12 ++++++++++ phone/src/os/phone/hooks/useLocalStorage.ts | 23 +++----------------- 6 files changed, 38 insertions(+), 29 deletions(-) create mode 100644 phone/src/os/phone/hooks/getLocalStorage.ts create mode 100644 phone/src/os/phone/hooks/settingState.ts diff --git a/phone/src/Phone.tsx b/phone/src/Phone.tsx index 09a5bb6..9da3827 100644 --- a/phone/src/Phone.tsx +++ b/phone/src/Phone.tsx @@ -25,7 +25,7 @@ import { useNotesService } from './apps/notes/hooks/useNotesService'; import { usePhotoService } from './apps/camera/hooks/usePhotoService'; import Nui from './os/nui-events/utils/Nui'; import { usePhone } from './os/phone/hooks/usePhone'; -import useLocalStorage from './os/phone/hooks/useLocalStorage'; +import { getStorageItem } from './os/phone/hooks/getLocalStorage'; // Inject mock data when in development env. if (process.env.NODE_ENV === 'development') { @@ -246,7 +246,6 @@ function Phone() { useNuiService(); usePhoneService(); const { visibility } = usePhone(); - const [, , getStorageItem] = useLocalStorage(); const { settings, currentTheme } = useSettings(); const { allApps } = useApps(); useSimcardService(); diff --git a/phone/src/apps/settings/hooks/useSettings.ts b/phone/src/apps/settings/hooks/useSettings.ts index 8ef1312..c472605 100644 --- a/phone/src/apps/settings/hooks/useSettings.ts +++ b/phone/src/apps/settings/hooks/useSettings.ts @@ -3,6 +3,7 @@ import { useConfig } from '../../../config/hooks/useConfig'; import { atom } from 'recoil'; import { createMuiTheme } from '@material-ui/core'; import useLocalStorage from '../../../os/phone/hooks/useLocalStorage'; +import { getStorageItem } from '../../../os/phone/hooks/getLocalStorage'; const settingsState = atom({ key: 'settings', @@ -10,10 +11,9 @@ const settingsState = atom({ }); export const useSettings = (): any => { - const [, , getStorageItem] = useLocalStorage('theme', 'taso-dark'); + const theme = getStorageItem('theme'); const [settings, setSettings] = useLocalStorage(); const [config] = useConfig(); - const currentTheme = () => - createMuiTheme(config.themes[getStorageItem('theme')]); + const currentTheme = () => createMuiTheme(config.themes[theme]); return { settings, setSettings, currentTheme }; }; diff --git a/phone/src/config/hooks/useConfig.ts b/phone/src/config/hooks/useConfig.ts index ab2b06e..02f15e7 100644 --- a/phone/src/config/hooks/useConfig.ts +++ b/phone/src/config/hooks/useConfig.ts @@ -8,12 +8,15 @@ const configState = atom({ }); export const useConfig = (state: any = configState): any => { - const [, setVal] = useLocalStorage(); - const [config] = useRecoilState(state); + const [, setVal] = useLocalStorage(''); + const [config, _setConfig] = useRecoilState(state); const setConfig = (key, value) => { - console.log(`setConfig: ${key} ${value}`); - setVal(key, value); + _setConfig((oldConfig) => ({ + ...oldConfig, + [key]: value, + })); + //setVal(key, value); }; return [config, setConfig]; diff --git a/phone/src/os/phone/hooks/getLocalStorage.ts b/phone/src/os/phone/hooks/getLocalStorage.ts new file mode 100644 index 0000000..84e2838 --- /dev/null +++ b/phone/src/os/phone/hooks/getLocalStorage.ts @@ -0,0 +1,12 @@ +export const getStorageItem = (key: string) => { + const UNIQ_PREFIX = 'npwd_phone_'; + try { + const data = window.localStorage.getItem(UNIQ_PREFIX + key); + // return stored or initValue if none stored + return JSON.parse(data); + } catch (e) { + // TODO: Integrate debug error state here + console.log(e); + // We still return initVal if error is thrown + } +}; diff --git a/phone/src/os/phone/hooks/settingState.ts b/phone/src/os/phone/hooks/settingState.ts new file mode 100644 index 0000000..a8edf73 --- /dev/null +++ b/phone/src/os/phone/hooks/settingState.ts @@ -0,0 +1,12 @@ +import { atom } from 'recoil'; + +export const phoneSettings = { + theme: atom({ + key: 'settingTheme', + default: 'default-dark', + }), + zoom: atom({ + key: 'settingZoom', + default: '100%', + }), +}; diff --git a/phone/src/os/phone/hooks/useLocalStorage.ts b/phone/src/os/phone/hooks/useLocalStorage.ts index fab9019..042acf3 100644 --- a/phone/src/os/phone/hooks/useLocalStorage.ts +++ b/phone/src/os/phone/hooks/useLocalStorage.ts @@ -1,5 +1,4 @@ import { useState } from 'react'; -import { useForceUpdate } from '../../../os/phone/hooks/forceUpdate'; // TODO: Integrate debug log to fetch when that branch is merged @@ -11,7 +10,6 @@ import { useForceUpdate } from '../../../os/phone/hooks/forceUpdate'; */ function useLocalStorage(key?: string, initialValue?: T) { - const { update, setUpdate } = useForceUpdate(); // Serves as a nice identifying prefix for the key const UNIQ_PREFIX = 'npwd_phone_'; const [localVal, setLocalVal] = useState(() => { @@ -27,31 +25,16 @@ function useLocalStorage(key?: string, initialValue?: T) { } }); - const getStorageItem = (localKey: string) => { - try { - const data = window.localStorage.getItem(UNIQ_PREFIX + localKey); - // return stored or initValue if none stored - return data ? JSON.parse(data) : initialValue; - } catch (e) { - // TODO: Integrate debug error state here - console.log(e); - // We still return initVal if error is thrown - return initialValue; - } - }; - // Trying to rep useState setter pretty close just with localStorage - const setVal = (localKey, value: T | ((val: T) => T)) => { - console.log(localKey, value); + const setVal = (value: T | ((val: T) => T)) => { try { - setUpdate(update + 1); // Same API as useState meaning we can accept a function for value const valForStore = value instanceof Function ? value(localVal) : value; // Save that state so we repli useState setLocalVal(valForStore); // Set that localStorage yo window.localStorage.setItem( - UNIQ_PREFIX + localKey, + UNIQ_PREFIX + key, JSON.stringify(valForStore) ); } catch (e) { @@ -60,7 +43,7 @@ function useLocalStorage(key?: string, initialValue?: T) { } }; - return [localVal, setVal, getStorageItem] as const; + return [localVal, setVal] as const; } export default useLocalStorage; From 5fdb9ba21c098ee436bf55031c05a396bc9b0043 Mon Sep 17 00:00:00 2001 From: Christopher Date: Fri, 8 Jan 2021 21:48:24 +0100 Subject: [PATCH 05/23] fix(localStorage): solution to localStorage issue Still need to find a good way to re-render --- phone/src/Phone.tsx | 10 ++--- .../apps/settings/components/SettingsApp.tsx | 40 +++++++++---------- phone/src/apps/settings/hooks/useSettings.ts | 10 ++--- phone/src/config/hooks/useConfig.ts | 1 - phone/src/os/phone/hooks/forceUpdate.ts | 7 ---- phone/src/os/phone/hooks/getLocalStorage.ts | 12 ------ phone/src/os/phone/hooks/useLocalStorage.ts | 24 ++++++++++- 7 files changed, 51 insertions(+), 53 deletions(-) delete mode 100644 phone/src/os/phone/hooks/forceUpdate.ts delete mode 100644 phone/src/os/phone/hooks/getLocalStorage.ts diff --git a/phone/src/Phone.tsx b/phone/src/Phone.tsx index 9da3827..9627e86 100644 --- a/phone/src/Phone.tsx +++ b/phone/src/Phone.tsx @@ -25,7 +25,7 @@ import { useNotesService } from './apps/notes/hooks/useNotesService'; import { usePhotoService } from './apps/camera/hooks/usePhotoService'; import Nui from './os/nui-events/utils/Nui'; import { usePhone } from './os/phone/hooks/usePhone'; -import { getStorageItem } from './os/phone/hooks/getLocalStorage'; +import { getStorage } from './os/phone/hooks/useLocalStorage'; // Inject mock data when in development env. if (process.env.NODE_ENV === 'development') { @@ -273,21 +273,19 @@ function Phone() { return (
-
+
( @@ -35,33 +38,32 @@ const SubHeaderComp = (props: { text: string }) => ( export const SettingsApp = () => { const settingsApp = useApp('SETTINGS'); const [config] = useConfig(); - const [localVal, setVal, getStorageItem] = useLocalStorage(); const simcard = useSimcard(); const wallpapers = config.wallpapers.map( - MapStringOptions(getStorageItem('wallpaper'), (val: string) => - setVal('wallpaper', val) + MapStringOptions(getStorage('wallpaper'), (val: string) => + writeStorage('wallpaper', val) ) ); const frames = config.frames.map( - MapStringOptions(getStorageItem('frame'), (val: string) => - setVal('frame', val) + MapStringOptions(getStorage('frame'), (val: string) => + writeStorage('frame', val) ) ); const themes = Object.keys(config.themes).map( - MapStringOptions(getStorageItem('theme'), (val: string) => - setVal('theme', val) + MapStringOptions(getStorage('theme'), (val: string) => + writeStorage('theme', val) ) ); const zoomOptions = config.zoomOptions.map( - MapStringOptions(getStorageItem('zoom'), (val: string) => - setVal('zoom', val) + MapStringOptions(getStorage('zoom'), (val: string) => + writeStorage('zoom', val) ) ); // Doesn't actually do anything for the time being const ringtones = config.ringtones.map( - MapStringOptions(getStorageItem('ringtone'), (val: string) => - setVal('ringtone', val) + MapStringOptions(getStorage('ringtone'), (val: string) => + writeStorage('ringtone', val) ) ); // * Probably gonna make this a slider component in the future @@ -71,9 +73,7 @@ export const SettingsApp = () => { // TODO: These new settings all work - useEffect(() => { - // this will be used to trigger a alert that gives feedback when the a setting is changed - }, [setVal]); + useEffect(() => {}, [getStorage]); const [openMenu, closeMenu, ContextMenu, isMenuOpen] = useContextMenu(); return ( @@ -88,7 +88,7 @@ export const SettingsApp = () => { /> } @@ -108,28 +108,28 @@ export const SettingsApp = () => { }> } /> } /> } /> } diff --git a/phone/src/apps/settings/hooks/useSettings.ts b/phone/src/apps/settings/hooks/useSettings.ts index c472605..dceedfe 100644 --- a/phone/src/apps/settings/hooks/useSettings.ts +++ b/phone/src/apps/settings/hooks/useSettings.ts @@ -2,8 +2,9 @@ import Default from '../default.json'; import { useConfig } from '../../../config/hooks/useConfig'; import { atom } from 'recoil'; import { createMuiTheme } from '@material-ui/core'; -import useLocalStorage from '../../../os/phone/hooks/useLocalStorage'; -import { getStorageItem } from '../../../os/phone/hooks/getLocalStorage'; +import useLocalStorage, { + getStorage, +} from '../../../os/phone/hooks/useLocalStorage'; const settingsState = atom({ key: 'settings', @@ -11,9 +12,8 @@ const settingsState = atom({ }); export const useSettings = (): any => { - const theme = getStorageItem('theme'); - const [settings, setSettings] = useLocalStorage(); + const theme = getStorage('theme'); const [config] = useConfig(); const currentTheme = () => createMuiTheme(config.themes[theme]); - return { settings, setSettings, currentTheme }; + return { currentTheme }; }; diff --git a/phone/src/config/hooks/useConfig.ts b/phone/src/config/hooks/useConfig.ts index 02f15e7..59785dd 100644 --- a/phone/src/config/hooks/useConfig.ts +++ b/phone/src/config/hooks/useConfig.ts @@ -8,7 +8,6 @@ const configState = atom({ }); export const useConfig = (state: any = configState): any => { - const [, setVal] = useLocalStorage(''); const [config, _setConfig] = useRecoilState(state); const setConfig = (key, value) => { diff --git a/phone/src/os/phone/hooks/forceUpdate.ts b/phone/src/os/phone/hooks/forceUpdate.ts deleted file mode 100644 index ebf5e3c..0000000 --- a/phone/src/os/phone/hooks/forceUpdate.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { useRecoilState } from 'recoil'; -import { phoneState } from './state'; - -export const useForceUpdate = () => { - const [update, setUpdate] = useRecoilState(phoneState.forceUpdateState); - return { update, setUpdate }; -}; diff --git a/phone/src/os/phone/hooks/getLocalStorage.ts b/phone/src/os/phone/hooks/getLocalStorage.ts deleted file mode 100644 index 84e2838..0000000 --- a/phone/src/os/phone/hooks/getLocalStorage.ts +++ /dev/null @@ -1,12 +0,0 @@ -export const getStorageItem = (key: string) => { - const UNIQ_PREFIX = 'npwd_phone_'; - try { - const data = window.localStorage.getItem(UNIQ_PREFIX + key); - // return stored or initValue if none stored - return JSON.parse(data); - } catch (e) { - // TODO: Integrate debug error state here - console.log(e); - // We still return initVal if error is thrown - } -}; diff --git a/phone/src/os/phone/hooks/useLocalStorage.ts b/phone/src/os/phone/hooks/useLocalStorage.ts index 042acf3..2467a98 100644 --- a/phone/src/os/phone/hooks/useLocalStorage.ts +++ b/phone/src/os/phone/hooks/useLocalStorage.ts @@ -9,7 +9,7 @@ import { useState } from 'react'; * if there is no savedState */ -function useLocalStorage(key?: string, initialValue?: T) { +function useLocalStorage(key: string, initialValue: T) { // Serves as a nice identifying prefix for the key const UNIQ_PREFIX = 'npwd_phone_'; const [localVal, setLocalVal] = useState(() => { @@ -43,7 +43,27 @@ function useLocalStorage(key?: string, initialValue?: T) { } }; - return [localVal, setVal] as const; + return [localVal, setVal]; } +export const writeStorage = (key: string, value: T) => { + const UNIQ_PREFIX = 'npwd_phone_'; + + try { + window.localStorage.setItem(UNIQ_PREFIX + key, JSON.stringify(value)); + } catch (error) { + console.log(error); + } +}; + +export const getStorage = (key: string) => { + const UNIQ_PREFIX = 'npwd_phone_'; + try { + const data = window.localStorage.getItem(UNIQ_PREFIX + key); + return JSON.parse(data); + } catch (error) { + console.log(error); + } +}; + export default useLocalStorage; From 6458bce17f111506667ccbab3ace076777fda293 Mon Sep 17 00:00:00 2001 From: Christopher Date: Sat, 9 Jan 2021 18:45:18 +0100 Subject: [PATCH 06/23] tweak(settings): switced to useLocalStorage hook --- .../apps/settings/components/SettingsApp.tsx | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/phone/src/apps/settings/components/SettingsApp.tsx b/phone/src/apps/settings/components/SettingsApp.tsx index 3db5d88..0cd327b 100644 --- a/phone/src/apps/settings/components/SettingsApp.tsx +++ b/phone/src/apps/settings/components/SettingsApp.tsx @@ -40,31 +40,30 @@ export const SettingsApp = () => { const [config] = useConfig(); const simcard = useSimcard(); + const [wallpaper, setWallpaper] = useLocalStorage( + 'wallpaper', + 'surf.jpg' + ); + const [frame, setFrame] = useLocalStorage('frame', 's10.png'); + const [theme, setTheme] = useLocalStorage('theme', 'default-dark'); + const [zoom, setZoom] = useLocalStorage('zoom', '100%'); + const [ringtone, setRingtone] = useLocalStorage('ringtone', ''); + const wallpapers = config.wallpapers.map( - MapStringOptions(getStorage('wallpaper'), (val: string) => - writeStorage('wallpaper', val) - ) + MapStringOptions(wallpaper, (val: string) => setWallpaper(val)) ); const frames = config.frames.map( - MapStringOptions(getStorage('frame'), (val: string) => - writeStorage('frame', val) - ) + MapStringOptions(frame, (val: string) => setFrame(val)) ); const themes = Object.keys(config.themes).map( - MapStringOptions(getStorage('theme'), (val: string) => - writeStorage('theme', val) - ) + MapStringOptions(theme, (val: string) => setTheme(val)) ); const zoomOptions = config.zoomOptions.map( - MapStringOptions(getStorage('zoom'), (val: string) => - writeStorage('zoom', val) - ) + MapStringOptions(zoom, (val: string) => setZoom(val)) ); // Doesn't actually do anything for the time being const ringtones = config.ringtones.map( - MapStringOptions(getStorage('ringtone'), (val: string) => - writeStorage('ringtone', val) - ) + MapStringOptions(ringtone, (val: string) => setRingtone(val)) ); // * Probably gonna make this a slider component in the future // const ringtoneVols = config.ringtoneVols.map( From 5af6e4936def7713f83d34f770f5c1718c6fd8f5 Mon Sep 17 00:00:00 2001 From: Christopher Date: Sat, 9 Jan 2021 20:09:30 +0100 Subject: [PATCH 07/23] feat(settings): utilze useLocalStorage --- .../apps/settings/components/SettingsApp.tsx | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/phone/src/apps/settings/components/SettingsApp.tsx b/phone/src/apps/settings/components/SettingsApp.tsx index 0cd327b..1604349 100644 --- a/phone/src/apps/settings/components/SettingsApp.tsx +++ b/phone/src/apps/settings/components/SettingsApp.tsx @@ -24,10 +24,7 @@ import { } from '@material-ui/icons'; import { ListSubheader } from '@material-ui/core'; -import useLocalStorage, { - writeStorage, - getStorage, -} from '../../../os/phone/hooks/useLocalStorage'; +import useLocalStorage from '../../../os/phone/hooks/useLocalStorage'; const SubHeaderComp = (props: { text: string }) => ( @@ -72,7 +69,7 @@ export const SettingsApp = () => { // TODO: These new settings all work - useEffect(() => {}, [getStorage]); + useEffect(() => {}, [theme]); const [openMenu, closeMenu, ContextMenu, isMenuOpen] = useContextMenu(); return ( @@ -87,7 +84,7 @@ export const SettingsApp = () => { /> } @@ -107,28 +104,28 @@ export const SettingsApp = () => { }> } /> } /> } /> } From d07b5496b11292f3fdaff1fe1ae6d8d96695f90a Mon Sep 17 00:00:00 2001 From: Taso Date: Sun, 10 Jan 2021 17:00:44 -0500 Subject: [PATCH 08/23] chore: removed unused .lua files that caused confusions for locales pr's --- resources/client/cl_call.lua | 19 ------------------- resources/locales/en.lua | 3 --- resources/locales/es.lua | 3 --- resources/locales/fr.lua | 3 --- resources/locales/sv.lua | 3 --- resources/locales/tr.lua | 3 --- 6 files changed, 34 deletions(-) delete mode 100644 resources/client/cl_call.lua delete mode 100644 resources/locales/en.lua delete mode 100644 resources/locales/es.lua delete mode 100644 resources/locales/fr.lua delete mode 100644 resources/locales/sv.lua delete mode 100644 resources/locales/tr.lua diff --git a/resources/client/cl_call.lua b/resources/client/cl_call.lua deleted file mode 100644 index 6b710c2..0000000 --- a/resources/client/cl_call.lua +++ /dev/null @@ -1,19 +0,0 @@ -ESX = nil - -Citizen.CreateThread(function() - while ESX == nil do - TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) - Citizen.Wait(0) - end -end) - -RegisterNUICallback('phone:startCall', function(data) - local phoneNumber = data.number - TriggerServerEvent('phone:beginCall', phoneNumber) -end) - -RegisterNetEvent('phone:startCall') -AddEventHandler('phone:startCall', function(partner, phoneNumber, id) - print('You are talking to ' .. partner .. ', who has the number: ' .. phoneNumber); - exports["mumble-voip"]:SetCallChannel(id+1) -end) diff --git a/resources/locales/en.lua b/resources/locales/en.lua deleted file mode 100644 index f1e430e..0000000 --- a/resources/locales/en.lua +++ /dev/null @@ -1,3 +0,0 @@ -Locales['en'] = { - ['keymap_phone'] = 'Toggle Phone', -} \ No newline at end of file diff --git a/resources/locales/es.lua b/resources/locales/es.lua deleted file mode 100644 index 56944a9..0000000 --- a/resources/locales/es.lua +++ /dev/null @@ -1,3 +0,0 @@ -Locales['es'] = { - ['keymap_phone'] = 'Fijar celular', -} \ No newline at end of file diff --git a/resources/locales/fr.lua b/resources/locales/fr.lua deleted file mode 100644 index cf6f9ac..0000000 --- a/resources/locales/fr.lua +++ /dev/null @@ -1,3 +0,0 @@ -Locales['fr'] = { - ['keymap_phone'] = 'Utiliser le téléphone', -} diff --git a/resources/locales/sv.lua b/resources/locales/sv.lua deleted file mode 100644 index 33b7b04..0000000 --- a/resources/locales/sv.lua +++ /dev/null @@ -1,3 +0,0 @@ -Locales['en'] = { - ['keymap_phone'] = 'Öppna telefonen', -} \ No newline at end of file diff --git a/resources/locales/tr.lua b/resources/locales/tr.lua deleted file mode 100644 index 4d50a3c..0000000 --- a/resources/locales/tr.lua +++ /dev/null @@ -1,3 +0,0 @@ -Locales['tr'] = { - ['keymap_phone'] = 'Telefonu aç', -} From 85b80d4de7e8e3c11774b9754232b927103efed8 Mon Sep 17 00:00:00 2001 From: SynTer Date: Sun, 10 Jan 2021 19:06:08 -0300 Subject: [PATCH 09/23] Brazilian Portuguese translation --- phone/src/locale/ptbr.json | 91 ++++++++++++++++++++++++++++++++++++++ resources/locales/ptbr.lua | 3 ++ 2 files changed, 94 insertions(+) create mode 100644 phone/src/locale/ptbr.json create mode 100644 resources/locales/ptbr.lua diff --git a/phone/src/locale/ptbr.json b/phone/src/locale/ptbr.json new file mode 100644 index 0000000..2eb8796 --- /dev/null +++ b/phone/src/locale/ptbr.json @@ -0,0 +1,91 @@ +{ + "translation": { + "COMING_SOON": "Em breve...", + "APPS_DIALER": "Telefone", + "APPS_CONTACTS": "Contatos", + "APPS_MESSAGES": "Mensagens", + "APPS_CALCULATOR": "Calculadora", + "APPS_SETTINGS": "Configurações​", + "APPS_BANK": "Banco WhoDis", + "APPS_NOTES": "Notas", + "APPS_EXAMPLE": "Aplicativo de exemplo", + "APPS_BANK_TRANSFER": "Transferir", + "APPS_SETTINGS_OPTIONS_WALLPAPER": "Papel de parede", + "APPS_SETTINGS_OPTIONS_FRAME": "Frame", + "APPS_TWITTER": "Twitter", + "APPS_TWITTER_TWEET": "Tweet", + "APPS_TWITTER_TWEET_MESSAGE_PLACEHOLDER": "O que está acontecendo?", + "APPS_TWITTER_IMAGE_PLACEHOLDER": "Link para sua foto de perfil", + "APPS_TWITTER_SUBMIT_IMAGE": "Adcionar foto", + "APPS_TWITTER_CLOSE_IMAGE": "Fechar", + "APPS_TWITTER_CLOSE": "Fechar", + "APPS_TWITTER_DELETE": "Deletar", + "APPS_TWITTER_REPORT": "Reportar", + "APPS_TWITTER_REPORTED": " Reportado", + "APPS_TWITTER_JUST_NOW": "Agora", + "APPS_TWITTER_SEARCH_TWEETS": "Procurar por tweets", + "APPS_TWITTER_SEARCH_TWEETS_PLACEHOLDER": "Procurar por nome de perfil ou mensagem", + "APPS_TWITTER_TWEET_MESSAGE_CHAR_LIMIT": "Mensagem está ultrapassando o limite de caracteres", + "APPS_TWITTER_CREATE_SUCCESS": "Seu tweet foi enviado com sucesso!", + "APPS_TWITTER_CREATE_FAILED": "Seu tweet não foi enviado", + "APPS_TWITTER_EDIT_PROFILE_AVATAR": "URL do Avatar", + "APPS_TWITTER_EDIT_PROFILE_NAME": "Nome de perfil", + "APPS_TWITTER_EDIT_PROFILE_BIO": "Bio", + "APPS_TWITTER_EDIT_PROFILE_LOCATION": "Localização", + "APPS_TWITTER_EDIT_PROFILE_JOB": "Emprego", + "APPS_TWITTER_EDIT_PROFILE_SUCCESS": "Seu perfil foi atualizado com sucesso", + "APPS_TWITTER_EDIT_PROFILE_FAILURE": "Não foi possivel atualizar seu perfil", + "APPS_TWITTER_TIME_JUST_NOW": "agora", + "APPS_TWITTER_TIME_MINUTES": "m", + "APPS_TWITTER_TIME_HOURS": "h", + "APPS_TWITTER_TIME_DAYS": "d", + + "APPS_BANK_HOME_TITLE": "Bem vindo", + "APPS_BANK_ACCOUNT_LINK": "Conta", + "APPS_BANK_TIME_JUST_NOW": "Agora", + "APPS_BANK_ACCOUNT_TITLE": "Resumo da conta", + "APPS_BANK_ACCOUNT_TRANSACTIONS": "Transações", + "APPS_BANK_ACCOUNT_SEE_TRANSACTION": "Ver tudo", + "APPS_BANK_ACTIONS_TRANSFER": "Transferir", + "APPS_BANK_ALERT_TRANSFER_SUCCESS": "Transferencia realizada com sucesso!", + "APPS_BANK_ALERT_TRANSFER_FAILURE": "Transferencia nao foi realizada", + + "APPS_CONTACT_FORM_NAME": "Nome", + "APPS_CONTACT_FORM_NUMBER": "Número", + "APPS_CONTACT_FORM_AVATAR": "URL do Avatar", + + "APPS_MESSAGES_SEARCH_PLACEHOLDER": "Procurar mensagem...", + "APPS_MESSAGES_NEW_MESSAGE": "Mensagem...", + "APPS_MESSAGES_NEW_MESSAGE_GROUP": "Números de telefone...", + "APPS_MESSAGES_GROUP_CHAT_LABEL": "Nome do chat em grupo...", + "APPS_MESSAGES_NEW_MESSAGE_GROUP_SUBMIT": "Enviar", + "APPS_MESSAGES_INVALID_PHONE_NUMBER": "Numero de telefone invalido: ", + "APPS_MESSAGES_MESSAGE_GROUP_DUPLICATE": "Esse grupo ja existe", + "APPS_MESSAGES_MESSAGE_GROUP_CREATE_FAILED": "Falha ao criar grupo de mensagens", + "APPS_MESSAGES_MESSAGE_GROUP_CREATE_MINE": "Voce nao pode adcionar voce mesmo!", + + "APPS_CONTACT_ADD_SUCCESS": "Contato criado com sucesso!", + "APPS_CONTACT_ADD_FAILED": "Falha ao criar contato!", + "APPS_CONTACT_UPDATE_SUCCESS": "Contato atualizado com sucesso!", + "APPS_CONTACT_UPDATE_FAILED": "Falha ao atualizar o contato!", + "APPS_CONTACT_DELETE_SUCCESS": "Contato deletado com sucesso!", + "APPS_CONTACT_DELETE_FAILED": "Falha ao deletar contato!", + "APPS_CONTACT_PLACEHOLDER_SEARCH_CONTACTS": "Procurar contato", + "APPS_CONTACT_MODAL_PLACEHOLDER_NAME": "Nome", + "APPS_CONTACT_MODAL_PLACEHOLDER_NUMBER": "Número", + "APPS_CONTACT_MODAL_PLACEHOLDER_AVATAR": "Foto de perfil", + "APPS_CONTACT_MODAL_BUTTON_ADD": "Adcionar contato", + + "APPS_SETTINGS_PHONE_NUMBER": "Número de telefone", + "APPS_SETTINGS_OPTION_WALLPAPER": "Papel de parede", + "APPS_SETTINGS_OPTION_FRAME": "Frame", + "APPS_SETTINGS_OPTION_THEME": "Tema", + "APPS_SETTINGS_OPTION_ZOOM": "Zoom", + "APPS_SETTINGS_OPTION_RINGTONE": "Toque", + "APPS_SETTINGS_OPTION_RINGTONEVOL": "Volume do toque", + + "GENERIC_UPDATE": "Atualizar", + "GENERIC_DELETE": "Deletar" + } + } + \ No newline at end of file diff --git a/resources/locales/ptbr.lua b/resources/locales/ptbr.lua new file mode 100644 index 0000000..9759337 --- /dev/null +++ b/resources/locales/ptbr.lua @@ -0,0 +1,3 @@ +Locales['en'] = { + ['keymap_phone'] = 'Abrir Celular', +} \ No newline at end of file From a799f6effadd58df577fd0485a106e5921bb0b45 Mon Sep 17 00:00:00 2001 From: SynTer Date: Sun, 10 Jan 2021 19:11:15 -0300 Subject: [PATCH 10/23] Added the translation on i18n.ts --- phone/src/i18n.ts | 1 + resources/locales/ptbr.lua | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 resources/locales/ptbr.lua diff --git a/phone/src/i18n.ts b/phone/src/i18n.ts index e5e87f1..8fb9a1e 100644 --- a/phone/src/i18n.ts +++ b/phone/src/i18n.ts @@ -6,6 +6,7 @@ import fr from './locale/fr.json'; import bh from './locale/bh.json'; import sv from './locale/sv.json'; import tr from './locale/tr.json'; +import ptbr from './locale/ptbr.json'; import config from './config/default.json'; const resources = { diff --git a/resources/locales/ptbr.lua b/resources/locales/ptbr.lua deleted file mode 100644 index 9759337..0000000 --- a/resources/locales/ptbr.lua +++ /dev/null @@ -1,3 +0,0 @@ -Locales['en'] = { - ['keymap_phone'] = 'Abrir Celular', -} \ No newline at end of file From acc0091c9ee7b848c5a8f162aaddaf8cd5d44225 Mon Sep 17 00:00:00 2001 From: SynTer Date: Sun, 10 Jan 2021 19:12:32 -0300 Subject: [PATCH 11/23] added on resources array --- phone/src/i18n.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/phone/src/i18n.ts b/phone/src/i18n.ts index 8fb9a1e..b614aa0 100644 --- a/phone/src/i18n.ts +++ b/phone/src/i18n.ts @@ -16,6 +16,7 @@ const resources = { bh, sv, tr, + ptbr, }; i18n From c249cfa2ecc44989d8809af5a3bc2a9f2d715d29 Mon Sep 17 00:00:00 2001 From: TasoOneAsia Date: Sun, 10 Jan 2021 22:14:48 +0000 Subject: [PATCH 12/23] Prettified Code! --- phone/src/locale/ptbr.json | 177 ++++++++++++++++++------------------- 1 file changed, 88 insertions(+), 89 deletions(-) diff --git a/phone/src/locale/ptbr.json b/phone/src/locale/ptbr.json index 2eb8796..cce49b7 100644 --- a/phone/src/locale/ptbr.json +++ b/phone/src/locale/ptbr.json @@ -1,91 +1,90 @@ { - "translation": { - "COMING_SOON": "Em breve...", - "APPS_DIALER": "Telefone", - "APPS_CONTACTS": "Contatos", - "APPS_MESSAGES": "Mensagens", - "APPS_CALCULATOR": "Calculadora", - "APPS_SETTINGS": "Configurações​", - "APPS_BANK": "Banco WhoDis", - "APPS_NOTES": "Notas", - "APPS_EXAMPLE": "Aplicativo de exemplo", - "APPS_BANK_TRANSFER": "Transferir", - "APPS_SETTINGS_OPTIONS_WALLPAPER": "Papel de parede", - "APPS_SETTINGS_OPTIONS_FRAME": "Frame", - "APPS_TWITTER": "Twitter", - "APPS_TWITTER_TWEET": "Tweet", - "APPS_TWITTER_TWEET_MESSAGE_PLACEHOLDER": "O que está acontecendo?", - "APPS_TWITTER_IMAGE_PLACEHOLDER": "Link para sua foto de perfil", - "APPS_TWITTER_SUBMIT_IMAGE": "Adcionar foto", - "APPS_TWITTER_CLOSE_IMAGE": "Fechar", - "APPS_TWITTER_CLOSE": "Fechar", - "APPS_TWITTER_DELETE": "Deletar", - "APPS_TWITTER_REPORT": "Reportar", - "APPS_TWITTER_REPORTED": " Reportado", - "APPS_TWITTER_JUST_NOW": "Agora", - "APPS_TWITTER_SEARCH_TWEETS": "Procurar por tweets", - "APPS_TWITTER_SEARCH_TWEETS_PLACEHOLDER": "Procurar por nome de perfil ou mensagem", - "APPS_TWITTER_TWEET_MESSAGE_CHAR_LIMIT": "Mensagem está ultrapassando o limite de caracteres", - "APPS_TWITTER_CREATE_SUCCESS": "Seu tweet foi enviado com sucesso!", - "APPS_TWITTER_CREATE_FAILED": "Seu tweet não foi enviado", - "APPS_TWITTER_EDIT_PROFILE_AVATAR": "URL do Avatar", - "APPS_TWITTER_EDIT_PROFILE_NAME": "Nome de perfil", - "APPS_TWITTER_EDIT_PROFILE_BIO": "Bio", - "APPS_TWITTER_EDIT_PROFILE_LOCATION": "Localização", - "APPS_TWITTER_EDIT_PROFILE_JOB": "Emprego", - "APPS_TWITTER_EDIT_PROFILE_SUCCESS": "Seu perfil foi atualizado com sucesso", - "APPS_TWITTER_EDIT_PROFILE_FAILURE": "Não foi possivel atualizar seu perfil", - "APPS_TWITTER_TIME_JUST_NOW": "agora", - "APPS_TWITTER_TIME_MINUTES": "m", - "APPS_TWITTER_TIME_HOURS": "h", - "APPS_TWITTER_TIME_DAYS": "d", - - "APPS_BANK_HOME_TITLE": "Bem vindo", - "APPS_BANK_ACCOUNT_LINK": "Conta", - "APPS_BANK_TIME_JUST_NOW": "Agora", - "APPS_BANK_ACCOUNT_TITLE": "Resumo da conta", - "APPS_BANK_ACCOUNT_TRANSACTIONS": "Transações", - "APPS_BANK_ACCOUNT_SEE_TRANSACTION": "Ver tudo", - "APPS_BANK_ACTIONS_TRANSFER": "Transferir", - "APPS_BANK_ALERT_TRANSFER_SUCCESS": "Transferencia realizada com sucesso!", - "APPS_BANK_ALERT_TRANSFER_FAILURE": "Transferencia nao foi realizada", - - "APPS_CONTACT_FORM_NAME": "Nome", - "APPS_CONTACT_FORM_NUMBER": "Número", - "APPS_CONTACT_FORM_AVATAR": "URL do Avatar", - - "APPS_MESSAGES_SEARCH_PLACEHOLDER": "Procurar mensagem...", - "APPS_MESSAGES_NEW_MESSAGE": "Mensagem...", - "APPS_MESSAGES_NEW_MESSAGE_GROUP": "Números de telefone...", - "APPS_MESSAGES_GROUP_CHAT_LABEL": "Nome do chat em grupo...", - "APPS_MESSAGES_NEW_MESSAGE_GROUP_SUBMIT": "Enviar", - "APPS_MESSAGES_INVALID_PHONE_NUMBER": "Numero de telefone invalido: ", - "APPS_MESSAGES_MESSAGE_GROUP_DUPLICATE": "Esse grupo ja existe", - "APPS_MESSAGES_MESSAGE_GROUP_CREATE_FAILED": "Falha ao criar grupo de mensagens", - "APPS_MESSAGES_MESSAGE_GROUP_CREATE_MINE": "Voce nao pode adcionar voce mesmo!", - - "APPS_CONTACT_ADD_SUCCESS": "Contato criado com sucesso!", - "APPS_CONTACT_ADD_FAILED": "Falha ao criar contato!", - "APPS_CONTACT_UPDATE_SUCCESS": "Contato atualizado com sucesso!", - "APPS_CONTACT_UPDATE_FAILED": "Falha ao atualizar o contato!", - "APPS_CONTACT_DELETE_SUCCESS": "Contato deletado com sucesso!", - "APPS_CONTACT_DELETE_FAILED": "Falha ao deletar contato!", - "APPS_CONTACT_PLACEHOLDER_SEARCH_CONTACTS": "Procurar contato", - "APPS_CONTACT_MODAL_PLACEHOLDER_NAME": "Nome", - "APPS_CONTACT_MODAL_PLACEHOLDER_NUMBER": "Número", - "APPS_CONTACT_MODAL_PLACEHOLDER_AVATAR": "Foto de perfil", - "APPS_CONTACT_MODAL_BUTTON_ADD": "Adcionar contato", - - "APPS_SETTINGS_PHONE_NUMBER": "Número de telefone", - "APPS_SETTINGS_OPTION_WALLPAPER": "Papel de parede", - "APPS_SETTINGS_OPTION_FRAME": "Frame", - "APPS_SETTINGS_OPTION_THEME": "Tema", - "APPS_SETTINGS_OPTION_ZOOM": "Zoom", - "APPS_SETTINGS_OPTION_RINGTONE": "Toque", - "APPS_SETTINGS_OPTION_RINGTONEVOL": "Volume do toque", - - "GENERIC_UPDATE": "Atualizar", - "GENERIC_DELETE": "Deletar" - } + "translation": { + "COMING_SOON": "Em breve...", + "APPS_DIALER": "Telefone", + "APPS_CONTACTS": "Contatos", + "APPS_MESSAGES": "Mensagens", + "APPS_CALCULATOR": "Calculadora", + "APPS_SETTINGS": "Configurações​", + "APPS_BANK": "Banco WhoDis", + "APPS_NOTES": "Notas", + "APPS_EXAMPLE": "Aplicativo de exemplo", + "APPS_BANK_TRANSFER": "Transferir", + "APPS_SETTINGS_OPTIONS_WALLPAPER": "Papel de parede", + "APPS_SETTINGS_OPTIONS_FRAME": "Frame", + "APPS_TWITTER": "Twitter", + "APPS_TWITTER_TWEET": "Tweet", + "APPS_TWITTER_TWEET_MESSAGE_PLACEHOLDER": "O que está acontecendo?", + "APPS_TWITTER_IMAGE_PLACEHOLDER": "Link para sua foto de perfil", + "APPS_TWITTER_SUBMIT_IMAGE": "Adcionar foto", + "APPS_TWITTER_CLOSE_IMAGE": "Fechar", + "APPS_TWITTER_CLOSE": "Fechar", + "APPS_TWITTER_DELETE": "Deletar", + "APPS_TWITTER_REPORT": "Reportar", + "APPS_TWITTER_REPORTED": " Reportado", + "APPS_TWITTER_JUST_NOW": "Agora", + "APPS_TWITTER_SEARCH_TWEETS": "Procurar por tweets", + "APPS_TWITTER_SEARCH_TWEETS_PLACEHOLDER": "Procurar por nome de perfil ou mensagem", + "APPS_TWITTER_TWEET_MESSAGE_CHAR_LIMIT": "Mensagem está ultrapassando o limite de caracteres", + "APPS_TWITTER_CREATE_SUCCESS": "Seu tweet foi enviado com sucesso!", + "APPS_TWITTER_CREATE_FAILED": "Seu tweet não foi enviado", + "APPS_TWITTER_EDIT_PROFILE_AVATAR": "URL do Avatar", + "APPS_TWITTER_EDIT_PROFILE_NAME": "Nome de perfil", + "APPS_TWITTER_EDIT_PROFILE_BIO": "Bio", + "APPS_TWITTER_EDIT_PROFILE_LOCATION": "Localização", + "APPS_TWITTER_EDIT_PROFILE_JOB": "Emprego", + "APPS_TWITTER_EDIT_PROFILE_SUCCESS": "Seu perfil foi atualizado com sucesso", + "APPS_TWITTER_EDIT_PROFILE_FAILURE": "Não foi possivel atualizar seu perfil", + "APPS_TWITTER_TIME_JUST_NOW": "agora", + "APPS_TWITTER_TIME_MINUTES": "m", + "APPS_TWITTER_TIME_HOURS": "h", + "APPS_TWITTER_TIME_DAYS": "d", + + "APPS_BANK_HOME_TITLE": "Bem vindo", + "APPS_BANK_ACCOUNT_LINK": "Conta", + "APPS_BANK_TIME_JUST_NOW": "Agora", + "APPS_BANK_ACCOUNT_TITLE": "Resumo da conta", + "APPS_BANK_ACCOUNT_TRANSACTIONS": "Transações", + "APPS_BANK_ACCOUNT_SEE_TRANSACTION": "Ver tudo", + "APPS_BANK_ACTIONS_TRANSFER": "Transferir", + "APPS_BANK_ALERT_TRANSFER_SUCCESS": "Transferencia realizada com sucesso!", + "APPS_BANK_ALERT_TRANSFER_FAILURE": "Transferencia nao foi realizada", + + "APPS_CONTACT_FORM_NAME": "Nome", + "APPS_CONTACT_FORM_NUMBER": "Número", + "APPS_CONTACT_FORM_AVATAR": "URL do Avatar", + + "APPS_MESSAGES_SEARCH_PLACEHOLDER": "Procurar mensagem...", + "APPS_MESSAGES_NEW_MESSAGE": "Mensagem...", + "APPS_MESSAGES_NEW_MESSAGE_GROUP": "Números de telefone...", + "APPS_MESSAGES_GROUP_CHAT_LABEL": "Nome do chat em grupo...", + "APPS_MESSAGES_NEW_MESSAGE_GROUP_SUBMIT": "Enviar", + "APPS_MESSAGES_INVALID_PHONE_NUMBER": "Numero de telefone invalido: ", + "APPS_MESSAGES_MESSAGE_GROUP_DUPLICATE": "Esse grupo ja existe", + "APPS_MESSAGES_MESSAGE_GROUP_CREATE_FAILED": "Falha ao criar grupo de mensagens", + "APPS_MESSAGES_MESSAGE_GROUP_CREATE_MINE": "Voce nao pode adcionar voce mesmo!", + + "APPS_CONTACT_ADD_SUCCESS": "Contato criado com sucesso!", + "APPS_CONTACT_ADD_FAILED": "Falha ao criar contato!", + "APPS_CONTACT_UPDATE_SUCCESS": "Contato atualizado com sucesso!", + "APPS_CONTACT_UPDATE_FAILED": "Falha ao atualizar o contato!", + "APPS_CONTACT_DELETE_SUCCESS": "Contato deletado com sucesso!", + "APPS_CONTACT_DELETE_FAILED": "Falha ao deletar contato!", + "APPS_CONTACT_PLACEHOLDER_SEARCH_CONTACTS": "Procurar contato", + "APPS_CONTACT_MODAL_PLACEHOLDER_NAME": "Nome", + "APPS_CONTACT_MODAL_PLACEHOLDER_NUMBER": "Número", + "APPS_CONTACT_MODAL_PLACEHOLDER_AVATAR": "Foto de perfil", + "APPS_CONTACT_MODAL_BUTTON_ADD": "Adcionar contato", + + "APPS_SETTINGS_PHONE_NUMBER": "Número de telefone", + "APPS_SETTINGS_OPTION_WALLPAPER": "Papel de parede", + "APPS_SETTINGS_OPTION_FRAME": "Frame", + "APPS_SETTINGS_OPTION_THEME": "Tema", + "APPS_SETTINGS_OPTION_ZOOM": "Zoom", + "APPS_SETTINGS_OPTION_RINGTONE": "Toque", + "APPS_SETTINGS_OPTION_RINGTONEVOL": "Volume do toque", + + "GENERIC_UPDATE": "Atualizar", + "GENERIC_DELETE": "Deletar" } - \ No newline at end of file +} From 8c5595ebefd96aa249135e7f7fb781a0cd56e2ca Mon Sep 17 00:00:00 2001 From: Oldarorn <36448848+Oldarorn@users.noreply.github.com> Date: Mon, 11 Jan 2021 17:55:37 +0100 Subject: [PATCH 13/23] Update fr.json --- phone/src/locale/fr.json | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/phone/src/locale/fr.json b/phone/src/locale/fr.json index 9d18291..8b1f925 100644 --- a/phone/src/locale/fr.json +++ b/phone/src/locale/fr.json @@ -69,6 +69,22 @@ "APPS_CONTACT_UPDATE_SUCCESS": "Contact mis à jour avec succès!", "APPS_CONTACT_UPDATE_FAILED": "Erreur lors de la mise à jour du contact!", "APPS_CONTACT_DELETE_SUCCESS": "Contact supprimé avec succès!", - "APPS_CONTACT_DELETE_FAILED": "Erreur lors de la suppression du contact!" + "APPS_CONTACT_DELETE_FAILED": "Erreur lors de la suppression du contact!", + "APPS_CONTACT_PLACEHOLDER_SEARCH_CONTACTS": "Rechercher un contact", + "APPS_CONTACT_MODAL_PLACEHOLDER_NAME": "Nom", + "APPS_CONTACT_MODAL_PLACEHOLDER_NUMBER": "Numéro", + "APPS_CONTACT_MODAL_PLACEHOLDER_AVATAR": "Photo", + "APPS_CONTACT_MODAL_BUTTON_ADD": "Ajouter un contact", + + "APPS_SETTINGS_PHONE_NUMBER": "Numéro de téléphone", + "APPS_SETTINGS_OPTION_WALLPAPER": "Fond d'écran", + "APPS_SETTINGS_OPTION_FRAME": "Coque", + "APPS_SETTINGS_OPTION_THEME": "Thème", + "APPS_SETTINGS_OPTION_ZOOM": "Zoom", + "APPS_SETTINGS_OPTION_RINGTONE": "Sonnerie", + "APPS_SETTINGS_OPTION_RINGTONEVOL": "Volume de la sonnerie", + + "GENERIC_UPDATE": "Mettre à jour", + "GENERIC_DELETE": "Supprimer" } } From e4c0a4e40c91dd3f1e9237153f30074afe7e871c Mon Sep 17 00:00:00 2001 From: HypeLevels <61633775+HypeLevels@users.noreply.github.com> Date: Mon, 11 Jan 2021 18:08:27 +0000 Subject: [PATCH 14/23] Create pt.json --- phone/src/locale/pt.json | 90 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 phone/src/locale/pt.json diff --git a/phone/src/locale/pt.json b/phone/src/locale/pt.json new file mode 100644 index 0000000..6ba5c24 --- /dev/null +++ b/phone/src/locale/pt.json @@ -0,0 +1,90 @@ +{ + "translation": { + "COMING_SOON": "Em breve...", + "APPS_DIALER": "Telefone", + "APPS_CONTACTS": "Contactos", + "APPS_MESSAGES": "Mensagens", + "APPS_CALCULATOR": "Calculadora", + "APPS_SETTINGS": "Definições", + "APPS_BANK": "WhoDis Banco", + "APPS_NOTES": "Notas", + "APPS_EXAMPLE": "Aplicativo exemplo", + "APPS_BANK_TRANSFER": "Transferir", + "APPS_SETTINGS_OPTIONS_WALLPAPER": "Papél de fundo", + "APPS_SETTINGS_OPTIONS_FRAME": "Borda", + "APPS_TWITTER": "Twitter", + "APPS_TWITTER_TWEET": "Tweet", + "APPS_TWITTER_TWEET_MESSAGE_PLACEHOLDER": "O que se passa?", + "APPS_TWITTER_IMAGE_PLACEHOLDER": "Link para imagem ou gif", + "APPS_TWITTER_SUBMIT_IMAGE": "Adicionar Mídia", + "APPS_TWITTER_CLOSE_IMAGE": "Fechar", + "APPS_TWITTER_CLOSE": "Fechar", + "APPS_TWITTER_DELETE": "Apagar", + "APPS_TWITTER_REPORT": "Reportar", + "APPS_TWITTER_REPORTED": " Reportado", + "APPS_TWITTER_JUST_NOW": "Agora", + "APPS_TWITTER_SEARCH_TWEETS": "Procurar por tweets", + "APPS_TWITTER_SEARCH_TWEETS_PLACEHOLDER": "Procurar por nome de perfil ou mensagem", + "APPS_TWITTER_TWEET_MESSAGE_CHAR_LIMIT": "Mensagem maior que o límite de caracteres", + "APPS_TWITTER_CREATE_SUCCESS": "Tweet enviado com sucesso!", + "APPS_TWITTER_CREATE_FAILED": "Falha a enviar o seu tweet", + "APPS_TWITTER_EDIT_PROFILE_AVATAR": "URL do Avatar", + "APPS_TWITTER_EDIT_PROFILE_NAME": "Nome de perfil", + "APPS_TWITTER_EDIT_PROFILE_BIO": "Biografia", + "APPS_TWITTER_EDIT_PROFILE_LOCATION": "Localização", + "APPS_TWITTER_EDIT_PROFILE_JOB": "Trabalho", + "APPS_TWITTER_EDIT_PROFILE_SUCCESS": "Perfil atualizado com sucesso", + "APPS_TWITTER_EDIT_PROFILE_FAILURE": "Falha a atualizar o seu perfil", + "APPS_TWITTER_TIME_JUST_NOW": "Agora", + "APPS_TWITTER_TIME_MINUTES": "m", + "APPS_TWITTER_TIME_HOURS": "h", + "APPS_TWITTER_TIME_DAYS": "d", + + "APPS_BANK_HOME_TITLE": "Bem-vindo", + "APPS_BANK_ACCOUNT_LINK": "Conta", + "APPS_BANK_TIME_JUST_NOW": "Agora", + "APPS_BANK_ACCOUNT_TITLE": "Resumo da conta", + "APPS_BANK_ACCOUNT_TRANSACTIONS": "Transações", + "APPS_BANK_ACCOUNT_SEE_TRANSACTION": "Ver todos", + "APPS_BANK_ACTIONS_TRANSFER": "Transferir", + "APPS_BANK_ALERT_TRANSFER_SUCCESS": "Transferência feita com sucesso!", + "APPS_BANK_ALERT_TRANSFER_FAILURE": "Transferência falhada!", + + "APPS_CONTACT_FORM_NAME": "Nome", + "APPS_CONTACT_FORM_NUMBER": "Numero", + "APPS_CONTACT_FORM_AVATAR": "URL do avatar", + + "APPS_MESSAGES_SEARCH_PLACEHOLDER": "Procurar mensagens...", + "APPS_MESSAGES_NEW_MESSAGE": "Mensagem...", + "APPS_MESSAGES_NEW_MESSAGE_GROUP": "Números de telefone...", + "APPS_MESSAGES_GROUP_CHAT_LABEL": "Nome do grupo...", + "APPS_MESSAGES_NEW_MESSAGE_GROUP_SUBMIT": "Enviar", + "APPS_MESSAGES_INVALID_PHONE_NUMBER": "Número de telefone inválido: ", + "APPS_MESSAGES_MESSAGE_GROUP_DUPLICATE": "Este grupo já existe", + "APPS_MESSAGES_MESSAGE_GROUP_CREATE_FAILED": "Falha a criar grupo", + "APPS_MESSAGES_MESSAGE_GROUP_CREATE_MINE": "Não te podes adicionar a tí mesmo!", + + "APPS_CONTACT_ADD_SUCCESS": "Contacto criado com sucesso!", + "APPS_CONTACT_ADD_FAILED": "Falha a criar contacto!", + "APPS_CONTACT_UPDATE_SUCCESS": "Contacto atualizado com sucesso!", + "APPS_CONTACT_UPDATE_FAILED": "Falha a atualizar contacto!", + "APPS_CONTACT_DELETE_SUCCESS": "Contacto apagado com sucesso!", + "APPS_CONTACT_DELETE_FAILED": "Falha a apagar contacto!", + "APPS_CONTACT_PLACEHOLDER_SEARCH_CONTACTS": "Procurar contactos", + "APPS_CONTACT_MODAL_PLACEHOLDER_NAME": "Nome", + "APPS_CONTACT_MODAL_PLACEHOLDER_NUMBER": "Numero", + "APPS_CONTACT_MODAL_PLACEHOLDER_AVATAR": "Avatar", + "APPS_CONTACT_MODAL_BUTTON_ADD": "Adicionar contacto", + + "APPS_SETTINGS_PHONE_NUMBER": "Número de telefone", + "APPS_SETTINGS_OPTION_WALLPAPER": "Papél de parede", + "APPS_SETTINGS_OPTION_FRAME": "Borda", + "APPS_SETTINGS_OPTION_THEME": "Tema", + "APPS_SETTINGS_OPTION_ZOOM": "Zoom", + "APPS_SETTINGS_OPTION_RINGTONE": "Toque", + "APPS_SETTINGS_OPTION_RINGTONEVOL": "Volume do toque", + + "GENERIC_UPDATE": "Atualizar", + "GENERIC_DELETE": "Apagar" + } +} From 1efb5fb54abaf978ae63c589bf603d396392c6c2 Mon Sep 17 00:00:00 2001 From: HypeLevels <61633775+HypeLevels@users.noreply.github.com> Date: Mon, 11 Jan 2021 18:08:54 +0000 Subject: [PATCH 15/23] Update i18n.ts --- phone/src/i18n.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phone/src/i18n.ts b/phone/src/i18n.ts index b614aa0..e0739ba 100644 --- a/phone/src/i18n.ts +++ b/phone/src/i18n.ts @@ -7,6 +7,7 @@ import bh from './locale/bh.json'; import sv from './locale/sv.json'; import tr from './locale/tr.json'; import ptbr from './locale/ptbr.json'; +import pt from './locale/pt.json'; import config from './config/default.json'; const resources = { @@ -17,6 +18,7 @@ const resources = { sv, tr, ptbr, + pt, }; i18n From 8912650f0e7592f903ae141100035415ef2ec1be Mon Sep 17 00:00:00 2001 From: Taso Date: Tue, 12 Jan 2021 11:28:20 -0500 Subject: [PATCH 16/23] refactor: LocalStorage state integration --- phone/package.json | 2 +- phone/src/Phone.tsx | 23 ++++--- .../apps/settings/components/SettingsApp.tsx | 48 +++++++------ phone/src/apps/settings/default.json | 8 --- phone/src/apps/settings/hooks/useSettings.ts | 37 ++++++---- phone/src/config/default.json | 8 +++ phone/src/config/hooks/useConfig.ts | 1 - phone/src/os/phone/hooks/useLocalStorage.ts | 69 ------------------- phone/src/ui/components/Notification.tsx | 53 +++++++------- phone/yarn.lock | 8 +-- 10 files changed, 103 insertions(+), 154 deletions(-) delete mode 100644 phone/src/apps/settings/default.json delete mode 100644 phone/src/os/phone/hooks/useLocalStorage.ts diff --git a/phone/package.json b/phone/package.json index 7ecf6e3..a271fbf 100644 --- a/phone/package.json +++ b/phone/package.json @@ -31,7 +31,7 @@ "react-popper": "^2.2.3", "react-router-dom": "^5.2.0", "react-scripts": "3.4.3", - "recoil": "^0.0.10", + "recoil": "^0.1.2", "styled-components": "^5.1.1" }, "devDependencies": { diff --git a/phone/src/Phone.tsx b/phone/src/Phone.tsx index 9627e86..18b7906 100644 --- a/phone/src/Phone.tsx +++ b/phone/src/Phone.tsx @@ -2,11 +2,10 @@ import React from 'react'; import './Phone.css'; import './i18n'; import { Route } from 'react-router-dom'; -import { useSettings } from './apps/settings/hooks/useSettings'; import MessageIcon from '@material-ui/icons/Email'; import { CallModal } from './modal/components/CallModal'; import { HomeApp } from './apps/home/components/Home'; -import { ThemeProvider } from '@material-ui/core'; +import { createMuiTheme, ThemeProvider } from '@material-ui/core'; import { useInitKeyboard } from './os/keyboard/hooks/useKeyboard'; import { NotificationIcon } from './os/notifications/components/NotificationIcon'; import { NotificationBar } from './os/notifications/components/NotificationBar'; @@ -25,7 +24,10 @@ import { useNotesService } from './apps/notes/hooks/useNotesService'; import { usePhotoService } from './apps/camera/hooks/usePhotoService'; import Nui from './os/nui-events/utils/Nui'; import { usePhone } from './os/phone/hooks/usePhone'; -import { getStorage } from './os/phone/hooks/useLocalStorage'; +import { settingsState } from './apps/settings/hooks/useSettings'; + +import config from './config/default.json'; +import { useRecoilState } from 'recoil'; // Inject mock data when in development env. if (process.env.NODE_ENV === 'development') { @@ -246,7 +248,6 @@ function Phone() { useNuiService(); usePhoneService(); const { visibility } = usePhone(); - const { settings, currentTheme } = useSettings(); const { allApps } = useApps(); useSimcardService(); useContactsService(); @@ -258,10 +259,14 @@ function Phone() { useNotesService(); usePhotoService(); + const [settings] = useRecoilState(settingsState); + if (visibility === false) { return null; } + const currentTheme = () => createMuiTheme(config.themes[settings.theme]); + const calling = false; document.onkeyup = function (data) { @@ -273,21 +278,19 @@ function Phone() { return (
-
+
+ />
<> diff --git a/phone/src/apps/settings/components/SettingsApp.tsx b/phone/src/apps/settings/components/SettingsApp.tsx index 1604349..acbe2d3 100644 --- a/phone/src/apps/settings/components/SettingsApp.tsx +++ b/phone/src/apps/settings/components/SettingsApp.tsx @@ -7,7 +7,6 @@ import { MapStringOptions, } from '../../../ui/hooks/useContextMenu'; import { useConfig } from '../../../config/hooks/useConfig'; -import { useSettings } from '../hooks/useSettings'; import { List } from '../../../ui/components/List'; import { useSimcard } from '../../../os/simcard/hooks/useSimcard'; import { useApp } from '../../../os/apps/hooks/useApps'; @@ -24,7 +23,8 @@ import { } from '@material-ui/icons'; import { ListSubheader } from '@material-ui/core'; -import useLocalStorage from '../../../os/phone/hooks/useLocalStorage'; +import { useRecoilState } from 'recoil'; +import { settingsState } from '../hooks/useSettings'; const SubHeaderComp = (props: { text: string }) => ( @@ -36,31 +36,37 @@ export const SettingsApp = () => { const settingsApp = useApp('SETTINGS'); const [config] = useConfig(); const simcard = useSimcard(); + const [settings, setSettings] = useRecoilState(settingsState); - const [wallpaper, setWallpaper] = useLocalStorage( - 'wallpaper', - 'surf.jpg' - ); - const [frame, setFrame] = useLocalStorage('frame', 's10.png'); - const [theme, setTheme] = useLocalStorage('theme', 'default-dark'); - const [zoom, setZoom] = useLocalStorage('zoom', '100%'); - const [ringtone, setRingtone] = useLocalStorage('ringtone', ''); + const handleSettingChange = (key: string | number, value: unknown) => { + setSettings({ ...settings, [key]: value }); + }; const wallpapers = config.wallpapers.map( - MapStringOptions(wallpaper, (val: string) => setWallpaper(val)) + MapStringOptions(settings.wallpaper, (val: string) => + handleSettingChange('wallpaper', val) + ) ); const frames = config.frames.map( - MapStringOptions(frame, (val: string) => setFrame(val)) + MapStringOptions(settings.frame, (val: string) => + handleSettingChange('frame', val) + ) ); const themes = Object.keys(config.themes).map( - MapStringOptions(theme, (val: string) => setTheme(val)) + MapStringOptions(settings.theme, (val: string) => + handleSettingChange('theme', val) + ) ); const zoomOptions = config.zoomOptions.map( - MapStringOptions(zoom, (val: string) => setZoom(val)) + MapStringOptions(settings.zoom, (val: string) => + handleSettingChange('zoom', val) + ) ); // Doesn't actually do anything for the time being const ringtones = config.ringtones.map( - MapStringOptions(ringtone, (val: string) => setRingtone(val)) + MapStringOptions(settings.ringtone, (val: string) => + handleSettingChange('ringtone', val) + ) ); // * Probably gonna make this a slider component in the future // const ringtoneVols = config.ringtoneVols.map( @@ -69,8 +75,6 @@ export const SettingsApp = () => { // TODO: These new settings all work - useEffect(() => {}, [theme]); - const [openMenu, closeMenu, ContextMenu, isMenuOpen] = useContextMenu(); return ( @@ -84,7 +88,7 @@ export const SettingsApp = () => { /> } @@ -104,28 +108,28 @@ export const SettingsApp = () => { }> } /> } /> } /> } diff --git a/phone/src/apps/settings/default.json b/phone/src/apps/settings/default.json deleted file mode 100644 index 70b0b4e..0000000 --- a/phone/src/apps/settings/default.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "wallpaper": "default.png", - "frame": "s10.png", - "theme": "taso-dark", - "zoom": "100%", - "ringtone": "pixel", - "ringtoneVol": 100 -} diff --git a/phone/src/apps/settings/hooks/useSettings.ts b/phone/src/apps/settings/hooks/useSettings.ts index dceedfe..4b2114f 100644 --- a/phone/src/apps/settings/hooks/useSettings.ts +++ b/phone/src/apps/settings/hooks/useSettings.ts @@ -1,19 +1,28 @@ -import Default from '../default.json'; -import { useConfig } from '../../../config/hooks/useConfig'; -import { atom } from 'recoil'; -import { createMuiTheme } from '@material-ui/core'; -import useLocalStorage, { - getStorage, -} from '../../../os/phone/hooks/useLocalStorage'; +import { atom, DefaultValue, useRecoilState } from 'recoil'; +import config from '../../../config/default.json'; -const settingsState = atom({ +const localStorageEffect = (key) => ({ setSelf, onSet }) => { + const savedVal = localStorage.getItem(key); + if (savedVal != null) { + setSelf(JSON.parse(savedVal)); + } + + onSet((newValue) => { + if (newValue instanceof DefaultValue) { + localStorage.removeItem(key); + } else { + localStorage.setItem(key, JSON.stringify(newValue)); + } + }); +}; + +export const settingsState = atom({ key: 'settings', - default: Default, + default: config.defaultSettings, + effects_UNSTABLE: [localStorageEffect('settings')], }); -export const useSettings = (): any => { - const theme = getStorage('theme'); - const [config] = useConfig(); - const currentTheme = () => createMuiTheme(config.themes[theme]); - return { currentTheme }; +export const useSettings = () => { + const [settings, setSettings] = useRecoilState(settingsState); + return [settings, setSettings]; }; diff --git a/phone/src/config/default.json b/phone/src/config/default.json index fe6fc4c..63270d4 100644 --- a/phone/src/config/default.json +++ b/phone/src/config/default.json @@ -10,6 +10,14 @@ "surf.jpg", "beach.jpg" ], + "defaultSettings": { + "wallpaper": "default.png", + "frame": "s10.png", + "theme": "taso-dark", + "zoom": "100%", + "ringtone": "pixel", + "ringtoneVol": 100 + }, "frames": ["default.png", "s10.png", "tw.png", "samsung.png"], "zoomOptions": ["120%", "100%", "80%", "60%", "40%"], "ringtones": ["marimba", "pixel"], diff --git a/phone/src/config/hooks/useConfig.ts b/phone/src/config/hooks/useConfig.ts index 59785dd..7789a0e 100644 --- a/phone/src/config/hooks/useConfig.ts +++ b/phone/src/config/hooks/useConfig.ts @@ -1,6 +1,5 @@ import Default from '../default.json'; import { atom, useRecoilState } from 'recoil'; -import useLocalStorage from '../../os/phone/hooks/useLocalStorage'; const configState = atom({ key: 'config', diff --git a/phone/src/os/phone/hooks/useLocalStorage.ts b/phone/src/os/phone/hooks/useLocalStorage.ts deleted file mode 100644 index 2467a98..0000000 --- a/phone/src/os/phone/hooks/useLocalStorage.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { useState } from 'react'; - -// TODO: Integrate debug log to fetch when that branch is merged - -/** - * A LocalStorage hook designed to behave like the useState hook. - * @param {string} key - The unique identifier to be used as a key - * @param {string} intialValue - The initialValue to be used - * if there is no savedState - */ - -function useLocalStorage(key: string, initialValue: T) { - // Serves as a nice identifying prefix for the key - const UNIQ_PREFIX = 'npwd_phone_'; - const [localVal, setLocalVal] = useState(() => { - try { - const data = window.localStorage.getItem(UNIQ_PREFIX + key); - // return stored or initValue if none stored - return data ? JSON.parse(data) : initialValue; - } catch (e) { - // TODO: Integrate debug error state here - console.log(e); - // We still return initVal if error is thrown - return initialValue; - } - }); - - // Trying to rep useState setter pretty close just with localStorage - const setVal = (value: T | ((val: T) => T)) => { - try { - // Same API as useState meaning we can accept a function for value - const valForStore = value instanceof Function ? value(localVal) : value; - // Save that state so we repli useState - setLocalVal(valForStore); - // Set that localStorage yo - window.localStorage.setItem( - UNIQ_PREFIX + key, - JSON.stringify(valForStore) - ); - } catch (e) { - // TODO: Also integrate debug log state error here - console.log(e); - } - }; - - return [localVal, setVal]; -} - -export const writeStorage = (key: string, value: T) => { - const UNIQ_PREFIX = 'npwd_phone_'; - - try { - window.localStorage.setItem(UNIQ_PREFIX + key, JSON.stringify(value)); - } catch (error) { - console.log(error); - } -}; - -export const getStorage = (key: string) => { - const UNIQ_PREFIX = 'npwd_phone_'; - try { - const data = window.localStorage.getItem(UNIQ_PREFIX + key); - return JSON.parse(data); - } catch (error) { - console.log(error); - } -}; - -export default useLocalStorage; diff --git a/phone/src/ui/components/Notification.tsx b/phone/src/ui/components/Notification.tsx index 03254f1..0a2ebfe 100644 --- a/phone/src/ui/components/Notification.tsx +++ b/phone/src/ui/components/Notification.tsx @@ -1,17 +1,17 @@ -import React from "react"; -import { ThemeProvider } from "@material-ui/core"; -import Paper from "@material-ui/core/Paper"; -import Snackbar from "@material-ui/core/Snackbar"; -import Fade from "@material-ui/core/Fade"; -import { makeStyles } from "@material-ui/core/styles"; -import { useSettings } from "../../apps/settings/hooks/useSettings"; -import { usePhone } from "../../os/phone/hooks/usePhone"; +import React from 'react'; +import { createMuiTheme, ThemeProvider } from '@material-ui/core'; +import Paper from '@material-ui/core/Paper'; +import Snackbar from '@material-ui/core/Snackbar'; +import Fade from '@material-ui/core/Fade'; +import { makeStyles } from '@material-ui/core/styles'; +import { useSettings } from '../../apps/settings/hooks/useSettings'; +import { usePhone } from '../../os/phone/hooks/usePhone'; const useStyles = makeStyles({ paper: { - width: "350px", - height: "100px", - opacity: "0.93", + width: '350px', + height: '100px', + opacity: '0.93', }, snackBar: { zIndex: -5, // we want this to appear behind other active NUI events...probably @@ -20,7 +20,7 @@ const useStyles = makeStyles({ function Notification({ children, handleClose, open }) { const classes = useStyles(); - const { currentTheme } = useSettings(); + const [settings] = useSettings(); const { config } = usePhone(); if (!config) return null; @@ -28,19 +28,22 @@ function Notification({ children, handleClose, open }) { const { horizontal, vertical } = config.notificationPosition; return ( - - setTimeout(() => { handleClose() }, 5000) }} - onClose={handleClose} - open={open} - TransitionComponent={Fade} - autoHideDuration={6000} - > - {children} - - + + setTimeout(() => { + handleClose(); + }, 5000), + }} + onClose={handleClose} + open={open} + TransitionComponent={Fade} + autoHideDuration={6000} + > + {children} + ); } diff --git a/phone/yarn.lock b/phone/yarn.lock index 438c9f6..d525f85 100644 --- a/phone/yarn.lock +++ b/phone/yarn.lock @@ -10124,10 +10124,10 @@ recast@~0.11.12: private "~0.1.5" source-map "~0.5.0" -recoil@^0.0.10: - version "0.0.10" - resolved "https://registry.yarnpkg.com/recoil/-/recoil-0.0.10.tgz#679ab22306f559f8a63c46fd5ff5241539f9248f" - integrity sha512-+9gRqehw3yKETmoZbhSnWu4GO10HDb5xYf1CjLF1oXGK2uT6GX5Lu9mfTXwjxV/jXxEKx8MIRUUbgPxvbJ8SEw== +recoil@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/recoil/-/recoil-0.1.2.tgz#844c612f535826dbe54c977761a67ded16f6d063" + integrity sha512-hIRrHlkmW4yITlBFprVYjVPhzPKYrJKoaDrrJtAtbkMeXfXaa/XE5OlyR10n+rNfnKWNToCKb3Z4fo86IGjkzg== recursive-readdir@2.2.2: version "2.2.2" From d65806ffa5f3143ad27bd0ba12d1ba21a0185e7f Mon Sep 17 00:00:00 2001 From: Taso Date: Tue, 12 Jan 2021 11:30:43 -0500 Subject: [PATCH 17/23] Misc: cleanup for rebase of master --- phone/src/ui/components/Notification.tsx | 1 - resources/.gitignore | 3 ++- yarn.lock | 8 -------- 3 files changed, 2 insertions(+), 10 deletions(-) delete mode 100644 yarn.lock diff --git a/phone/src/ui/components/Notification.tsx b/phone/src/ui/components/Notification.tsx index 0a2ebfe..e22689c 100644 --- a/phone/src/ui/components/Notification.tsx +++ b/phone/src/ui/components/Notification.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import { createMuiTheme, ThemeProvider } from '@material-ui/core'; import Paper from '@material-ui/core/Paper'; import Snackbar from '@material-ui/core/Snackbar'; import Fade from '@material-ui/core/Fade'; diff --git a/resources/.gitignore b/resources/.gitignore index 11abf92..015b151 100644 --- a/resources/.gitignore +++ b/resources/.gitignore @@ -1,4 +1,5 @@ .vscode dist/ node_modules/ -yarn-error.log \ No newline at end of file +yarn-error.log +html \ No newline at end of file diff --git a/yarn.lock b/yarn.lock deleted file mode 100644 index 102d128..0000000 --- a/yarn.lock +++ /dev/null @@ -1,8 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -typescript@3.9.7: - version "3.9.7" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.7.tgz#98d600a5ebdc38f40cb277522f12dc800e9e25fa" - integrity sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw== From 3269f2f270a2b04e4df1b1db3953019d215ee3c7 Mon Sep 17 00:00:00 2001 From: TasoOneAsia Date: Tue, 12 Jan 2021 17:10:35 +0000 Subject: [PATCH 18/23] Prettified Code! --- phone/src/locale/fr.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phone/src/locale/fr.json b/phone/src/locale/fr.json index 8b1f925..9f65d63 100644 --- a/phone/src/locale/fr.json +++ b/phone/src/locale/fr.json @@ -75,7 +75,7 @@ "APPS_CONTACT_MODAL_PLACEHOLDER_NUMBER": "Numéro", "APPS_CONTACT_MODAL_PLACEHOLDER_AVATAR": "Photo", "APPS_CONTACT_MODAL_BUTTON_ADD": "Ajouter un contact", - + "APPS_SETTINGS_PHONE_NUMBER": "Numéro de téléphone", "APPS_SETTINGS_OPTION_WALLPAPER": "Fond d'écran", "APPS_SETTINGS_OPTION_FRAME": "Coque", @@ -85,6 +85,6 @@ "APPS_SETTINGS_OPTION_RINGTONEVOL": "Volume de la sonnerie", "GENERIC_UPDATE": "Mettre à jour", - "GENERIC_DELETE": "Supprimer" + "GENERIC_DELETE": "Supprimer" } } From 6e94bef7f317fe24cdd6da2d0b7dede0af3445a3 Mon Sep 17 00:00:00 2001 From: Xios_Bombay <72895600+XiosBombay@users.noreply.github.com> Date: Tue, 12 Jan 2021 12:15:01 -0500 Subject: [PATCH 19/23] locale: Added new translations for es.json (#54) --- phone/src/locale/es.json | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/phone/src/locale/es.json b/phone/src/locale/es.json index 395f854..79b824e 100644 --- a/phone/src/locale/es.json +++ b/phone/src/locale/es.json @@ -69,6 +69,22 @@ "APPS_CONTACT_UPDATE_SUCCESS": "Se ha actualizado el contacto!", "APPS_CONTACT_UPDATE_FAILED": "Error al actualizar el contacto!", "APPS_CONTACT_DELETE_SUCCESS": "Se ha borrado el contacto!", - "APPS_CONTACT_DELETE_FAILED": "Error al borrar el contacto!" + "APPS_CONTACT_DELETE_FAILED": "Error al borrar el contacto!", + "APPS_CONTACT_PLACEHOLDER_SEARCH_CONTACTS": "Buscar contactos", + "APPS_CONTACT_MODAL_PLACEHOLDER_NAME": "Nombre", + "APPS_CONTACT_MODAL_PLACEHOLDER_NUMBER": "Numero", + "APPS_CONTACT_MODAL_PLACEHOLDER_AVATAR": "Avatar", + "APPS_CONTACT_MODAL_BUTTON_ADD": "Agregar contacto", + + "APPS_SETTINGS_PHONE_NUMBER": "Numero de telefono", + "APPS_SETTINGS_OPTION_WALLPAPER": "Fondo de pantalla", + "APPS_SETTINGS_OPTION_FRAME": "Marco", + "APPS_SETTINGS_OPTION_THEME": "Tema", + "APPS_SETTINGS_OPTION_ZOOM": "Ampliar", + "APPS_SETTINGS_OPTION_RINGTONE": "Tono de llamada", + "APPS_SETTINGS_OPTION_RINGTONEVOL": "Volumen del tono de llamada", + + "GENERIC_UPDATE": "Actualizar", + "GENERIC_DELETE": "Borrar" } } From 2b52612f656e017796a0eeff7f0a51318331f226 Mon Sep 17 00:00:00 2001 From: Taso Date: Tue, 12 Jan 2021 21:25:14 -0500 Subject: [PATCH 20/23] bump: esx.js version --- resources/package.json | 2 +- resources/yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/package.json b/resources/package.json index 4873b0e..046340c 100644 --- a/resources/package.json +++ b/resources/package.json @@ -19,7 +19,7 @@ "@types/node": "^14.11.10", "axios": "^0.21.0", "connection-string-parser": "^1.0.3", - "esx.js": "^1.1.5", + "esx.js": "^1.1.6", "fivem-esx-js": "^0.1.12", "fivem-js": "^1.3.1", "md5": "^2.3.0", diff --git a/resources/yarn.lock b/resources/yarn.lock index 24aba1c..e850968 100644 --- a/resources/yarn.lock +++ b/resources/yarn.lock @@ -3032,10 +3032,10 @@ esutils@^2.0.2: resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== -esx.js@^1.1.5: - version "1.1.5" - resolved "https://registry.yarnpkg.com/esx.js/-/esx.js-1.1.5.tgz#a6a9abb1b5ef6b6bdf73f1969eb917f667a438eb" - integrity sha512-6QJgvFvbr/d+eM6AhX7Tzz4lJjJnBnRUcomgzoRW9Jnok7nxmmDEtkGVWZijoSVenxfoUrY8wrf2C1Tg5OYNLg== +esx.js@^1.1.6: + version "1.1.6" + resolved "https://registry.yarnpkg.com/esx.js/-/esx.js-1.1.6.tgz#e5e61afe70b5ac63dcac63de09c1b7451a3d4971" + integrity sha512-vS41PgxinKhQsJ8Hc5iqu+GqfS0Srxfkf51RnpDlWlaN1m4qfGzHz1IE2lw61QouSL/RqzrdJPyJxm6fJ6jPFg== events@^3.0.0: version "3.2.0" From c91d0729fb87627332df97bc8a97de8cc1233913 Mon Sep 17 00:00:00 2001 From: Taso Date: Tue, 12 Jan 2021 21:27:00 -0500 Subject: [PATCH 21/23] DB: Removed need for password and added docs --- README.md | 11 ++++++++++- resources/server/db_utils.test.ts | 11 +++++------ resources/server/db_utils.ts | 9 ++++----- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 41f4588..266e269 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,16 @@ The original repo for NPWD TODO -## Production Server Installation +### Production Server Installation + +**Database** + +NPWD uses its own database driver compatible with `mysql-async` and `ghmattimysql`'s connection string. If you +don't utilize these resources, ensure you have this set in your console. + +``` +set mysql_connection_string "server=127.0.0.1;database=es_extended;userid=user;password=pass" +``` ### Configuration diff --git a/resources/server/db_utils.test.ts b/resources/server/db_utils.test.ts index 7fa20eb..2d04f34 100644 --- a/resources/server/db_utils.test.ts +++ b/resources/server/db_utils.test.ts @@ -8,14 +8,13 @@ describe("parseSemiColonFormat", () => { }); it("Correctly parses configuration options", () => { - const test = - "server=127.0.0.1;database=es_extended;userid=user;password=pass"; + const test = "server=127.0.0.1;database=es_extended;userid=user;"; const result = db.parseSemiColonFormat(test); expect(result.server).toEqual("127.0.0.1"); expect(result.database).toEqual("es_extended"); expect(result.userid).toEqual("user"); - expect(result.password).toEqual("pass"); + expect(result.password).toEqual(undefined); }); }); @@ -80,9 +79,9 @@ describe("getUserId", () => { }); describe("getPassword", () => { - it("returns default", () => { - expect(() => db.getPassword({})).toThrowError(); - }); + // it("returns default", () => { + // expect(() => db.getPassword({})).toThrowError(); + // }); it("Correctly returns password", () => { expect(db.getPassword({ password: t })).toEqual(t); diff --git a/resources/server/db_utils.ts b/resources/server/db_utils.ts index 827a38c..a370d0a 100644 --- a/resources/server/db_utils.ts +++ b/resources/server/db_utils.ts @@ -15,7 +15,7 @@ export function parseSemiColonFormat(connectionString: string): Map { const parts = connectionString.split(";"); if (parts.length === 1) { throw new Error( - `Connection string ${connectionString} is in the incorrect format.` + `Connection string ${connectionString} is in the incorrect format. Please follow the README.` ); } @@ -59,13 +59,12 @@ export function getUserId(config: Map): string { } /** + * Note: We are allowing no password as many FiveM servers love to not use one for an ungodly reason. * allowed variable names: password | pwd * @param config - database config variables parsed from mysql_connection_string */ -export function getPassword(config: Map): string { +export function getPassword(config: Map): string | undefined { const password = config.password || config.pwd; - if (!password) { - throw new Error("Password is a required field"); - } + if (!password) return undefined; return password; } From c9b317450575aec2ce4f4f299e8d3cdc61d7112b Mon Sep 17 00:00:00 2001 From: Taso Date: Tue, 12 Jan 2021 21:27:37 -0500 Subject: [PATCH 22/23] DB: Removed explicit collation values on tables for compatability reasons --- resources/import.sql | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/resources/import.sql b/resources/import.sql index 2689cc7..441531e 100644 --- a/resources/import.sql +++ b/resources/import.sql @@ -14,9 +14,7 @@ CREATE TABLE IF NOT EXISTS npwd_phone_contacts ( ) ENGINE = INNODB, AUTO_INCREMENT = 6, -AVG_ROW_LENGTH = 4096, -CHARACTER SET utf8mb4, -COLLATE utf8mb4_0900_ai_ci; +AVG_ROW_LENGTH = 4096; CREATE TABLE IF NOT EXISTS `npwd_twitter_tweets` ( `id` int NOT NULL AUTO_INCREMENT, @@ -24,26 +22,26 @@ CREATE TABLE IF NOT EXISTS `npwd_twitter_tweets` ( `createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `likes` int NOT NULL DEFAULT '0', - `identifier` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `identifier` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `visible` tinyint NOT NULL DEFAULT '1', `images` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=190 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; +) ENGINE=InnoDB AUTO_INCREMENT=19; CREATE TABLE IF NOT EXISTS `npwd_twitter_profiles` ( `id` int NOT NULL AUTO_INCREMENT, - `profile_name` varchar(90) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, - `identifier` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `avatar_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, - `bio` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, - `location` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, - `job` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, + `profile_name` varchar(90) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `identifier` varchar(40) NOT NULL, + `avatar_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `bio` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `location` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `job` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `profile_name_UNIQUE` (`profile_name`) -) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; +) ENGINE=InnoDB AUTO_INCREMENT=15; CREATE TABLE IF NOT EXISTS `npwd_twitter_likes` ( `id` int NOT NULL AUTO_INCREMENT, @@ -55,7 +53,7 @@ CREATE TABLE IF NOT EXISTS `npwd_twitter_likes` ( KEY `tweet_idx` (`tweet_id`), CONSTRAINT `profile` FOREIGN KEY (`profile_id`) REFERENCES `npwd_twitter_profiles` (`id`), CONSTRAINT `tweet` FOREIGN KEY (`tweet_id`) REFERENCES `npwd_twitter_tweets` (`id`) ON DELETE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=41 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; +) ENGINE=InnoDB AUTO_INCREMENT=41; CREATE TABLE IF NOT EXISTS npwd_notes ( @@ -67,9 +65,7 @@ CREATE TABLE IF NOT EXISTS npwd_notes ( ) ENGINE = INNODB, AUTO_INCREMENT = 5, -AVG_ROW_LENGTH = 4096, -CHARACTER SET utf8mb4, -COLLATE utf8mb4_general_ci; +AVG_ROW_LENGTH = 4096; CREATE TABLE IF NOT EXISTS npwd_sellout_listings ( id int(11) NOT NULL AUTO_INCREMENT, @@ -97,7 +93,7 @@ CREATE TABLE IF NOT EXISTS `npwd_twitter_reports` ( KEY `tweet_idx` (`tweet_id`), CONSTRAINT `report_profile` FOREIGN KEY (`profile_id`) REFERENCES `npwd_twitter_profiles` (`id`), CONSTRAINT `report_tweet` FOREIGN KEY (`tweet_id`) REFERENCES `npwd_twitter_tweets` (`id`) ON DELETE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=45 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; +) ENGINE=InnoDB AUTO_INCREMENT=45; CREATE TABLE IF NOT EXISTS `npwd_messages_groups` ( @@ -112,9 +108,11 @@ CREATE TABLE IF NOT EXISTS `npwd_messages_groups` ( KEY `npwd_messages_groups_group_id` (`group_id`), KEY `npwd_messages_groups_user_identifier_idx` (`user_identifier`), KEY `npwd_messages_groups_participant_identifier_idx` (`participant_identifier`), +# This table is erroring out because of default collation and charset values on the `user` table +# We should discuss an adequate solution CONSTRAINT `npwd_messages_groups_participant_identifier` FOREIGN KEY (`participant_identifier`) REFERENCES `users` (`identifier`), CONSTRAINT `npwd_messages_groups_user_identifier` FOREIGN KEY (`user_identifier`) REFERENCES `users` (`identifier`) -) ENGINE=InnoDB AUTO_INCREMENT=66 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; +) ENGINE=InnoDB AUTO_INCREMENT=66; CREATE TABLE IF NOT EXISTS `npwd_messages_labels` ( `id` int NOT NULL AUTO_INCREMENT, @@ -127,7 +125,7 @@ CREATE TABLE IF NOT EXISTS `npwd_messages_labels` ( KEY `npwd_messages_labels_group_id_idx` (`group_id`), KEY `npwd_messages_labels_group_id_idx1` (`user_identifier`), CONSTRAINT `npwd_messages_labels_group_id` FOREIGN KEY (`group_id`) REFERENCES `npwd_messages_groups` (`group_id`) -) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; +); CREATE TABLE IF NOT EXISTS `npwd_messages` ( `id` int NOT NULL AUTO_INCREMENT, @@ -143,4 +141,4 @@ CREATE TABLE IF NOT EXISTS `npwd_messages` ( KEY `npwd_messages_group_id_idx` (`group_id`), CONSTRAINT `npwd_messages_group_id` FOREIGN KEY (`group_id`) REFERENCES `npwd_messages_groups` (`group_id`), CONSTRAINT `npwd_messages_user_identifier` FOREIGN KEY (`user_identifier`) REFERENCES `users` (`identifier`) -) ENGINE=InnoDB AUTO_INCREMENT=120 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; +); From 54daa4245418944a6022ab5f207165fa69d1c44d Mon Sep 17 00:00:00 2001 From: Taso Date: Tue, 12 Jan 2021 21:31:03 -0500 Subject: [PATCH 23/23] styling: Enforced styling across all files (#55) --- phone/src/Phone.test.tsx | 10 +- phone/src/apps/bank/components/BankApp.css | 18 +- phone/src/apps/bank/components/BankApp.tsx | 1 - .../src/apps/bank/components/alert/Alert.tsx | 6 +- phone/src/apps/bank/hooks/state.ts | 12 +- phone/src/apps/bank/hooks/useBankAlert.ts | 6 +- phone/src/apps/bank/hooks/useBankModal.ts | 4 +- phone/src/apps/bank/hooks/useBankService.ts | 14 +- phone/src/apps/bank/hooks/useTransactions.ts | 4 +- .../calculator/components/CalculatorApp.tsx | 14 +- .../calculator/components/CalculatorIcon.tsx | 46 ++-- .../src/apps/camera/components/CameraApp.tsx | 14 +- .../camera/components/grid/GalleryGrid.tsx | 66 +++-- .../camera/components/grid/grid.styles.ts | 8 +- .../camera/components/modal/GalleryModal.tsx | 49 ++-- .../camera/components/modal/modal.styles.ts | 22 +- phone/src/apps/camera/hooks/state.ts | 14 +- phone/src/apps/camera/hooks/usePhotoMeta.ts | 4 +- phone/src/apps/camera/hooks/usePhotoModal.ts | 4 +- .../src/apps/camera/hooks/usePhotoService.ts | 2 +- phone/src/apps/camera/hooks/usePhotos.ts | 3 +- phone/src/apps/camera/hooks/useShareLink.ts | 6 +- phone/src/apps/camera/hooks/useShareModal.ts | 6 +- .../src/apps/contacts/components/Contact.css | 4 +- .../contacts/components/modal/modal.styles.ts | 18 +- .../apps/contacts/hooks/useContactDetail.ts | 8 +- .../apps/contacts/hooks/useContactModal.ts | 6 +- phone/src/apps/contacts/hooks/useContacts.ts | 6 +- .../contacts/hooks/useFilteredContacts.ts | 4 +- phone/src/apps/contacts/hooks/useModal.ts | 4 +- .../src/apps/dialer/components/DialerApp.tsx | 16 +- .../src/apps/dialer/hooks/useDialerHistory.ts | 10 +- phone/src/apps/home/components/Home.tsx | 12 +- .../src/apps/messages/components/AlertBar.tsx | 34 +-- .../apps/messages/components/MessagesApp.tsx | 26 +- .../buttons/NewMessageGroupButton.tsx | 18 +- .../messages/components/form/MessageInput.tsx | 28 +-- .../components/form/NewMessageGroupForm.tsx | 36 +-- .../messages/components/form/form.styles.ts | 26 +- .../components/list/MessageSearch.tsx | 16 +- .../messages/components/list/list.styles.ts | 46 ++-- .../messages/components/messages.styles.ts | 4 +- .../components/modal/Conversation.tsx | 6 +- .../components/modal/MessageGroupModal.tsx | 16 +- .../components/modal/MessageImageModal.tsx | 38 +-- .../components/modal/MessageModal.tsx | 28 +-- .../components/modal/MessageSkeleton.tsx | 12 +- .../components/modal/MessageSkeletonList.tsx | 6 +- .../messages/components/modal/modal.styles.ts | 76 +++--- phone/src/apps/messages/hooks/state.ts | 16 +- .../src/apps/messages/hooks/useImageModal.ts | 5 +- .../apps/messages/hooks/useMessageService.ts | 18 +- phone/src/apps/notes/NotesApp.css | 2 +- phone/src/apps/notes/NotesTitle.tsx | 22 +- phone/src/apps/notes/hooks/state.ts | 10 +- phone/src/apps/notes/hooks/useNoteDetail.ts | 2 +- phone/src/apps/notes/hooks/useNoteModal.ts | 4 +- phone/src/apps/notes/hooks/useNotes.ts | 4 +- phone/src/apps/notes/hooks/useNotesService.ts | 4 +- phone/src/apps/notes/modal/NoteModal.tsx | 2 +- phone/src/apps/notes/modal/modal.styles.ts | 18 +- phone/src/apps/notes/notes.styles.ts | 12 +- phone/src/apps/sellout/components/Sellout.css | 5 +- .../apps/sellout/components/SelloutApp.tsx | 24 +- .../components/SelloutList/SelloutItem.tsx | 69 +++--- .../components/SelloutList/SelloutList.tsx | 6 +- .../SelloutList/SelloutListContainer.tsx | 6 +- .../sellout/components/form/ListingForm.tsx | 66 ++--- .../components/form/ListingFormContainer.tsx | 4 +- .../components/images/ImageDisplay.tsx | 6 +- phone/src/apps/sellout/hooks/state.ts | 6 +- phone/src/apps/sellout/hooks/useListing.ts | 4 +- .../apps/sellout/hooks/useSelloutService.ts | 10 +- .../apps/twitter/components/AddTweetModal.tsx | 94 ++++---- phone/src/apps/twitter/components/Avatar.tsx | 24 +- .../twitter/components/BottomNavigation.tsx | 22 +- .../apps/twitter/components/EmojiSelect.tsx | 8 +- .../apps/twitter/components/TwitterApp.tsx | 56 ++--- .../apps/twitter/components/TwitterSearch.tsx | 32 +-- .../apps/twitter/components/TwitterTitle.tsx | 26 +- .../twitter/components/alerts/AlertBar.tsx | 34 +-- .../components/buttons/ControlButtons.tsx | 32 +-- .../components/buttons/IconButtons.tsx | 28 +-- .../twitter/components/buttons/LikeButton.tsx | 12 +- .../buttons/ProfileUpdateButton.tsx | 20 +- .../components/buttons/QuoteButton.tsx | 10 +- .../components/buttons/ReplyButton.tsx | 10 +- .../components/buttons/ReportButton.tsx | 28 +-- .../components/buttons/SearchButton.tsx | 18 +- .../components/buttons/TweetButton.tsx | 18 +- .../apps/twitter/components/images/Image.tsx | 42 ++-- .../components/images/ImageDisplay.tsx | 6 +- .../twitter/components/images/ImagePrompt.tsx | 20 +- .../notification/TwitterNotification.test.tsx | 30 +-- .../notification/TwitterNotification.tsx | 54 ++--- .../twitter/components/profile/Profile.tsx | 50 ++-- .../components/profile/ProfileField.tsx | 12 +- .../components/profile/ProfilePrompt.tsx | 30 +-- .../twitter/components/tweet/ShowMore.tsx | 84 ++++--- .../apps/twitter/components/tweet/Tweet.tsx | 88 +++---- .../twitter/components/tweet/TweetList.tsx | 9 +- .../components/tweet/TweetListContainer.tsx | 10 +- .../twitter/components/tweet/TweetMessage.tsx | 24 +- .../components/tweet/TweetSkeleton.tsx | 30 +-- .../components/tweet/TweetSkeletonList.tsx | 6 +- phone/src/apps/twitter/hooks/state.ts | 26 +- .../apps/twitter/hooks/useFilteredTweets.ts | 4 +- phone/src/apps/twitter/hooks/useModal.ts | 4 +- phone/src/apps/twitter/hooks/useProfile.ts | 4 +- .../src/apps/twitter/hooks/useTweetStatus.ts | 4 +- phone/src/apps/twitter/hooks/useTweets.ts | 4 +- .../apps/twitter/hooks/useTwitterService.ts | 28 +-- phone/src/apps/twitter/utils/constants.ts | 6 +- phone/src/apps/twitter/utils/images.ts | 2 +- phone/src/apps/twitter/utils/time.ts | 8 +- phone/src/main.css | 6 +- phone/src/modal/components/CallModal.tsx | 18 +- phone/src/modal/hooks/state.ts | 4 +- phone/src/modal/hooks/useCall.ts | 4 +- phone/src/modal/hooks/useCallService.ts | 10 +- phone/src/os/apps/hooks/useApps.tsx | 52 ++-- phone/src/os/keyboard/hooks/useKeyboard.ts | 38 +-- .../navigation-bar/components/Navigation.tsx | 26 +- .../components/NotificationIcon.tsx | 4 +- phone/src/os/nui-events/hooks/useNuiEvent.ts | 16 +- .../src/os/nui-events/hooks/useNuiService.ts | 10 +- phone/src/os/nui-events/utils/Nui.ts | 4 +- phone/src/os/nui-events/utils/nuiUtils.ts | 2 +- phone/src/os/simcard/hooks/state.ts | 4 +- phone/src/os/simcard/hooks/useSimcard.ts | 4 +- .../src/os/simcard/hooks/useSimcardService.ts | 10 +- phone/src/setupTests.tsx | 4 +- phone/src/ui/components/Alert.tsx | 6 +- phone/src/ui/components/AppContent.tsx | 24 +- phone/src/ui/components/AppIcon.tsx | 20 +- phone/src/ui/components/AppTitle.tsx | 14 +- phone/src/ui/components/Button.tsx | 6 +- phone/src/ui/components/Input.tsx | 6 +- phone/src/ui/components/List.tsx | 6 +- phone/src/ui/components/ListItem.tsx | 6 +- phone/src/ui/components/Modal.tsx | 38 +-- phone/src/ui/components/index.tsx | 2 +- phone/src/ui/hooks/useContextMenu.tsx | 4 +- resources/client/cl_bank.ts | 39 ++- resources/client/cl_contacts.ts | 30 ++- resources/client/cl_main.ts | 41 ++-- resources/client/cl_messages.ts | 35 +-- resources/client/cl_photo.ts | 60 +++-- resources/client/cl_sellout.ts | 17 +- resources/client/client.ts | 18 +- resources/server/db.ts | 19 +- resources/server/discord.ts | 41 ++-- resources/server/functions.ts | 12 +- resources/server/server.ts | 21 +- resources/server/sv_bank.ts | 88 +++---- resources/server/sv_contacts.ts | 109 ++++++--- resources/server/sv_main.ts | 24 +- resources/server/sv_messages.ts | 225 +++++++++++------- resources/server/sv_photo.ts | 49 ++-- resources/server/sv_sellout.ts | 58 ++--- resources/server/sv_twitter.ts | 29 ++- resources/utils/apps.ts | 2 +- resources/utils/config.ts | 6 +- resources/utils/events.ts | 112 ++++----- resources/utils/messages.ts | 2 +- 165 files changed, 1879 insertions(+), 1725 deletions(-) diff --git a/phone/src/Phone.test.tsx b/phone/src/Phone.test.tsx index e7c39fe..d3a4b15 100644 --- a/phone/src/Phone.test.tsx +++ b/phone/src/Phone.test.tsx @@ -1,9 +1,9 @@ -import React from "react"; -import { RecoilRoot } from "recoil"; -import { shallow } from "enzyme"; -import Phone from "./Phone"; +import React from 'react'; +import { RecoilRoot } from 'recoil'; +import { shallow } from 'enzyme'; +import Phone from './Phone'; -it("renders Phone", () => { +it('renders Phone', () => { shallow( diff --git a/phone/src/apps/bank/components/BankApp.css b/phone/src/apps/bank/components/BankApp.css index ad19ba4..c980c49 100644 --- a/phone/src/apps/bank/components/BankApp.css +++ b/phone/src/apps/bank/components/BankApp.css @@ -1,4 +1,4 @@ -@import url("https://fonts.googleapis.com/css2?family=Bebas+Neue&display=swap"); +@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&display=swap'); /* #### Generated By: http://www.cufonfonts.com #### */ @@ -6,11 +6,13 @@ font-family: 'Bahnschrift Regular'; font-style: normal; font-weight: normal; - src: local('Bahnschrift Regular'), url('../fonts/BAHNSCHRIFT.woff') format('woff'); - } + src: local('Bahnschrift Regular'), + url('../fonts/BAHNSCHRIFT.woff') format('woff'); +} -#account-section, #transaction-section { - font-family: 'Bahnschrift Regular' +#account-section, +#transaction-section { + font-family: 'Bahnschrift Regular'; } #transaction-section .MuiTablePagination-root { @@ -26,12 +28,10 @@ font-size: 50px; } - #bank-app .Mui-selected { - color: #388CF8 !important; + color: #388cf8 !important; } - #bank-app .MuiSnackbar-root { position: absolute; } @@ -47,4 +47,4 @@ #actionButton a { color: #fff; -} \ No newline at end of file +} diff --git a/phone/src/apps/bank/components/BankApp.tsx b/phone/src/apps/bank/components/BankApp.tsx index 7001d3f..979c4fe 100644 --- a/phone/src/apps/bank/components/BankApp.tsx +++ b/phone/src/apps/bank/components/BankApp.tsx @@ -11,7 +11,6 @@ import { useBankModal } from '../hooks/useBankModal'; import { Switch, Route } from 'react-router-dom'; import { NavigationBar } from './navigation/NavigationBar'; - import { BankHome } from './home/BankHome'; import { BankAccount } from './account/BankAccount'; import { TransactionList } from './transactions/TransactionList'; diff --git a/phone/src/apps/bank/components/alert/Alert.tsx b/phone/src/apps/bank/components/alert/Alert.tsx index 2ba1e67..103e28b 100644 --- a/phone/src/apps/bank/components/alert/Alert.tsx +++ b/phone/src/apps/bank/components/alert/Alert.tsx @@ -1,8 +1,8 @@ -import React from "react"; -import MuiAlert from "@material-ui/lab/Alert"; +import React from 'react'; +import MuiAlert from '@material-ui/lab/Alert'; export function Alert(props) { - return ; + return ; } export default Alert; diff --git a/phone/src/apps/bank/hooks/state.ts b/phone/src/apps/bank/hooks/state.ts index 70ad8d4..b89443c 100644 --- a/phone/src/apps/bank/hooks/state.ts +++ b/phone/src/apps/bank/hooks/state.ts @@ -3,7 +3,7 @@ import { atom } from 'recoil'; export const bankState = { transactions: atom({ key: 'transactionList', - default: [] + default: [], }), bankModal: atom({ key: 'modalVisibility', @@ -11,14 +11,14 @@ export const bankState = { }), transferSuccessful: atom({ key: 'bankAlert', - default: null + default: null, }), bankCredentials: atom({ key: 'bankCredentails', - default: null + default: null, }), notification: atom({ key: 'bankNotification', - default: null - }) -} \ No newline at end of file + default: null, + }), +}; diff --git a/phone/src/apps/bank/hooks/useBankAlert.ts b/phone/src/apps/bank/hooks/useBankAlert.ts index da6deb0..f25d33b 100644 --- a/phone/src/apps/bank/hooks/useBankAlert.ts +++ b/phone/src/apps/bank/hooks/useBankAlert.ts @@ -2,6 +2,8 @@ import { useRecoilState } from 'recoil'; import { bankState } from './state'; export const useBankAlert = (): any => { - const [ bankAlert, setBankAlert ] = useRecoilState(bankState.transferSuccessful); + const [bankAlert, setBankAlert] = useRecoilState( + bankState.transferSuccessful + ); return { bankAlert, setBankAlert }; -} \ No newline at end of file +}; diff --git a/phone/src/apps/bank/hooks/useBankModal.ts b/phone/src/apps/bank/hooks/useBankModal.ts index 71afcf8..16a0c08 100644 --- a/phone/src/apps/bank/hooks/useBankModal.ts +++ b/phone/src/apps/bank/hooks/useBankModal.ts @@ -2,6 +2,6 @@ import { useRecoilState } from 'recoil'; import { bankState } from './state'; export const useBankModal = () => { - const [ showBankModal, setShowBankModal ] = useRecoilState(bankState.bankModal); + const [showBankModal, setShowBankModal] = useRecoilState(bankState.bankModal); return { showBankModal, setShowBankModal }; -} +}; diff --git a/phone/src/apps/bank/hooks/useBankService.ts b/phone/src/apps/bank/hooks/useBankService.ts index f853886..710ef91 100644 --- a/phone/src/apps/bank/hooks/useBankService.ts +++ b/phone/src/apps/bank/hooks/useBankService.ts @@ -1,22 +1,22 @@ import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent'; import { bankState } from './state'; -import { useTransactions } from './useTransactions' +import { useTransactions } from './useTransactions'; import { useCredentials } from './useCredentials'; import { useBankAlert } from './useBankAlert'; -import { useSetRecoilState } from 'recoil' +import { useSetRecoilState } from 'recoil'; import { useBankNotification } from './useBankNotification'; export const useBankService = () => { - const setTransaction = useSetRecoilState(bankState.transactions) - const setCredentials = useSetRecoilState(bankState.bankCredentials) - const setAlertMessage = useSetRecoilState(bankState.transferSuccessful) + const setTransaction = useSetRecoilState(bankState.transactions); + const setCredentials = useSetRecoilState(bankState.bankCredentials); + const setAlertMessage = useSetRecoilState(bankState.transferSuccessful); const setNotification = useSetRecoilState(bankState.notification); /// - + useNuiEvent('BANK', 'setTransaction', setTransaction); useNuiEvent('BANK', 'setCredentials', setCredentials); useNuiEvent('BANK', 'setAlert', setAlertMessage); useNuiEvent('BANK', 'setNotification', setNotification); return { useTransactions, useCredentials, useBankAlert, useBankNotification }; -} \ No newline at end of file +}; diff --git a/phone/src/apps/bank/hooks/useTransactions.ts b/phone/src/apps/bank/hooks/useTransactions.ts index 26c7870..94be613 100644 --- a/phone/src/apps/bank/hooks/useTransactions.ts +++ b/phone/src/apps/bank/hooks/useTransactions.ts @@ -1,5 +1,5 @@ -import { useRecoilValue } from "recoil"; -import { bankState } from './state'; +import { useRecoilValue } from 'recoil'; +import { bankState } from './state'; export const useTransactions = () => { const transactionList = useRecoilValue(bankState.transactions); diff --git a/phone/src/apps/calculator/components/CalculatorApp.tsx b/phone/src/apps/calculator/components/CalculatorApp.tsx index b089fcc..be3d98f 100644 --- a/phone/src/apps/calculator/components/CalculatorApp.tsx +++ b/phone/src/apps/calculator/components/CalculatorApp.tsx @@ -1,12 +1,12 @@ -import React from "react"; -import { AppWrapper } from "../../../ui/components"; -import { AppTitle } from "../../../ui/components/AppTitle"; -import { AppContent } from "../../../ui/components/AppContent"; -import { Calculator } from "./Calculator"; -import { useApp } from "../../../os/apps/hooks/useApps"; +import React from 'react'; +import { AppWrapper } from '../../../ui/components'; +import { AppTitle } from '../../../ui/components/AppTitle'; +import { AppContent } from '../../../ui/components/AppContent'; +import { Calculator } from './Calculator'; +import { useApp } from '../../../os/apps/hooks/useApps'; export const CalculatorApp = () => { - const calculator = useApp("CALCULATOR"); + const calculator = useApp('CALCULATOR'); return ( diff --git a/phone/src/apps/calculator/components/CalculatorIcon.tsx b/phone/src/apps/calculator/components/CalculatorIcon.tsx index 398c66c..41b0710 100644 --- a/phone/src/apps/calculator/components/CalculatorIcon.tsx +++ b/phone/src/apps/calculator/components/CalculatorIcon.tsx @@ -1,41 +1,41 @@ -import React from "react"; -import { SvgIcon } from "@material-ui/core"; +import React from 'react'; +import { SvgIcon } from '@material-ui/core'; export const CalculatorIcon = ({ ...props }) => { return ( - - - - + + + + diff --git a/phone/src/apps/camera/components/CameraApp.tsx b/phone/src/apps/camera/components/CameraApp.tsx index 916185c..1e7d6f9 100644 --- a/phone/src/apps/camera/components/CameraApp.tsx +++ b/phone/src/apps/camera/components/CameraApp.tsx @@ -1,14 +1,12 @@ -import React from 'react' -import { AppWrapper } from "../../../ui/components"; -import { AppContent } from "../../../ui/components/AppContent"; +import React from 'react'; +import { AppWrapper } from '../../../ui/components'; +import { AppContent } from '../../../ui/components/AppContent'; import { usePhotoModal } from '../hooks/usePhotoModal'; import { GalleryGrid } from './grid/GalleryGrid'; import { GalleryModal } from './modal/GalleryModal'; - const CameraApp = () => { - - const {modal} = usePhotoModal(); + const { modal } = usePhotoModal(); return ( @@ -23,7 +21,7 @@ const CameraApp = () => { {!modal ? : null} - ) -} + ); +}; export default CameraApp; diff --git a/phone/src/apps/camera/components/grid/GalleryGrid.tsx b/phone/src/apps/camera/components/grid/GalleryGrid.tsx index d9d01f6..1a97bcd 100644 --- a/phone/src/apps/camera/components/grid/GalleryGrid.tsx +++ b/phone/src/apps/camera/components/grid/GalleryGrid.tsx @@ -1,4 +1,4 @@ -import React from 'react' +import React from 'react'; import { Box, Button } from '@material-ui/core'; import useStyles from './grid.styles'; import { usePhotos } from '../../hooks/usePhotos'; @@ -10,48 +10,70 @@ import { usePhotoMeta } from '../../hooks/usePhotoMeta'; // isMessage will work as a style handler kinda. If the gallery is rendered in the messages, // it will have the value true, which basically means a tweak on the design to fit in a modal export const GalleryGrid = (isMessags) => { - const classes = useStyles() - + const classes = useStyles(); + const { setMeta } = usePhotoMeta(); const { setModal } = usePhotoModal(); - + const photos = usePhotos(); - console.log(photos) + console.log(photos); const handleCamera = () => { - Nui.send('phone:TakePhoto', {}) - } + Nui.send('phone:TakePhoto', {}); + }; const handlePhotoOpen = (photo) => { - setModal(true) - setMeta(photo) - } + setModal(true); + setMeta(photo); + }; - if(!photos) return ( - + if (!photos) + return ( + - - ) + ); return (
- + - - {photos.map(photo => ( + {photos.map((photo) => ( handlePhotoOpen(photo)}> -
+
))}
- ) -} + ); +}; diff --git a/phone/src/apps/camera/components/grid/grid.styles.ts b/phone/src/apps/camera/components/grid/grid.styles.ts index 5e7008b..b888fbc 100644 --- a/phone/src/apps/camera/components/grid/grid.styles.ts +++ b/phone/src/apps/camera/components/grid/grid.styles.ts @@ -2,7 +2,7 @@ import { makeStyles, Theme } from '@material-ui/core/styles'; const useStyles = makeStyles((theme: Theme) => ({ root: { - flexGrow: 1 + flexGrow: 1, }, photo: { border: '1px inset #fff', @@ -13,7 +13,7 @@ const useStyles = makeStyles((theme: Theme) => ({ backgroundPosition: 'center', backgroundRepeat: 'no-repeat', backgroundSize: 'cover', - } -})) + }, +})); -export default useStyles; \ No newline at end of file +export default useStyles; diff --git a/phone/src/apps/camera/components/modal/GalleryModal.tsx b/phone/src/apps/camera/components/modal/GalleryModal.tsx index 357bfe1..8cff0eb 100644 --- a/phone/src/apps/camera/components/modal/GalleryModal.tsx +++ b/phone/src/apps/camera/components/modal/GalleryModal.tsx @@ -1,4 +1,4 @@ -import React from 'react' +import React from 'react'; import { usePhotoMeta } from '../../hooks/usePhotoMeta'; import { usePhotoModal } from '../../hooks/usePhotoModal'; import useStyles from './modal.styles'; @@ -12,49 +12,52 @@ import { ShareModal } from './ShareModal'; import { useShareLink } from '../../hooks/useShareLink'; export const GalleryModal = () => { - const { meta, setMeta } = usePhotoMeta(); const { modal, setModal } = usePhotoModal(); const classes = useStyles(); - const { shareModal ,setShareModal } = useShareModal(); + const { shareModal, setShareModal } = useShareModal(); const { setShareLink } = useShareLink(); - const _handleClose = () => { - setModal(false) + setModal(false); setMeta(null); - } + }; const handleDeletePhoto = () => { - console.log(meta.id) + console.log(meta.id); Nui.send('photo:deletePhoto', { - id: meta.id - }) - setModal(false) - } + id: meta.id, + }); + setModal(false); + }; const handleSharePhoto = () => { - setShareModal(true) - setShareLink(meta.image) - } - - if(!meta) return null; + setShareModal(true); + setShareLink(meta.image); + }; + + if (!meta) return null; return ( - +
- -
+ +
- ) -} + ); +}; diff --git a/phone/src/apps/camera/components/modal/modal.styles.ts b/phone/src/apps/camera/components/modal/modal.styles.ts index b402c77..017439d 100644 --- a/phone/src/apps/camera/components/modal/modal.styles.ts +++ b/phone/src/apps/camera/components/modal/modal.styles.ts @@ -2,9 +2,9 @@ import { makeStyles, Theme } from '@material-ui/core/styles'; const useStyles = makeStyles((theme: Theme) => ({ backgroundModal: { - background: "black", - opacity: "0.6", - position: "absolute", + background: 'black', + opacity: '0.6', + position: 'absolute', top: 0, left: 0, right: 0, @@ -17,7 +17,7 @@ const useStyles = makeStyles((theme: Theme) => ({ width: '100%', }, modalHide: { - display: 'none' + display: 'none', }, image: { width: 'auto', @@ -27,22 +27,22 @@ const useStyles = makeStyles((theme: Theme) => ({ backgroundPosition: 'center', backgroundSize: 'cover', backgroundRepeat: 'no-repeat', - marginTop: '4em' + marginTop: '4em', }, actionDiv: { marginTop: 15, display: 'flex', - justifyContent: 'space-evenly' + justifyContent: 'space-evenly', }, // share modal shareModal: { - marginBottom: 50 + marginBottom: 50, }, innerShareModal: { marginTop: 40, - textAlign: 'center' - } -})) + textAlign: 'center', + }, +})); -export default useStyles; \ No newline at end of file +export default useStyles; diff --git a/phone/src/apps/camera/hooks/state.ts b/phone/src/apps/camera/hooks/state.ts index d098ba4..9305ab0 100644 --- a/phone/src/apps/camera/hooks/state.ts +++ b/phone/src/apps/camera/hooks/state.ts @@ -3,22 +3,22 @@ import { atom } from 'recoil'; export const photoState = { photos: atom({ key: 'galleryPhotos', - default: null + default: null, }), modal: atom({ key: 'photoModal', - default: false + default: false, }), photoMeta: atom({ key: 'photoMeta', - default: null + default: null, }), shareModal: atom({ key: 'phoneShareModal', - default: false + default: false, }), shareLink: atom({ key: 'photoShareLink', - default: null - }) -} \ No newline at end of file + default: null, + }), +}; diff --git a/phone/src/apps/camera/hooks/usePhotoMeta.ts b/phone/src/apps/camera/hooks/usePhotoMeta.ts index 5c31a5c..ffc8dd5 100644 --- a/phone/src/apps/camera/hooks/usePhotoMeta.ts +++ b/phone/src/apps/camera/hooks/usePhotoMeta.ts @@ -3,5 +3,5 @@ import { photoState } from './state'; export const usePhotoMeta = () => { const [meta, setMeta] = useRecoilState(photoState.photoMeta); - return { meta, setMeta}; -} \ No newline at end of file + return { meta, setMeta }; +}; diff --git a/phone/src/apps/camera/hooks/usePhotoModal.ts b/phone/src/apps/camera/hooks/usePhotoModal.ts index 39aafe2..df44ef0 100644 --- a/phone/src/apps/camera/hooks/usePhotoModal.ts +++ b/phone/src/apps/camera/hooks/usePhotoModal.ts @@ -3,5 +3,5 @@ import { photoState } from './state'; export const usePhotoModal = () => { const [modal, setModal] = useRecoilState(photoState.modal); - return { modal, setModal} -} \ No newline at end of file + return { modal, setModal }; +}; diff --git a/phone/src/apps/camera/hooks/usePhotoService.ts b/phone/src/apps/camera/hooks/usePhotoService.ts index b080ff2..5b33e31 100644 --- a/phone/src/apps/camera/hooks/usePhotoService.ts +++ b/phone/src/apps/camera/hooks/usePhotoService.ts @@ -7,4 +7,4 @@ export const usePhotoService = () => { const setPhotos = useSetRecoilState(photoState.photos); useNuiEvent('CAMERA', 'setPhotos', setPhotos); return usePhotos(); -} \ No newline at end of file +}; diff --git a/phone/src/apps/camera/hooks/usePhotos.ts b/phone/src/apps/camera/hooks/usePhotos.ts index 1c4d781..c38c047 100644 --- a/phone/src/apps/camera/hooks/usePhotos.ts +++ b/phone/src/apps/camera/hooks/usePhotos.ts @@ -7,8 +7,7 @@ interface IPhotos { map?: any; } - export const usePhotos = (): IPhotos | null => { const photos = useRecoilValue(photoState.photos); return photos; -} \ No newline at end of file +}; diff --git a/phone/src/apps/camera/hooks/useShareLink.ts b/phone/src/apps/camera/hooks/useShareLink.ts index ecb1b9b..9d79d13 100644 --- a/phone/src/apps/camera/hooks/useShareLink.ts +++ b/phone/src/apps/camera/hooks/useShareLink.ts @@ -2,6 +2,6 @@ import { useRecoilState } from 'recoil'; import { photoState } from './state'; export const useShareLink = () => { - const [ shareLink, setShareLink ] = useRecoilState(photoState.shareLink); - return { shareLink, setShareLink } -} \ No newline at end of file + const [shareLink, setShareLink] = useRecoilState(photoState.shareLink); + return { shareLink, setShareLink }; +}; diff --git a/phone/src/apps/camera/hooks/useShareModal.ts b/phone/src/apps/camera/hooks/useShareModal.ts index 66dfec1..eeaaaab 100644 --- a/phone/src/apps/camera/hooks/useShareModal.ts +++ b/phone/src/apps/camera/hooks/useShareModal.ts @@ -2,6 +2,6 @@ import { useRecoilState } from 'recoil'; import { photoState } from './state'; export const useShareModal = () => { - const [ shareModal, setShareModal ] = useRecoilState(photoState.shareModal); - return { shareModal, setShareModal } -} \ No newline at end of file + const [shareModal, setShareModal] = useRecoilState(photoState.shareModal); + return { shareModal, setShareModal }; +}; diff --git a/phone/src/apps/contacts/components/Contact.css b/phone/src/apps/contacts/components/Contact.css index a6986f2..9d67f58 100644 --- a/phone/src/apps/contacts/components/Contact.css +++ b/phone/src/apps/contacts/components/Contact.css @@ -1,3 +1,3 @@ #contact-app .Mui-focused::after { - border-bottom: #2196f3 solid 4px; -} \ No newline at end of file + border-bottom: #2196f3 solid 4px; +} diff --git a/phone/src/apps/contacts/components/modal/modal.styles.ts b/phone/src/apps/contacts/components/modal/modal.styles.ts index 7f0af19..4b4c94e 100644 --- a/phone/src/apps/contacts/components/modal/modal.styles.ts +++ b/phone/src/apps/contacts/components/modal/modal.styles.ts @@ -5,10 +5,10 @@ const useStyles = makeStyles((theme) => ({ zIndex: 10, position: 'absolute', height: '100%', - width: '100%' + width: '100%', }, modalHide: { - display: 'none' + display: 'none', }, listContainer: { marginTop: 30, @@ -20,7 +20,7 @@ const useStyles = makeStyles((theme) => ({ margin: 'auto', height: '125px', width: '124px', - marginBottom: 29 + marginBottom: 29, }, input: { marginBottom: 20, @@ -28,7 +28,7 @@ const useStyles = makeStyles((theme) => ({ textAlign: 'center', }, inputProps: { - fontSize: 22 + fontSize: 22, }, updateButton: { background: '#2196f3', @@ -36,14 +36,14 @@ const useStyles = makeStyles((theme) => ({ height: 45, fontSize: 16, marginTop: 29, - marginBottom: 29 + marginBottom: 29, }, deleteButton: { background: '#d32f2f', width: 150, height: 40, - fontSize: 16 - } -})) + fontSize: 16, + }, +})); -export default useStyles; \ No newline at end of file +export default useStyles; diff --git a/phone/src/apps/contacts/hooks/useContactDetail.ts b/phone/src/apps/contacts/hooks/useContactDetail.ts index 9c064e9..9089c01 100644 --- a/phone/src/apps/contacts/hooks/useContactDetail.ts +++ b/phone/src/apps/contacts/hooks/useContactDetail.ts @@ -1,7 +1,9 @@ import { useRecoilState } from 'recoil'; import { contactsState } from './state'; - + export const useContactDetail = (): any => { - const [ contactDetail, setContactDetail ] = useRecoilState(contactsState.contactDetail); + const [contactDetail, setContactDetail] = useRecoilState( + contactsState.contactDetail + ); return { contactDetail, setContactDetail }; -} \ No newline at end of file +}; diff --git a/phone/src/apps/contacts/hooks/useContactModal.ts b/phone/src/apps/contacts/hooks/useContactModal.ts index ce448bf..2528f0b 100644 --- a/phone/src/apps/contacts/hooks/useContactModal.ts +++ b/phone/src/apps/contacts/hooks/useContactModal.ts @@ -2,6 +2,8 @@ import { useRecoilState } from 'recoil'; import { contactsState } from './state'; export const useContactModal = () => { - const [ showContactModal, setShowContactModal ] = useRecoilState(contactsState.showContactsModal); + const [showContactModal, setShowContactModal] = useRecoilState( + contactsState.showContactsModal + ); return { showContactModal, setShowContactModal }; -} \ No newline at end of file +}; diff --git a/phone/src/apps/contacts/hooks/useContacts.ts b/phone/src/apps/contacts/hooks/useContacts.ts index b52fc7e..034d184 100644 --- a/phone/src/apps/contacts/hooks/useContacts.ts +++ b/phone/src/apps/contacts/hooks/useContacts.ts @@ -1,11 +1,11 @@ -import { useRecoilValue } from "recoil"; -import { contactsState } from "./state"; +import { useRecoilValue } from 'recoil'; +import { contactsState } from './state'; interface Contact { id: string; display: string; number: string; - avatar?: string + avatar?: string; } interface IUseContacts { diff --git a/phone/src/apps/contacts/hooks/useFilteredContacts.ts b/phone/src/apps/contacts/hooks/useFilteredContacts.ts index 0e77e25..662346d 100644 --- a/phone/src/apps/contacts/hooks/useFilteredContacts.ts +++ b/phone/src/apps/contacts/hooks/useFilteredContacts.ts @@ -1,5 +1,5 @@ -import { useRecoilState } from "recoil"; -import { contactsState } from "./state"; +import { useRecoilState } from 'recoil'; +import { contactsState } from './state'; export const useFilteredContacts = () => { const [filteredContacts, setFilteredContacts] = useRecoilState( diff --git a/phone/src/apps/contacts/hooks/useModal.ts b/phone/src/apps/contacts/hooks/useModal.ts index fddf5a1..8ed865b 100644 --- a/phone/src/apps/contacts/hooks/useModal.ts +++ b/phone/src/apps/contacts/hooks/useModal.ts @@ -1,5 +1,5 @@ -import { useRecoilState } from "recoil"; -import { contactsState } from "./state"; +import { useRecoilState } from 'recoil'; +import { contactsState } from './state'; export const useModal = () => { const [showModal, setShowModal] = useRecoilState(contactsState.showModal); diff --git a/phone/src/apps/dialer/components/DialerApp.tsx b/phone/src/apps/dialer/components/DialerApp.tsx index 5ec8610..4aacf55 100644 --- a/phone/src/apps/dialer/components/DialerApp.tsx +++ b/phone/src/apps/dialer/components/DialerApp.tsx @@ -1,14 +1,14 @@ -import React from "react"; -import { AppWrapper } from "../../../ui/components"; -import { AppTitle } from "../../../ui/components/AppTitle"; -import { AppContent } from "../../../ui/components/AppContent"; -import { DialerHistory } from "./DialerHistory"; -import { useDialerHistory } from "../hooks/useDialerHistory"; -import { useApp } from "../../../os/apps/hooks/useApps"; +import React from 'react'; +import { AppWrapper } from '../../../ui/components'; +import { AppTitle } from '../../../ui/components/AppTitle'; +import { AppContent } from '../../../ui/components/AppContent'; +import { DialerHistory } from './DialerHistory'; +import { useDialerHistory } from '../hooks/useDialerHistory'; +import { useApp } from '../../../os/apps/hooks/useApps'; export const DialerApp = () => { const { history } = useDialerHistory(); - const dialer = useApp("DIALER"); + const dialer = useApp('DIALER'); return ( diff --git a/phone/src/apps/dialer/hooks/useDialerHistory.ts b/phone/src/apps/dialer/hooks/useDialerHistory.ts index 6a8e19a..39e35ca 100644 --- a/phone/src/apps/dialer/hooks/useDialerHistory.ts +++ b/phone/src/apps/dialer/hooks/useDialerHistory.ts @@ -1,13 +1,13 @@ -import { useRecoilState, atom } from "recoil"; +import { useRecoilState, atom } from 'recoil'; const dialerHistoryState = atom({ - key: "dialerHistory", + key: 'dialerHistory', default: [ { id: 1, - caller: "ROCKY", - phoneNumber: "000-1112", - type: "outgoing", + caller: 'ROCKY', + phoneNumber: '000-1112', + type: 'outgoing', }, ], }); diff --git a/phone/src/apps/home/components/Home.tsx b/phone/src/apps/home/components/Home.tsx index d97a0ba..92eca40 100644 --- a/phone/src/apps/home/components/Home.tsx +++ b/phone/src/apps/home/components/Home.tsx @@ -1,14 +1,14 @@ -import React from "react"; -import { AppWrapper } from "../../../ui/components"; -import { Box } from "@material-ui/core"; -import { GridMenu } from "../../../ui/components/GridMenu"; -import { useApps } from "../../../os/apps/hooks/useApps"; +import React from 'react'; +import { AppWrapper } from '../../../ui/components'; +import { Box } from '@material-ui/core'; +import { GridMenu } from '../../../ui/components/GridMenu'; +import { useApps } from '../../../os/apps/hooks/useApps'; export const HomeApp = () => { const { apps } = useApps(); return ( - + {apps && } diff --git a/phone/src/apps/messages/components/AlertBar.tsx b/phone/src/apps/messages/components/AlertBar.tsx index b7bab8f..008073d 100644 --- a/phone/src/apps/messages/components/AlertBar.tsx +++ b/phone/src/apps/messages/components/AlertBar.tsx @@ -1,16 +1,16 @@ -import React, { useEffect, useState } from "react"; -import { useTranslation } from "react-i18next"; -import { Snackbar } from "@material-ui/core"; -import { makeStyles } from "@material-ui/core/styles"; +import React, { useEffect, useState } from 'react'; +import { useTranslation } from 'react-i18next'; +import { Snackbar } from '@material-ui/core'; +import { makeStyles } from '@material-ui/core/styles'; -import useAlerts from "../hooks/useAlerts"; -import Alert from "../../../ui/components/Alert"; +import useAlerts from '../hooks/useAlerts'; +import Alert from '../../../ui/components/Alert'; const useStyles = makeStyles(() => ({ root: { - width: "100%", - bottom: "60px", - position: "absolute", + width: '100%', + bottom: '60px', + position: 'absolute', }, })); @@ -37,22 +37,22 @@ export default function AlertBar() { const { error, phoneNumber, duplicate, mine } = createMessageGroupResult; if (error && phoneNumber) { - const error = `${t("APPS_MESSAGES_INVALID_PHONE_NUMBER")}${phoneNumber}`; + const error = `${t('APPS_MESSAGES_INVALID_PHONE_NUMBER')}${phoneNumber}`; setOpen(true); - setSeverity("error"); + setSeverity('error'); setMessage(error); } else if (error && duplicate) { setOpen(true); - setSeverity("error"); - setMessage(t("APPS_MESSAGES_MESSAGE_GROUP_DUPLICATE")); + setSeverity('error'); + setMessage(t('APPS_MESSAGES_MESSAGE_GROUP_DUPLICATE')); } else if (error && mine) { setOpen(true); - setSeverity("error"); - setMessage(t("APPS_MESSAGES_MESSAGE_GROUP_CREATE_MINE")); + setSeverity('error'); + setMessage(t('APPS_MESSAGES_MESSAGE_GROUP_CREATE_MINE')); } else if (error) { setOpen(true); - setSeverity("error"); - setMessage(t("APPS_MESSAGES_MESSAGE_GROUP_CREATE_FAILED")); + setSeverity('error'); + setMessage(t('APPS_MESSAGES_MESSAGE_GROUP_CREATE_FAILED')); } }, [createMessageGroupResult, t]); diff --git a/phone/src/apps/messages/components/MessagesApp.tsx b/phone/src/apps/messages/components/MessagesApp.tsx index 2e93bf0..56e19fc 100644 --- a/phone/src/apps/messages/components/MessagesApp.tsx +++ b/phone/src/apps/messages/components/MessagesApp.tsx @@ -1,19 +1,19 @@ -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"; -import AlertBar from "./AlertBar"; -import { MessageModal } from "./modal/MessageModal"; -import MessageGroupModal from "./modal/MessageGroupModal"; -import NewMessageGroupButton from "./buttons/NewMessageGroupButton"; -import MessagesList from "./list/MessagesList"; -import "./messages.css"; +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'; +import AlertBar from './AlertBar'; +import { MessageModal } from './modal/MessageModal'; +import MessageGroupModal from './modal/MessageGroupModal'; +import NewMessageGroupButton from './buttons/NewMessageGroupButton'; +import MessagesList from './list/MessagesList'; +import './messages.css'; export const MessagesApp = () => { - const messages = useApp("MESSAGES"); + const messages = useApp('MESSAGES'); return ( - + diff --git a/phone/src/apps/messages/components/buttons/NewMessageGroupButton.tsx b/phone/src/apps/messages/components/buttons/NewMessageGroupButton.tsx index 6b9ac73..2504a3d 100644 --- a/phone/src/apps/messages/components/buttons/NewMessageGroupButton.tsx +++ b/phone/src/apps/messages/components/buttons/NewMessageGroupButton.tsx @@ -1,14 +1,14 @@ -import React from "react"; -import { makeStyles } from "@material-ui/core/styles"; -import { Fab } from "@material-ui/core"; -import AddIcon from "@material-ui/icons/Add"; -import useModals from "../../hooks/useModals"; +import React from 'react'; +import { makeStyles } from '@material-ui/core/styles'; +import { Fab } from '@material-ui/core'; +import AddIcon from '@material-ui/icons/Add'; +import useModals from '../../hooks/useModals'; const useStyles = makeStyles(() => ({ root: { - position: "absolute", - bottom: "25px", - right: "15px", + position: 'absolute', + bottom: '25px', + right: '15px', }, })); @@ -20,7 +20,7 @@ export function NewMessageGroupButton() { return (
- +
diff --git a/phone/src/apps/messages/components/form/MessageInput.tsx b/phone/src/apps/messages/components/form/MessageInput.tsx index 364465b..b83c5de 100644 --- a/phone/src/apps/messages/components/form/MessageInput.tsx +++ b/phone/src/apps/messages/components/form/MessageInput.tsx @@ -1,11 +1,11 @@ -import React, { FormEvent, useState } from "react"; -import { useTranslation } from "react-i18next"; -import { Paper, TextField, Button } from "@material-ui/core"; -import useStyles from "./form.styles"; -import SendIcon from "@material-ui/icons/Send"; +import React, { FormEvent, useState } from 'react'; +import { useTranslation } from 'react-i18next'; +import { Paper, TextField, Button } from '@material-ui/core'; +import useStyles from './form.styles'; +import SendIcon from '@material-ui/icons/Send'; import ImageIcon from '@material-ui/icons/Image'; -import Nui from "../../../../os/nui-events/utils/Nui"; -import { useImageModal } from "../../hooks/useImageModal"; +import Nui from '../../../../os/nui-events/utils/Nui'; +import { useImageModal } from '../../hooks/useImageModal'; interface IProps { messageGroupId: string | undefined; @@ -15,33 +15,33 @@ const MessageInput = ({ messageGroupId }: IProps) => { const { setImageModal } = useImageModal(); const classes = useStyles(); const { t } = useTranslation(); - const [message, setMessage] = useState(""); + const [message, setMessage] = useState(''); const handleSubmit = (event: FormEvent) => { event.preventDefault(); if (message.trim()) { // don't allow the user to submit white space - Nui.send("phone:sendMessage", { + Nui.send('phone:sendMessage', { groupId: messageGroupId, message, }); - setMessage(""); + setMessage(''); } }; const openImageModal = () => { setImageModal(true); - } + }; if (!messageGroupId) return null; return ( - +
setMessage(e.target.value)} - placeholder={t("APPS_MESSAGES_NEW_MESSAGE")} + placeholder={t('APPS_MESSAGES_NEW_MESSAGE')} className={classes.input} inputRef={(input) => input && input.focus()} inputProps={{ @@ -51,7 +51,7 @@ const MessageInput = ({ messageGroupId }: IProps) => { - diff --git a/phone/src/apps/messages/components/form/NewMessageGroupForm.tsx b/phone/src/apps/messages/components/form/NewMessageGroupForm.tsx index 567a685..6e46d01 100644 --- a/phone/src/apps/messages/components/form/NewMessageGroupForm.tsx +++ b/phone/src/apps/messages/components/form/NewMessageGroupForm.tsx @@ -1,24 +1,24 @@ -import React, { FormEvent, useState } from "react"; -import { useTranslation } from "react-i18next"; -import { TextField, Button } from "@material-ui/core"; +import React, { FormEvent, useState } from 'react'; +import { useTranslation } from 'react-i18next'; +import { TextField, Button } from '@material-ui/core'; -import useStyles from "./form.styles"; -import useModals from "../../hooks/useModals"; -import Nui from "../../../../os/nui-events/utils/Nui"; +import useStyles from './form.styles'; +import useModals from '../../hooks/useModals'; +import Nui from '../../../../os/nui-events/utils/Nui'; const NewMessageGroupForm = () => { const classes = useStyles(); const { t } = useTranslation(); const { setShowNewMessageGroup } = useModals(); - const [participants, setParticipants] = useState(""); - const [label, setLabel] = useState(""); + const [participants, setParticipants] = useState(''); + const [label, setLabel] = useState(''); // handles phone numbers in a csv format and strips all spaces and // external characters out of them: // 123-4567, 987-6543, 333-4444 const parts = participants - .split(",") - .map((part) => part.replace(/[^0-9]/g, "")); + .split(',') + .map((part) => part.replace(/[^0-9]/g, '')); const isGroupChat = parts.length > 1; const handleSubmit = (event: FormEvent) => { @@ -26,11 +26,11 @@ const NewMessageGroupForm = () => { if (parts.length > 0) { const labelValue = label.trim(); - Nui.send("phone:createMessageGroup", { + Nui.send('phone:createMessageGroup', { phoneNumbers: parts, label: isGroupChat && labelValue ? labelValue : null, }); - setParticipants(""); + setParticipants(''); setShowNewMessageGroup(false); // close modal after submission } }; @@ -40,7 +40,7 @@ const NewMessageGroupForm = () => { setParticipants(e.target.value)} - placeholder={t("APPS_MESSAGES_NEW_MESSAGE_GROUP")} + placeholder={t('APPS_MESSAGES_NEW_MESSAGE_GROUP')} className={classes.newGroupinput} autoFocus inputProps={{ @@ -52,7 +52,7 @@ const NewMessageGroupForm = () => { setLabel(e.target.value)} - placeholder={t("APPS_MESSAGES_GROUP_CHAT_LABEL")} + placeholder={t('APPS_MESSAGES_GROUP_CHAT_LABEL')} className={classes.newGroupinput} inputProps={{ className: classes.messagesInput, @@ -60,12 +60,12 @@ const NewMessageGroupForm = () => { /> )} ); diff --git a/phone/src/apps/messages/components/form/form.styles.ts b/phone/src/apps/messages/components/form/form.styles.ts index cc12aad..4bc363b 100644 --- a/phone/src/apps/messages/components/form/form.styles.ts +++ b/phone/src/apps/messages/components/form/form.styles.ts @@ -1,34 +1,34 @@ -import { makeStyles } from "@material-ui/core"; +import { makeStyles } from '@material-ui/core'; const useStyles = makeStyles((theme) => ({ sendButton: { - float: "right", + float: 'right', }, paper: { - position: "absolute", + position: 'absolute', bottom: 0, - width: "100%", + width: '100%', }, form: { - display: "flex", + display: 'flex', }, input: { - width: "100%", + width: '100%', margin: 10, }, newGroupForm: { - position: "absolute", + position: 'absolute', top: 65, - display: "flex", - flexFlow: "column nowrap", - justifyContent: "flex-start", - width: "100%", + display: 'flex', + flexFlow: 'column nowrap', + justifyContent: 'flex-start', + width: '100%', }, newGroupSubmitButton: { - margin: "15px 8px 0px 8px", + margin: '15px 8px 0px 8px', }, newGroupinput: { - margin: "0px 8px 15px 8px", + margin: '0px 8px 15px 8px', }, messagesInput: { fontSize: 20, diff --git a/phone/src/apps/messages/components/list/MessageSearch.tsx b/phone/src/apps/messages/components/list/MessageSearch.tsx index e1c2c50..53306e9 100644 --- a/phone/src/apps/messages/components/list/MessageSearch.tsx +++ b/phone/src/apps/messages/components/list/MessageSearch.tsx @@ -1,9 +1,9 @@ -import React from "react"; -import { useTranslation } from "react-i18next"; -import { InputBase, Paper } from "@material-ui/core"; -import SearchIcon from "@material-ui/icons/Search"; +import React from 'react'; +import { useTranslation } from 'react-i18next'; +import { InputBase, Paper } from '@material-ui/core'; +import SearchIcon from '@material-ui/icons/Search'; -import useStyles from "./list.styles"; +import useStyles from './list.styles'; interface IProps { value: string; @@ -16,7 +16,7 @@ const MessageSearch = ({ value, handleChange }: IProps) => { const { t } = useTranslation(); const classes = useStyles(); return ( - +
@@ -24,12 +24,12 @@ const MessageSearch = ({ value, handleChange }: IProps) => {
diff --git a/phone/src/apps/messages/components/list/list.styles.ts b/phone/src/apps/messages/components/list/list.styles.ts index c037bca..2f88133 100644 --- a/phone/src/apps/messages/components/list/list.styles.ts +++ b/phone/src/apps/messages/components/list/list.styles.ts @@ -1,15 +1,15 @@ -import { makeStyles, fade } from "@material-ui/core"; +import { makeStyles, fade } from '@material-ui/core'; const useStyles = makeStyles((theme) => ({ root: { - height: "100%", - overflowY: "auto", + height: '100%', + overflowY: 'auto', }, bg: { - display: "flex", + display: 'flex', height: 60, - justifyContent: "center", - alignItems: "center", + justifyContent: 'center', + alignItems: 'center', }, textFieldInput: { fontSize: 20, @@ -21,38 +21,38 @@ const useStyles = makeStyles((theme) => ({ inputInput: { padding: theme.spacing(1, 4, 1, 4), // vertical padding + font size from searchIcon - transition: theme.transitions.create("width"), - width: "100%", + transition: theme.transitions.create('width'), + width: '100%', - [theme.breakpoints.up("sm")]: { - width: "13ch", - "&:focus": { - width: "20ch", + [theme.breakpoints.up('sm')]: { + width: '13ch', + '&:focus': { + width: '20ch', }, }, }, search: { - position: "relative", + position: 'relative', borderRadius: theme.shape.borderRadius, backgroundColor: fade(theme.palette.common.white, 0.25), - "&:hover": { + '&:hover': { backgroundColor: fade(theme.palette.common.white, 0.25), }, marginLeft: 0, - width: "100%", - [theme.breakpoints.up("sm")]: { + width: '100%', + [theme.breakpoints.up('sm')]: { marginLeft: theme.spacing(1), - width: "auto", + width: 'auto', }, }, searchIcon: { padding: theme.spacing(0, 0.5), - height: "100%", - position: "absolute", - pointerEvents: "none", - display: "flex", - alignItems: "center", - justifyContent: "center", + height: '100%', + position: 'absolute', + pointerEvents: 'none', + display: 'flex', + alignItems: 'center', + justifyContent: 'center', }, })); diff --git a/phone/src/apps/messages/components/messages.styles.ts b/phone/src/apps/messages/components/messages.styles.ts index 0d390e1..06ceaf1 100644 --- a/phone/src/apps/messages/components/messages.styles.ts +++ b/phone/src/apps/messages/components/messages.styles.ts @@ -1,8 +1,8 @@ -import { makeStyles } from "@material-ui/core"; +import { makeStyles } from '@material-ui/core'; const useStyles = makeStyles((theme) => ({ addMessageFab: { - position: "sticky", + position: 'sticky', bottom: theme.spacing(2), left: theme.spacing(3), }, diff --git a/phone/src/apps/messages/components/modal/Conversation.tsx b/phone/src/apps/messages/components/modal/Conversation.tsx index c3f6cf6..7c33152 100644 --- a/phone/src/apps/messages/components/modal/Conversation.tsx +++ b/phone/src/apps/messages/components/modal/Conversation.tsx @@ -31,7 +31,11 @@ const Conversation = ({ activeMessageGroup, messages }: IProps) => { variant='outlined' > {isImage(message.message) ? ( - image + image ) : (
{message.message}
)} diff --git a/phone/src/apps/messages/components/modal/MessageGroupModal.tsx b/phone/src/apps/messages/components/modal/MessageGroupModal.tsx index 71deb53..518c1a2 100644 --- a/phone/src/apps/messages/components/modal/MessageGroupModal.tsx +++ b/phone/src/apps/messages/components/modal/MessageGroupModal.tsx @@ -1,10 +1,10 @@ -import React from "react"; -import { Slide, Paper, Button } from "@material-ui/core"; -import ArrowBackIcon from "@material-ui/icons/ArrowBack"; -import useStyles from "./modal.styles"; +import React from 'react'; +import { Slide, Paper, Button } from '@material-ui/core'; +import ArrowBackIcon from '@material-ui/icons/ArrowBack'; +import useStyles from './modal.styles'; -import useModals from "../../hooks/useModals"; -import NewMessageGroupForm from "../form/NewMessageGroupForm"; +import useModals from '../../hooks/useModals'; +import NewMessageGroupForm from '../form/NewMessageGroupForm'; const MessageGroupModal = () => { const classes = useStyles(); @@ -13,12 +13,12 @@ const MessageGroupModal = () => { const handleClose = () => setShowNewMessageGroup(false); return ( - + diff --git a/phone/src/apps/messages/components/modal/MessageImageModal.tsx b/phone/src/apps/messages/components/modal/MessageImageModal.tsx index b0e4451..881a3c6 100644 --- a/phone/src/apps/messages/components/modal/MessageImageModal.tsx +++ b/phone/src/apps/messages/components/modal/MessageImageModal.tsx @@ -1,8 +1,8 @@ import { TextField, Button } from '@material-ui/core'; -import React, { useState } from 'react' +import React, { useState } from 'react'; import Nui from '../../../../os/nui-events/utils/Nui'; -import Modal from '../../../../ui/components/Modal' -import { useImageModal } from '../../hooks/useImageModal' +import Modal from '../../../../ui/components/Modal'; +import { useImageModal } from '../../hooks/useImageModal'; import CloseIcon from '@material-ui/icons/Close'; import useStyles from './modal.styles'; @@ -13,30 +13,34 @@ interface IProps { export const MessageImageModal = ({ messageGroupId }: IProps) => { const classes = useStyles(); const { imageModal, setImageModal } = useImageModal(); - const [ message, setMessage ] = useState(""); + const [message, setMessage] = useState(''); const _handleClose = () => { - setImageModal(false) - } + setImageModal(false); + }; const sendImageMessage = (event) => { - if (event.key ==="Enter") { + if (event.key === 'Enter') { Nui.send('phone:sendMessage', { groupId: messageGroupId, - message - }) + message, + }); setImageModal(false); } - } - + }; return (
- - setMessage(e.target.value)} + + setMessage(e.target.value)} value={message} className={classes.input} inputProps={{ @@ -47,5 +51,5 @@ export const MessageImageModal = ({ messageGroupId }: IProps) => { />
- ) -} + ); +}; diff --git a/phone/src/apps/messages/components/modal/MessageModal.tsx b/phone/src/apps/messages/components/modal/MessageModal.tsx index fac35b7..f55fd94 100644 --- a/phone/src/apps/messages/components/modal/MessageModal.tsx +++ b/phone/src/apps/messages/components/modal/MessageModal.tsx @@ -1,13 +1,13 @@ -import React, { useEffect, useState } from "react"; -import { Slide, Paper, Button, Typography } from "@material-ui/core"; -import ArrowBackIcon from "@material-ui/icons/ArrowBack"; +import React, { useEffect, useState } from 'react'; +import { Slide, Paper, Button, Typography } from '@material-ui/core'; +import ArrowBackIcon from '@material-ui/icons/ArrowBack'; -import useStyles from "./modal.styles"; -import useMessages from "../../hooks/useMessages"; -import useModals from "../../hooks/useModals"; -import Conversation, { CONVERSATION_ELEMENT_ID } from "./Conversation"; -import MessageSkeletonList from "./MessageSkeletonList"; -import Nui from "../../../../os/nui-events/utils/Nui"; +import useStyles from './modal.styles'; +import useMessages from '../../hooks/useMessages'; +import useModals from '../../hooks/useModals'; +import Conversation, { CONVERSATION_ELEMENT_ID } from './Conversation'; +import MessageSkeletonList from './MessageSkeletonList'; +import Nui from '../../../../os/nui-events/utils/Nui'; const LARGE_HEADER_CHARS = 30; const MAX_HEADER_CHARS = 80; @@ -35,7 +35,7 @@ export const MessageModal = () => { const interval = window.setInterval(() => { if (!activeMessageGroup) return; - Nui.send("phone:fetchMessages", { + Nui.send('phone:fetchMessages', { groupId: activeMessageGroup.groupId, }); }, MESSAGES_REFRESH_RATE); @@ -64,7 +64,7 @@ export const MessageModal = () => { const isOpen = activeMessageGroup !== null; // don't allow too many characters, it takes too much room - let header = activeMessageGroup ? activeMessageGroup.groupDisplay : ""; + let header = activeMessageGroup ? activeMessageGroup.groupDisplay : ''; const truncatedHeader = `${header.slice(0, MAX_HEADER_CHARS).trim()}...`; header = header.length > MAX_HEADER_CHARS @@ -77,13 +77,13 @@ export const MessageModal = () => { : classes.groupdisplay; return ( - + - + {header} diff --git a/phone/src/apps/messages/components/modal/MessageSkeleton.tsx b/phone/src/apps/messages/components/modal/MessageSkeleton.tsx index 21ebfd6..b381047 100644 --- a/phone/src/apps/messages/components/modal/MessageSkeleton.tsx +++ b/phone/src/apps/messages/components/modal/MessageSkeleton.tsx @@ -1,20 +1,20 @@ -import React from "react"; -import { makeStyles } from "@material-ui/core/styles"; -import Skeleton from "@material-ui/lab/Skeleton"; +import React from 'react'; +import { makeStyles } from '@material-ui/core/styles'; +import Skeleton from '@material-ui/lab/Skeleton'; const useStyles = makeStyles({ root: { - margin: "0px 0px 12px 8px", + margin: '0px 0px 12px 8px', }, }); export default function MessageSkeleton({ height, isMine = false }) { const classes = useStyles(); - const marginLeft = isMine ? "60px" : "8px"; + const marginLeft = isMine ? '60px' : '8px'; return (
- +
); } diff --git a/phone/src/apps/messages/components/modal/MessageSkeletonList.tsx b/phone/src/apps/messages/components/modal/MessageSkeletonList.tsx index efd10e4..1cd56eb 100644 --- a/phone/src/apps/messages/components/modal/MessageSkeletonList.tsx +++ b/phone/src/apps/messages/components/modal/MessageSkeletonList.tsx @@ -1,7 +1,7 @@ -import React from "react"; +import React from 'react'; -import { List } from "../../../../ui/components/List"; -import MessageSkeleton from "./MessageSkeleton"; +import { List } from '../../../../ui/components/List'; +import MessageSkeleton from './MessageSkeleton'; export function MessageSkeletonList() { return ( diff --git a/phone/src/apps/messages/components/modal/modal.styles.ts b/phone/src/apps/messages/components/modal/modal.styles.ts index 17d4696..366bcc1 100644 --- a/phone/src/apps/messages/components/modal/modal.styles.ts +++ b/phone/src/apps/messages/components/modal/modal.styles.ts @@ -1,81 +1,81 @@ -import { makeStyles } from "@material-ui/core"; +import { makeStyles } from '@material-ui/core'; const useStyles = makeStyles((theme) => ({ modalRoot: { zIndex: 10, - position: "absolute", - height: "100%", - width: "100%", + position: 'absolute', + height: '100%', + width: '100%', }, modalHide: { - display: "none", + display: 'none', }, topContainer: { - display: "flex", - flexFlow: "row nowrap", - padding: "3px 0px", + display: 'flex', + flexFlow: 'row nowrap', + padding: '3px 0px', }, groupdisplay: { - width: "300px", - paddingTop: "8px", - fontSize: "24px", - whiteSpace: "nowrap", - overflowX: "hidden", - textOverflow: "ellipsis", + width: '300px', + paddingTop: '8px', + fontSize: '24px', + whiteSpace: 'nowrap', + overflowX: 'hidden', + textOverflow: 'ellipsis', }, largeGroupDisplay: { - width: "300px", - paddingTop: "8px", - fontSize: "20px", + width: '300px', + paddingTop: '8px', + fontSize: '20px', }, messageList: { - height: "90%", - overflowY: "auto", - paddingBottom: "40px", + height: '90%', + overflowY: 'auto', + paddingBottom: '40px', }, messageContainer: { marginTop: 25, - width: "100%", + width: '100%', }, sourceSms: { - float: "right", + float: 'right', margin: 10, - padding: "6px 12px", + padding: '6px 12px', height: 'auto', - width: "80%", - background: "#0288d1", - borderRadius: "20px", - textOverflow: 'ellipsis' + width: '80%', + background: '#0288d1', + borderRadius: '20px', + textOverflow: 'ellipsis', }, sms: { - float: "left", + float: 'left', margin: 10, - padding: "6px 12px", - width: "80%", + padding: '6px 12px', + width: '80%', height: 'auto', - background: "#ddd", - color: "#232323", - borderRadius: "15px", - textOverflow: 'ellipsis' + background: '#ddd', + color: '#232323', + borderRadius: '15px', + textOverflow: 'ellipsis', }, messagesInput: { fontSize: 20, }, input: { - width: "100%", + width: '100%', margin: 10, }, imageMessage: { width: '80%', maxWidth: '80%', height: '80%', - maxHeight: '80%' + maxHeight: '80%', }, imageModalCloseButton: { position: 'absolute', right: 0, - width: '10%' - } + width: '10%', + }, })); export default useStyles; diff --git a/phone/src/apps/messages/hooks/state.ts b/phone/src/apps/messages/hooks/state.ts index 8bbd7ce..a69acaa 100644 --- a/phone/src/apps/messages/hooks/state.ts +++ b/phone/src/apps/messages/hooks/state.ts @@ -1,28 +1,28 @@ -import { atom } from "recoil"; +import { atom } from 'recoil'; export const messageState = { messageGroups: atom({ - key: "messageGroups", + key: 'messageGroups', default: null, }), messages: atom({ - key: "messages", + key: 'messages', default: null, }), activeMessageGroup: atom({ - key: "activeMessageGroup", + key: 'activeMessageGroup', default: null, }), showNewMessageGroup: atom({ - key: "showNewMessageGroup", + key: 'showNewMessageGroup', default: false, }), createMessageGroupResult: atom({ - key: "createMessageGroupResult", + key: 'createMessageGroupResult', default: null, }), imageModal: atom({ key: 'useImageModal', - default: false - }) + default: false, + }), }; diff --git a/phone/src/apps/messages/hooks/useImageModal.ts b/phone/src/apps/messages/hooks/useImageModal.ts index 15abd3c..4af8fa7 100644 --- a/phone/src/apps/messages/hooks/useImageModal.ts +++ b/phone/src/apps/messages/hooks/useImageModal.ts @@ -1,8 +1,7 @@ import { useRecoilState } from 'recoil'; import { messageState } from './state'; - export const useImageModal = () => { - const [ imageModal, setImageModal ] = useRecoilState(messageState.imageModal); + const [imageModal, setImageModal] = useRecoilState(messageState.imageModal); return { imageModal, setImageModal }; -} \ No newline at end of file +}; diff --git a/phone/src/apps/messages/hooks/useMessageService.ts b/phone/src/apps/messages/hooks/useMessageService.ts index 2a8a990..37ac1a3 100644 --- a/phone/src/apps/messages/hooks/useMessageService.ts +++ b/phone/src/apps/messages/hooks/useMessageService.ts @@ -1,6 +1,6 @@ -import { useSetRecoilState } from "recoil"; -import { messageState } from "./state"; -import { useNuiEvent } from "../../../os/nui-events/hooks/useNuiEvent"; +import { useSetRecoilState } from 'recoil'; +import { messageState } from './state'; +import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent'; export const useMessagesService = () => { const setMessageGroups = useSetRecoilState(messageState.messageGroups); @@ -9,16 +9,16 @@ export const useMessagesService = () => { messageState.createMessageGroupResult ); - useNuiEvent("MESSAGES", "phone:fetchMessageGroupsSuccess", setMessageGroups); - useNuiEvent("MESSAGES", "phone:fetchMessagesSuccess", setMessages); + useNuiEvent('MESSAGES', 'phone:fetchMessageGroupsSuccess', setMessageGroups); + useNuiEvent('MESSAGES', 'phone:fetchMessagesSuccess', setMessages); useNuiEvent( - "MESSAGES", - "phone:createMessageGroupSuccess", + 'MESSAGES', + 'phone:createMessageGroupSuccess', setCreateMessageGroupResult ); useNuiEvent( - "MESSAGES", - "phone:createMessageGroupFailed", + 'MESSAGES', + 'phone:createMessageGroupFailed', setCreateMessageGroupResult ); }; diff --git a/phone/src/apps/notes/NotesApp.css b/phone/src/apps/notes/NotesApp.css index ed44c69..6728c0e 100644 --- a/phone/src/apps/notes/NotesApp.css +++ b/phone/src/apps/notes/NotesApp.css @@ -4,4 +4,4 @@ #notes-app .MuiOutlinedInput-root { border: 2px soild #f9a825; -} \ No newline at end of file +} diff --git a/phone/src/apps/notes/NotesTitle.tsx b/phone/src/apps/notes/NotesTitle.tsx index 8197ac4..9d4404a 100644 --- a/phone/src/apps/notes/NotesTitle.tsx +++ b/phone/src/apps/notes/NotesTitle.tsx @@ -1,20 +1,20 @@ -import React from 'react' +import React from 'react'; -import { yellow } from "@material-ui/core/colors"; +import { yellow } from '@material-ui/core/colors'; import useStyles from './notes.styles'; -import { Paper } from "@material-ui/core"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { faStickyNote } from "@fortawesome/free-solid-svg-icons"; +import { Paper } from '@material-ui/core'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { faStickyNote } from '@fortawesome/free-solid-svg-icons'; const NotesTitle = () => { - const classes = useStyles() + const classes = useStyles(); return ( - - + + - ) -} + ); +}; -export default NotesTitle; \ No newline at end of file +export default NotesTitle; diff --git a/phone/src/apps/notes/hooks/state.ts b/phone/src/apps/notes/hooks/state.ts index 9599aa0..37c31d5 100644 --- a/phone/src/apps/notes/hooks/state.ts +++ b/phone/src/apps/notes/hooks/state.ts @@ -3,14 +3,14 @@ import { atom } from 'recoil'; export const noteStates = { noteItems: atom({ key: 'noteItem', - default: [] + default: [], }), noteModal: atom({ key: 'noteModal', - default: false + default: false, }), noteDetail: atom({ key: 'noteDetail', - default: null - }) -} \ No newline at end of file + default: null, + }), +}; diff --git a/phone/src/apps/notes/hooks/useNoteDetail.ts b/phone/src/apps/notes/hooks/useNoteDetail.ts index 9faab1e..d2e328b 100644 --- a/phone/src/apps/notes/hooks/useNoteDetail.ts +++ b/phone/src/apps/notes/hooks/useNoteDetail.ts @@ -4,4 +4,4 @@ import { noteStates } from './state'; export const useNoteDetail = (): any => { const [detail, setDetail] = useRecoilState(noteStates.noteDetail); return { detail, setDetail }; -} \ No newline at end of file +}; diff --git a/phone/src/apps/notes/hooks/useNoteModal.ts b/phone/src/apps/notes/hooks/useNoteModal.ts index adbcc9a..e25a79b 100644 --- a/phone/src/apps/notes/hooks/useNoteModal.ts +++ b/phone/src/apps/notes/hooks/useNoteModal.ts @@ -3,5 +3,5 @@ import { noteStates } from './state'; export const useNoteModal = () => { const [noteModal, setNoteModal] = useRecoilState(noteStates.noteModal); - return { noteModal, setNoteModal }; -} \ No newline at end of file + return { noteModal, setNoteModal }; +}; diff --git a/phone/src/apps/notes/hooks/useNotes.ts b/phone/src/apps/notes/hooks/useNotes.ts index 69ce277..06ddb20 100644 --- a/phone/src/apps/notes/hooks/useNotes.ts +++ b/phone/src/apps/notes/hooks/useNotes.ts @@ -1,7 +1,7 @@ import { useRecoilValue } from 'recoil'; -import { noteStates } from './state'; +import { noteStates } from './state'; export const useNotes = () => { const notes = useRecoilValue(noteStates.noteItems); return notes; -} +}; diff --git a/phone/src/apps/notes/hooks/useNotesService.ts b/phone/src/apps/notes/hooks/useNotesService.ts index 3b7df58..5e504a6 100644 --- a/phone/src/apps/notes/hooks/useNotesService.ts +++ b/phone/src/apps/notes/hooks/useNotesService.ts @@ -1,4 +1,4 @@ -import { useSetRecoilState } from 'recoil' +import { useSetRecoilState } from 'recoil'; import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent'; import { useNotes } from './useNotes'; import { noteStates } from './state'; @@ -7,4 +7,4 @@ export const useNotesService = () => { const setNotes = useSetRecoilState(noteStates.noteItems); useNuiEvent('NOTES', 'setNotes', setNotes); return useNotes(); -} \ No newline at end of file +}; diff --git a/phone/src/apps/notes/modal/NoteModal.tsx b/phone/src/apps/notes/modal/NoteModal.tsx index 98d99c8..fb75c6e 100644 --- a/phone/src/apps/notes/modal/NoteModal.tsx +++ b/phone/src/apps/notes/modal/NoteModal.tsx @@ -58,7 +58,7 @@ export const NoteModal = () => {
({ modalRoot: { zIndex: 20, - position: "absolute", + position: 'absolute', height: '100%', width: '100%', background: '#232323', }, modalHide: { - display: 'none' + display: 'none', }, closeButton: { width: '10%', position: 'absolute', top: 10, - left: 0 + left: 0, }, noteContainer: { width: '90%', @@ -33,17 +33,17 @@ const useStyles = makeStyles((theme) => ({ }, saveButton: { background: '#f9a825', - padding: '10px 30px' + padding: '10px 30px', }, updateButton: { background: '#f9a825', padding: '10px 30px', - marginRight: '8px' + marginRight: '8px', }, deleteButton: { background: '#c62828', - padding: '10px 30px' - } -})) + padding: '10px 30px', + }, +})); -export default useStyles; \ No newline at end of file +export default useStyles; diff --git a/phone/src/apps/notes/notes.styles.ts b/phone/src/apps/notes/notes.styles.ts index 2623a4d..c1b1cc5 100644 --- a/phone/src/apps/notes/notes.styles.ts +++ b/phone/src/apps/notes/notes.styles.ts @@ -11,9 +11,9 @@ const useStyles = makeStyles((theme) => ({ height: '60px', }, backgroundModal: { - background: "black", - opacity: "0.6", - position: "absolute", + background: 'black', + opacity: '0.6', + position: 'absolute', top: 0, left: 0, right: 0, @@ -21,10 +21,10 @@ const useStyles = makeStyles((theme) => ({ zIndex: 5, }, absolute: { - position: "absolute", + position: 'absolute', bottom: theme.spacing(2), right: theme.spacing(3), }, -})) +})); -export default useStyles; \ No newline at end of file +export default useStyles; diff --git a/phone/src/apps/sellout/components/Sellout.css b/phone/src/apps/sellout/components/Sellout.css index 8310949..bcdd76e 100644 --- a/phone/src/apps/sellout/components/Sellout.css +++ b/phone/src/apps/sellout/components/Sellout.css @@ -2,7 +2,6 @@ color: #f44336 !important; } - -#sellout-app .Mui-focused::after { +#sellout-app .Mui-focused::after { border-bottom: #f44336 solid 3px; -} \ No newline at end of file +} diff --git a/phone/src/apps/sellout/components/SelloutApp.tsx b/phone/src/apps/sellout/components/SelloutApp.tsx index da0a277..544b00a 100644 --- a/phone/src/apps/sellout/components/SelloutApp.tsx +++ b/phone/src/apps/sellout/components/SelloutApp.tsx @@ -1,22 +1,22 @@ -import React from "react"; -import { AppWrapper } from "../../../ui/components/AppWrapper"; -import { AppContent } from "../../../ui/components/AppContent"; -import { SelloutTitle } from "./SelloutTitle"; -import { SelloutListContainer } from "./SelloutList/SelloutListContainer"; -import { NavigationBar } from "./navigation/NavigationBar"; -import { Switch, Route } from "react-router-dom"; +import React from 'react'; +import { AppWrapper } from '../../../ui/components/AppWrapper'; +import { AppContent } from '../../../ui/components/AppContent'; +import { SelloutTitle } from './SelloutTitle'; +import { SelloutListContainer } from './SelloutList/SelloutListContainer'; +import { NavigationBar } from './navigation/NavigationBar'; +import { Switch, Route } from 'react-router-dom'; -import "./Sellout.css"; -import { ListingFormContainer } from "./form/ListingFormContainer"; +import './Sellout.css'; +import { ListingFormContainer } from './form/ListingFormContainer'; export const SelloutApp = () => { return ( - + - - + + diff --git a/phone/src/apps/sellout/components/SelloutList/SelloutItem.tsx b/phone/src/apps/sellout/components/SelloutList/SelloutItem.tsx index 74647e0..2407704 100644 --- a/phone/src/apps/sellout/components/SelloutList/SelloutItem.tsx +++ b/phone/src/apps/sellout/components/SelloutList/SelloutItem.tsx @@ -1,33 +1,33 @@ -import React from "react"; -import { makeStyles } from "@material-ui/core/styles"; -import { Button, Typography, Paper } from "@material-ui/core"; -import { ImageDisplay } from "../images/ImageDisplay"; -import { ListItem } from "../../../../ui/components/ListItem"; -import ChatIcon from "@material-ui/icons/Chat"; -import PhoneIcon from "@material-ui/icons/Phone"; +import React from 'react'; +import { makeStyles } from '@material-ui/core/styles'; +import { Button, Typography, Paper } from '@material-ui/core'; +import { ImageDisplay } from '../images/ImageDisplay'; +import { ListItem } from '../../../../ui/components/ListItem'; +import ChatIcon from '@material-ui/icons/Chat'; +import PhoneIcon from '@material-ui/icons/Phone'; const useStyles = makeStyles((theme) => ({ root: { - overflowX: "hidden", - display: "flex", - flexFlow: "row nowrap", - alignItems: "flex-start", - width: "100%", - marginTop: "3px", + overflowX: 'hidden', + display: 'flex', + flexFlow: 'row nowrap', + alignItems: 'flex-start', + width: '100%', + marginTop: '3px', }, content: { - display: "flex", - marginTop: "-10px", - flexFlow: "column nowrap", - width: "100%", + display: 'flex', + marginTop: '-10px', + flexFlow: 'column nowrap', + width: '100%', }, paper: { - overflow: "auto", - display: "flex", - flexFlow: "column", - alignItems: "flex", - height: "auto", - background: "#232323", + overflow: 'auto', + display: 'flex', + flexFlow: 'column', + alignItems: 'flex', + height: 'auto', + background: '#232323', marginBottom: 20, }, header: { @@ -48,33 +48,38 @@ export const SelloutItem = (listing) => {
- + {listing.name} {listing.number} - + {listing.title}
{listing.url ? ( - ): ( - No image provided 🙁 - ) } - + ) : ( + + No image provided{' '} + + 🙁 + + + )} + {listing.description}
diff --git a/phone/src/apps/sellout/components/SelloutList/SelloutList.tsx b/phone/src/apps/sellout/components/SelloutList/SelloutList.tsx index 9c7df00..2f68711 100644 --- a/phone/src/apps/sellout/components/SelloutList/SelloutList.tsx +++ b/phone/src/apps/sellout/components/SelloutList/SelloutList.tsx @@ -1,6 +1,6 @@ -import React from "react"; -import { List } from "../../../../ui/components/List"; -import { SelloutItem } from "./SelloutItem"; +import React from 'react'; +import { List } from '../../../../ui/components/List'; +import { SelloutItem } from './SelloutItem'; export const SelloutList = ({ listings }) => { return ( diff --git a/phone/src/apps/sellout/components/SelloutList/SelloutListContainer.tsx b/phone/src/apps/sellout/components/SelloutList/SelloutListContainer.tsx index 4117b89..570b3c0 100644 --- a/phone/src/apps/sellout/components/SelloutList/SelloutListContainer.tsx +++ b/phone/src/apps/sellout/components/SelloutList/SelloutListContainer.tsx @@ -1,6 +1,6 @@ -import React from "react"; -import { useListing } from "../../hooks/useListing"; -import { SelloutList } from "./SelloutList"; +import React from 'react'; +import { useListing } from '../../hooks/useListing'; +import { SelloutList } from './SelloutList'; export const SelloutListContainer = () => { const { listing } = useListing(); diff --git a/phone/src/apps/sellout/components/form/ListingForm.tsx b/phone/src/apps/sellout/components/form/ListingForm.tsx index 5064aaf..9da433d 100644 --- a/phone/src/apps/sellout/components/form/ListingForm.tsx +++ b/phone/src/apps/sellout/components/form/ListingForm.tsx @@ -1,14 +1,14 @@ -import React, { useState } from "react"; -import { makeStyles, Button, TextField } from "@material-ui/core"; -import Nui from "../../../../os/nui-events/utils/Nui"; +import React, { useState } from 'react'; +import { makeStyles, Button, TextField } from '@material-ui/core'; +import Nui from '../../../../os/nui-events/utils/Nui'; -import "../Sellout.css" +import '../Sellout.css'; const useStyles = makeStyles((theme) => ({ root: { - width: "100%", - margin: "auto", - textAlign: "center", + width: '100%', + margin: 'auto', + textAlign: 'center', }, input: { marginBottom: 25, @@ -20,10 +20,10 @@ const useStyles = makeStyles((theme) => ({ fontSize: 20, }, postButton: { - display: "block", - margin: "auto", - background: "#f44336", - width: "80%", + display: 'block', + margin: 'auto', + background: '#f44336', + width: '80%', fontSize: 20, }, })); @@ -31,53 +31,55 @@ const useStyles = makeStyles((theme) => ({ export const ListingForm = () => { const classes = useStyles(); - const [ title, setTitle ] = useState(''); - const [ url, setUrl ] = useState(''); - const [ description, setDescription ] = useState(''); + const [title, setTitle] = useState(''); + const [url, setUrl] = useState(''); + const [description, setDescription] = useState(''); const addListing = () => { Nui.send('phone:addListing', { title, url, - description - }) - } + description, + }); + }; return (

New Listing

setTitle(e.target.value)} - placeholder="Title on listing.." + onChange={(e) => setTitle(e.target.value)} + placeholder='Title on listing..' inputProps={{ className: classes.textFieldInput }} - style={{ width: "80%" }} - size="medium" + style={{ width: '80%' }} + size='medium' /> setUrl(e.target.value)} + placeholder='Image URL' + onChange={(e) => setUrl(e.target.value)} inputProps={{ className: classes.textFieldInput }} - style={{ width: "80%" }} - size="medium" - variant="outlined" + style={{ width: '80%' }} + size='medium' + variant='outlined' /> setDescription(e.target.value)} - placeholder="Description" + onChange={(e) => setDescription(e.target.value)} + placeholder='Description' inputProps={{ className: classes.multilineFieldInput }} - style={{ width: "80%" }} - size="medium" + style={{ width: '80%' }} + size='medium' multiline rows={4} - variant="outlined" + variant='outlined' /> - +
); }; diff --git a/phone/src/apps/sellout/components/form/ListingFormContainer.tsx b/phone/src/apps/sellout/components/form/ListingFormContainer.tsx index 0823fb6..dd915c4 100644 --- a/phone/src/apps/sellout/components/form/ListingFormContainer.tsx +++ b/phone/src/apps/sellout/components/form/ListingFormContainer.tsx @@ -1,5 +1,5 @@ -import React from "react"; -import { ListingForm } from "./ListingForm"; +import React from 'react'; +import { ListingForm } from './ListingForm'; export const ListingFormContainer = () => { return ( diff --git a/phone/src/apps/sellout/components/images/ImageDisplay.tsx b/phone/src/apps/sellout/components/images/ImageDisplay.tsx index 7145b0c..d8c0fa8 100644 --- a/phone/src/apps/sellout/components/images/ImageDisplay.tsx +++ b/phone/src/apps/sellout/components/images/ImageDisplay.tsx @@ -1,11 +1,11 @@ -import React from "react"; +import React from 'react'; export const ImageDisplay = ({ imgURL }) => { return ( twitter display ); }; diff --git a/phone/src/apps/sellout/hooks/state.ts b/phone/src/apps/sellout/hooks/state.ts index 3f1c4f9..b81618a 100644 --- a/phone/src/apps/sellout/hooks/state.ts +++ b/phone/src/apps/sellout/hooks/state.ts @@ -1,8 +1,8 @@ -import { atom } from "recoil"; +import { atom } from 'recoil'; export const selloutState = { listing: atom({ - key: "listing", + key: 'listing', default: [], - }) + }), }; diff --git a/phone/src/apps/sellout/hooks/useListing.ts b/phone/src/apps/sellout/hooks/useListing.ts index f20defd..bed1de6 100644 --- a/phone/src/apps/sellout/hooks/useListing.ts +++ b/phone/src/apps/sellout/hooks/useListing.ts @@ -1,5 +1,5 @@ -import { useRecoilValue } from "recoil"; -import { selloutState } from "./state"; +import { useRecoilValue } from 'recoil'; +import { selloutState } from './state'; export const useListing = () => { const listing = useRecoilValue(selloutState.listing); diff --git a/phone/src/apps/sellout/hooks/useSelloutService.ts b/phone/src/apps/sellout/hooks/useSelloutService.ts index d114f58..cac461d 100644 --- a/phone/src/apps/sellout/hooks/useSelloutService.ts +++ b/phone/src/apps/sellout/hooks/useSelloutService.ts @@ -1,10 +1,10 @@ -import { useNuiEvent } from "../../../os/nui-events/hooks/useNuiEvent"; -import { selloutState } from "./state"; -import { useListing } from "./useListing"; -import { useSetRecoilState } from "recoil"; +import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent'; +import { selloutState } from './state'; +import { useListing } from './useListing'; +import { useSetRecoilState } from 'recoil'; export const useSelloutService = () => { const setSellout = useSetRecoilState(selloutState.listing); - useNuiEvent("SELLOUT", "setListings", setSellout); + useNuiEvent('SELLOUT', 'setListings', setSellout); return useListing(); }; diff --git a/phone/src/apps/twitter/components/AddTweetModal.tsx b/phone/src/apps/twitter/components/AddTweetModal.tsx index 9050504..e780a42 100644 --- a/phone/src/apps/twitter/components/AddTweetModal.tsx +++ b/phone/src/apps/twitter/components/AddTweetModal.tsx @@ -1,54 +1,54 @@ -import React, { useState, useEffect } from "react"; -import { makeStyles } from "@material-ui/core/styles"; -import { Button } from "@material-ui/core"; -import CloseIcon from "@material-ui/icons/Close"; -import { v4 as uuidv4 } from "uuid"; +import React, { useState, useEffect } from 'react'; +import { makeStyles } from '@material-ui/core/styles'; +import { Button } from '@material-ui/core'; +import CloseIcon from '@material-ui/icons/Close'; +import { v4 as uuidv4 } from 'uuid'; -import Nui from "../../../os/nui-events/utils/Nui"; -import Modal from "../../../ui/components/Modal"; -import { IMAGE_DELIMITER } from "../utils/images"; -import { withValidImage } from "../utils/images"; -import { useModal } from "../hooks/useModal"; -import EmojiSelect from "./EmojiSelect"; -import ImageDisplay from "./images/ImageDisplay"; -import ImagePrompt from "./images/ImagePrompt"; -import TweetMessage from "./tweet/TweetMessage"; -import ControlButtons from "./buttons/ControlButtons"; -import IconButtons from "./buttons/IconButtons"; -import { usePhone } from "../../../os/phone/hooks/usePhone"; +import Nui from '../../../os/nui-events/utils/Nui'; +import Modal from '../../../ui/components/Modal'; +import { IMAGE_DELIMITER } from '../utils/images'; +import { withValidImage } from '../utils/images'; +import { useModal } from '../hooks/useModal'; +import EmojiSelect from './EmojiSelect'; +import ImageDisplay from './images/ImageDisplay'; +import ImagePrompt from './images/ImagePrompt'; +import TweetMessage from './tweet/TweetMessage'; +import ControlButtons from './buttons/ControlButtons'; +import IconButtons from './buttons/IconButtons'; +import { usePhone } from '../../../os/phone/hooks/usePhone'; const useStyles = makeStyles((theme) => ({ root: { zIndex: 10, - background: "#424242", - marginTop: "15px", - width: "90%", - display: "flex", - flexFlow: "column nowrap", - position: "absolute", - top: "80px", + background: '#424242', + marginTop: '15px', + width: '90%', + display: 'flex', + flexFlow: 'column nowrap', + position: 'absolute', + top: '80px', }, button: { margin: 5, marginTop: 20, }, close: { - position: "absolute", - top: "12px", - right: "4px", + position: 'absolute', + top: '12px', + right: '4px', zIndex: 2, }, buttonsContainer: { - paddingBottom: "8px", - display: "flex", - flexFlow: "row nowrap", - justifyContent: "space-between", - flex: "1 0 45px", + paddingBottom: '8px', + display: 'flex', + flexFlow: 'row nowrap', + justifyContent: 'space-between', + flex: '1 0 45px', }, emojiPicker: { - background: "none", - border: "none", - boxShadow: "none", + background: 'none', + border: 'none', + boxShadow: 'none', }, })); @@ -64,7 +64,7 @@ export const AddTweetModal = () => { const [showEmoji, setShowEmoji] = useState(false); const [showImagePrompt, setShowImagePrompt] = useState(false); - const [link, setLink] = useState(""); + const [link, setLink] = useState(''); const [images, setImages] = useState([]); @@ -72,9 +72,9 @@ export const AddTweetModal = () => { setShowImagePrompt(false); setShowEmoji(false); - setLink(""); + setLink(''); setImages([]); - setMessage(""); + setMessage(''); }; const _handleClose = () => { @@ -84,15 +84,15 @@ export const AddTweetModal = () => { // when the user presses escape we should close the modal const _handleEscape = (e) => { - const isEscapeKey = e.key === "Escape" || e.key === "Esc"; + const isEscapeKey = e.key === 'Escape' || e.key === 'Esc'; if (isEscapeKey) { e.preventDefault(); _handleClose(); } }; useEffect(() => { - window.addEventListener("keydown", _handleEscape, true); - return () => window.removeEventListener("keydown", _handleEscape); + window.addEventListener('keydown', _handleEscape, true); + return () => window.removeEventListener('keydown', _handleEscape); }); if (!config) return null; @@ -107,10 +107,10 @@ export const AddTweetModal = () => { images: images && images.length > 0 ? images.map((image) => image.link).join(IMAGE_DELIMITER) - : "", - realUser: "testUser", + : '', + realUser: 'testUser', }; - Nui.send("phone:createTweet", data); + Nui.send('phone:createTweet', data); _handleClose(); }; @@ -119,7 +119,7 @@ export const AddTweetModal = () => { const addImage = () => { // strip any whitespace from the link in case the user // added some spaces/returns accidentally - const cleanedLink = link.replace("/ /g", ""); + const cleanedLink = link.replace('/ /g', ''); // because we're only storing strings in the database we need // to give this an arbirtrary (but unique) id so that we can // correctly filter an array of images when the user wants to @@ -134,7 +134,7 @@ export const AddTweetModal = () => { withValidImage(cleanedLink, () => setImages([...images, image])); setShowImagePrompt(false); - setLink(""); + setLink(''); }; const removeImage = (id) => setImages(images.filter((image) => id !== image.id)); @@ -161,7 +161,7 @@ export const AddTweetModal = () => { return ( )} Your profile avatar
); @@ -49,8 +49,8 @@ function Avatar({ avatarUrl, showInvalidImage, height, width }) { Avatar.defaultProps = { avatarUrl: null, showInvalidImage: false, - height: "125px", - width: "125px", + height: '125px', + width: '125px', }; export default Avatar; diff --git a/phone/src/apps/twitter/components/BottomNavigation.tsx b/phone/src/apps/twitter/components/BottomNavigation.tsx index 91cd2b8..2f83015 100644 --- a/phone/src/apps/twitter/components/BottomNavigation.tsx +++ b/phone/src/apps/twitter/components/BottomNavigation.tsx @@ -1,14 +1,14 @@ -import React from "react"; -import { Link } from "react-router-dom"; -import { makeStyles } from "@material-ui/core/styles"; -import { BottomNavigation, BottomNavigationAction } from "@material-ui/core"; -import HomeIcon from "@material-ui/icons/Home"; -import SearchIcon from "@material-ui/icons/Search"; -import ProfileIcon from "@material-ui/icons/Person"; +import React from 'react'; +import { Link } from 'react-router-dom'; +import { makeStyles } from '@material-ui/core/styles'; +import { BottomNavigation, BottomNavigationAction } from '@material-ui/core'; +import HomeIcon from '@material-ui/icons/Home'; +import SearchIcon from '@material-ui/icons/Search'; +import ProfileIcon from '@material-ui/icons/Person'; const useStyles = makeStyles({ root: { - width: "100%", + width: '100%', }, }); @@ -23,17 +23,17 @@ export function TwitterBottomNavigation({ activePage, handleChange }) { > } /> } /> } /> diff --git a/phone/src/apps/twitter/components/EmojiSelect.tsx b/phone/src/apps/twitter/components/EmojiSelect.tsx index fe4fa6d..231dfcd 100644 --- a/phone/src/apps/twitter/components/EmojiSelect.tsx +++ b/phone/src/apps/twitter/components/EmojiSelect.tsx @@ -1,5 +1,5 @@ -import React, { memo } from "react"; -import { Picker } from "emoji-mart"; +import React, { memo } from 'react'; +import { Picker } from 'emoji-mart'; export const EmojiSelect = ({ visible, onEmojiClick }) => { if (!visible) return null; @@ -7,8 +7,8 @@ export const EmojiSelect = ({ visible, onEmojiClick }) => { return ( ); diff --git a/phone/src/apps/twitter/components/TwitterApp.tsx b/phone/src/apps/twitter/components/TwitterApp.tsx index f264676..f8425cc 100644 --- a/phone/src/apps/twitter/components/TwitterApp.tsx +++ b/phone/src/apps/twitter/components/TwitterApp.tsx @@ -1,30 +1,30 @@ -import React, { useState, useEffect } from "react"; -import { Switch, Route } from "react-router-dom"; -import { makeStyles } from "@material-ui/core/styles"; +import React, { useState, useEffect } from 'react'; +import { Switch, Route } from 'react-router-dom'; +import { makeStyles } from '@material-ui/core/styles'; -import Nui from "../../../os/nui-events/utils/Nui"; -import { AppWrapper } from "../../../ui/components"; -import { AppContent } from "../../../ui/components/AppContent"; -import TweetListContainer from "./tweet/TweetListContainer"; -import AddTweetModal from "./AddTweetModal"; -import { useModal } from "../hooks/useModal"; -import TweetButton from "./buttons/TweetButton"; -import TwitterTitle from "./TwitterTitle"; -import BottomNavigation from "./BottomNavigation"; -import TwitterProfile from "./profile/Profile"; -import AlertBar from "./alerts/AlertBar"; -import TwitterSearch from "./TwitterSearch"; +import Nui from '../../../os/nui-events/utils/Nui'; +import { AppWrapper } from '../../../ui/components'; +import { AppContent } from '../../../ui/components/AppContent'; +import TweetListContainer from './tweet/TweetListContainer'; +import AddTweetModal from './AddTweetModal'; +import { useModal } from '../hooks/useModal'; +import TweetButton from './buttons/TweetButton'; +import TwitterTitle from './TwitterTitle'; +import BottomNavigation from './BottomNavigation'; +import TwitterProfile from './profile/Profile'; +import AlertBar from './alerts/AlertBar'; +import TwitterSearch from './TwitterSearch'; -import "./twitter.css"; -import "emoji-mart/css/emoji-mart.css"; -import { useProfile } from "../hooks/useProfile"; -import ProfilePrompt from "./profile/ProfilePrompt"; +import './twitter.css'; +import 'emoji-mart/css/emoji-mart.css'; +import { useProfile } from '../hooks/useProfile'; +import ProfilePrompt from './profile/ProfilePrompt'; const useStyles = makeStyles(() => ({ backgroundModal: { - background: "black", - opacity: "0.6", - position: "absolute", + background: 'black', + opacity: '0.6', + position: 'absolute', top: 0, left: 0, right: 0, @@ -42,7 +42,7 @@ export const TwitterApp = () => { const { profile } = useProfile(); useEffect(() => { - Nui.send("phone:getOrCreateTwitterProfile", {}); + Nui.send('phone:getOrCreateTwitterProfile', {}); // this is a polling implementation. It is possible that // there is some interaction where, on a new tweet, all @@ -52,7 +52,7 @@ export const TwitterApp = () => { // TODO don't call fetchTweets - implement a function that only // returns tweets that we don't already have const timeout = window.setTimeout(() => { - Nui.send("phone:fetchTweets", {}); + Nui.send('phone:fetchTweets', {}); }, TWEETS_REFRESH_RATE); return () => window.clearTimeout(timeout); }, []); @@ -67,7 +67,7 @@ export const TwitterApp = () => { const showTweetButton = !promptProfileName && activePage === 0; return ( - +
@@ -76,9 +76,9 @@ export const TwitterApp = () => { ) : ( - - - + + + )} diff --git a/phone/src/apps/twitter/components/TwitterSearch.tsx b/phone/src/apps/twitter/components/TwitterSearch.tsx index 187e05a..be3874c 100644 --- a/phone/src/apps/twitter/components/TwitterSearch.tsx +++ b/phone/src/apps/twitter/components/TwitterSearch.tsx @@ -1,29 +1,29 @@ -import React, { useState } from "react"; -import { useTranslation } from "react-i18next"; -import { makeStyles } from "@material-ui/core/styles"; -import { TextField } from "@material-ui/core"; -import TweetList from "./tweet/TweetList"; +import React, { useState } from 'react'; +import { useTranslation } from 'react-i18next'; +import { makeStyles } from '@material-ui/core/styles'; +import { TextField } from '@material-ui/core'; +import TweetList from './tweet/TweetList'; -import Nui from "../../../os/nui-events/utils/Nui"; -import SearchButton from "./buttons/SearchButton"; -import { useFilteredTweets } from "../hooks/useFilteredTweets"; +import Nui from '../../../os/nui-events/utils/Nui'; +import SearchButton from './buttons/SearchButton'; +import { useFilteredTweets } from '../hooks/useFilteredTweets'; const useStyles = makeStyles({ root: { - width: "100%", + width: '100%', }, searchContainer: { - padding: "15px", + padding: '15px', }, search: { - width: "100%", + width: '100%', }, }); function TwitterSearch() { const classes = useStyles(); const { t } = useTranslation(); - const [searchValue, setSearchValue] = useState(""); + const [searchValue, setSearchValue] = useState(''); const { tweets } = useFilteredTweets(); const handleChange = (e) => setSearchValue(e.target.value); @@ -32,7 +32,7 @@ function TwitterSearch() { const cleanedSearchValue = searchValue.trim(); if (!cleanedSearchValue) return; - Nui.send("phone:fetchTweetsFiltered", cleanedSearchValue); + Nui.send('phone:fetchTweetsFiltered', cleanedSearchValue); }; const filteredTweets = tweets || []; @@ -43,11 +43,11 @@ function TwitterSearch() {
input && input.focus()} />
diff --git a/phone/src/apps/twitter/components/TwitterTitle.tsx b/phone/src/apps/twitter/components/TwitterTitle.tsx index 1182c4e..23a6594 100644 --- a/phone/src/apps/twitter/components/TwitterTitle.tsx +++ b/phone/src/apps/twitter/components/TwitterTitle.tsx @@ -1,20 +1,20 @@ -import React from "react"; -import Paper from "@material-ui/core/Paper"; -import { makeStyles } from "@material-ui/core"; -import TwitterIcon from "@material-ui/icons/Twitter"; +import React from 'react'; +import Paper from '@material-ui/core/Paper'; +import { makeStyles } from '@material-ui/core'; +import TwitterIcon from '@material-ui/icons/Twitter'; const useStyles = makeStyles((theme) => ({ root: { - height: "60px", - width: "100%", - display: "flex", - flexFlow: "row nowrap", - justifyContent: "center", - alignItems: "center", - background: "#424242", + height: '60px', + width: '100%', + display: 'flex', + flexFlow: 'row nowrap', + justifyContent: 'center', + alignItems: 'center', + background: '#424242', }, icon: { - color: "#00acee", + color: '#00acee', fontSize: 30, }, })); @@ -22,7 +22,7 @@ const useStyles = makeStyles((theme) => ({ export function TwitterTitle() { const classes = useStyles(); return ( - + ); diff --git a/phone/src/apps/twitter/components/alerts/AlertBar.tsx b/phone/src/apps/twitter/components/alerts/AlertBar.tsx index d0ae093..8bed5b5 100644 --- a/phone/src/apps/twitter/components/alerts/AlertBar.tsx +++ b/phone/src/apps/twitter/components/alerts/AlertBar.tsx @@ -1,16 +1,16 @@ -import React, { useEffect, useState } from "react"; -import { useTranslation } from "react-i18next"; -import { Snackbar } from "@material-ui/core"; -import { makeStyles } from "@material-ui/core/styles"; +import React, { useEffect, useState } from 'react'; +import { useTranslation } from 'react-i18next'; +import { Snackbar } from '@material-ui/core'; +import { makeStyles } from '@material-ui/core/styles'; -import { useProfile } from "../../hooks/useProfile"; -import { useTweetStatus } from "../../hooks/useTweetStatus"; -import Alert from "../../../../ui/components/Alert"; +import { useProfile } from '../../hooks/useProfile'; +import { useTweetStatus } from '../../hooks/useTweetStatus'; +import Alert from '../../../../ui/components/Alert'; const useStyles = makeStyles((theme) => ({ root: { - width: "100%", - bottom: "60px", + width: '100%', + bottom: '60px', }, })); @@ -34,20 +34,20 @@ export default function AlertBar() { useEffect(() => { if (createTweetSuccessful === true) { setOpen(true); - setSeverity("success"); - setMessage(t("APPS_TWITTER_CREATE_SUCCESS")); + setSeverity('success'); + setMessage(t('APPS_TWITTER_CREATE_SUCCESS')); } else if (createTweetSuccessful === false) { setOpen(true); - setSeverity("error"); - setMessage(t("APPS_TWITTER_CREATE_FAILED")); + setSeverity('error'); + setMessage(t('APPS_TWITTER_CREATE_FAILED')); } else if (updateProfileSuccessful === true) { setOpen(true); - setSeverity("success"); - setMessage(t("APPS_TWITTER_EDIT_PROFILE_SUCCESS")); + setSeverity('success'); + setMessage(t('APPS_TWITTER_EDIT_PROFILE_SUCCESS')); } else if (updateProfileSuccessful === false) { setOpen(true); - setSeverity("error"); - setMessage(t("APPS_TWITTER_EDIT_PROFILE_FAILURE")); + setSeverity('error'); + setMessage(t('APPS_TWITTER_EDIT_PROFILE_FAILURE')); } }, [updateProfileSuccessful, createTweetSuccessful, t]); diff --git a/phone/src/apps/twitter/components/buttons/ControlButtons.tsx b/phone/src/apps/twitter/components/buttons/ControlButtons.tsx index 5841c35..86caf20 100644 --- a/phone/src/apps/twitter/components/buttons/ControlButtons.tsx +++ b/phone/src/apps/twitter/components/buttons/ControlButtons.tsx @@ -1,18 +1,18 @@ -import React from "react"; -import { useTranslation } from "react-i18next"; -import { makeStyles } from "@material-ui/core/styles"; -import { Button } from "@material-ui/core"; +import React from 'react'; +import { useTranslation } from 'react-i18next'; +import { makeStyles } from '@material-ui/core/styles'; +import { Button } from '@material-ui/core'; const useStyles = makeStyles((theme) => ({ buttons: { - display: "flex", - flexFlow: "row nowrap", - justifyContent: "flex-end", - alignItems: "justify-content", - marginRight: "15px", + display: 'flex', + flexFlow: 'row nowrap', + justifyContent: 'flex-end', + alignItems: 'justify-content', + marginRight: '15px', }, close: { - marginLeft: "8px", + marginLeft: '8px', }, })); @@ -27,23 +27,23 @@ export const ControlButtons = ({ const imagePromptVisible = showImagePrompt && !showEmoji; const primaryButtonText = imagePromptVisible - ? t("APPS_TWITTER_SUBMIT_IMAGE") - : t("APPS_TWITTER_TWEET"); + ? t('APPS_TWITTER_SUBMIT_IMAGE') + : t('APPS_TWITTER_TWEET'); const showCloseButton = showImagePrompt || showEmoji; return (
- {showCloseButton && ( )}
diff --git a/phone/src/apps/twitter/components/buttons/IconButtons.tsx b/phone/src/apps/twitter/components/buttons/IconButtons.tsx index 519420b..71082c4 100644 --- a/phone/src/apps/twitter/components/buttons/IconButtons.tsx +++ b/phone/src/apps/twitter/components/buttons/IconButtons.tsx @@ -1,20 +1,20 @@ -import React from "react"; -import { makeStyles } from "@material-ui/core/styles"; -import { Button } from "@material-ui/core"; -import InsertPhotoIcon from "@material-ui/icons/InsertPhoto"; -import EmojiIcon from "@material-ui/icons/SentimentSatisfied"; -import { usePhone } from "../../../../os/phone/hooks/usePhone"; +import React from 'react'; +import { makeStyles } from '@material-ui/core/styles'; +import { Button } from '@material-ui/core'; +import InsertPhotoIcon from '@material-ui/icons/InsertPhoto'; +import EmojiIcon from '@material-ui/icons/SentimentSatisfied'; +import { usePhone } from '../../../../os/phone/hooks/usePhone'; const useStyles = makeStyles((theme) => ({ buttons: { - display: "flex", - flexFlow: "row nowrap", - justifyContent: "flex-start", - paddingLeft: "5px", // re-align left buttons after overriding material-ui spacing + display: 'flex', + flexFlow: 'row nowrap', + justifyContent: 'flex-start', + paddingLeft: '5px', // re-align left buttons after overriding material-ui spacing }, button: { - background: "transparent", - minWidth: "45px", // override default material-ui spacing between buttons + background: 'transparent', + minWidth: '45px', // override default material-ui spacing between buttons }, })); @@ -29,12 +29,12 @@ export const IconButtons = ({ onImageClick, onEmojiClick }) => {
{enableImages && ( )} {enableEmojis && ( )}
diff --git a/phone/src/apps/twitter/components/buttons/LikeButton.tsx b/phone/src/apps/twitter/components/buttons/LikeButton.tsx index d93bc49..ede5974 100644 --- a/phone/src/apps/twitter/components/buttons/LikeButton.tsx +++ b/phone/src/apps/twitter/components/buttons/LikeButton.tsx @@ -1,9 +1,9 @@ -import React, { useState } from "react"; -import { Button, CircularProgress } from "@material-ui/core"; -import FavoriteBorderIcon from "@material-ui/icons/FavoriteBorder"; -import FavoriteIcon from "@material-ui/icons/Favorite"; +import React, { useState } from 'react'; +import { Button, CircularProgress } from '@material-ui/core'; +import FavoriteBorderIcon from '@material-ui/icons/FavoriteBorder'; +import FavoriteIcon from '@material-ui/icons/Favorite'; -import Nui from "../../../../os/nui-events/utils/Nui"; +import Nui from '../../../../os/nui-events/utils/Nui'; const LOADING_TIME = 1250; @@ -12,7 +12,7 @@ function LikeButton({ tweetId, isLiked }) { const [loading, setLoading] = useState(false); const handleClick = () => { - Nui.send("phone:toggleLike", tweetId); + Nui.send('phone:toggleLike', tweetId); setLoading(true); window.setTimeout(() => { setLiked(!liked); diff --git a/phone/src/apps/twitter/components/buttons/ProfileUpdateButton.tsx b/phone/src/apps/twitter/components/buttons/ProfileUpdateButton.tsx index efc5347..7e5a39f 100644 --- a/phone/src/apps/twitter/components/buttons/ProfileUpdateButton.tsx +++ b/phone/src/apps/twitter/components/buttons/ProfileUpdateButton.tsx @@ -1,18 +1,18 @@ -import React, { useState, useEffect } from "react"; -import { makeStyles } from "@material-ui/core/styles"; -import { Fab } from "@material-ui/core"; -import PublishIcon from "@material-ui/icons/Publish"; +import React, { useState, useEffect } from 'react'; +import { makeStyles } from '@material-ui/core/styles'; +import { Fab } from '@material-ui/core'; +import PublishIcon from '@material-ui/icons/Publish'; -import { useProfile } from "../../hooks/useProfile"; +import { useProfile } from '../../hooks/useProfile'; const useStyles = makeStyles((theme) => ({ root: { - position: "absolute", - bottom: "15px", - right: "15px", + position: 'absolute', + bottom: '15px', + right: '15px', }, button: { - background: "#00acee", + background: '#00acee', }, })); @@ -37,7 +37,7 @@ export function ProfileUpdateButton({ handleClick }) {
diff --git a/phone/src/apps/twitter/components/buttons/QuoteButton.tsx b/phone/src/apps/twitter/components/buttons/QuoteButton.tsx index a1008ce..f5ce1ce 100644 --- a/phone/src/apps/twitter/components/buttons/QuoteButton.tsx +++ b/phone/src/apps/twitter/components/buttons/QuoteButton.tsx @@ -1,9 +1,9 @@ -import React from "react"; -import { useSetRecoilState } from "recoil"; -import { Button } from "@material-ui/core"; -import QuoteIcon from "@material-ui/icons/FormatQuote"; +import React from 'react'; +import { useSetRecoilState } from 'recoil'; +import { Button } from '@material-ui/core'; +import QuoteIcon from '@material-ui/icons/FormatQuote'; -import { twitterState } from "../../hooks/state"; +import { twitterState } from '../../hooks/state'; export const QuoteButton = ({ message }) => { const setModalVisible = useSetRecoilState(twitterState.showCreateTweetModal); diff --git a/phone/src/apps/twitter/components/buttons/ReplyButton.tsx b/phone/src/apps/twitter/components/buttons/ReplyButton.tsx index ee1fd13..a0afe27 100644 --- a/phone/src/apps/twitter/components/buttons/ReplyButton.tsx +++ b/phone/src/apps/twitter/components/buttons/ReplyButton.tsx @@ -1,9 +1,9 @@ -import React from "react"; -import { useSetRecoilState } from "recoil"; -import { Button } from "@material-ui/core"; -import ReplyIcon from "@material-ui/icons/Reply"; +import React from 'react'; +import { useSetRecoilState } from 'recoil'; +import { Button } from '@material-ui/core'; +import ReplyIcon from '@material-ui/icons/Reply'; -import { twitterState } from "../../hooks/state"; +import { twitterState } from '../../hooks/state'; export const ReplyButton = ({ profile_name }) => { const setModalVisible = useSetRecoilState(twitterState.showCreateTweetModal); diff --git a/phone/src/apps/twitter/components/buttons/ReportButton.tsx b/phone/src/apps/twitter/components/buttons/ReportButton.tsx index d80ee35..78dadfb 100644 --- a/phone/src/apps/twitter/components/buttons/ReportButton.tsx +++ b/phone/src/apps/twitter/components/buttons/ReportButton.tsx @@ -1,13 +1,9 @@ -import React, { useState } from "react"; -import { useTranslation } from "react-i18next"; -import { - Button, - CircularProgress, - MenuItem -} from "@material-ui/core"; +import React, { useState } from 'react'; +import { useTranslation } from 'react-i18next'; +import { Button, CircularProgress, MenuItem } from '@material-ui/core'; import DoneIcon from '@material-ui/icons/Done'; -import Nui from "../../../../os/nui-events/utils/Nui"; +import Nui from '../../../../os/nui-events/utils/Nui'; const LOADING_TIME = 1250; @@ -16,7 +12,7 @@ function ReportButton({ handleClose, tweetId, isReported }) { const [loading, setLoading] = useState(false); const handleClick = () => { - Nui.send("phone:reportTweet", tweetId); + Nui.send('phone:reportTweet', tweetId); setLoading(true); window.setTimeout(() => { setLoading(false); @@ -26,24 +22,22 @@ function ReportButton({ handleClose, tweetId, isReported }) { if (isReported) { return ( - - - {t('APPS_TWITTER_REPORTED')} - + + + {t('APPS_TWITTER_REPORTED')} + ); } if (loading) { return ( ); } - return ( - {t('APPS_TWITTER_REPORT')} - ); + return {t('APPS_TWITTER_REPORT')}; } export default ReportButton; diff --git a/phone/src/apps/twitter/components/buttons/SearchButton.tsx b/phone/src/apps/twitter/components/buttons/SearchButton.tsx index c01456a..cf9b002 100644 --- a/phone/src/apps/twitter/components/buttons/SearchButton.tsx +++ b/phone/src/apps/twitter/components/buttons/SearchButton.tsx @@ -1,16 +1,16 @@ -import React from "react"; -import { makeStyles } from "@material-ui/core/styles"; -import { Fab } from "@material-ui/core"; -import SearchIcon from "@material-ui/icons/Search"; +import React from 'react'; +import { makeStyles } from '@material-ui/core/styles'; +import { Fab } from '@material-ui/core'; +import SearchIcon from '@material-ui/icons/Search'; const useStyles = makeStyles((theme) => ({ root: { - position: "absolute", - bottom: "15px", - right: "15px", + position: 'absolute', + bottom: '15px', + right: '15px', }, button: { - background: "#00acee", + background: '#00acee', }, })); @@ -19,7 +19,7 @@ export function ProfileUpdateButton({ handleClick }) { return (
- +
diff --git a/phone/src/apps/twitter/components/buttons/TweetButton.tsx b/phone/src/apps/twitter/components/buttons/TweetButton.tsx index 3c96214..944d01f 100644 --- a/phone/src/apps/twitter/components/buttons/TweetButton.tsx +++ b/phone/src/apps/twitter/components/buttons/TweetButton.tsx @@ -1,16 +1,16 @@ -import React from "react"; -import { makeStyles } from "@material-ui/core/styles"; -import { Fab } from "@material-ui/core"; -import CreateIcon from "@material-ui/icons/Create"; +import React from 'react'; +import { makeStyles } from '@material-ui/core/styles'; +import { Fab } from '@material-ui/core'; +import CreateIcon from '@material-ui/icons/Create'; const useStyles = makeStyles(() => ({ root: { - position: "absolute", - bottom: "75px", - right: "15px", + position: 'absolute', + bottom: '75px', + right: '15px', }, button: { - background: "#00acee", + background: '#00acee', }, })); @@ -19,7 +19,7 @@ export function TweetButton({ openModal }) { return (
- +
diff --git a/phone/src/apps/twitter/components/images/Image.tsx b/phone/src/apps/twitter/components/images/Image.tsx index bb61c76..9292582 100644 --- a/phone/src/apps/twitter/components/images/Image.tsx +++ b/phone/src/apps/twitter/components/images/Image.tsx @@ -1,38 +1,38 @@ -import React from "react"; -import { IconButton } from "@material-ui/core"; -import { makeStyles } from "@material-ui/core/styles"; -import CloseIcon from "@material-ui/icons/Close"; +import React from 'react'; +import { IconButton } from '@material-ui/core'; +import { makeStyles } from '@material-ui/core/styles'; +import CloseIcon from '@material-ui/icons/Close'; const useStyles = makeStyles(() => ({ root: { - margin: "2px 15px", + margin: '2px 15px', }, imageContainer: { // catch the close button here so it doesn't go all the way up to the modal - position: "relative", - display: "inline-block", + position: 'relative', + display: 'inline-block', }, imgButton: { - position: "absolute", // show the close button in the top right of the image - top: "2px", - right: "5px", - backgroundColor: "#000", + position: 'absolute', // show the close button in the top right of the image + top: '2px', + right: '5px', + backgroundColor: '#000', opacity: 0.7, - "&:hover": { + '&:hover': { // fixes a bug where when the user closes one image material-ui puts // the hover status on the previous image - backgroundColor: "#000", + backgroundColor: '#000', }, }, img: { - maxHeight: "125px", // constrain images so we don't overwhelm the UI - maxWidth: "300px", - padding: "0px 3px 3px 0px", + maxHeight: '125px', // constrain images so we don't overwhelm the UI + maxWidth: '300px', + padding: '0px 3px 3px 0px', }, imgSmall: { - maxHeight: "200px", // constrain images so we don't overwhelm the UI - maxWidth: "100%", - padding: "0px 1px 1px 0px", + maxHeight: '200px', // constrain images so we don't overwhelm the UI + maxWidth: '100%', + padding: '0px 1px 1px 0px', }, })); @@ -44,13 +44,13 @@ export const Image = ({ link, handleClick, small }) => { )} small avatar diff --git a/phone/src/apps/twitter/components/images/ImageDisplay.tsx b/phone/src/apps/twitter/components/images/ImageDisplay.tsx index 5ed6ceb..d648c48 100644 --- a/phone/src/apps/twitter/components/images/ImageDisplay.tsx +++ b/phone/src/apps/twitter/components/images/ImageDisplay.tsx @@ -1,11 +1,11 @@ -import React from "react"; +import React from 'react'; -import Image from "./Image"; +import Image from './Image'; export const ImageDisplay = ({ visible, images, removeImage, small }) => { if (!visible || !images || images.length === 0) return null; - const styles = { margin: small ? "2px 0px" : "2px 15px" }; + const styles = { margin: small ? '2px 0px' : '2px 15px' }; return (
diff --git a/phone/src/apps/twitter/components/images/ImagePrompt.tsx b/phone/src/apps/twitter/components/images/ImagePrompt.tsx index ae1d7c0..3552983 100644 --- a/phone/src/apps/twitter/components/images/ImagePrompt.tsx +++ b/phone/src/apps/twitter/components/images/ImagePrompt.tsx @@ -1,16 +1,16 @@ -import React from "react"; -import { useTranslation } from "react-i18next"; -import { makeStyles } from "@material-ui/core/styles"; -import { TextField } from "@material-ui/core"; +import React from 'react'; +import { useTranslation } from 'react-i18next'; +import { makeStyles } from '@material-ui/core/styles'; +import { TextField } from '@material-ui/core'; const useStyles = makeStyles((theme) => ({ textField: { - flex: "1 1 100%", - padding: "10px 15px", - marginTop: "15px", + flex: '1 1 100%', + padding: '10px 15px', + marginTop: '15px', }, textFieldInput: { - fontSize: "22px", + fontSize: '22px', }, })); @@ -26,8 +26,8 @@ export const ImagePrompt = ({ visible, value, handleChange }) => { className={classes.textField} onChange={handleChange} multiline - size="small" - placeholder={t("APPS_TWITTER_IMAGE_PLACEHOLDER")} + size='small' + placeholder={t('APPS_TWITTER_IMAGE_PLACEHOLDER')} inputRef={(input) => input && input.focus()} /> ); diff --git a/phone/src/apps/twitter/components/notification/TwitterNotification.test.tsx b/phone/src/apps/twitter/components/notification/TwitterNotification.test.tsx index 40eca1e..958af69 100644 --- a/phone/src/apps/twitter/components/notification/TwitterNotification.test.tsx +++ b/phone/src/apps/twitter/components/notification/TwitterNotification.test.tsx @@ -1,12 +1,12 @@ -import React from "react"; -import { shallow } from "enzyme"; -import TwitterNotification from "./TwitterNotification"; +import React from 'react'; +import { shallow } from 'enzyme'; +import TwitterNotification from './TwitterNotification'; -jest.mock("react-i18next", () => ({ +jest.mock('react-i18next', () => ({ useTranslation: () => ({ t: (key) => key }), })); -jest.mock("../../../../os/phone/hooks/usePhone", () => ({ +jest.mock('../../../../os/phone/hooks/usePhone', () => ({ usePhone: jest.fn().mockReturnValue({ config: { twitter: { @@ -16,32 +16,32 @@ jest.mock("../../../../os/phone/hooks/usePhone", () => ({ }), })); -jest.mock("../../hooks/useTwitterNotification", () => ({ +jest.mock('../../hooks/useTwitterNotification', () => ({ useTwitterNotification: jest.fn().mockReturnValue({ notification: { - profile_name: "test", - message: "test message", + profile_name: 'test', + message: 'test message', }, }), })); -describe("TwitterNotification", () => { +describe('TwitterNotification', () => { let wrapper; beforeEach(() => { wrapper = shallow(); }); - it("renders", () => { + it('renders', () => { expect(wrapper).toBeDefined(); }); - it("renders profile name", () => { - expect(wrapper.find(".makeStyles-profileName-5").text()).toEqual("@test"); + it('renders profile name', () => { + expect(wrapper.find('.makeStyles-profileName-5').text()).toEqual('@test'); }); - it("renders message", () => { - expect(wrapper.find(".makeStyles-message-7").text()).toEqual( - "test message" + it('renders message', () => { + expect(wrapper.find('.makeStyles-message-7').text()).toEqual( + 'test message' ); }); }); diff --git a/phone/src/apps/twitter/components/notification/TwitterNotification.tsx b/phone/src/apps/twitter/components/notification/TwitterNotification.tsx index 45c1d8c..c11bd91 100644 --- a/phone/src/apps/twitter/components/notification/TwitterNotification.tsx +++ b/phone/src/apps/twitter/components/notification/TwitterNotification.tsx @@ -1,47 +1,47 @@ -import React, { useEffect, useState } from "react"; -import { useTranslation } from "react-i18next"; -import { makeStyles, createStyles, Theme } from "@material-ui/core/styles"; -import TwitterIcon from "@material-ui/icons/Twitter"; -import { useTwitterNotification } from "../../hooks/useTwitterNotification"; -import Notification from "../../../../ui/components/Notification"; -import { usePhone } from "../../../../os/phone/hooks/usePhone"; +import React, { useEffect, useState } from 'react'; +import { useTranslation } from 'react-i18next'; +import { makeStyles, createStyles, Theme } from '@material-ui/core/styles'; +import TwitterIcon from '@material-ui/icons/Twitter'; +import { useTwitterNotification } from '../../hooks/useTwitterNotification'; +import Notification from '../../../../ui/components/Notification'; +import { usePhone } from '../../../../os/phone/hooks/usePhone'; const useStyles = makeStyles((theme: Theme) => createStyles({ content: { padding: theme.spacing(2), - overflowY: "hidden", + overflowY: 'hidden', }, title: { - display: "flex", - flexFlow: "row nowrap", - justifyContent: "space-between", - alignItems: "center", + display: 'flex', + flexFlow: 'row nowrap', + justifyContent: 'space-between', + alignItems: 'center', }, titleLeft: { - display: "flex", - flexFlow: "row nowrap", - justifyContent: "flex-start", - alignItems: "center", + display: 'flex', + flexFlow: 'row nowrap', + justifyContent: 'flex-start', + alignItems: 'center', }, icon: { - marginTop: "3px", - marginRight: "5px", + marginTop: '3px', + marginRight: '5px', }, profileName: { - marginBottom: "3px", + marginBottom: '3px', }, justNow: { - fontSize: "18px", - fontStyle: "italic", - paddingRight: "3px", + fontSize: '18px', + fontStyle: 'italic', + paddingRight: '3px', }, message: { - fontSize: "16px", - overflow: "hidden", - display: "-webkit-box", + fontSize: '16px', + overflow: 'hidden', + display: '-webkit-box', WebkitLineClamp: 2, - WebkitBoxOrient: "vertical", + WebkitBoxOrient: 'vertical', }, }) ); @@ -77,7 +77,7 @@ function TwitterNotification() {
{profileName}
-
{t("APPS_TWITTER_JUST_NOW")}
+
{t('APPS_TWITTER_JUST_NOW')}
{notification.message}
diff --git a/phone/src/apps/twitter/components/profile/Profile.tsx b/phone/src/apps/twitter/components/profile/Profile.tsx index ddc7cd1..326e002 100644 --- a/phone/src/apps/twitter/components/profile/Profile.tsx +++ b/phone/src/apps/twitter/components/profile/Profile.tsx @@ -1,23 +1,23 @@ -import React, { useState } from "react"; -import { makeStyles } from "@material-ui/core/styles"; -import { useTranslation } from "react-i18next"; +import React, { useState } from 'react'; +import { makeStyles } from '@material-ui/core/styles'; +import { useTranslation } from 'react-i18next'; -import Nui from "../../../../os/nui-events/utils/Nui"; -import { useProfile } from "../../hooks/useProfile"; -import Avatar from "../Avatar"; -import ProfileField from "./ProfileField"; -import ProfileUpdateButton from "../buttons/ProfileUpdateButton"; -import { usePhone } from "../../../../os/phone/hooks/usePhone"; +import Nui from '../../../../os/nui-events/utils/Nui'; +import { useProfile } from '../../hooks/useProfile'; +import Avatar from '../Avatar'; +import ProfileField from './ProfileField'; +import ProfileUpdateButton from '../buttons/ProfileUpdateButton'; +import { usePhone } from '../../../../os/phone/hooks/usePhone'; const useStyles = makeStyles((theme) => ({ root: { - position: "relative", - width: "100%", - height: "100%", - padding: "15px", + position: 'relative', + width: '100%', + height: '100%', + padding: '15px', }, spacer: { - height: "8px", + height: '8px', }, })); @@ -32,11 +32,11 @@ export function Profile() { // Annoyingling adding conditionals above this line to not render // when profile === null results in a react error that different // amounts of hooks are rendering - const [avatarUrl, handleAvatarChange] = useState(profile.avatar_url || ""); - const [name, handleNameChange] = useState(profile.profile_name || ""); - const [bio, handleBioChange] = useState(profile.bio || ""); - const [location, handleLocationChange] = useState(profile.location || ""); - const [job, handleJobChange] = useState(profile.job || ""); + const [avatarUrl, handleAvatarChange] = useState(profile.avatar_url || ''); + const [name, handleNameChange] = useState(profile.profile_name || ''); + const [bio, handleBioChange] = useState(profile.bio || ''); + const [location, handleLocationChange] = useState(profile.location || ''); + const [job, handleJobChange] = useState(profile.job || ''); const handleUpdate = () => { const data = { @@ -46,7 +46,7 @@ export function Profile() { location, job, }; - Nui.send("phone:updateTwitterProfile", data); + Nui.send('phone:updateTwitterProfile', data); }; // fetching the config is an asynchronous call so defend against it @@ -59,30 +59,30 @@ export function Profile() { {enableAvatars && }
diff --git a/phone/src/apps/twitter/components/profile/ProfileField.tsx b/phone/src/apps/twitter/components/profile/ProfileField.tsx index da7150c..fb00e72 100644 --- a/phone/src/apps/twitter/components/profile/ProfileField.tsx +++ b/phone/src/apps/twitter/components/profile/ProfileField.tsx @@ -1,14 +1,14 @@ -import React from "react"; -import { makeStyles } from "@material-ui/core/styles"; -import { TextField } from "@material-ui/core"; +import React from 'react'; +import { makeStyles } from '@material-ui/core/styles'; +import { TextField } from '@material-ui/core'; const useStyles = makeStyles({ formContainer: { - width: "100%", - marginTop: "8px", + width: '100%', + marginTop: '8px', }, textField: { - width: "100%", + width: '100%', }, }); diff --git a/phone/src/apps/twitter/components/profile/ProfilePrompt.tsx b/phone/src/apps/twitter/components/profile/ProfilePrompt.tsx index 2d83882..7fc408f 100644 --- a/phone/src/apps/twitter/components/profile/ProfilePrompt.tsx +++ b/phone/src/apps/twitter/components/profile/ProfilePrompt.tsx @@ -1,21 +1,21 @@ -import React, { useState } from "react"; -import { makeStyles } from "@material-ui/core/styles"; -import { useTranslation } from "react-i18next"; +import React, { useState } from 'react'; +import { makeStyles } from '@material-ui/core/styles'; +import { useTranslation } from 'react-i18next'; -import Nui from "../../../../os/nui-events/utils/Nui"; -import { useProfile } from "../../hooks/useProfile"; -import ProfileField from "./ProfileField"; -import ProfileUpdateButton from "../buttons/ProfileUpdateButton"; +import Nui from '../../../../os/nui-events/utils/Nui'; +import { useProfile } from '../../hooks/useProfile'; +import ProfileField from './ProfileField'; +import ProfileUpdateButton from '../buttons/ProfileUpdateButton'; const useStyles = makeStyles((theme) => ({ root: { - position: "relative", - width: "100%", - height: "100%", - padding: "15px", + position: 'relative', + width: '100%', + height: '100%', + padding: '15px', }, spacer: { - height: "8px", + height: '8px', }, })); @@ -24,20 +24,20 @@ export function ProfilePrompt() { const { t } = useTranslation(); const { profile } = useProfile(); - const [name, handleNameChange] = useState(profile.profile_name || ""); + const [name, handleNameChange] = useState(profile.profile_name || ''); const handleUpdate = () => { const data = { ...profile, profile_name: name, }; - Nui.send("phone:updateTwitterProfile", data); + Nui.send('phone:updateTwitterProfile', data); }; return (
{ @@ -41,11 +36,11 @@ export const ShowMore = ({ id, isReported, isMine }) => { if (!config) return null; const handleClick = (event: React.MouseEvent) => { - const element = event.currentTarget + const element = event.currentTarget; setAnchorEl(element); - - const top = window.pageYOffset + element.getBoundingClientRect().top - setVerticalOffset(calculateVerticalOffset(top)); + + const top = window.pageYOffset + element.getBoundingClientRect().top; + setVerticalOffset(calculateVerticalOffset(top)); }; const handleClose = () => { @@ -54,36 +49,51 @@ export const ShowMore = ({ id, isReported, isMine }) => { }; const handleDeleteTweet = () => { - Nui.send("phone:deleteTweet", id); + Nui.send('phone:deleteTweet', id); handleClose(); - } + }; const allowedToDelete = config.twitter.allowDeleteTweets && isMine; const allowedToReport = config.twitter.allowReportTweets && !isMine; // if the user cannot perform any actions in show more then don't // allow them to interact with it - let _handleClick = allowedToDelete || allowedToReport ? handleClick : () => null; + let _handleClick = + allowedToDelete || allowedToReport ? handleClick : () => null; return ( - <> - - - {allowedToDelete && {t('APPS_TWITTER_DELETE')}} - {allowedToReport && } - + <> + + + {allowedToDelete && ( + + {t('APPS_TWITTER_DELETE')} + + )} + {allowedToReport && ( + + )} + ); }; diff --git a/phone/src/apps/twitter/components/tweet/Tweet.tsx b/phone/src/apps/twitter/components/tweet/Tweet.tsx index adf1c3b..5d17cc3 100644 --- a/phone/src/apps/twitter/components/tweet/Tweet.tsx +++ b/phone/src/apps/twitter/components/tweet/Tweet.tsx @@ -1,63 +1,63 @@ -import React, { memo } from "react"; -import { useTranslation } from "react-i18next"; -import { makeStyles } from "@material-ui/core/styles"; +import React, { memo } from 'react'; +import { useTranslation } from 'react-i18next'; +import { makeStyles } from '@material-ui/core/styles'; import { ListItemAvatar, Avatar as MuiAvatar, ListItem, Typography, -} from "@material-ui/core"; +} from '@material-ui/core'; -import { secondsToHumanReadable } from "../../utils/time"; -import LikeButton from "../buttons/LikeButton"; -import ReplyButton from "../buttons/ReplyButton"; -import ImageDisplay from "../images/ImageDisplay"; -import Avatar from "../Avatar"; +import { secondsToHumanReadable } from '../../utils/time'; +import LikeButton from '../buttons/LikeButton'; +import ReplyButton from '../buttons/ReplyButton'; +import ImageDisplay from '../images/ImageDisplay'; +import Avatar from '../Avatar'; import ShowMore from './ShowMore'; -import { QuoteButton } from "../buttons/QuoteButton"; -import { usePhone } from "../../../../os/phone/hooks/usePhone"; +import { QuoteButton } from '../buttons/QuoteButton'; +import { usePhone } from '../../../../os/phone/hooks/usePhone'; const useStyles = makeStyles(() => ({ root: { - overflowX: "hidden", - display: "flex", - flexFlow: "row nowrap", - alignItems: "flex-start", - width: "100%", - marginTop: "3px", + overflowX: 'hidden', + display: 'flex', + flexFlow: 'row nowrap', + alignItems: 'flex-start', + width: '100%', + marginTop: '3px', }, content: { - display: "flex", - marginTop: "-10px", // easier to do this here than override the MUI styles - flexFlow: "column nowrap", - width: "100%", + display: 'flex', + marginTop: '-10px', // easier to do this here than override the MUI styles + flexFlow: 'column nowrap', + width: '100%', }, primary: { - display: "flex", - flexFlow: "row nowrap", - width: "100%", - alignItems: "flex-end", + display: 'flex', + flexFlow: 'row nowrap', + width: '100%', + alignItems: 'flex-end', }, profile: { - fontSize: "18px", - fontWeight: "bold", + fontSize: '18px', + fontWeight: 'bold', }, date: { - marginLeft: "10px", - fontSize: "14px", + marginLeft: '10px', + fontSize: '14px', }, message: { - fontSize: "18px", - color: "rgba(255, 255, 255, 0.7)", + fontSize: '18px', + color: 'rgba(255, 255, 255, 0.7)', }, buttonContainer: { - display: "flex", - flexFlow: "row nowrap", - justifyContent: "space-between", - width: "100%", - marginLeft: "-20px", // easier to do this here than override the MUI styles - marginTop: "3px", - } + display: 'flex', + flexFlow: 'row nowrap', + justifyContent: 'space-between', + width: '100%', + marginLeft: '-20px', // easier to do this here than override the MUI styles + marginTop: '3px', + }, })); export const Tweet = (tweet) => { @@ -81,15 +81,15 @@ export const Tweet = (tweet) => { // this is a workaround to transfer string new lines and returns that // are stored into the database into html for the UI to render - const formattedMessage = message.replace(/\n\r?/g, "
"); - const profileName = profile_name ? `@${profile_name}` : ""; + const formattedMessage = message.replace(/\n\r?/g, '
'); + const profileName = profile_name ? `@${profile_name}` : ''; return ( {enableAvatars && ( - + )} @@ -98,9 +98,9 @@ export const Tweet = (tweet) => {
{profileName}
{secondsToHumanReadable(t, seconds_since_tweet)} diff --git a/phone/src/apps/twitter/components/tweet/TweetList.tsx b/phone/src/apps/twitter/components/tweet/TweetList.tsx index 1f91bde..7c931f6 100644 --- a/phone/src/apps/twitter/components/tweet/TweetList.tsx +++ b/phone/src/apps/twitter/components/tweet/TweetList.tsx @@ -1,8 +1,8 @@ -import React, { useEffect, useState, memo } from "react"; +import React, { useEffect, useState, memo } from 'react'; -import { List } from "../../../../ui/components/List"; -import Tweet from "./Tweet"; -import TweetSkeletonList from "./TweetSkeletonList"; +import { List } from '../../../../ui/components/List'; +import Tweet from './Tweet'; +import TweetSkeletonList from './TweetSkeletonList'; const MINIMUM_LOAD_TIME = 700; @@ -21,7 +21,6 @@ export function TweetList({ tweets }) { // another flash to the tweets screen. const hasLoaded = tweets && minimumLoadPassed; - if (!hasLoaded) return ; return ( diff --git a/phone/src/apps/twitter/components/tweet/TweetListContainer.tsx b/phone/src/apps/twitter/components/tweet/TweetListContainer.tsx index 7d41a2b..a5a74c2 100644 --- a/phone/src/apps/twitter/components/tweet/TweetListContainer.tsx +++ b/phone/src/apps/twitter/components/tweet/TweetListContainer.tsx @@ -1,14 +1,14 @@ -import React, { useEffect } from "react"; +import React, { useEffect } from 'react'; -import Nui from "../../../../os/nui-events/utils/Nui"; -import { useTweets } from "../../hooks/useTweets"; -import TweetList from "./TweetList"; +import Nui from '../../../../os/nui-events/utils/Nui'; +import { useTweets } from '../../hooks/useTweets'; +import TweetList from './TweetList'; export function TweetListContainer() { const { tweets } = useTweets(); useEffect(() => { - Nui.send("phone:fetchTweets", {}); + Nui.send('phone:fetchTweets', {}); }, []); return ; diff --git a/phone/src/apps/twitter/components/tweet/TweetMessage.tsx b/phone/src/apps/twitter/components/tweet/TweetMessage.tsx index 7818ca6..520bb6e 100644 --- a/phone/src/apps/twitter/components/tweet/TweetMessage.tsx +++ b/phone/src/apps/twitter/components/tweet/TweetMessage.tsx @@ -1,20 +1,20 @@ -import React from "react"; -import { useTranslation } from "react-i18next"; -import { makeStyles } from "@material-ui/core/styles"; -import { TextField } from "@material-ui/core"; -import { usePhone } from "../../../../os/phone/hooks/usePhone"; +import React from 'react'; +import { useTranslation } from 'react-i18next'; +import { makeStyles } from '@material-ui/core/styles'; +import { TextField } from '@material-ui/core'; +import { usePhone } from '../../../../os/phone/hooks/usePhone'; const useStyles = makeStyles((theme) => ({ textField: { - flex: "1 1 100%", - padding: "10px 15px", - marginTop: "15px", + flex: '1 1 100%', + padding: '10px 15px', + marginTop: '15px', }, textFieldInput: { - fontSize: "22px", + fontSize: '22px', }, display: { - height: "200px", + height: '200px', }, })); @@ -28,7 +28,7 @@ export const TweetMessage = ({ message, handleChange }) => { const overCharacterLimit = message.trim().length > config.twitter.characterLimit; const characterWarningPrompt = `${t( - "APPS_TWITTER_TWEET_MESSAGE_CHAR_LIMIT" + 'APPS_TWITTER_TWEET_MESSAGE_CHAR_LIMIT' )} (${config.twitter.characterLimit})`; return ( @@ -38,7 +38,7 @@ export const TweetMessage = ({ message, handleChange }) => { className={classes.textField} onChange={handleChange} multiline - placeholder={t("APPS_TWITTER_TWEET_MESSAGE_PLACEHOLDER")} + placeholder={t('APPS_TWITTER_TWEET_MESSAGE_PLACEHOLDER')} inputRef={(input) => input && input.focus()} error={overCharacterLimit} helperText={overCharacterLimit ? characterWarningPrompt : null} diff --git a/phone/src/apps/twitter/components/tweet/TweetSkeleton.tsx b/phone/src/apps/twitter/components/tweet/TweetSkeleton.tsx index 2154e88..11d0771 100644 --- a/phone/src/apps/twitter/components/tweet/TweetSkeleton.tsx +++ b/phone/src/apps/twitter/components/tweet/TweetSkeleton.tsx @@ -1,21 +1,21 @@ -import React from "react"; -import Divider from "@material-ui/core/Divider"; -import { makeStyles } from "@material-ui/core/styles"; -import Skeleton from "@material-ui/lab/Skeleton"; +import React from 'react'; +import Divider from '@material-ui/core/Divider'; +import { makeStyles } from '@material-ui/core/styles'; +import Skeleton from '@material-ui/lab/Skeleton'; const useStyles = makeStyles({ root: { - width: "100%", - padding: "15px", - display: "flex", - flexFlow: "row nowrap", - marginTop: "3px", - marginBottom: "3px", + width: '100%', + padding: '15px', + display: 'flex', + flexFlow: 'row nowrap', + marginTop: '3px', + marginBottom: '3px', }, left: {}, right: { - marginLeft: "15px", - marginTop: "-5px", + marginLeft: '15px', + marginTop: '-5px', }, }); @@ -25,11 +25,11 @@ export default function TweetSkeleton() { <>
- +
- - + +
diff --git a/phone/src/apps/twitter/components/tweet/TweetSkeletonList.tsx b/phone/src/apps/twitter/components/tweet/TweetSkeletonList.tsx index b35be9e..a22cfe9 100644 --- a/phone/src/apps/twitter/components/tweet/TweetSkeletonList.tsx +++ b/phone/src/apps/twitter/components/tweet/TweetSkeletonList.tsx @@ -1,7 +1,7 @@ -import React from "react"; +import React from 'react'; -import { List } from "../../../../ui/components/List"; -import TweetSkeleton from "./TweetSkeleton"; +import { List } from '../../../../ui/components/List'; +import TweetSkeleton from './TweetSkeleton'; export function TweetSkeletonList() { return ( diff --git a/phone/src/apps/twitter/hooks/state.ts b/phone/src/apps/twitter/hooks/state.ts index 053e463..f541623 100644 --- a/phone/src/apps/twitter/hooks/state.ts +++ b/phone/src/apps/twitter/hooks/state.ts @@ -1,44 +1,44 @@ -import { atom } from "recoil"; +import { atom } from 'recoil'; export const twitterState = { profile: atom({ - key: "profile", + key: 'profile', default: {}, }), tweets: atom({ - key: "tweets", + key: 'tweets', default: null, }), filteredTweets: atom({ - key: "filteredTweets", + key: 'filteredTweets', default: null, }), showCreateTweetModal: atom({ - key: "showCreateTweetModal", + key: 'showCreateTweetModal', default: false, }), modalMessage: atom({ - key: "modalMessage", - default: "", + key: 'modalMessage', + default: '', }), createTweetLoading: atom({ - key: "createTweetLoading", + key: 'createTweetLoading', default: false, }), createTweetSuccessful: atom({ - key: "createTweetSuccessful", + key: 'createTweetSuccessful', default: null, }), updateProfileLoading: atom({ - key: "updateProfileLoading", + key: 'updateProfileLoading', default: false, }), updateProfileSuccess: atom({ - key: "updateProfileSuccess", + key: 'updateProfileSuccess', default: null, }), notification: atom({ - key: "notification", + key: 'notification', default: null, - }) + }), }; diff --git a/phone/src/apps/twitter/hooks/useFilteredTweets.ts b/phone/src/apps/twitter/hooks/useFilteredTweets.ts index e1fbebe..4237121 100644 --- a/phone/src/apps/twitter/hooks/useFilteredTweets.ts +++ b/phone/src/apps/twitter/hooks/useFilteredTweets.ts @@ -1,5 +1,5 @@ -import { useRecoilState } from "recoil"; -import { twitterState } from "./state"; +import { useRecoilState } from 'recoil'; +import { twitterState } from './state'; export const useFilteredTweets = () => { const [tweets, setTweets] = useRecoilState(twitterState.filteredTweets); diff --git a/phone/src/apps/twitter/hooks/useModal.ts b/phone/src/apps/twitter/hooks/useModal.ts index 763956e..2ecb71d 100644 --- a/phone/src/apps/twitter/hooks/useModal.ts +++ b/phone/src/apps/twitter/hooks/useModal.ts @@ -1,5 +1,5 @@ -import { useRecoilState } from "recoil"; -import { twitterState } from "./state"; +import { useRecoilState } from 'recoil'; +import { twitterState } from './state'; export const useModal = () => { const [modalVisible, setModalVisible] = useRecoilState( diff --git a/phone/src/apps/twitter/hooks/useProfile.ts b/phone/src/apps/twitter/hooks/useProfile.ts index 388317c..36ee3ea 100644 --- a/phone/src/apps/twitter/hooks/useProfile.ts +++ b/phone/src/apps/twitter/hooks/useProfile.ts @@ -1,5 +1,5 @@ -import { useRecoilValue, useRecoilState } from "recoil"; -import { twitterState } from "./state"; +import { useRecoilValue, useRecoilState } from 'recoil'; +import { twitterState } from './state'; interface IProfile { profile_name?: string; diff --git a/phone/src/apps/twitter/hooks/useTweetStatus.ts b/phone/src/apps/twitter/hooks/useTweetStatus.ts index f8116da..22311bc 100644 --- a/phone/src/apps/twitter/hooks/useTweetStatus.ts +++ b/phone/src/apps/twitter/hooks/useTweetStatus.ts @@ -1,6 +1,6 @@ -import { useRecoilValue, useRecoilState } from "recoil"; +import { useRecoilValue, useRecoilState } from 'recoil'; -import { twitterState } from "./state"; +import { twitterState } from './state'; export const useTweetStatus = () => { const createTweetLoading = useRecoilValue(twitterState.createTweetLoading); diff --git a/phone/src/apps/twitter/hooks/useTweets.ts b/phone/src/apps/twitter/hooks/useTweets.ts index 2753b39..e236113 100644 --- a/phone/src/apps/twitter/hooks/useTweets.ts +++ b/phone/src/apps/twitter/hooks/useTweets.ts @@ -1,5 +1,5 @@ -import { useRecoilValue } from "recoil"; -import { twitterState } from "./state"; +import { useRecoilValue } from 'recoil'; +import { twitterState } from './state'; export const useTweets = () => { const tweets = useRecoilValue(twitterState.tweets); diff --git a/phone/src/apps/twitter/hooks/useTwitterService.ts b/phone/src/apps/twitter/hooks/useTwitterService.ts index 25a2f5b..8b794c9 100644 --- a/phone/src/apps/twitter/hooks/useTwitterService.ts +++ b/phone/src/apps/twitter/hooks/useTwitterService.ts @@ -1,10 +1,10 @@ -import { useSetRecoilState } from "recoil"; -import { v4 as uuidv4 } from "uuid"; +import { useSetRecoilState } from 'recoil'; +import { v4 as uuidv4 } from 'uuid'; -import { useNuiEvent } from "../../../os/nui-events/hooks/useNuiEvent"; -import { IMAGE_DELIMITER } from "../utils/images"; -import { APP_TWITTER } from "../utils/constants"; -import { twitterState } from "./state"; +import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent'; +import { IMAGE_DELIMITER } from '../utils/images'; +import { APP_TWITTER } from '../utils/constants'; +import { twitterState } from './state'; /** * Perform all necessary processing/transforms from the raw database @@ -67,12 +67,12 @@ export const useTwitterService = () => { setFilteredTweets(tweets.map(processTweet)); }; - useNuiEvent(APP_TWITTER, "getOrCreateTwitterProfile", _setProfile); - useNuiEvent(APP_TWITTER, "updateProfileLoading", setUpdateProfileLoading); - useNuiEvent(APP_TWITTER, "updateProfileResult", _setUpdateProfileSuccess); - useNuiEvent(APP_TWITTER, "fetchTweets", _setTweets); - useNuiEvent(APP_TWITTER, "fetchTweetsFiltered", _setFilteredTweets); - useNuiEvent(APP_TWITTER, "createTweetLoading", setCreateLoading); - useNuiEvent(APP_TWITTER, "createTweetResult", _setCreateSuccess); - useNuiEvent(APP_TWITTER, "createTweetBroadcast", _setNotification); + useNuiEvent(APP_TWITTER, 'getOrCreateTwitterProfile', _setProfile); + useNuiEvent(APP_TWITTER, 'updateProfileLoading', setUpdateProfileLoading); + useNuiEvent(APP_TWITTER, 'updateProfileResult', _setUpdateProfileSuccess); + useNuiEvent(APP_TWITTER, 'fetchTweets', _setTweets); + useNuiEvent(APP_TWITTER, 'fetchTweetsFiltered', _setFilteredTweets); + useNuiEvent(APP_TWITTER, 'createTweetLoading', setCreateLoading); + useNuiEvent(APP_TWITTER, 'createTweetResult', _setCreateSuccess); + useNuiEvent(APP_TWITTER, 'createTweetBroadcast', _setNotification); }; diff --git a/phone/src/apps/twitter/utils/constants.ts b/phone/src/apps/twitter/utils/constants.ts index 6558f91..42aed19 100644 --- a/phone/src/apps/twitter/utils/constants.ts +++ b/phone/src/apps/twitter/utils/constants.ts @@ -1,3 +1,3 @@ -export const IMG_DEFAULT_AVATAR = "./media/twitter/egg.png"; -export const IMG_INVALID_AVATAR = "./media/twitter/invalid.png"; -export const APP_TWITTER = "TWITTER"; +export const IMG_DEFAULT_AVATAR = './media/twitter/egg.png'; +export const IMG_INVALID_AVATAR = './media/twitter/invalid.png'; +export const APP_TWITTER = 'TWITTER'; diff --git a/phone/src/apps/twitter/utils/images.ts b/phone/src/apps/twitter/utils/images.ts index 2177196..6a8fbe9 100644 --- a/phone/src/apps/twitter/utils/images.ts +++ b/phone/src/apps/twitter/utils/images.ts @@ -3,7 +3,7 @@ // hash, etc.) are often found in URLS (even though it's not technically // within specification). To get around this we have our own delimiter // here we'll use to join and split these strings -export const IMAGE_DELIMITER = "||!||"; +export const IMAGE_DELIMITER = '||!||'; /** * Validate that the URL successfully loads in the browser diff --git a/phone/src/apps/twitter/utils/time.ts b/phone/src/apps/twitter/utils/time.ts index 657ab9f..2cbf06a 100644 --- a/phone/src/apps/twitter/utils/time.ts +++ b/phone/src/apps/twitter/utils/time.ts @@ -2,10 +2,10 @@ const ONE_MINUTE = 60; const ONE_HOUR = 60 * ONE_MINUTE; const ONE_DAY = 24 * ONE_HOUR; -const JUST_NOW = "APPS_TWITTER_TIME_JUST_NOW"; -const MINUTES = "APPS_TWITTER_TIME_MINUTES"; -const HOURS = "APPS_TWITTER_TIME_HOURS"; -const DAYS = "APPS_TWITTER_TIME_DAYS"; +const JUST_NOW = 'APPS_TWITTER_TIME_JUST_NOW'; +const MINUTES = 'APPS_TWITTER_TIME_MINUTES'; +const HOURS = 'APPS_TWITTER_TIME_HOURS'; +const DAYS = 'APPS_TWITTER_TIME_DAYS'; /** * Convert seconds to a human readable format i.e. "Just Now", "2m", "3d" diff --git a/phone/src/main.css b/phone/src/main.css index cb4e9ca..fe2f050 100644 --- a/phone/src/main.css +++ b/phone/src/main.css @@ -1,6 +1,6 @@ body { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", - "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', + 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; @@ -13,7 +13,7 @@ body { } code { - font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", + font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace; } diff --git a/phone/src/modal/components/CallModal.tsx b/phone/src/modal/components/CallModal.tsx index 6fd581e..7c7fe87 100644 --- a/phone/src/modal/components/CallModal.tsx +++ b/phone/src/modal/components/CallModal.tsx @@ -1,8 +1,8 @@ -import React from "react"; -import { green } from "@material-ui/core/colors"; -import { AppWrapper } from "../../ui/components/AppWrapper"; -import { AppTitle } from "../../ui/components/AppTitle"; -import { AppContent } from "../../ui/components/AppContent"; +import React from 'react'; +import { green } from '@material-ui/core/colors'; +import { AppWrapper } from '../../ui/components/AppWrapper'; +import { AppTitle } from '../../ui/components/AppTitle'; +import { AppContent } from '../../ui/components/AppContent'; export const CallModal = () => { return ( @@ -11,15 +11,15 @@ export const CallModal = () => { app={{ backgroundColor: green[400], color: green[50], - nameLocale: "Call", + nameLocale: 'Call', }} - variant="h4" + variant='h4' />

Call diff --git a/phone/src/modal/hooks/state.ts b/phone/src/modal/hooks/state.ts index d56c306..5205d4a 100644 --- a/phone/src/modal/hooks/state.ts +++ b/phone/src/modal/hooks/state.ts @@ -1,8 +1,8 @@ -import { atom } from "recoil"; +import { atom } from 'recoil'; export const callerState = { caller: atom({ - key: "callerList", + key: 'callerList', default: [], }), }; diff --git a/phone/src/modal/hooks/useCall.ts b/phone/src/modal/hooks/useCall.ts index c60ae57..ecf52d0 100644 --- a/phone/src/modal/hooks/useCall.ts +++ b/phone/src/modal/hooks/useCall.ts @@ -1,5 +1,5 @@ -import { useRecoilState } from "recoil"; -import { callerState } from "./state"; +import { useRecoilState } from 'recoil'; +import { callerState } from './state'; export const useCall = () => { const caller = useRecoilState(callerState.caller); diff --git a/phone/src/modal/hooks/useCallService.ts b/phone/src/modal/hooks/useCallService.ts index e97a5cb..17fcabc 100644 --- a/phone/src/modal/hooks/useCallService.ts +++ b/phone/src/modal/hooks/useCallService.ts @@ -1,10 +1,10 @@ -import { useNuiEvent } from "../../os/nui-events/hooks/useNuiEvent"; -import { useSetRecoilState } from "recoil"; -import { callerState } from "./state"; -import { useCall } from "./useCall"; +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); + useNuiEvent('CALL', 'setCaller', setCaller); return useCall(); }; diff --git a/phone/src/os/apps/hooks/useApps.tsx b/phone/src/os/apps/hooks/useApps.tsx index d3d726f..7ceccbc 100644 --- a/phone/src/os/apps/hooks/useApps.tsx +++ b/phone/src/os/apps/hooks/useApps.tsx @@ -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: () => , }, { - id: "CAMERA", + id: 'CAMERA', name: 'APPS_CAMERA', - icon: , + icon: , backgroundColor: grey['A400'], color: common.white, - path: "/camera", - Route: () => + path: '/camera', + Route: () => , }, { - id: "EXAMPLE", - nameLocale: "APPS_EXAMPLE", - icon: , + id: 'EXAMPLE', + nameLocale: 'APPS_EXAMPLE', + icon: , backgroundColor: blue[500], color: blue[50], path: '/example', diff --git a/phone/src/os/keyboard/hooks/useKeyboard.ts b/phone/src/os/keyboard/hooks/useKeyboard.ts index 7430e37..b0b6bd6 100644 --- a/phone/src/os/keyboard/hooks/useKeyboard.ts +++ b/phone/src/os/keyboard/hooks/useKeyboard.ts @@ -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] ); diff --git a/phone/src/os/navigation-bar/components/Navigation.tsx b/phone/src/os/navigation-bar/components/Navigation.tsx index 79c0937..2fc7ef9 100644 --- a/phone/src/os/navigation-bar/components/Navigation.tsx +++ b/phone/src/os/navigation-bar/components/Navigation.tsx @@ -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()} > history.push("/")} + label='Home' + value={() => history.push('/')} icon={} /> closePhone()} icon={} /> history.goBack()} icon={} /> diff --git a/phone/src/os/notifications/components/NotificationIcon.tsx b/phone/src/os/notifications/components/NotificationIcon.tsx index a836e9f..d427e4a 100644 --- a/phone/src/os/notifications/components/NotificationIcon.tsx +++ b/phone/src/os/notifications/components/NotificationIcon.tsx @@ -1,5 +1,5 @@ -import React from "react"; +import React from 'react'; export const NotificationIcon = ({ Icon }) => { - return ; + return ; }; diff --git a/phone/src/os/nui-events/hooks/useNuiEvent.ts b/phone/src/os/nui-events/hooks/useNuiEvent.ts index 91b0e0e..8ce77eb 100644 --- a/phone/src/os/nui-events/hooks/useNuiEvent.ts +++ b/phone/src/os/nui-events/hooks/useNuiEvent.ts @@ -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]); -}; \ No newline at end of file +}; diff --git a/phone/src/os/nui-events/hooks/useNuiService.ts b/phone/src/os/nui-events/hooks/useNuiService.ts index 1e1467f..fd1c083 100644 --- a/phone/src/os/nui-events/hooks/useNuiService.ts +++ b/phone/src/os/nui-events/hooks/useNuiService.ts @@ -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]); -}; \ No newline at end of file +}; diff --git a/phone/src/os/nui-events/utils/Nui.ts b/phone/src/os/nui-events/utils/Nui.ts index 7751930..b92d7cb 100644 --- a/phone/src/os/nui-events/utils/Nui.ts +++ b/phone/src/os/nui-events/utils/Nui.ts @@ -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), }); diff --git a/phone/src/os/nui-events/utils/nuiUtils.ts b/phone/src/os/nui-events/utils/nuiUtils.ts index ca79e53..3ddebbd 100644 --- a/phone/src/os/nui-events/utils/nuiUtils.ts +++ b/phone/src/os/nui-events/utils/nuiUtils.ts @@ -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; diff --git a/phone/src/os/simcard/hooks/state.ts b/phone/src/os/simcard/hooks/state.ts index 8ea53e1..65b038d 100644 --- a/phone/src/os/simcard/hooks/state.ts +++ b/phone/src/os/simcard/hooks/state.ts @@ -1,8 +1,8 @@ -import { atom } from "recoil"; +import { atom } from 'recoil'; export const simcardState = { number: atom({ - key: "simcardNumber", + key: 'simcardNumber', default: null, }), }; diff --git a/phone/src/os/simcard/hooks/useSimcard.ts b/phone/src/os/simcard/hooks/useSimcard.ts index 0868b25..e31c69a 100644 --- a/phone/src/os/simcard/hooks/useSimcard.ts +++ b/phone/src/os/simcard/hooks/useSimcard.ts @@ -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); diff --git a/phone/src/os/simcard/hooks/useSimcardService.ts b/phone/src/os/simcard/hooks/useSimcardService.ts index 309579e..633b5fd 100644 --- a/phone/src/os/simcard/hooks/useSimcardService.ts +++ b/phone/src/os/simcard/hooks/useSimcardService.ts @@ -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(); }; diff --git a/phone/src/setupTests.tsx b/phone/src/setupTests.tsx index 6f413a4..82edfc9 100644 --- a/phone/src/setupTests.tsx +++ b/phone/src/setupTests.tsx @@ -1,4 +1,4 @@ -import { configure } from "enzyme"; -import Adapter from "enzyme-adapter-react-16"; +import { configure } from 'enzyme'; +import Adapter from 'enzyme-adapter-react-16'; configure({ adapter: new Adapter() }); diff --git a/phone/src/ui/components/Alert.tsx b/phone/src/ui/components/Alert.tsx index 2ba1e67..103e28b 100644 --- a/phone/src/ui/components/Alert.tsx +++ b/phone/src/ui/components/Alert.tsx @@ -1,8 +1,8 @@ -import React from "react"; -import MuiAlert from "@material-ui/lab/Alert"; +import React from 'react'; +import MuiAlert from '@material-ui/lab/Alert'; export function Alert(props) { - return ; + return ; } export default Alert; diff --git a/phone/src/ui/components/AppContent.tsx b/phone/src/ui/components/AppContent.tsx index eb6cb0a..f8069ca 100644 --- a/phone/src/ui/components/AppContent.tsx +++ b/phone/src/ui/components/AppContent.tsx @@ -1,25 +1,25 @@ -import React from "react"; -import { Box, makeStyles, Backdrop, Paper } from "@material-ui/core"; -import { AppContentTypes } from "../interface/InterfaceUI"; +import React from 'react'; +import { Box, makeStyles, Backdrop, Paper } from '@material-ui/core'; +import { AppContentTypes } from '../interface/InterfaceUI'; const useStyles = makeStyles(() => ({ wrapper: { - height: "70vh", // NOTE: Taso: Hacky change temp, this should be done automatically tbh. Will refactor at some point - overflow: "auto", + height: '70vh', // NOTE: Taso: Hacky change temp, this should be done automatically tbh. Will refactor at some point + overflow: 'auto', }, box: { - width: "100%", - height: "100%", // allow application to fill entireity of space - position: "relative", - overflow: "auto", + width: '100%', + height: '100%', // allow application to fill entireity of space + position: 'relative', + overflow: 'auto', }, backdrop: { - position: "absolute", + position: 'absolute', zIndex: 1, }, paper: { - width: "100%", - height: "100%", // allow application to fill entireity of space + width: '100%', + height: '100%', // allow application to fill entireity of space }, })); diff --git a/phone/src/ui/components/AppIcon.tsx b/phone/src/ui/components/AppIcon.tsx index 2e3f20a..0b3c10a 100644 --- a/phone/src/ui/components/AppIcon.tsx +++ b/phone/src/ui/components/AppIcon.tsx @@ -1,9 +1,9 @@ -import React from "react"; -import { makeStyles } from "@material-ui/core/styles"; -import Avatar from "@material-ui/core/Avatar"; -import { green } from "@material-ui/core/colors"; -import { Button } from "@material-ui/core"; -import Nui from "../../os/nui-events/utils/Nui"; +import React from 'react'; +import { makeStyles } from '@material-ui/core/styles'; +import Avatar from '@material-ui/core/Avatar'; +import { green } from '@material-ui/core/colors'; +import { Button } from '@material-ui/core'; +import Nui from '../../os/nui-events/utils/Nui'; interface IStyles { root: any; @@ -13,8 +13,8 @@ interface IStyles { const useStyles = makeStyles( (theme): IStyles => ({ root: { - display: "flex", - "& > *": { + display: 'flex', + '& > *': { margin: theme.spacing(1), }, padding: 0, @@ -36,8 +36,8 @@ export const AppIcon = ({ id, name, icon, backgroundColor, color }) => { }); const openAppCallback = () => { - Nui.send(`phone:app:${id}`) - } + Nui.send(`phone:app:${id}`); + }; return (