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 (