Merge branch 'master' into feat/calling-lua-ts

This commit is contained in:
Taso committed 2021-01-12 21:47:24 -05:00
commit a227743bdc
195 files changed
+2244 -1886

No files matched your search

+10 -1
View File
@@ -4,7 +4,16 @@ The original repo for NPWD
TODO TODO
## Production Server Installation ### Production Server Installation
**Database**
NPWD uses its own database driver compatible with `mysql-async` and `ghmattimysql`'s connection string. If you
don't utilize these resources, ensure you have this set in your console.
```
set mysql_connection_string "server=127.0.0.1;database=es_extended;userid=user;password=pass"
```
### Configuration ### Configuration
+1 -1
View File
@@ -32,7 +32,7 @@
"react-popper": "^2.2.3", "react-popper": "^2.2.3",
"react-router-dom": "^5.2.0", "react-router-dom": "^5.2.0",
"react-scripts": "3.4.3", "react-scripts": "3.4.3",
"recoil": "^0.0.10", "recoil": "^0.1.2",
"styled-components": "^5.1.1" "styled-components": "^5.1.1"
}, },
"devDependencies": { "devDependencies": {
+5 -5
View File
@@ -1,9 +1,9 @@
import React from "react"; import React from 'react';
import { RecoilRoot } from "recoil"; import { RecoilRoot } from 'recoil';
import { shallow } from "enzyme"; import { shallow } from 'enzyme';
import Phone from "./Phone"; import Phone from './Phone';
it("renders Phone", () => { it('renders Phone', () => {
shallow( shallow(
<RecoilRoot> <RecoilRoot>
<Phone /> <Phone />
+10 -4
View File
@@ -2,11 +2,10 @@ import React from 'react';
import './Phone.css'; import './Phone.css';
import './i18n'; import './i18n';
import { Route } from 'react-router-dom'; import { Route } from 'react-router-dom';
import { useSettings } from './apps/settings/hooks/useSettings';
import MessageIcon from '@material-ui/icons/Email'; import MessageIcon from '@material-ui/icons/Email';
import { CallModal } from './modal/components/CallModal'; import { CallModal } from './modal/components/CallModal';
import { HomeApp } from './apps/home/components/Home'; import { HomeApp } from './apps/home/components/Home';
import { ThemeProvider } from '@material-ui/core'; import { createMuiTheme, ThemeProvider } from '@material-ui/core';
import { useInitKeyboard } from './os/keyboard/hooks/useKeyboard'; import { useInitKeyboard } from './os/keyboard/hooks/useKeyboard';
import { NotificationIcon } from './os/notifications/components/NotificationIcon'; import { NotificationIcon } from './os/notifications/components/NotificationIcon';
import { NotificationBar } from './os/notifications/components/NotificationBar'; import { NotificationBar } from './os/notifications/components/NotificationBar';
@@ -25,6 +24,10 @@ import { useNotesService } from './apps/notes/hooks/useNotesService';
import { usePhotoService } from './apps/camera/hooks/usePhotoService'; import { usePhotoService } from './apps/camera/hooks/usePhotoService';
import Nui from './os/nui-events/utils/Nui'; import Nui from './os/nui-events/utils/Nui';
import { usePhone } from './os/phone/hooks/usePhone'; import { usePhone } from './os/phone/hooks/usePhone';
import { settingsState } from './apps/settings/hooks/useSettings';
import config from './config/default.json';
import { useRecoilState } from 'recoil';
// Inject mock data when in development env. // Inject mock data when in development env.
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
@@ -245,7 +248,6 @@ function Phone() {
useNuiService(); useNuiService();
usePhoneService(); usePhoneService();
const { visibility } = usePhone(); const { visibility } = usePhone();
const { settings, currentTheme } = useSettings();
const { allApps } = useApps(); const { allApps } = useApps();
useSimcardService(); useSimcardService();
useContactsService(); useContactsService();
@@ -257,10 +259,14 @@ function Phone() {
useNotesService(); useNotesService();
usePhotoService(); usePhotoService();
const [settings] = useRecoilState(settingsState);
if (visibility === false) { if (visibility === false) {
return null; return null;
} }
const currentTheme = () => createMuiTheme(config.themes[settings.theme]);
const calling = false; const calling = false;
document.onkeyup = function (data) { document.onkeyup = function (data) {
@@ -279,7 +285,7 @@ function Phone() {
style={{ style={{
backgroundImage: `url(./media/frames/${settings.frame})`, backgroundImage: `url(./media/frames/${settings.frame})`,
}} }}
></div> />
<div <div
id='phone' id='phone'
className='PhoneScreen' className='PhoneScreen'
+9 -9
View File
@@ -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 #### */ /* #### Generated By: http://www.cufonfonts.com #### */
@@ -6,11 +6,13 @@
font-family: 'Bahnschrift Regular'; font-family: 'Bahnschrift Regular';
font-style: normal; font-style: normal;
font-weight: 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 { #account-section,
font-family: 'Bahnschrift Regular' #transaction-section {
font-family: 'Bahnschrift Regular';
} }
#transaction-section .MuiTablePagination-root { #transaction-section .MuiTablePagination-root {
@@ -26,12 +28,10 @@
font-size: 50px; font-size: 50px;
} }
#bank-app .Mui-selected { #bank-app .Mui-selected {
color: #388CF8 !important; color: #388cf8 !important;
} }
#bank-app .MuiSnackbar-root { #bank-app .MuiSnackbar-root {
position: absolute; position: absolute;
} }
@@ -47,4 +47,4 @@
#actionButton a { #actionButton a {
color: #fff; color: #fff;
} }
@@ -11,7 +11,6 @@ import { useBankModal } from '../hooks/useBankModal';
import { Switch, Route } from 'react-router-dom'; import { Switch, Route } from 'react-router-dom';
import { NavigationBar } from './navigation/NavigationBar'; import { NavigationBar } from './navigation/NavigationBar';
import { BankHome } from './home/BankHome'; import { BankHome } from './home/BankHome';
import { BankAccount } from './account/BankAccount'; import { BankAccount } from './account/BankAccount';
import { TransactionList } from './transactions/TransactionList'; import { TransactionList } from './transactions/TransactionList';
@@ -1,8 +1,8 @@
import React from "react"; import React from 'react';
import MuiAlert from "@material-ui/lab/Alert"; import MuiAlert from '@material-ui/lab/Alert';
export function Alert(props) { export function Alert(props) {
return <MuiAlert elevation={6} variant="filled" {...props} />; return <MuiAlert elevation={6} variant='filled' {...props} />;
} }
export default Alert; export default Alert;
+6 -6
View File
@@ -3,7 +3,7 @@ import { atom } from 'recoil';
export const bankState = { export const bankState = {
transactions: atom({ transactions: atom({
key: 'transactionList', key: 'transactionList',
default: [] default: [],
}), }),
bankModal: atom({ bankModal: atom({
key: 'modalVisibility', key: 'modalVisibility',
@@ -11,14 +11,14 @@ export const bankState = {
}), }),
transferSuccessful: atom({ transferSuccessful: atom({
key: 'bankAlert', key: 'bankAlert',
default: null default: null,
}), }),
bankCredentials: atom({ bankCredentials: atom({
key: 'bankCredentails', key: 'bankCredentails',
default: null default: null,
}), }),
notification: atom({ notification: atom({
key: 'bankNotification', key: 'bankNotification',
default: null default: null,
}) }),
} };
+4 -2
View File
@@ -2,6 +2,8 @@ import { useRecoilState } from 'recoil';
import { bankState } from './state'; import { bankState } from './state';
export const useBankAlert = (): any => { export const useBankAlert = (): any => {
const [ bankAlert, setBankAlert ] = useRecoilState(bankState.transferSuccessful); const [bankAlert, setBankAlert] = useRecoilState(
bankState.transferSuccessful
);
return { bankAlert, setBankAlert }; return { bankAlert, setBankAlert };
} };
+2 -2
View File
@@ -2,6 +2,6 @@ import { useRecoilState } from 'recoil';
import { bankState } from './state'; import { bankState } from './state';
export const useBankModal = () => { export const useBankModal = () => {
const [ showBankModal, setShowBankModal ] = useRecoilState(bankState.bankModal); const [showBankModal, setShowBankModal] = useRecoilState(bankState.bankModal);
return { showBankModal, setShowBankModal }; return { showBankModal, setShowBankModal };
} };
+7 -7
View File
@@ -1,22 +1,22 @@
import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent'; import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
import { bankState } from './state'; import { bankState } from './state';
import { useTransactions } from './useTransactions' import { useTransactions } from './useTransactions';
import { useCredentials } from './useCredentials'; import { useCredentials } from './useCredentials';
import { useBankAlert } from './useBankAlert'; import { useBankAlert } from './useBankAlert';
import { useSetRecoilState } from 'recoil' import { useSetRecoilState } from 'recoil';
import { useBankNotification } from './useBankNotification'; import { useBankNotification } from './useBankNotification';
export const useBankService = () => { export const useBankService = () => {
const setTransaction = useSetRecoilState(bankState.transactions) const setTransaction = useSetRecoilState(bankState.transactions);
const setCredentials = useSetRecoilState(bankState.bankCredentials) const setCredentials = useSetRecoilState(bankState.bankCredentials);
const setAlertMessage = useSetRecoilState(bankState.transferSuccessful) const setAlertMessage = useSetRecoilState(bankState.transferSuccessful);
const setNotification = useSetRecoilState(bankState.notification); const setNotification = useSetRecoilState(bankState.notification);
/// ///
useNuiEvent('BANK', 'setTransaction', setTransaction); useNuiEvent('BANK', 'setTransaction', setTransaction);
useNuiEvent('BANK', 'setCredentials', setCredentials); useNuiEvent('BANK', 'setCredentials', setCredentials);
useNuiEvent('BANK', 'setAlert', setAlertMessage); useNuiEvent('BANK', 'setAlert', setAlertMessage);
useNuiEvent('BANK', 'setNotification', setNotification); useNuiEvent('BANK', 'setNotification', setNotification);
return { useTransactions, useCredentials, useBankAlert, useBankNotification }; return { useTransactions, useCredentials, useBankAlert, useBankNotification };
} };
+2 -2
View File
@@ -1,5 +1,5 @@
import { useRecoilValue } from "recoil"; import { useRecoilValue } from 'recoil';
import { bankState } from './state'; import { bankState } from './state';
export const useTransactions = () => { export const useTransactions = () => {
const transactionList = useRecoilValue(bankState.transactions); const transactionList = useRecoilValue(bankState.transactions);
@@ -1,12 +1,12 @@
import React from "react"; import React from 'react';
import { AppWrapper } from "../../../ui/components"; import { AppWrapper } from '../../../ui/components';
import { AppTitle } from "../../../ui/components/AppTitle"; import { AppTitle } from '../../../ui/components/AppTitle';
import { AppContent } from "../../../ui/components/AppContent"; import { AppContent } from '../../../ui/components/AppContent';
import { Calculator } from "./Calculator"; import { Calculator } from './Calculator';
import { useApp } from "../../../os/apps/hooks/useApps"; import { useApp } from '../../../os/apps/hooks/useApps';
export const CalculatorApp = () => { export const CalculatorApp = () => {
const calculator = useApp("CALCULATOR"); const calculator = useApp('CALCULATOR');
return ( return (
<AppWrapper> <AppWrapper>
<AppTitle app={calculator} /> <AppTitle app={calculator} />
@@ -1,41 +1,41 @@
import React from "react"; import React from 'react';
import { SvgIcon } from "@material-ui/core"; import { SvgIcon } from '@material-ui/core';
export const CalculatorIcon = ({ ...props }) => { export const CalculatorIcon = ({ ...props }) => {
return ( return (
<SvgIcon {...props}> <SvgIcon {...props}>
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns='http://www.w3.org/2000/svg'
x="0" x='0'
y="0" y='0'
enableBackground="new 0 0 56 56" enableBackground='new 0 0 56 56'
version="1.1" version='1.1'
viewBox="0 0 56 56" viewBox='0 0 56 56'
xmlSpace="preserve" xmlSpace='preserve'
> >
<path fill="#EBBA16" d="M0 0H28V28H0z"></path> <path fill='#EBBA16' d='M0 0H28V28H0z'></path>
<path fill="#ED8A19" d="M28 0H56V28H28z"></path> <path fill='#ED8A19' d='M28 0H56V28H28z'></path>
<path fill="#ED8A19" d="M0 28H28V56H0z"></path> <path fill='#ED8A19' d='M0 28H28V56H0z'></path>
<path fill="#556080" d="M28 28H56V56H28z"></path> <path fill='#556080' d='M28 28H56V56H28z'></path>
<path <path
fill="#FFF" fill='#FFF'
d="M48 46H36a1 1 0 110-2h12a1 1 0 110 2zM48 40H36a1 1 0 110-2h12a1 1 0 110 2zM14 43a.999.999 0 01-.707-1.707l5-5a.999.999 0 111.414 1.414l-5 5A.997.997 0 0114 43z" d='M48 46H36a1 1 0 110-2h12a1 1 0 110 2zM48 40H36a1 1 0 110-2h12a1 1 0 110 2zM14 43a.999.999 0 01-.707-1.707l5-5a.999.999 0 111.414 1.414l-5 5A.997.997 0 0114 43z'
></path> ></path>
<path <path
fill="#FFF" fill='#FFF'
d="M9 48a.999.999 0 01-.707-1.707l5-5a.999.999 0 111.414 1.414l-5 5A.997.997 0 019 48z" d='M9 48a.999.999 0 01-.707-1.707l5-5a.999.999 0 111.414 1.414l-5 5A.997.997 0 019 48z'
></path> ></path>
<path <path
fill="#FFF" fill='#FFF'
d="M19 48a.997.997 0 01-.707-.293l-5-5a.999.999 0 111.414-1.414l5 5A.999.999 0 0119 48z" d='M19 48a.997.997 0 01-.707-.293l-5-5a.999.999 0 111.414-1.414l5 5A.999.999 0 0119 48z'
></path> ></path>
<path <path
fill="#FFF" fill='#FFF'
d="M14 43a.997.997 0 01-.707-.293l-5-5a.999.999 0 111.414-1.414l5 5A.999.999 0 0114 43zM20 15H8a1 1 0 110-2h12a1 1 0 110 2z" d='M14 43a.997.997 0 01-.707-.293l-5-5a.999.999 0 111.414-1.414l5 5A.999.999 0 0114 43zM20 15H8a1 1 0 110-2h12a1 1 0 110 2z'
></path> ></path>
<path <path
fill="#FFF" fill='#FFF'
d="M14 21a1 1 0 01-1-1V8a1 1 0 112 0v12a1 1 0 01-1 1zM48 15H36a1 1 0 110-2h12a1 1 0 110 2z" d='M14 21a1 1 0 01-1-1V8a1 1 0 112 0v12a1 1 0 01-1 1zM48 15H36a1 1 0 110-2h12a1 1 0 110 2z'
></path> ></path>
</svg> </svg>
</SvgIcon> </SvgIcon>
@@ -1,14 +1,12 @@
import React from 'react' import React from 'react';
import { AppWrapper } from "../../../ui/components"; import { AppWrapper } from '../../../ui/components';
import { AppContent } from "../../../ui/components/AppContent"; import { AppContent } from '../../../ui/components/AppContent';
import { usePhotoModal } from '../hooks/usePhotoModal'; import { usePhotoModal } from '../hooks/usePhotoModal';
import { GalleryGrid } from './grid/GalleryGrid'; import { GalleryGrid } from './grid/GalleryGrid';
import { GalleryModal } from './modal/GalleryModal'; import { GalleryModal } from './modal/GalleryModal';
const CameraApp = () => { const CameraApp = () => {
const { modal } = usePhotoModal();
const {modal} = usePhotoModal();
return ( return (
<AppWrapper id='camera-app'> <AppWrapper id='camera-app'>
@@ -23,7 +21,7 @@ const CameraApp = () => {
{!modal ? <GalleryGrid /> : null} {!modal ? <GalleryGrid /> : null}
</AppContent> </AppContent>
</AppWrapper> </AppWrapper>
) );
} };
export default CameraApp; export default CameraApp;
@@ -1,4 +1,4 @@
import React from 'react' import React from 'react';
import { Box, Button } from '@material-ui/core'; import { Box, Button } from '@material-ui/core';
import useStyles from './grid.styles'; import useStyles from './grid.styles';
import { usePhotos } from '../../hooks/usePhotos'; 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, // 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 // it will have the value true, which basically means a tweak on the design to fit in a modal
export const GalleryGrid = (isMessags) => { export const GalleryGrid = (isMessags) => {
const classes = useStyles() const classes = useStyles();
const { setMeta } = usePhotoMeta(); const { setMeta } = usePhotoMeta();
const { setModal } = usePhotoModal(); const { setModal } = usePhotoModal();
const photos = usePhotos(); const photos = usePhotos();
console.log(photos) console.log(photos);
const handleCamera = () => { const handleCamera = () => {
Nui.send('phone:TakePhoto', {}) Nui.send('phone:TakePhoto', {});
} };
const handlePhotoOpen = (photo) => { const handlePhotoOpen = (photo) => {
setModal(true) setModal(true);
setMeta(photo) setMeta(photo);
} };
if(!photos) return ( if (!photos)
<Box display="flex" flexWrap="wrap" alignContent="flex-start" className={classes.root}> return (
<Box
display='flex'
flexWrap='wrap'
alignContent='flex-start'
className={classes.root}
>
<Box> <Box>
<Button onClick={handleCamera} style={{ borderRadius: 0 }} className={classes.photo}> <Button
<AddIcon fontSize="large"/> onClick={handleCamera}
style={{ borderRadius: 0 }}
className={classes.photo}
>
<AddIcon fontSize='large' />
</Button> </Button>
</Box> </Box>
</Box> </Box>
) );
return ( return (
<div> <div>
<Box display="flex" flexWrap="wrap" alignContent="flex-start" className={classes.root}> <Box
display='flex'
flexWrap='wrap'
alignContent='flex-start'
className={classes.root}
>
<Box> <Box>
<Button onClick={handleCamera} style={{ borderRadius: 0 }} className={classes.photo}> <Button
<AddIcon fontSize="large"/> onClick={handleCamera}
style={{ borderRadius: 0 }}
className={classes.photo}
>
<AddIcon fontSize='large' />
</Button> </Button>
</Box> </Box>
{photos.map(photo => ( {photos.map((photo) => (
<Box onClick={() => handlePhotoOpen(photo)}> <Box onClick={() => handlePhotoOpen(photo)}>
<div style={{ backgroundImage: `url(${photo.image})` }} className={classes.photo} /> <div
style={{ backgroundImage: `url(${photo.image})` }}
className={classes.photo}
/>
</Box> </Box>
))} ))}
</Box> </Box>
</div> </div>
) );
} };
@@ -2,7 +2,7 @@ import { makeStyles, Theme } from '@material-ui/core/styles';
const useStyles = makeStyles((theme: Theme) => ({ const useStyles = makeStyles((theme: Theme) => ({
root: { root: {
flexGrow: 1 flexGrow: 1,
}, },
photo: { photo: {
border: '1px inset #fff', border: '1px inset #fff',
@@ -13,7 +13,7 @@ const useStyles = makeStyles((theme: Theme) => ({
backgroundPosition: 'center', backgroundPosition: 'center',
backgroundRepeat: 'no-repeat', backgroundRepeat: 'no-repeat',
backgroundSize: 'cover', backgroundSize: 'cover',
} },
})) }));
export default useStyles; export default useStyles;
@@ -1,4 +1,4 @@
import React from 'react' import React from 'react';
import { usePhotoMeta } from '../../hooks/usePhotoMeta'; import { usePhotoMeta } from '../../hooks/usePhotoMeta';
import { usePhotoModal } from '../../hooks/usePhotoModal'; import { usePhotoModal } from '../../hooks/usePhotoModal';
import useStyles from './modal.styles'; import useStyles from './modal.styles';
@@ -12,49 +12,52 @@ import { ShareModal } from './ShareModal';
import { useShareLink } from '../../hooks/useShareLink'; import { useShareLink } from '../../hooks/useShareLink';
export const GalleryModal = () => { export const GalleryModal = () => {
const { meta, setMeta } = usePhotoMeta(); const { meta, setMeta } = usePhotoMeta();
const { modal, setModal } = usePhotoModal(); const { modal, setModal } = usePhotoModal();
const classes = useStyles(); const classes = useStyles();
const { shareModal ,setShareModal } = useShareModal(); const { shareModal, setShareModal } = useShareModal();
const { setShareLink } = useShareLink(); const { setShareLink } = useShareLink();
const _handleClose = () => { const _handleClose = () => {
setModal(false) setModal(false);
setMeta(null); setMeta(null);
} };
const handleDeletePhoto = () => { const handleDeletePhoto = () => {
console.log(meta.id) console.log(meta.id);
Nui.send('photo:deletePhoto', { Nui.send('photo:deletePhoto', {
id: meta.id id: meta.id,
}) });
setModal(false) setModal(false);
} };
const handleSharePhoto = () => { const handleSharePhoto = () => {
setShareModal(true) setShareModal(true);
setShareLink(meta.image) setShareLink(meta.image);
} };
if(!meta) return null; if (!meta) return null;
return ( return (
<Paper className={modal ? classes.modal : classes.modalHide}> <Paper className={modal ? classes.modal : classes.modalHide}>
<ShareModal key={meta.id} {...meta}/> <ShareModal key={meta.id} {...meta} />
<div className={shareModal ? classes.backgroundModal : undefined} /> <div className={shareModal ? classes.backgroundModal : undefined} />
<Button onClick={_handleClose}><ArrowBackIcon /></Button> <Button onClick={_handleClose}>
<div className={classes.image} style={{ backgroundImage: `url(${meta.image})`}} /> <ArrowBackIcon />
</Button>
<div
className={classes.image}
style={{ backgroundImage: `url(${meta.image})` }}
/>
<div className={classes.actionDiv}> <div className={classes.actionDiv}>
<Button onClick={handleDeletePhoto}> <Button onClick={handleDeletePhoto}>
<DeleteIcon fontSize="large" /> <DeleteIcon fontSize='large' />
</Button> </Button>
<Button onClick={handleSharePhoto}> <Button onClick={handleSharePhoto}>
<ShareIcon fontSize="large" /> <ShareIcon fontSize='large' />
</Button> </Button>
</div> </div>
</Paper> </Paper>
) );
} };
@@ -2,9 +2,9 @@ import { makeStyles, Theme } from '@material-ui/core/styles';
const useStyles = makeStyles((theme: Theme) => ({ const useStyles = makeStyles((theme: Theme) => ({
backgroundModal: { backgroundModal: {
background: "black", background: 'black',
opacity: "0.6", opacity: '0.6',
position: "absolute", position: 'absolute',
top: 0, top: 0,
left: 0, left: 0,
right: 0, right: 0,
@@ -17,7 +17,7 @@ const useStyles = makeStyles((theme: Theme) => ({
width: '100%', width: '100%',
}, },
modalHide: { modalHide: {
display: 'none' display: 'none',
}, },
image: { image: {
width: 'auto', width: 'auto',
@@ -27,22 +27,22 @@ const useStyles = makeStyles((theme: Theme) => ({
backgroundPosition: 'center', backgroundPosition: 'center',
backgroundSize: 'cover', backgroundSize: 'cover',
backgroundRepeat: 'no-repeat', backgroundRepeat: 'no-repeat',
marginTop: '4em' marginTop: '4em',
}, },
actionDiv: { actionDiv: {
marginTop: 15, marginTop: 15,
display: 'flex', display: 'flex',
justifyContent: 'space-evenly' justifyContent: 'space-evenly',
}, },
// share modal // share modal
shareModal: { shareModal: {
marginBottom: 50 marginBottom: 50,
}, },
innerShareModal: { innerShareModal: {
marginTop: 40, marginTop: 40,
textAlign: 'center' textAlign: 'center',
} },
})) }));
export default useStyles; export default useStyles;
+7 -7
View File
@@ -3,22 +3,22 @@ import { atom } from 'recoil';
export const photoState = { export const photoState = {
photos: atom({ photos: atom({
key: 'galleryPhotos', key: 'galleryPhotos',
default: null default: null,
}), }),
modal: atom({ modal: atom({
key: 'photoModal', key: 'photoModal',
default: false default: false,
}), }),
photoMeta: atom({ photoMeta: atom({
key: 'photoMeta', key: 'photoMeta',
default: null default: null,
}), }),
shareModal: atom({ shareModal: atom({
key: 'phoneShareModal', key: 'phoneShareModal',
default: false default: false,
}), }),
shareLink: atom({ shareLink: atom({
key: 'photoShareLink', key: 'photoShareLink',
default: null default: null,
}) }),
} };
+2 -2
View File
@@ -3,5 +3,5 @@ import { photoState } from './state';
export const usePhotoMeta = () => { export const usePhotoMeta = () => {
const [meta, setMeta] = useRecoilState(photoState.photoMeta); const [meta, setMeta] = useRecoilState(photoState.photoMeta);
return { meta, setMeta}; return { meta, setMeta };
} };
+2 -2
View File
@@ -3,5 +3,5 @@ import { photoState } from './state';
export const usePhotoModal = () => { export const usePhotoModal = () => {
const [modal, setModal] = useRecoilState(photoState.modal); const [modal, setModal] = useRecoilState(photoState.modal);
return { modal, setModal} return { modal, setModal };
} };
@@ -7,4 +7,4 @@ export const usePhotoService = () => {
const setPhotos = useSetRecoilState(photoState.photos); const setPhotos = useSetRecoilState(photoState.photos);
useNuiEvent('CAMERA', 'setPhotos', setPhotos); useNuiEvent('CAMERA', 'setPhotos', setPhotos);
return usePhotos(); return usePhotos();
} };
+1 -2
View File
@@ -7,8 +7,7 @@ interface IPhotos {
map?: any; map?: any;
} }
export const usePhotos = (): IPhotos | null => { export const usePhotos = (): IPhotos | null => {
const photos = useRecoilValue<IPhotos | null>(photoState.photos); const photos = useRecoilValue<IPhotos | null>(photoState.photos);
return photos; return photos;
} };
+3 -3
View File
@@ -2,6 +2,6 @@ import { useRecoilState } from 'recoil';
import { photoState } from './state'; import { photoState } from './state';
export const useShareLink = () => { export const useShareLink = () => {
const [ shareLink, setShareLink ] = useRecoilState(photoState.shareLink); const [shareLink, setShareLink] = useRecoilState(photoState.shareLink);
return { shareLink, setShareLink } return { shareLink, setShareLink };
} };
+3 -3
View File
@@ -2,6 +2,6 @@ import { useRecoilState } from 'recoil';
import { photoState } from './state'; import { photoState } from './state';
export const useShareModal = () => { export const useShareModal = () => {
const [ shareModal, setShareModal ] = useRecoilState(photoState.shareModal); const [shareModal, setShareModal] = useRecoilState(photoState.shareModal);
return { shareModal, setShareModal } return { shareModal, setShareModal };
} };
@@ -1,3 +1,3 @@
#contact-app .Mui-focused::after { #contact-app .Mui-focused::after {
border-bottom: #2196f3 solid 4px; border-bottom: #2196f3 solid 4px;
} }
@@ -5,10 +5,10 @@ const useStyles = makeStyles((theme) => ({
zIndex: 10, zIndex: 10,
position: 'absolute', position: 'absolute',
height: '100%', height: '100%',
width: '100%' width: '100%',
}, },
modalHide: { modalHide: {
display: 'none' display: 'none',
}, },
listContainer: { listContainer: {
marginTop: 30, marginTop: 30,
@@ -20,7 +20,7 @@ const useStyles = makeStyles((theme) => ({
margin: 'auto', margin: 'auto',
height: '125px', height: '125px',
width: '124px', width: '124px',
marginBottom: 29 marginBottom: 29,
}, },
input: { input: {
marginBottom: 20, marginBottom: 20,
@@ -28,7 +28,7 @@ const useStyles = makeStyles((theme) => ({
textAlign: 'center', textAlign: 'center',
}, },
inputProps: { inputProps: {
fontSize: 22 fontSize: 22,
}, },
updateButton: { updateButton: {
background: '#2196f3', background: '#2196f3',
@@ -36,14 +36,14 @@ const useStyles = makeStyles((theme) => ({
height: 45, height: 45,
fontSize: 16, fontSize: 16,
marginTop: 29, marginTop: 29,
marginBottom: 29 marginBottom: 29,
}, },
deleteButton: { deleteButton: {
background: '#d32f2f', background: '#d32f2f',
width: 150, width: 150,
height: 40, height: 40,
fontSize: 16 fontSize: 16,
} },
})) }));
export default useStyles; export default useStyles;
@@ -1,7 +1,9 @@
import { useRecoilState } from 'recoil'; import { useRecoilState } from 'recoil';
import { contactsState } from './state'; import { contactsState } from './state';
export const useContactDetail = (): any => { export const useContactDetail = (): any => {
const [ contactDetail, setContactDetail ] = useRecoilState(contactsState.contactDetail); const [contactDetail, setContactDetail] = useRecoilState(
contactsState.contactDetail
);
return { contactDetail, setContactDetail }; return { contactDetail, setContactDetail };
} };
@@ -2,6 +2,8 @@ import { useRecoilState } from 'recoil';
import { contactsState } from './state'; import { contactsState } from './state';
export const useContactModal = () => { export const useContactModal = () => {
const [ showContactModal, setShowContactModal ] = useRecoilState(contactsState.showContactsModal); const [showContactModal, setShowContactModal] = useRecoilState(
contactsState.showContactsModal
);
return { showContactModal, setShowContactModal }; return { showContactModal, setShowContactModal };
} };
+3 -3
View File
@@ -1,11 +1,11 @@
import { useRecoilValue } from "recoil"; import { useRecoilValue } from 'recoil';
import { contactsState } from "./state"; import { contactsState } from './state';
interface Contact { interface Contact {
id: string; id: string;
display: string; display: string;
number: string; number: string;
avatar?: string avatar?: string;
} }
interface IUseContacts { interface IUseContacts {
@@ -1,5 +1,5 @@
import { useRecoilState } from "recoil"; import { useRecoilState } from 'recoil';
import { contactsState } from "./state"; import { contactsState } from './state';
export const useFilteredContacts = () => { export const useFilteredContacts = () => {
const [filteredContacts, setFilteredContacts] = useRecoilState( const [filteredContacts, setFilteredContacts] = useRecoilState(
+2 -2
View File
@@ -1,5 +1,5 @@
import { useRecoilState } from "recoil"; import { useRecoilState } from 'recoil';
import { contactsState } from "./state"; import { contactsState } from './state';
export const useModal = () => { export const useModal = () => {
const [showModal, setShowModal] = useRecoilState(contactsState.showModal); const [showModal, setShowModal] = useRecoilState(contactsState.showModal);
@@ -1,14 +1,14 @@
import React from "react"; import React from 'react';
import { AppWrapper } from "../../../ui/components"; import { AppWrapper } from '../../../ui/components';
import { AppTitle } from "../../../ui/components/AppTitle"; import { AppTitle } from '../../../ui/components/AppTitle';
import { AppContent } from "../../../ui/components/AppContent"; import { AppContent } from '../../../ui/components/AppContent';
import { DialerHistory } from "./DialerHistory"; import { DialerHistory } from './DialerHistory';
import { useDialerHistory } from "../hooks/useDialerHistory"; import { useDialerHistory } from '../hooks/useDialerHistory';
import { useApp } from "../../../os/apps/hooks/useApps"; import { useApp } from '../../../os/apps/hooks/useApps';
export const DialerApp = () => { export const DialerApp = () => {
const { history } = useDialerHistory(); const { history } = useDialerHistory();
const dialer = useApp("DIALER"); const dialer = useApp('DIALER');
return ( return (
<AppWrapper> <AppWrapper>
<AppTitle app={dialer} /> <AppTitle app={dialer} />
@@ -1,13 +1,13 @@
import { useRecoilState, atom } from "recoil"; import { useRecoilState, atom } from 'recoil';
const dialerHistoryState = atom({ const dialerHistoryState = atom({
key: "dialerHistory", key: 'dialerHistory',
default: [ default: [
{ {
id: 1, id: 1,
caller: "ROCKY", caller: 'ROCKY',
phoneNumber: "000-1112", phoneNumber: '000-1112',
type: "outgoing", type: 'outgoing',
}, },
], ],
}); });
+6 -6
View File
@@ -1,14 +1,14 @@
import React from "react"; import React from 'react';
import { AppWrapper } from "../../../ui/components"; import { AppWrapper } from '../../../ui/components';
import { Box } from "@material-ui/core"; import { Box } from '@material-ui/core';
import { GridMenu } from "../../../ui/components/GridMenu"; import { GridMenu } from '../../../ui/components/GridMenu';
import { useApps } from "../../../os/apps/hooks/useApps"; import { useApps } from '../../../os/apps/hooks/useApps';
export const HomeApp = () => { export const HomeApp = () => {
const { apps } = useApps(); const { apps } = useApps();
return ( return (
<AppWrapper> <AppWrapper>
<Box width="100%" mt={6} px={1}> <Box width='100%' mt={6} px={1}>
{apps && <GridMenu items={apps.preinstalled} />} {apps && <GridMenu items={apps.preinstalled} />}
</Box> </Box>
</AppWrapper> </AppWrapper>
+17 -17
View File
@@ -1,16 +1,16 @@
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from 'react';
import { useTranslation } from "react-i18next"; import { useTranslation } from 'react-i18next';
import { Snackbar } from "@material-ui/core"; import { Snackbar } from '@material-ui/core';
import { makeStyles } from "@material-ui/core/styles"; import { makeStyles } from '@material-ui/core/styles';
import useAlerts from "../hooks/useAlerts"; import useAlerts from '../hooks/useAlerts';
import Alert from "../../../ui/components/Alert"; import Alert from '../../../ui/components/Alert';
const useStyles = makeStyles(() => ({ const useStyles = makeStyles(() => ({
root: { root: {
width: "100%", width: '100%',
bottom: "60px", bottom: '60px',
position: "absolute", position: 'absolute',
}, },
})); }));
@@ -37,22 +37,22 @@ export default function AlertBar() {
const { error, phoneNumber, duplicate, mine } = createMessageGroupResult; const { error, phoneNumber, duplicate, mine } = createMessageGroupResult;
if (error && phoneNumber) { if (error && phoneNumber) {
const error = `${t("APPS_MESSAGES_INVALID_PHONE_NUMBER")}${phoneNumber}`; const error = `${t('APPS_MESSAGES_INVALID_PHONE_NUMBER')}${phoneNumber}`;
setOpen(true); setOpen(true);
setSeverity("error"); setSeverity('error');
setMessage(error); setMessage(error);
} else if (error && duplicate) { } else if (error && duplicate) {
setOpen(true); setOpen(true);
setSeverity("error"); setSeverity('error');
setMessage(t("APPS_MESSAGES_MESSAGE_GROUP_DUPLICATE")); setMessage(t('APPS_MESSAGES_MESSAGE_GROUP_DUPLICATE'));
} else if (error && mine) { } else if (error && mine) {
setOpen(true); setOpen(true);
setSeverity("error"); setSeverity('error');
setMessage(t("APPS_MESSAGES_MESSAGE_GROUP_CREATE_MINE")); setMessage(t('APPS_MESSAGES_MESSAGE_GROUP_CREATE_MINE'));
} else if (error) { } else if (error) {
setOpen(true); setOpen(true);
setSeverity("error"); setSeverity('error');
setMessage(t("APPS_MESSAGES_MESSAGE_GROUP_CREATE_FAILED")); setMessage(t('APPS_MESSAGES_MESSAGE_GROUP_CREATE_FAILED'));
} }
}, [createMessageGroupResult, t]); }, [createMessageGroupResult, t]);
@@ -1,19 +1,19 @@
import React from "react"; import React from 'react';
import { AppWrapper } from "../../../ui/components"; import { AppWrapper } from '../../../ui/components';
import { AppTitle } from "../../../ui/components/AppTitle"; import { AppTitle } from '../../../ui/components/AppTitle';
import { AppContent } from "../../../ui/components/AppContent"; import { AppContent } from '../../../ui/components/AppContent';
import { useApp } from "../../../os/apps/hooks/useApps"; import { useApp } from '../../../os/apps/hooks/useApps';
import AlertBar from "./AlertBar"; import AlertBar from './AlertBar';
import { MessageModal } from "./modal/MessageModal"; import { MessageModal } from './modal/MessageModal';
import MessageGroupModal from "./modal/MessageGroupModal"; import MessageGroupModal from './modal/MessageGroupModal';
import NewMessageGroupButton from "./buttons/NewMessageGroupButton"; import NewMessageGroupButton from './buttons/NewMessageGroupButton';
import MessagesList from "./list/MessagesList"; import MessagesList from './list/MessagesList';
import "./messages.css"; import './messages.css';
export const MessagesApp = () => { export const MessagesApp = () => {
const messages = useApp("MESSAGES"); const messages = useApp('MESSAGES');
return ( return (
<AppWrapper id="messages-app"> <AppWrapper id='messages-app'>
<AppTitle app={messages} /> <AppTitle app={messages} />
<MessageModal /> <MessageModal />
<MessageGroupModal /> <MessageGroupModal />
@@ -1,14 +1,14 @@
import React from "react"; import React from 'react';
import { makeStyles } from "@material-ui/core/styles"; import { makeStyles } from '@material-ui/core/styles';
import { Fab } from "@material-ui/core"; import { Fab } from '@material-ui/core';
import AddIcon from "@material-ui/icons/Add"; import AddIcon from '@material-ui/icons/Add';
import useModals from "../../hooks/useModals"; import useModals from '../../hooks/useModals';
const useStyles = makeStyles(() => ({ const useStyles = makeStyles(() => ({
root: { root: {
position: "absolute", position: 'absolute',
bottom: "25px", bottom: '25px',
right: "15px", right: '15px',
}, },
})); }));
@@ -20,7 +20,7 @@ export function NewMessageGroupButton() {
return ( return (
<div className={classes.root}> <div className={classes.root}>
<Fab color="primary" onClick={handleClick}> <Fab color='primary' onClick={handleClick}>
<AddIcon /> <AddIcon />
</Fab> </Fab>
</div> </div>
@@ -1,11 +1,11 @@
import React, { FormEvent, useState } from "react"; import React, { FormEvent, useState } from 'react';
import { useTranslation } from "react-i18next"; import { useTranslation } from 'react-i18next';
import { Paper, TextField, Button } from "@material-ui/core"; import { Paper, TextField, Button } from '@material-ui/core';
import useStyles from "./form.styles"; import useStyles from './form.styles';
import SendIcon from "@material-ui/icons/Send"; import SendIcon from '@material-ui/icons/Send';
import ImageIcon from '@material-ui/icons/Image'; import ImageIcon from '@material-ui/icons/Image';
import Nui from "../../../../os/nui-events/utils/Nui"; import Nui from '../../../../os/nui-events/utils/Nui';
import { useImageModal } from "../../hooks/useImageModal"; import { useImageModal } from '../../hooks/useImageModal';
interface IProps { interface IProps {
messageGroupId: string | undefined; messageGroupId: string | undefined;
@@ -15,33 +15,33 @@ const MessageInput = ({ messageGroupId }: IProps) => {
const { setImageModal } = useImageModal(); const { setImageModal } = useImageModal();
const classes = useStyles(); const classes = useStyles();
const { t } = useTranslation(); const { t } = useTranslation();
const [message, setMessage] = useState(""); const [message, setMessage] = useState('');
const handleSubmit = (event: FormEvent) => { const handleSubmit = (event: FormEvent) => {
event.preventDefault(); event.preventDefault();
if (message.trim()) { if (message.trim()) {
// don't allow the user to submit white space // don't allow the user to submit white space
Nui.send("phone:sendMessage", { Nui.send('phone:sendMessage', {
groupId: messageGroupId, groupId: messageGroupId,
message, message,
}); });
setMessage(""); setMessage('');
} }
}; };
const openImageModal = () => { const openImageModal = () => {
setImageModal(true); setImageModal(true);
} };
if (!messageGroupId) return null; if (!messageGroupId) return null;
return ( return (
<Paper className={classes.paper} variant="outlined"> <Paper className={classes.paper} variant='outlined'>
<form className={classes.form} onSubmit={handleSubmit}> <form className={classes.form} onSubmit={handleSubmit}>
<TextField <TextField
value={message} value={message}
onChange={(e) => setMessage(e.target.value)} onChange={(e) => setMessage(e.target.value)}
placeholder={t("APPS_MESSAGES_NEW_MESSAGE")} placeholder={t('APPS_MESSAGES_NEW_MESSAGE')}
className={classes.input} className={classes.input}
inputRef={(input) => input && input.focus()} inputRef={(input) => input && input.focus()}
inputProps={{ inputProps={{
@@ -51,7 +51,7 @@ const MessageInput = ({ messageGroupId }: IProps) => {
<Button className={classes.sendButton} onClick={openImageModal}> <Button className={classes.sendButton} onClick={openImageModal}>
<ImageIcon /> <ImageIcon />
</Button> </Button>
<Button className={classes.sendButton} type="submit"> <Button className={classes.sendButton} type='submit'>
<SendIcon /> <SendIcon />
</Button> </Button>
</form> </form>
@@ -1,24 +1,24 @@
import React, { FormEvent, useState } from "react"; import React, { FormEvent, useState } from 'react';
import { useTranslation } from "react-i18next"; import { useTranslation } from 'react-i18next';
import { TextField, Button } from "@material-ui/core"; import { TextField, Button } from '@material-ui/core';
import useStyles from "./form.styles"; import useStyles from './form.styles';
import useModals from "../../hooks/useModals"; import useModals from '../../hooks/useModals';
import Nui from "../../../../os/nui-events/utils/Nui"; import Nui from '../../../../os/nui-events/utils/Nui';
const NewMessageGroupForm = () => { const NewMessageGroupForm = () => {
const classes = useStyles(); const classes = useStyles();
const { t } = useTranslation(); const { t } = useTranslation();
const { setShowNewMessageGroup } = useModals(); const { setShowNewMessageGroup } = useModals();
const [participants, setParticipants] = useState(""); const [participants, setParticipants] = useState('');
const [label, setLabel] = useState(""); const [label, setLabel] = useState('');
// handles phone numbers in a csv format and strips all spaces and // handles phone numbers in a csv format and strips all spaces and
// external characters out of them: // external characters out of them:
// 123-4567, 987-6543, 333-4444 // 123-4567, 987-6543, 333-4444
const parts = participants const parts = participants
.split(",") .split(',')
.map((part) => part.replace(/[^0-9]/g, "")); .map((part) => part.replace(/[^0-9]/g, ''));
const isGroupChat = parts.length > 1; const isGroupChat = parts.length > 1;
const handleSubmit = (event: FormEvent) => { const handleSubmit = (event: FormEvent) => {
@@ -26,11 +26,11 @@ const NewMessageGroupForm = () => {
if (parts.length > 0) { if (parts.length > 0) {
const labelValue = label.trim(); const labelValue = label.trim();
Nui.send("phone:createMessageGroup", { Nui.send('phone:createMessageGroup', {
phoneNumbers: parts, phoneNumbers: parts,
label: isGroupChat && labelValue ? labelValue : null, label: isGroupChat && labelValue ? labelValue : null,
}); });
setParticipants(""); setParticipants('');
setShowNewMessageGroup(false); // close modal after submission setShowNewMessageGroup(false); // close modal after submission
} }
}; };
@@ -40,7 +40,7 @@ const NewMessageGroupForm = () => {
<TextField <TextField
value={participants} value={participants}
onChange={(e) => setParticipants(e.target.value)} onChange={(e) => setParticipants(e.target.value)}
placeholder={t("APPS_MESSAGES_NEW_MESSAGE_GROUP")} placeholder={t('APPS_MESSAGES_NEW_MESSAGE_GROUP')}
className={classes.newGroupinput} className={classes.newGroupinput}
autoFocus autoFocus
inputProps={{ inputProps={{
@@ -52,7 +52,7 @@ const NewMessageGroupForm = () => {
<TextField <TextField
value={label} value={label}
onChange={(e) => setLabel(e.target.value)} onChange={(e) => setLabel(e.target.value)}
placeholder={t("APPS_MESSAGES_GROUP_CHAT_LABEL")} placeholder={t('APPS_MESSAGES_GROUP_CHAT_LABEL')}
className={classes.newGroupinput} className={classes.newGroupinput}
inputProps={{ inputProps={{
className: classes.messagesInput, className: classes.messagesInput,
@@ -60,12 +60,12 @@ const NewMessageGroupForm = () => {
/> />
)} )}
<Button <Button
variant="contained" variant='contained'
className={classes.newGroupSubmitButton} className={classes.newGroupSubmitButton}
color="primary" color='primary'
type="submit" type='submit'
> >
{t("APPS_MESSAGES_NEW_MESSAGE_GROUP_SUBMIT")} {t('APPS_MESSAGES_NEW_MESSAGE_GROUP_SUBMIT')}
</Button> </Button>
</form> </form>
); );
@@ -1,34 +1,34 @@
import { makeStyles } from "@material-ui/core"; import { makeStyles } from '@material-ui/core';
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
sendButton: { sendButton: {
float: "right", float: 'right',
}, },
paper: { paper: {
position: "absolute", position: 'absolute',
bottom: 0, bottom: 0,
width: "100%", width: '100%',
}, },
form: { form: {
display: "flex", display: 'flex',
}, },
input: { input: {
width: "100%", width: '100%',
margin: 10, margin: 10,
}, },
newGroupForm: { newGroupForm: {
position: "absolute", position: 'absolute',
top: 65, top: 65,
display: "flex", display: 'flex',
flexFlow: "column nowrap", flexFlow: 'column nowrap',
justifyContent: "flex-start", justifyContent: 'flex-start',
width: "100%", width: '100%',
}, },
newGroupSubmitButton: { newGroupSubmitButton: {
margin: "15px 8px 0px 8px", margin: '15px 8px 0px 8px',
}, },
newGroupinput: { newGroupinput: {
margin: "0px 8px 15px 8px", margin: '0px 8px 15px 8px',
}, },
messagesInput: { messagesInput: {
fontSize: 20, fontSize: 20,
@@ -1,9 +1,9 @@
import React from "react"; import React from 'react';
import { useTranslation } from "react-i18next"; import { useTranslation } from 'react-i18next';
import { InputBase, Paper } from "@material-ui/core"; import { InputBase, Paper } from '@material-ui/core';
import SearchIcon from "@material-ui/icons/Search"; import SearchIcon from '@material-ui/icons/Search';
import useStyles from "./list.styles"; import useStyles from './list.styles';
interface IProps { interface IProps {
value: string; value: string;
@@ -16,7 +16,7 @@ const MessageSearch = ({ value, handleChange }: IProps) => {
const { t } = useTranslation(); const { t } = useTranslation();
const classes = useStyles(); const classes = useStyles();
return ( return (
<Paper elevation={24} variant="outlined" className={classes.bg}> <Paper elevation={24} variant='outlined' className={classes.bg}>
<div className={classes.search}> <div className={classes.search}>
<div className={classes.searchIcon}> <div className={classes.searchIcon}>
<SearchIcon /> <SearchIcon />
@@ -24,12 +24,12 @@ const MessageSearch = ({ value, handleChange }: IProps) => {
<InputBase <InputBase
value={value} value={value}
onChange={handleChange} onChange={handleChange}
placeholder={t("APPS_MESSAGES_SEARCH_PLACEHOLDER")} placeholder={t('APPS_MESSAGES_SEARCH_PLACEHOLDER')}
classes={{ classes={{
root: classes.inputRoot, root: classes.inputRoot,
input: classes.inputInput, input: classes.inputInput,
}} }}
inputProps={{ "aria-label": "search" }} inputProps={{ 'aria-label': 'search' }}
/> />
</div> </div>
</Paper> </Paper>
@@ -1,15 +1,15 @@
import { makeStyles, fade } from "@material-ui/core"; import { makeStyles, fade } from '@material-ui/core';
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
root: { root: {
height: "100%", height: '100%',
overflowY: "auto", overflowY: 'auto',
}, },
bg: { bg: {
display: "flex", display: 'flex',
height: 60, height: 60,
justifyContent: "center", justifyContent: 'center',
alignItems: "center", alignItems: 'center',
}, },
textFieldInput: { textFieldInput: {
fontSize: 20, fontSize: 20,
@@ -21,38 +21,38 @@ const useStyles = makeStyles((theme) => ({
inputInput: { inputInput: {
padding: theme.spacing(1, 4, 1, 4), padding: theme.spacing(1, 4, 1, 4),
// vertical padding + font size from searchIcon // vertical padding + font size from searchIcon
transition: theme.transitions.create("width"), transition: theme.transitions.create('width'),
width: "100%", width: '100%',
[theme.breakpoints.up("sm")]: { [theme.breakpoints.up('sm')]: {
width: "13ch", width: '13ch',
"&:focus": { '&:focus': {
width: "20ch", width: '20ch',
}, },
}, },
}, },
search: { search: {
position: "relative", position: 'relative',
borderRadius: theme.shape.borderRadius, borderRadius: theme.shape.borderRadius,
backgroundColor: fade(theme.palette.common.white, 0.25), backgroundColor: fade(theme.palette.common.white, 0.25),
"&:hover": { '&:hover': {
backgroundColor: fade(theme.palette.common.white, 0.25), backgroundColor: fade(theme.palette.common.white, 0.25),
}, },
marginLeft: 0, marginLeft: 0,
width: "100%", width: '100%',
[theme.breakpoints.up("sm")]: { [theme.breakpoints.up('sm')]: {
marginLeft: theme.spacing(1), marginLeft: theme.spacing(1),
width: "auto", width: 'auto',
}, },
}, },
searchIcon: { searchIcon: {
padding: theme.spacing(0, 0.5), padding: theme.spacing(0, 0.5),
height: "100%", height: '100%',
position: "absolute", position: 'absolute',
pointerEvents: "none", pointerEvents: 'none',
display: "flex", display: 'flex',
alignItems: "center", alignItems: 'center',
justifyContent: "center", justifyContent: 'center',
}, },
})); }));
@@ -1,8 +1,8 @@
import { makeStyles } from "@material-ui/core"; import { makeStyles } from '@material-ui/core';
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
addMessageFab: { addMessageFab: {
position: "sticky", position: 'sticky',
bottom: theme.spacing(2), bottom: theme.spacing(2),
left: theme.spacing(3), left: theme.spacing(3),
}, },
@@ -31,7 +31,11 @@ const Conversation = ({ activeMessageGroup, messages }: IProps) => {
variant='outlined' variant='outlined'
> >
{isImage(message.message) ? ( {isImage(message.message) ? (
<img src={message.message} className={classes.imageMessage} alt="image" /> <img
src={message.message}
className={classes.imageMessage}
alt='image'
/>
) : ( ) : (
<div>{message.message}</div> <div>{message.message}</div>
)} )}
@@ -1,10 +1,10 @@
import React from "react"; import React from 'react';
import { Slide, Paper, Button } from "@material-ui/core"; import { Slide, Paper, Button } from '@material-ui/core';
import ArrowBackIcon from "@material-ui/icons/ArrowBack"; import ArrowBackIcon from '@material-ui/icons/ArrowBack';
import useStyles from "./modal.styles"; import useStyles from './modal.styles';
import useModals from "../../hooks/useModals"; import useModals from '../../hooks/useModals';
import NewMessageGroupForm from "../form/NewMessageGroupForm"; import NewMessageGroupForm from '../form/NewMessageGroupForm';
const MessageGroupModal = () => { const MessageGroupModal = () => {
const classes = useStyles(); const classes = useStyles();
@@ -13,12 +13,12 @@ const MessageGroupModal = () => {
const handleClose = () => setShowNewMessageGroup(false); const handleClose = () => setShowNewMessageGroup(false);
return ( return (
<Slide direction="left" in={showNewMessageGroup}> <Slide direction='left' in={showNewMessageGroup}>
<Paper <Paper
className={showNewMessageGroup ? classes.modalRoot : classes.modalHide} className={showNewMessageGroup ? classes.modalRoot : classes.modalHide}
> >
<Button onClick={handleClose}> <Button onClick={handleClose}>
<ArrowBackIcon fontSize="large" /> <ArrowBackIcon fontSize='large' />
</Button> </Button>
<NewMessageGroupForm /> <NewMessageGroupForm />
</Paper> </Paper>
@@ -1,8 +1,8 @@
import { TextField, Button } from '@material-ui/core'; 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 Nui from '../../../../os/nui-events/utils/Nui';
import Modal from '../../../../ui/components/Modal' import Modal from '../../../../ui/components/Modal';
import { useImageModal } from '../../hooks/useImageModal' import { useImageModal } from '../../hooks/useImageModal';
import CloseIcon from '@material-ui/icons/Close'; import CloseIcon from '@material-ui/icons/Close';
import useStyles from './modal.styles'; import useStyles from './modal.styles';
@@ -13,30 +13,34 @@ interface IProps {
export const MessageImageModal = ({ messageGroupId }: IProps) => { export const MessageImageModal = ({ messageGroupId }: IProps) => {
const classes = useStyles(); const classes = useStyles();
const { imageModal, setImageModal } = useImageModal(); const { imageModal, setImageModal } = useImageModal();
const [ message, setMessage ] = useState(""); const [message, setMessage] = useState('');
const _handleClose = () => { const _handleClose = () => {
setImageModal(false) setImageModal(false);
} };
const sendImageMessage = (event) => { const sendImageMessage = (event) => {
if (event.key ==="Enter") { if (event.key === 'Enter') {
Nui.send('phone:sendMessage', { Nui.send('phone:sendMessage', {
groupId: messageGroupId, groupId: messageGroupId,
message message,
}) });
setImageModal(false); setImageModal(false);
} }
} };
return ( return (
<Modal visible={imageModal} handleClose={_handleClose}> <Modal visible={imageModal} handleClose={_handleClose}>
<div> <div>
<Button onClick={_handleClose} className={classes.imageModalCloseButton} ><CloseIcon /></Button> <Button
<TextField onClick={_handleClose}
placeholder="A link to your image or gif" className={classes.imageModalCloseButton}
onChange={e => setMessage(e.target.value)} >
<CloseIcon />
</Button>
<TextField
placeholder='A link to your image or gif'
onChange={(e) => setMessage(e.target.value)}
value={message} value={message}
className={classes.input} className={classes.input}
inputProps={{ inputProps={{
@@ -47,5 +51,5 @@ export const MessageImageModal = ({ messageGroupId }: IProps) => {
/> />
</div> </div>
</Modal> </Modal>
) );
} };
@@ -1,13 +1,13 @@
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from 'react';
import { Slide, Paper, Button, Typography } from "@material-ui/core"; import { Slide, Paper, Button, Typography } from '@material-ui/core';
import ArrowBackIcon from "@material-ui/icons/ArrowBack"; import ArrowBackIcon from '@material-ui/icons/ArrowBack';
import useStyles from "./modal.styles"; import useStyles from './modal.styles';
import useMessages from "../../hooks/useMessages"; import useMessages from '../../hooks/useMessages';
import useModals from "../../hooks/useModals"; import useModals from '../../hooks/useModals';
import Conversation, { CONVERSATION_ELEMENT_ID } from "./Conversation"; import Conversation, { CONVERSATION_ELEMENT_ID } from './Conversation';
import MessageSkeletonList from "./MessageSkeletonList"; import MessageSkeletonList from './MessageSkeletonList';
import Nui from "../../../../os/nui-events/utils/Nui"; import Nui from '../../../../os/nui-events/utils/Nui';
const LARGE_HEADER_CHARS = 30; const LARGE_HEADER_CHARS = 30;
const MAX_HEADER_CHARS = 80; const MAX_HEADER_CHARS = 80;
@@ -35,7 +35,7 @@ export const MessageModal = () => {
const interval = window.setInterval(() => { const interval = window.setInterval(() => {
if (!activeMessageGroup) return; if (!activeMessageGroup) return;
Nui.send("phone:fetchMessages", { Nui.send('phone:fetchMessages', {
groupId: activeMessageGroup.groupId, groupId: activeMessageGroup.groupId,
}); });
}, MESSAGES_REFRESH_RATE); }, MESSAGES_REFRESH_RATE);
@@ -64,7 +64,7 @@ export const MessageModal = () => {
const isOpen = activeMessageGroup !== null; const isOpen = activeMessageGroup !== null;
// don't allow too many characters, it takes too much room // 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()}...`; const truncatedHeader = `${header.slice(0, MAX_HEADER_CHARS).trim()}...`;
header = header =
header.length > MAX_HEADER_CHARS header.length > MAX_HEADER_CHARS
@@ -77,13 +77,13 @@ export const MessageModal = () => {
: classes.groupdisplay; : classes.groupdisplay;
return ( return (
<Slide direction="left" in={isOpen}> <Slide direction='left' in={isOpen}>
<Paper className={isOpen ? classes.modalRoot : classes.modalHide}> <Paper className={isOpen ? classes.modalRoot : classes.modalHide}>
<Paper className={classes.topContainer}> <Paper className={classes.topContainer}>
<Button onClick={closeModal}> <Button onClick={closeModal}>
<ArrowBackIcon fontSize="large" /> <ArrowBackIcon fontSize='large' />
</Button> </Button>
<Typography variant="h5" className={headerClass}> <Typography variant='h5' className={headerClass}>
{header} {header}
</Typography> </Typography>
</Paper> </Paper>
@@ -1,20 +1,20 @@
import React from "react"; import React from 'react';
import { makeStyles } from "@material-ui/core/styles"; import { makeStyles } from '@material-ui/core/styles';
import Skeleton from "@material-ui/lab/Skeleton"; import Skeleton from '@material-ui/lab/Skeleton';
const useStyles = makeStyles({ const useStyles = makeStyles({
root: { root: {
margin: "0px 0px 12px 8px", margin: '0px 0px 12px 8px',
}, },
}); });
export default function MessageSkeleton({ height, isMine = false }) { export default function MessageSkeleton({ height, isMine = false }) {
const classes = useStyles(); const classes = useStyles();
const marginLeft = isMine ? "60px" : "8px"; const marginLeft = isMine ? '60px' : '8px';
return ( return (
<div className={classes.root} style={{ marginLeft, height: `${height}px` }}> <div className={classes.root} style={{ marginLeft, height: `${height}px` }}>
<Skeleton variant="text" width={325} height={height} /> <Skeleton variant='text' width={325} height={height} />
</div> </div>
); );
} }
@@ -1,7 +1,7 @@
import React from "react"; import React from 'react';
import { List } from "../../../../ui/components/List"; import { List } from '../../../../ui/components/List';
import MessageSkeleton from "./MessageSkeleton"; import MessageSkeleton from './MessageSkeleton';
export function MessageSkeletonList() { export function MessageSkeletonList() {
return ( return (
@@ -1,81 +1,81 @@
import { makeStyles } from "@material-ui/core"; import { makeStyles } from '@material-ui/core';
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
modalRoot: { modalRoot: {
zIndex: 10, zIndex: 10,
position: "absolute", position: 'absolute',
height: "100%", height: '100%',
width: "100%", width: '100%',
}, },
modalHide: { modalHide: {
display: "none", display: 'none',
}, },
topContainer: { topContainer: {
display: "flex", display: 'flex',
flexFlow: "row nowrap", flexFlow: 'row nowrap',
padding: "3px 0px", padding: '3px 0px',
}, },
groupdisplay: { groupdisplay: {
width: "300px", width: '300px',
paddingTop: "8px", paddingTop: '8px',
fontSize: "24px", fontSize: '24px',
whiteSpace: "nowrap", whiteSpace: 'nowrap',
overflowX: "hidden", overflowX: 'hidden',
textOverflow: "ellipsis", textOverflow: 'ellipsis',
}, },
largeGroupDisplay: { largeGroupDisplay: {
width: "300px", width: '300px',
paddingTop: "8px", paddingTop: '8px',
fontSize: "20px", fontSize: '20px',
}, },
messageList: { messageList: {
height: "90%", height: '90%',
overflowY: "auto", overflowY: 'auto',
paddingBottom: "40px", paddingBottom: '40px',
}, },
messageContainer: { messageContainer: {
marginTop: 25, marginTop: 25,
width: "100%", width: '100%',
}, },
sourceSms: { sourceSms: {
float: "right", float: 'right',
margin: 10, margin: 10,
padding: "6px 12px", padding: '6px 12px',
height: 'auto', height: 'auto',
width: "80%", width: '80%',
background: "#0288d1", background: '#0288d1',
borderRadius: "20px", borderRadius: '20px',
textOverflow: 'ellipsis' textOverflow: 'ellipsis',
}, },
sms: { sms: {
float: "left", float: 'left',
margin: 10, margin: 10,
padding: "6px 12px", padding: '6px 12px',
width: "80%", width: '80%',
height: 'auto', height: 'auto',
background: "#ddd", background: '#ddd',
color: "#232323", color: '#232323',
borderRadius: "15px", borderRadius: '15px',
textOverflow: 'ellipsis' textOverflow: 'ellipsis',
}, },
messagesInput: { messagesInput: {
fontSize: 20, fontSize: 20,
}, },
input: { input: {
width: "100%", width: '100%',
margin: 10, margin: 10,
}, },
imageMessage: { imageMessage: {
width: '80%', width: '80%',
maxWidth: '80%', maxWidth: '80%',
height: '80%', height: '80%',
maxHeight: '80%' maxHeight: '80%',
}, },
imageModalCloseButton: { imageModalCloseButton: {
position: 'absolute', position: 'absolute',
right: 0, right: 0,
width: '10%' width: '10%',
} },
})); }));
export default useStyles; export default useStyles;
+8 -8
View File
@@ -1,28 +1,28 @@
import { atom } from "recoil"; import { atom } from 'recoil';
export const messageState = { export const messageState = {
messageGroups: atom({ messageGroups: atom({
key: "messageGroups", key: 'messageGroups',
default: null, default: null,
}), }),
messages: atom({ messages: atom({
key: "messages", key: 'messages',
default: null, default: null,
}), }),
activeMessageGroup: atom({ activeMessageGroup: atom({
key: "activeMessageGroup", key: 'activeMessageGroup',
default: null, default: null,
}), }),
showNewMessageGroup: atom({ showNewMessageGroup: atom({
key: "showNewMessageGroup", key: 'showNewMessageGroup',
default: false, default: false,
}), }),
createMessageGroupResult: atom({ createMessageGroupResult: atom({
key: "createMessageGroupResult", key: 'createMessageGroupResult',
default: null, default: null,
}), }),
imageModal: atom({ imageModal: atom({
key: 'useImageModal', key: 'useImageModal',
default: false default: false,
}) }),
}; };
@@ -1,8 +1,7 @@
import { useRecoilState } from 'recoil'; import { useRecoilState } from 'recoil';
import { messageState } from './state'; import { messageState } from './state';
export const useImageModal = () => { export const useImageModal = () => {
const [ imageModal, setImageModal ] = useRecoilState(messageState.imageModal); const [imageModal, setImageModal] = useRecoilState(messageState.imageModal);
return { imageModal, setImageModal }; return { imageModal, setImageModal };
} };
@@ -1,6 +1,6 @@
import { useSetRecoilState } from "recoil"; import { useSetRecoilState } from 'recoil';
import { messageState } from "./state"; import { messageState } from './state';
import { useNuiEvent } from "../../../os/nui-events/hooks/useNuiEvent"; import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
export const useMessagesService = () => { export const useMessagesService = () => {
const setMessageGroups = useSetRecoilState(messageState.messageGroups); const setMessageGroups = useSetRecoilState(messageState.messageGroups);
@@ -9,16 +9,16 @@ export const useMessagesService = () => {
messageState.createMessageGroupResult messageState.createMessageGroupResult
); );
useNuiEvent("MESSAGES", "phone:fetchMessageGroupsSuccess", setMessageGroups); useNuiEvent('MESSAGES', 'phone:fetchMessageGroupsSuccess', setMessageGroups);
useNuiEvent("MESSAGES", "phone:fetchMessagesSuccess", setMessages); useNuiEvent('MESSAGES', 'phone:fetchMessagesSuccess', setMessages);
useNuiEvent( useNuiEvent(
"MESSAGES", 'MESSAGES',
"phone:createMessageGroupSuccess", 'phone:createMessageGroupSuccess',
setCreateMessageGroupResult setCreateMessageGroupResult
); );
useNuiEvent( useNuiEvent(
"MESSAGES", 'MESSAGES',
"phone:createMessageGroupFailed", 'phone:createMessageGroupFailed',
setCreateMessageGroupResult setCreateMessageGroupResult
); );
}; };
+1 -1
View File
@@ -4,4 +4,4 @@
#notes-app .MuiOutlinedInput-root { #notes-app .MuiOutlinedInput-root {
border: 2px soild #f9a825; border: 2px soild #f9a825;
} }
+11 -11
View File
@@ -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 useStyles from './notes.styles';
import { Paper } from "@material-ui/core"; import { Paper } from '@material-ui/core';
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faStickyNote } from "@fortawesome/free-solid-svg-icons"; import { faStickyNote } from '@fortawesome/free-solid-svg-icons';
const NotesTitle = () => { const NotesTitle = () => {
const classes = useStyles() const classes = useStyles();
return ( return (
<Paper elevation={24} square variant="outlined" className={classes.header}> <Paper elevation={24} square variant='outlined' className={classes.header}>
<FontAwesomeIcon icon={faStickyNote} color={yellow[800]} size="lg" /> <FontAwesomeIcon icon={faStickyNote} color={yellow[800]} size='lg' />
</Paper> </Paper>
) );
} };
export default NotesTitle; export default NotesTitle;
+5 -5
View File
@@ -3,14 +3,14 @@ import { atom } from 'recoil';
export const noteStates = { export const noteStates = {
noteItems: atom({ noteItems: atom({
key: 'noteItem', key: 'noteItem',
default: [] default: [],
}), }),
noteModal: atom({ noteModal: atom({
key: 'noteModal', key: 'noteModal',
default: false default: false,
}), }),
noteDetail: atom({ noteDetail: atom({
key: 'noteDetail', key: 'noteDetail',
default: null default: null,
}) }),
} };
+1 -1
View File
@@ -4,4 +4,4 @@ import { noteStates } from './state';
export const useNoteDetail = (): any => { export const useNoteDetail = (): any => {
const [detail, setDetail] = useRecoilState(noteStates.noteDetail); const [detail, setDetail] = useRecoilState(noteStates.noteDetail);
return { detail, setDetail }; return { detail, setDetail };
} };
+2 -2
View File
@@ -3,5 +3,5 @@ import { noteStates } from './state';
export const useNoteModal = () => { export const useNoteModal = () => {
const [noteModal, setNoteModal] = useRecoilState(noteStates.noteModal); const [noteModal, setNoteModal] = useRecoilState(noteStates.noteModal);
return { noteModal, setNoteModal }; return { noteModal, setNoteModal };
} };
+2 -2
View File
@@ -1,7 +1,7 @@
import { useRecoilValue } from 'recoil'; import { useRecoilValue } from 'recoil';
import { noteStates } from './state'; import { noteStates } from './state';
export const useNotes = () => { export const useNotes = () => {
const notes = useRecoilValue(noteStates.noteItems); const notes = useRecoilValue(noteStates.noteItems);
return notes; return notes;
} };
@@ -1,4 +1,4 @@
import { useSetRecoilState } from 'recoil' import { useSetRecoilState } from 'recoil';
import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent'; import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
import { useNotes } from './useNotes'; import { useNotes } from './useNotes';
import { noteStates } from './state'; import { noteStates } from './state';
@@ -7,4 +7,4 @@ export const useNotesService = () => {
const setNotes = useSetRecoilState(noteStates.noteItems); const setNotes = useSetRecoilState(noteStates.noteItems);
useNuiEvent('NOTES', 'setNotes', setNotes); useNuiEvent('NOTES', 'setNotes', setNotes);
return useNotes(); return useNotes();
} };
+1 -1
View File
@@ -58,7 +58,7 @@ export const NoteModal = () => {
<Slide direction='left' in={noteModal} mountOnEnter unmountOnExit> <Slide direction='left' in={noteModal} mountOnEnter unmountOnExit>
<div> <div>
<Button className={classes.closeButton} onClick={_handleClose}> <Button className={classes.closeButton} onClick={_handleClose}>
<ArrowBackIcon fontSize="large" /> <ArrowBackIcon fontSize='large' />
</Button> </Button>
<div id='notes-modal' className={classes.noteContainer}> <div id='notes-modal' className={classes.noteContainer}>
<TextField <TextField
+9 -9
View File
@@ -3,19 +3,19 @@ import { makeStyles } from '@material-ui/core';
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
modalRoot: { modalRoot: {
zIndex: 20, zIndex: 20,
position: "absolute", position: 'absolute',
height: '100%', height: '100%',
width: '100%', width: '100%',
background: '#232323', background: '#232323',
}, },
modalHide: { modalHide: {
display: 'none' display: 'none',
}, },
closeButton: { closeButton: {
width: '10%', width: '10%',
position: 'absolute', position: 'absolute',
top: 10, top: 10,
left: 0 left: 0,
}, },
noteContainer: { noteContainer: {
width: '90%', width: '90%',
@@ -33,17 +33,17 @@ const useStyles = makeStyles((theme) => ({
}, },
saveButton: { saveButton: {
background: '#f9a825', background: '#f9a825',
padding: '10px 30px' padding: '10px 30px',
}, },
updateButton: { updateButton: {
background: '#f9a825', background: '#f9a825',
padding: '10px 30px', padding: '10px 30px',
marginRight: '8px' marginRight: '8px',
}, },
deleteButton: { deleteButton: {
background: '#c62828', background: '#c62828',
padding: '10px 30px' padding: '10px 30px',
} },
})) }));
export default useStyles; export default useStyles;
+6 -6
View File
@@ -11,9 +11,9 @@ const useStyles = makeStyles((theme) => ({
height: '60px', height: '60px',
}, },
backgroundModal: { backgroundModal: {
background: "black", background: 'black',
opacity: "0.6", opacity: '0.6',
position: "absolute", position: 'absolute',
top: 0, top: 0,
left: 0, left: 0,
right: 0, right: 0,
@@ -21,10 +21,10 @@ const useStyles = makeStyles((theme) => ({
zIndex: 5, zIndex: 5,
}, },
absolute: { absolute: {
position: "absolute", position: 'absolute',
bottom: theme.spacing(2), bottom: theme.spacing(2),
right: theme.spacing(3), right: theme.spacing(3),
}, },
})) }));
export default useStyles; export default useStyles;
@@ -2,7 +2,6 @@
color: #f44336 !important; color: #f44336 !important;
} }
#sellout-app .Mui-focused::after {
#sellout-app .Mui-focused::after {
border-bottom: #f44336 solid 3px; border-bottom: #f44336 solid 3px;
} }
@@ -1,22 +1,22 @@
import React from "react"; import React from 'react';
import { AppWrapper } from "../../../ui/components/AppWrapper"; import { AppWrapper } from '../../../ui/components/AppWrapper';
import { AppContent } from "../../../ui/components/AppContent"; import { AppContent } from '../../../ui/components/AppContent';
import { SelloutTitle } from "./SelloutTitle"; import { SelloutTitle } from './SelloutTitle';
import { SelloutListContainer } from "./SelloutList/SelloutListContainer"; import { SelloutListContainer } from './SelloutList/SelloutListContainer';
import { NavigationBar } from "./navigation/NavigationBar"; import { NavigationBar } from './navigation/NavigationBar';
import { Switch, Route } from "react-router-dom"; import { Switch, Route } from 'react-router-dom';
import "./Sellout.css"; import './Sellout.css';
import { ListingFormContainer } from "./form/ListingFormContainer"; import { ListingFormContainer } from './form/ListingFormContainer';
export const SelloutApp = () => { export const SelloutApp = () => {
return ( return (
<AppWrapper id="sellout-app"> <AppWrapper id='sellout-app'>
<SelloutTitle /> <SelloutTitle />
<AppContent> <AppContent>
<Switch> <Switch>
<Route path="/sellout" exact component={SelloutListContainer} /> <Route path='/sellout' exact component={SelloutListContainer} />
<Route path="/sellout/new" component={ListingFormContainer} /> <Route path='/sellout/new' component={ListingFormContainer} />
</Switch> </Switch>
</AppContent> </AppContent>
<NavigationBar /> <NavigationBar />
@@ -1,33 +1,33 @@
import React from "react"; import React from 'react';
import { makeStyles } from "@material-ui/core/styles"; import { makeStyles } from '@material-ui/core/styles';
import { Button, Typography, Paper } from "@material-ui/core"; import { Button, Typography, Paper } from '@material-ui/core';
import { ImageDisplay } from "../images/ImageDisplay"; import { ImageDisplay } from '../images/ImageDisplay';
import { ListItem } from "../../../../ui/components/ListItem"; import { ListItem } from '../../../../ui/components/ListItem';
import ChatIcon from "@material-ui/icons/Chat"; import ChatIcon from '@material-ui/icons/Chat';
import PhoneIcon from "@material-ui/icons/Phone"; import PhoneIcon from '@material-ui/icons/Phone';
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
root: { root: {
overflowX: "hidden", overflowX: 'hidden',
display: "flex", display: 'flex',
flexFlow: "row nowrap", flexFlow: 'row nowrap',
alignItems: "flex-start", alignItems: 'flex-start',
width: "100%", width: '100%',
marginTop: "3px", marginTop: '3px',
}, },
content: { content: {
display: "flex", display: 'flex',
marginTop: "-10px", marginTop: '-10px',
flexFlow: "column nowrap", flexFlow: 'column nowrap',
width: "100%", width: '100%',
}, },
paper: { paper: {
overflow: "auto", overflow: 'auto',
display: "flex", display: 'flex',
flexFlow: "column", flexFlow: 'column',
alignItems: "flex", alignItems: 'flex',
height: "auto", height: 'auto',
background: "#232323", background: '#232323',
marginBottom: 20, marginBottom: 20,
}, },
header: { header: {
@@ -48,33 +48,38 @@ export const SelloutItem = (listing) => {
<div className={classes.content}> <div className={classes.content}>
<Paper elevation={2} className={classes.paper}> <Paper elevation={2} className={classes.paper}>
<div className={classes.header}> <div className={classes.header}>
<Typography className={classes.headerTypo} variant="h5"> <Typography className={classes.headerTypo} variant='h5'>
{listing.name} {listing.name}
</Typography> </Typography>
<Typography <Typography
className={classes.headerTypo} className={classes.headerTypo}
style={{ borderBottom: "1px solid #f44336" }} style={{ borderBottom: '1px solid #f44336' }}
> >
{listing.number} {listing.number}
</Typography> </Typography>
<Typography variant="h5" style={{ padding: 5}}> <Typography variant='h5' style={{ padding: 5 }}>
{listing.title} {listing.title}
</Typography> </Typography>
</div> </div>
{listing.url ? ( {listing.url ? (
<ImageDisplay imgURL={listing.url} /> <ImageDisplay imgURL={listing.url} />
): ( ) : (
<Typography style={{ margin: 10 }}>No image provided <span role="img" aria-label="emoji">🙁</span></Typography> <Typography style={{ margin: 10 }}>
) } No image provided{' '}
<Typography variant="h6" className={classes.desc}> <span role='img' aria-label='emoji'>
🙁
</span>
</Typography>
)}
<Typography variant='h6' className={classes.desc}>
{listing.description} {listing.description}
</Typography> </Typography>
<div> <div>
<Button> <Button>
<ChatIcon style={{ color: "#f44336" }} /> <ChatIcon style={{ color: '#f44336' }} />
</Button> </Button>
<Button> <Button>
<PhoneIcon style={{ color: "#f44336" }} /> <PhoneIcon style={{ color: '#f44336' }} />
</Button> </Button>
</div> </div>
</Paper> </Paper>
@@ -1,6 +1,6 @@
import React from "react"; import React from 'react';
import { List } from "../../../../ui/components/List"; import { List } from '../../../../ui/components/List';
import { SelloutItem } from "./SelloutItem"; import { SelloutItem } from './SelloutItem';
export const SelloutList = ({ listings }) => { export const SelloutList = ({ listings }) => {
return ( return (
@@ -1,6 +1,6 @@
import React from "react"; import React from 'react';
import { useListing } from "../../hooks/useListing"; import { useListing } from '../../hooks/useListing';
import { SelloutList } from "./SelloutList"; import { SelloutList } from './SelloutList';
export const SelloutListContainer = () => { export const SelloutListContainer = () => {
const { listing } = useListing(); const { listing } = useListing();
@@ -1,14 +1,14 @@
import React, { useState } from "react"; import React, { useState } from 'react';
import { makeStyles, Button, TextField } from "@material-ui/core"; import { makeStyles, Button, TextField } from '@material-ui/core';
import Nui from "../../../../os/nui-events/utils/Nui"; import Nui from '../../../../os/nui-events/utils/Nui';
import "../Sellout.css" import '../Sellout.css';
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
root: { root: {
width: "100%", width: '100%',
margin: "auto", margin: 'auto',
textAlign: "center", textAlign: 'center',
}, },
input: { input: {
marginBottom: 25, marginBottom: 25,
@@ -20,10 +20,10 @@ const useStyles = makeStyles((theme) => ({
fontSize: 20, fontSize: 20,
}, },
postButton: { postButton: {
display: "block", display: 'block',
margin: "auto", margin: 'auto',
background: "#f44336", background: '#f44336',
width: "80%", width: '80%',
fontSize: 20, fontSize: 20,
}, },
})); }));
@@ -31,53 +31,55 @@ const useStyles = makeStyles((theme) => ({
export const ListingForm = () => { export const ListingForm = () => {
const classes = useStyles(); const classes = useStyles();
const [ title, setTitle ] = useState(''); const [title, setTitle] = useState('');
const [ url, setUrl ] = useState(''); const [url, setUrl] = useState('');
const [ description, setDescription ] = useState(''); const [description, setDescription] = useState('');
const addListing = () => { const addListing = () => {
Nui.send('phone:addListing', { Nui.send('phone:addListing', {
title, title,
url, url,
description description,
}) });
} };
return ( return (
<div className={classes.root}> <div className={classes.root}>
<h1>New Listing</h1> <h1>New Listing</h1>
<TextField <TextField
className={classes.input} className={classes.input}
onChange={e => setTitle(e.target.value)} onChange={(e) => setTitle(e.target.value)}
placeholder="Title on listing.." placeholder='Title on listing..'
inputProps={{ className: classes.textFieldInput }} inputProps={{ className: classes.textFieldInput }}
style={{ width: "80%" }} style={{ width: '80%' }}
size="medium" size='medium'
/> />
<TextField <TextField
className={classes.input} className={classes.input}
placeholder="Image URL" placeholder='Image URL'
onChange={e => setUrl(e.target.value)} onChange={(e) => setUrl(e.target.value)}
inputProps={{ className: classes.textFieldInput }} inputProps={{ className: classes.textFieldInput }}
style={{ width: "80%" }} style={{ width: '80%' }}
size="medium" size='medium'
variant="outlined" variant='outlined'
/> />
<TextField <TextField
className={classes.input} className={classes.input}
onChange={e => setDescription(e.target.value)} onChange={(e) => setDescription(e.target.value)}
placeholder="Description" placeholder='Description'
inputProps={{ className: classes.multilineFieldInput }} inputProps={{ className: classes.multilineFieldInput }}
style={{ width: "80%" }} style={{ width: '80%' }}
size="medium" size='medium'
multiline multiline
rows={4} rows={4}
variant="outlined" variant='outlined'
/> />
<Button onClick={addListing} className={classes.postButton}>Post</Button> <Button onClick={addListing} className={classes.postButton}>
Post
</Button>
</div> </div>
); );
}; };
@@ -1,5 +1,5 @@
import React from "react"; import React from 'react';
import { ListingForm } from "./ListingForm"; import { ListingForm } from './ListingForm';
export const ListingFormContainer = () => { export const ListingFormContainer = () => {
return ( return (
@@ -1,11 +1,11 @@
import React from "react"; import React from 'react';
export const ImageDisplay = ({ imgURL }) => { export const ImageDisplay = ({ imgURL }) => {
return ( return (
<img <img
src={imgURL} src={imgURL}
alt="twitter display" alt='twitter display'
style={{ height: 200, width: 350, margin: "auto" }} style={{ height: 200, width: 350, margin: 'auto' }}
/> />
); );
}; };
+3 -3
View File
@@ -1,8 +1,8 @@
import { atom } from "recoil"; import { atom } from 'recoil';
export const selloutState = { export const selloutState = {
listing: atom({ listing: atom({
key: "listing", key: 'listing',
default: [], default: [],
}) }),
}; };
+2 -2
View File
@@ -1,5 +1,5 @@
import { useRecoilValue } from "recoil"; import { useRecoilValue } from 'recoil';
import { selloutState } from "./state"; import { selloutState } from './state';
export const useListing = () => { export const useListing = () => {
const listing = useRecoilValue(selloutState.listing); const listing = useRecoilValue(selloutState.listing);
@@ -1,10 +1,10 @@
import { useNuiEvent } from "../../../os/nui-events/hooks/useNuiEvent"; import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
import { selloutState } from "./state"; import { selloutState } from './state';
import { useListing } from "./useListing"; import { useListing } from './useListing';
import { useSetRecoilState } from "recoil"; import { useSetRecoilState } from 'recoil';
export const useSelloutService = () => { export const useSelloutService = () => {
const setSellout = useSetRecoilState(selloutState.listing); const setSellout = useSetRecoilState(selloutState.listing);
useNuiEvent("SELLOUT", "setListings", setSellout); useNuiEvent('SELLOUT', 'setListings', setSellout);
return useListing(); return useListing();
}; };
@@ -5,6 +5,8 @@ import {
Divider, Divider,
ListItemIcon, ListItemIcon,
} from '@material-ui/core'; } from '@material-ui/core';
import { SvgIconProps } from '@material-ui/core';
interface IProps { interface IProps {
options?: any; options?: any;
label: string; label: string;
@@ -1,4 +1,4 @@
import React from 'react'; import React, { useEffect, useState } from 'react';
import { AppWrapper } from '../../../ui/components'; import { AppWrapper } from '../../../ui/components';
import { AppTitle } from '../../../ui/components/AppTitle'; import { AppTitle } from '../../../ui/components/AppTitle';
import { AppContent } from '../../../ui/components/AppContent'; import { AppContent } from '../../../ui/components/AppContent';
@@ -7,7 +7,6 @@ import {
MapStringOptions, MapStringOptions,
} from '../../../ui/hooks/useContextMenu'; } from '../../../ui/hooks/useContextMenu';
import { useConfig } from '../../../config/hooks/useConfig'; import { useConfig } from '../../../config/hooks/useConfig';
import { useSettings } from '../hooks/useSettings';
import { List } from '../../../ui/components/List'; import { List } from '../../../ui/components/List';
import { useSimcard } from '../../../os/simcard/hooks/useSimcard'; import { useSimcard } from '../../../os/simcard/hooks/useSimcard';
import { useApp } from '../../../os/apps/hooks/useApps'; import { useApp } from '../../../os/apps/hooks/useApps';
@@ -25,6 +24,8 @@ import {
} from '@material-ui/icons'; } from '@material-ui/icons';
import { ListSubheader } from '@material-ui/core'; import { ListSubheader } from '@material-ui/core';
import { useRecoilState } from 'recoil';
import { settingsState } from '../hooks/useSettings';
const SubHeaderComp = (props: { text: string }) => ( const SubHeaderComp = (props: { text: string }) => (
<ListSubheader component='div' disableSticky> <ListSubheader component='div' disableSticky>
@@ -35,29 +36,39 @@ const SubHeaderComp = (props: { text: string }) => (
export const SettingsApp = () => { export const SettingsApp = () => {
const settingsApp = useApp('SETTINGS'); const settingsApp = useApp('SETTINGS');
const [config] = useConfig(); const [config] = useConfig();
const { setSettings, settings } = useSettings();
const simcard = useSimcard(); const simcard = useSimcard();
const [settings, setSettings] = useRecoilState(settingsState);
const handleSettingChange = (key: string | number, value: unknown) => {
setSettings({ ...settings, [key]: value });
};
const { t } = useTranslation(); const { t } = useTranslation();
const wallpapers = config.wallpapers.map( const wallpapers = config.wallpapers.map(
MapStringOptions(settings.wallpaper, (val: string) => MapStringOptions(settings.wallpaper, (val: string) =>
setSettings('wallpaper', val) handleSettingChange('wallpaper', val)
) )
); );
const frames = config.frames.map( const frames = config.frames.map(
MapStringOptions(settings.frame, (val: string) => setSettings('frame', val)) MapStringOptions(settings.frame, (val: string) =>
handleSettingChange('frame', val)
)
); );
const themes = Object.keys(config.themes).map( const themes = Object.keys(config.themes).map(
MapStringOptions(settings.theme, (val: string) => setSettings('theme', val)) MapStringOptions(settings.theme, (val: string) =>
handleSettingChange('theme', val)
)
); );
const zoomOptions = config.zoomOptions.map( const zoomOptions = config.zoomOptions.map(
MapStringOptions(settings.zoom, (val: string) => setSettings('zoom', val)) MapStringOptions(settings.zoom, (val: string) =>
handleSettingChange('zoom', val)
)
); );
// Doesn't actually do anything for the time being // Doesn't actually do anything for the time being
const ringtones = config.ringtones.map( const ringtones = config.ringtones.map(
MapStringOptions(settings.ringtone, (val: string) => MapStringOptions(settings.ringtone, (val: string) =>
setSettings('ringtone', val) handleSettingChange('ringtone', val)
) )
); );
// * Probably gonna make this a slider component in the future // * Probably gonna make this a slider component in the future
-8
View File
@@ -1,8 +0,0 @@
{
"wallpaper": "default.png",
"frame": "s10.png",
"theme": "taso-dark",
"zoom": "100%",
"ringtone": "pixel",
"ringtoneVol": 100
}
+24 -12
View File
@@ -1,16 +1,28 @@
import Default from "../default.json"; import { atom, DefaultValue, useRecoilState } from 'recoil';
import { useConfig } from "../../../config/hooks/useConfig"; import config from '../../../config/default.json';
import { atom } from "recoil";
import { createMuiTheme } from "@material-ui/core";
const settingsState = atom({ const localStorageEffect = (key) => ({ setSelf, onSet }) => {
key: "settings", const savedVal = localStorage.getItem(key);
default: Default, if (savedVal != null) {
setSelf(JSON.parse(savedVal));
}
onSet((newValue) => {
if (newValue instanceof DefaultValue) {
localStorage.removeItem(key);
} else {
localStorage.setItem(key, JSON.stringify(newValue));
}
});
};
export const settingsState = atom({
key: 'settings',
default: config.defaultSettings,
effects_UNSTABLE: [localStorageEffect('settings')],
}); });
export const useSettings = (): any => { export const useSettings = () => {
const [settings, setSettings] = useConfig(settingsState); const [settings, setSettings] = useRecoilState(settingsState);
const [config] = useConfig(); return [settings, setSettings];
const currentTheme = () => createMuiTheme(config.themes[settings.theme]);
return { settings, setSettings, currentTheme };
}; };
@@ -1,54 +1,54 @@
import React, { useState, useEffect } from "react"; import React, { useState, useEffect } from 'react';
import { makeStyles } from "@material-ui/core/styles"; import { makeStyles } from '@material-ui/core/styles';
import { Button } from "@material-ui/core"; import { Button } from '@material-ui/core';
import CloseIcon from "@material-ui/icons/Close"; import CloseIcon from '@material-ui/icons/Close';
import { v4 as uuidv4 } from "uuid"; import { v4 as uuidv4 } from 'uuid';
import Nui from "../../../os/nui-events/utils/Nui"; import Nui from '../../../os/nui-events/utils/Nui';
import Modal from "../../../ui/components/Modal"; import Modal from '../../../ui/components/Modal';
import { IMAGE_DELIMITER } from "../utils/images"; import { IMAGE_DELIMITER } from '../utils/images';
import { withValidImage } from "../utils/images"; import { withValidImage } from '../utils/images';
import { useModal } from "../hooks/useModal"; import { useModal } from '../hooks/useModal';
import EmojiSelect from "./EmojiSelect"; import EmojiSelect from './EmojiSelect';
import ImageDisplay from "./images/ImageDisplay"; import ImageDisplay from './images/ImageDisplay';
import ImagePrompt from "./images/ImagePrompt"; import ImagePrompt from './images/ImagePrompt';
import TweetMessage from "./tweet/TweetMessage"; import TweetMessage from './tweet/TweetMessage';
import ControlButtons from "./buttons/ControlButtons"; import ControlButtons from './buttons/ControlButtons';
import IconButtons from "./buttons/IconButtons"; import IconButtons from './buttons/IconButtons';
import { usePhone } from "../../../os/phone/hooks/usePhone"; import { usePhone } from '../../../os/phone/hooks/usePhone';
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
root: { root: {
zIndex: 10, zIndex: 10,
background: "#424242", background: '#424242',
marginTop: "15px", marginTop: '15px',
width: "90%", width: '90%',
display: "flex", display: 'flex',
flexFlow: "column nowrap", flexFlow: 'column nowrap',
position: "absolute", position: 'absolute',
top: "80px", top: '80px',
}, },
button: { button: {
margin: 5, margin: 5,
marginTop: 20, marginTop: 20,
}, },
close: { close: {
position: "absolute", position: 'absolute',
top: "12px", top: '12px',
right: "4px", right: '4px',
zIndex: 2, zIndex: 2,
}, },
buttonsContainer: { buttonsContainer: {
paddingBottom: "8px", paddingBottom: '8px',
display: "flex", display: 'flex',
flexFlow: "row nowrap", flexFlow: 'row nowrap',
justifyContent: "space-between", justifyContent: 'space-between',
flex: "1 0 45px", flex: '1 0 45px',
}, },
emojiPicker: { emojiPicker: {
background: "none", background: 'none',
border: "none", border: 'none',
boxShadow: "none", boxShadow: 'none',
}, },
})); }));
@@ -64,7 +64,7 @@ export const AddTweetModal = () => {
const [showEmoji, setShowEmoji] = useState(false); const [showEmoji, setShowEmoji] = useState(false);
const [showImagePrompt, setShowImagePrompt] = useState(false); const [showImagePrompt, setShowImagePrompt] = useState(false);
const [link, setLink] = useState(""); const [link, setLink] = useState('');
const [images, setImages] = useState<Image[]>([]); const [images, setImages] = useState<Image[]>([]);
@@ -72,9 +72,9 @@ export const AddTweetModal = () => {
setShowImagePrompt(false); setShowImagePrompt(false);
setShowEmoji(false); setShowEmoji(false);
setLink(""); setLink('');
setImages([]); setImages([]);
setMessage(""); setMessage('');
}; };
const _handleClose = () => { const _handleClose = () => {
@@ -84,15 +84,15 @@ export const AddTweetModal = () => {
// when the user presses escape we should close the modal // when the user presses escape we should close the modal
const _handleEscape = (e) => { const _handleEscape = (e) => {
const isEscapeKey = e.key === "Escape" || e.key === "Esc"; const isEscapeKey = e.key === 'Escape' || e.key === 'Esc';
if (isEscapeKey) { if (isEscapeKey) {
e.preventDefault(); e.preventDefault();
_handleClose(); _handleClose();
} }
}; };
useEffect(() => { useEffect(() => {
window.addEventListener("keydown", _handleEscape, true); window.addEventListener('keydown', _handleEscape, true);
return () => window.removeEventListener("keydown", _handleEscape); return () => window.removeEventListener('keydown', _handleEscape);
}); });
if (!config) return null; if (!config) return null;
@@ -107,10 +107,10 @@ export const AddTweetModal = () => {
images: images:
images && images.length > 0 images && images.length > 0
? images.map((image) => image.link).join(IMAGE_DELIMITER) ? images.map((image) => image.link).join(IMAGE_DELIMITER)
: "", : '',
realUser: "testUser", realUser: 'testUser',
}; };
Nui.send("phone:createTweet", data); Nui.send('phone:createTweet', data);
_handleClose(); _handleClose();
}; };
@@ -119,7 +119,7 @@ export const AddTweetModal = () => {
const addImage = () => { const addImage = () => {
// strip any whitespace from the link in case the user // strip any whitespace from the link in case the user
// added some spaces/returns accidentally // 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 // because we're only storing strings in the database we need
// to give this an arbirtrary (but unique) id so that we can // to give this an arbirtrary (but unique) id so that we can
// correctly filter an array of images when the user wants to // correctly filter an array of images when the user wants to
@@ -134,7 +134,7 @@ export const AddTweetModal = () => {
withValidImage(cleanedLink, () => setImages([...images, image])); withValidImage(cleanedLink, () => setImages([...images, image]));
setShowImagePrompt(false); setShowImagePrompt(false);
setLink(""); setLink('');
}; };
const removeImage = (id) => const removeImage = (id) =>
setImages(images.filter((image) => id !== image.id)); setImages(images.filter((image) => id !== image.id));
@@ -161,7 +161,7 @@ export const AddTweetModal = () => {
return ( return (
<Modal visible={modalVisible} handleClose={_handleClose}> <Modal visible={modalVisible} handleClose={_handleClose}>
<Button className={classes.close} onClick={_handleClose}> <Button className={classes.close} onClick={_handleClose}>
<CloseIcon color="action" /> <CloseIcon color='action' />
</Button> </Button>
<TweetMessage message={message} handleChange={handleMessageChange} /> <TweetMessage message={message} handleChange={handleMessageChange} />
<ImagePrompt <ImagePrompt
+12 -12
View File
@@ -1,16 +1,16 @@
import React, { useState } from "react"; import React, { useState } from 'react';
import { makeStyles } from "@material-ui/core/styles"; import { makeStyles } from '@material-ui/core/styles';
import { usePhone } from "../../../os/phone/hooks/usePhone"; import { usePhone } from '../../../os/phone/hooks/usePhone';
import { IMG_DEFAULT_AVATAR, IMG_INVALID_AVATAR } from "../utils/constants"; import { IMG_DEFAULT_AVATAR, IMG_INVALID_AVATAR } from '../utils/constants';
const useStyles = makeStyles({ const useStyles = makeStyles({
root: { root: {
width: "100%", width: '100%',
}, },
img: { img: {
borderRadius: "50%", borderRadius: '50%',
objectFit: "cover", objectFit: 'cover',
}, },
}); });
@@ -30,17 +30,17 @@ function Avatar({ avatarUrl, showInvalidImage, height, width }) {
<img <img
className={classes.img} className={classes.img}
src={showInvalidImage ? IMG_INVALID_AVATAR : IMG_DEFAULT_AVATAR} src={showInvalidImage ? IMG_INVALID_AVATAR : IMG_DEFAULT_AVATAR}
alt="Invalid avatar" alt='Invalid avatar'
style={{ height, width }} style={{ height, width }}
/> />
)} )}
<img <img
className={classes.img} className={classes.img}
src={avatarUrl || IMG_DEFAULT_AVATAR} src={avatarUrl || IMG_DEFAULT_AVATAR}
alt="Your profile avatar" alt='Your profile avatar'
onError={handleImageError} onError={handleImageError}
onLoad={handleImageLoad} onLoad={handleImageLoad}
style={{ display: showImageError ? "none" : "block", height, width }} style={{ display: showImageError ? 'none' : 'block', height, width }}
/> />
</div> </div>
); );
@@ -49,8 +49,8 @@ function Avatar({ avatarUrl, showInvalidImage, height, width }) {
Avatar.defaultProps = { Avatar.defaultProps = {
avatarUrl: null, avatarUrl: null,
showInvalidImage: false, showInvalidImage: false,
height: "125px", height: '125px',
width: "125px", width: '125px',
}; };
export default Avatar; export default Avatar;
@@ -1,14 +1,14 @@
import React from "react"; import React from 'react';
import { Link } from "react-router-dom"; import { Link } from 'react-router-dom';
import { makeStyles } from "@material-ui/core/styles"; import { makeStyles } from '@material-ui/core/styles';
import { BottomNavigation, BottomNavigationAction } from "@material-ui/core"; import { BottomNavigation, BottomNavigationAction } from '@material-ui/core';
import HomeIcon from "@material-ui/icons/Home"; import HomeIcon from '@material-ui/icons/Home';
import SearchIcon from "@material-ui/icons/Search"; import SearchIcon from '@material-ui/icons/Search';
import ProfileIcon from "@material-ui/icons/Person"; import ProfileIcon from '@material-ui/icons/Person';
const useStyles = makeStyles({ const useStyles = makeStyles({
root: { root: {
width: "100%", width: '100%',
}, },
}); });
@@ -23,17 +23,17 @@ export function TwitterBottomNavigation({ activePage, handleChange }) {
> >
<BottomNavigationAction <BottomNavigationAction
component={Link} component={Link}
to="/twitter" to='/twitter'
icon={<HomeIcon />} icon={<HomeIcon />}
/> />
<BottomNavigationAction <BottomNavigationAction
component={Link} component={Link}
to="/twitter/search" to='/twitter/search'
icon={<SearchIcon />} icon={<SearchIcon />}
/> />
<BottomNavigationAction <BottomNavigationAction
component={Link} component={Link}
to="/twitter/profile" to='/twitter/profile'
icon={<ProfileIcon />} icon={<ProfileIcon />}
/> />
</BottomNavigation> </BottomNavigation>
@@ -1,5 +1,5 @@
import React, { memo } from "react"; import React, { memo } from 'react';
import { Picker } from "emoji-mart"; import { Picker } from 'emoji-mart';
export const EmojiSelect = ({ visible, onEmojiClick }) => { export const EmojiSelect = ({ visible, onEmojiClick }) => {
if (!visible) return null; if (!visible) return null;
@@ -7,8 +7,8 @@ export const EmojiSelect = ({ visible, onEmojiClick }) => {
return ( return (
<Picker <Picker
onClick={onEmojiClick} onClick={onEmojiClick}
set="google" set='google'
theme="dark" theme='dark'
showPreview={false} showPreview={false}
/> />
); );
@@ -1,30 +1,30 @@
import React, { useState, useEffect } from "react"; import React, { useState, useEffect } from 'react';
import { Switch, Route } from "react-router-dom"; import { Switch, Route } from 'react-router-dom';
import { makeStyles } from "@material-ui/core/styles"; import { makeStyles } from '@material-ui/core/styles';
import Nui from "../../../os/nui-events/utils/Nui"; import Nui from '../../../os/nui-events/utils/Nui';
import { AppWrapper } from "../../../ui/components"; import { AppWrapper } from '../../../ui/components';
import { AppContent } from "../../../ui/components/AppContent"; import { AppContent } from '../../../ui/components/AppContent';
import TweetListContainer from "./tweet/TweetListContainer"; import TweetListContainer from './tweet/TweetListContainer';
import AddTweetModal from "./AddTweetModal"; import AddTweetModal from './AddTweetModal';
import { useModal } from "../hooks/useModal"; import { useModal } from '../hooks/useModal';
import TweetButton from "./buttons/TweetButton"; import TweetButton from './buttons/TweetButton';
import TwitterTitle from "./TwitterTitle"; import TwitterTitle from './TwitterTitle';
import BottomNavigation from "./BottomNavigation"; import BottomNavigation from './BottomNavigation';
import TwitterProfile from "./profile/Profile"; import TwitterProfile from './profile/Profile';
import AlertBar from "./alerts/AlertBar"; import AlertBar from './alerts/AlertBar';
import TwitterSearch from "./TwitterSearch"; import TwitterSearch from './TwitterSearch';
import "./twitter.css"; import './twitter.css';
import "emoji-mart/css/emoji-mart.css"; import 'emoji-mart/css/emoji-mart.css';
import { useProfile } from "../hooks/useProfile"; import { useProfile } from '../hooks/useProfile';
import ProfilePrompt from "./profile/ProfilePrompt"; import ProfilePrompt from './profile/ProfilePrompt';
const useStyles = makeStyles(() => ({ const useStyles = makeStyles(() => ({
backgroundModal: { backgroundModal: {
background: "black", background: 'black',
opacity: "0.6", opacity: '0.6',
position: "absolute", position: 'absolute',
top: 0, top: 0,
left: 0, left: 0,
right: 0, right: 0,
@@ -42,7 +42,7 @@ export const TwitterApp = () => {
const { profile } = useProfile(); const { profile } = useProfile();
useEffect(() => { useEffect(() => {
Nui.send("phone:getOrCreateTwitterProfile", {}); Nui.send('phone:getOrCreateTwitterProfile', {});
// this is a polling implementation. It is possible that // this is a polling implementation. It is possible that
// there is some interaction where, on a new tweet, all // 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 // TODO don't call fetchTweets - implement a function that only
// returns tweets that we don't already have // returns tweets that we don't already have
const timeout = window.setTimeout(() => { const timeout = window.setTimeout(() => {
Nui.send("phone:fetchTweets", {}); Nui.send('phone:fetchTweets', {});
}, TWEETS_REFRESH_RATE); }, TWEETS_REFRESH_RATE);
return () => window.clearTimeout(timeout); return () => window.clearTimeout(timeout);
}, []); }, []);
@@ -67,7 +67,7 @@ export const TwitterApp = () => {
const showTweetButton = !promptProfileName && activePage === 0; const showTweetButton = !promptProfileName && activePage === 0;
return ( return (
<AppWrapper id="twitter-app"> <AppWrapper id='twitter-app'>
<AddTweetModal /> <AddTweetModal />
<div className={modalVisible ? classes.backgroundModal : undefined} /> <div className={modalVisible ? classes.backgroundModal : undefined} />
<TwitterTitle /> <TwitterTitle />
@@ -76,9 +76,9 @@ export const TwitterApp = () => {
<ProfilePrompt /> <ProfilePrompt />
) : ( ) : (
<Switch> <Switch>
<Route path="/twitter" exact component={TweetListContainer} /> <Route path='/twitter' exact component={TweetListContainer} />
<Route path="/twitter/search" component={TwitterSearch} /> <Route path='/twitter/search' component={TwitterSearch} />
<Route path="/twitter/profile" component={TwitterProfile} /> <Route path='/twitter/profile' component={TwitterProfile} />
</Switch> </Switch>
)} )}
</AppContent> </AppContent>
@@ -1,29 +1,29 @@
import React, { useState } from "react"; import React, { useState } from 'react';
import { useTranslation } from "react-i18next"; import { useTranslation } from 'react-i18next';
import { makeStyles } from "@material-ui/core/styles"; import { makeStyles } from '@material-ui/core/styles';
import { TextField } from "@material-ui/core"; import { TextField } from '@material-ui/core';
import TweetList from "./tweet/TweetList"; import TweetList from './tweet/TweetList';
import Nui from "../../../os/nui-events/utils/Nui"; import Nui from '../../../os/nui-events/utils/Nui';
import SearchButton from "./buttons/SearchButton"; import SearchButton from './buttons/SearchButton';
import { useFilteredTweets } from "../hooks/useFilteredTweets"; import { useFilteredTweets } from '../hooks/useFilteredTweets';
const useStyles = makeStyles({ const useStyles = makeStyles({
root: { root: {
width: "100%", width: '100%',
}, },
searchContainer: { searchContainer: {
padding: "15px", padding: '15px',
}, },
search: { search: {
width: "100%", width: '100%',
}, },
}); });
function TwitterSearch() { function TwitterSearch() {
const classes = useStyles(); const classes = useStyles();
const { t } = useTranslation(); const { t } = useTranslation();
const [searchValue, setSearchValue] = useState(""); const [searchValue, setSearchValue] = useState('');
const { tweets } = useFilteredTweets(); const { tweets } = useFilteredTweets();
const handleChange = (e) => setSearchValue(e.target.value); const handleChange = (e) => setSearchValue(e.target.value);
@@ -32,7 +32,7 @@ function TwitterSearch() {
const cleanedSearchValue = searchValue.trim(); const cleanedSearchValue = searchValue.trim();
if (!cleanedSearchValue) return; if (!cleanedSearchValue) return;
Nui.send("phone:fetchTweetsFiltered", cleanedSearchValue); Nui.send('phone:fetchTweetsFiltered', cleanedSearchValue);
}; };
const filteredTweets = tweets || []; const filteredTweets = tweets || [];
@@ -43,11 +43,11 @@ function TwitterSearch() {
<div className={classes.searchContainer}> <div className={classes.searchContainer}>
<TextField <TextField
className={classes.search} className={classes.search}
placeholder={t("APPS_TWITTER_SEARCH_TWEETS_PLACEHOLDER")} placeholder={t('APPS_TWITTER_SEARCH_TWEETS_PLACEHOLDER')}
label={t("APPS_TWITTER_SEARCH_TWEETS")} label={t('APPS_TWITTER_SEARCH_TWEETS')}
value={searchValue} value={searchValue}
onChange={handleChange} onChange={handleChange}
size="medium" size='medium'
inputRef={(input) => input && input.focus()} inputRef={(input) => input && input.focus()}
/> />
</div> </div>
@@ -1,20 +1,20 @@
import React from "react"; import React from 'react';
import Paper from "@material-ui/core/Paper"; import Paper from '@material-ui/core/Paper';
import { makeStyles } from "@material-ui/core"; import { makeStyles } from '@material-ui/core';
import TwitterIcon from "@material-ui/icons/Twitter"; import TwitterIcon from '@material-ui/icons/Twitter';
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
root: { root: {
height: "60px", height: '60px',
width: "100%", width: '100%',
display: "flex", display: 'flex',
flexFlow: "row nowrap", flexFlow: 'row nowrap',
justifyContent: "center", justifyContent: 'center',
alignItems: "center", alignItems: 'center',
background: "#424242", background: '#424242',
}, },
icon: { icon: {
color: "#00acee", color: '#00acee',
fontSize: 30, fontSize: 30,
}, },
})); }));
@@ -22,7 +22,7 @@ const useStyles = makeStyles((theme) => ({
export function TwitterTitle() { export function TwitterTitle() {
const classes = useStyles(); const classes = useStyles();
return ( return (
<Paper elevation={24} variant="outlined" square className={classes.root}> <Paper elevation={24} variant='outlined' square className={classes.root}>
<TwitterIcon className={classes.icon} /> <TwitterIcon className={classes.icon} />
</Paper> </Paper>
); );
@@ -1,16 +1,16 @@
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from 'react';
import { useTranslation } from "react-i18next"; import { useTranslation } from 'react-i18next';
import { Snackbar } from "@material-ui/core"; import { Snackbar } from '@material-ui/core';
import { makeStyles } from "@material-ui/core/styles"; import { makeStyles } from '@material-ui/core/styles';
import { useProfile } from "../../hooks/useProfile"; import { useProfile } from '../../hooks/useProfile';
import { useTweetStatus } from "../../hooks/useTweetStatus"; import { useTweetStatus } from '../../hooks/useTweetStatus';
import Alert from "../../../../ui/components/Alert"; import Alert from '../../../../ui/components/Alert';
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
root: { root: {
width: "100%", width: '100%',
bottom: "60px", bottom: '60px',
}, },
})); }));
@@ -34,20 +34,20 @@ export default function AlertBar() {
useEffect(() => { useEffect(() => {
if (createTweetSuccessful === true) { if (createTweetSuccessful === true) {
setOpen(true); setOpen(true);
setSeverity("success"); setSeverity('success');
setMessage(t("APPS_TWITTER_CREATE_SUCCESS")); setMessage(t('APPS_TWITTER_CREATE_SUCCESS'));
} else if (createTweetSuccessful === false) { } else if (createTweetSuccessful === false) {
setOpen(true); setOpen(true);
setSeverity("error"); setSeverity('error');
setMessage(t("APPS_TWITTER_CREATE_FAILED")); setMessage(t('APPS_TWITTER_CREATE_FAILED'));
} else if (updateProfileSuccessful === true) { } else if (updateProfileSuccessful === true) {
setOpen(true); setOpen(true);
setSeverity("success"); setSeverity('success');
setMessage(t("APPS_TWITTER_EDIT_PROFILE_SUCCESS")); setMessage(t('APPS_TWITTER_EDIT_PROFILE_SUCCESS'));
} else if (updateProfileSuccessful === false) { } else if (updateProfileSuccessful === false) {
setOpen(true); setOpen(true);
setSeverity("error"); setSeverity('error');
setMessage(t("APPS_TWITTER_EDIT_PROFILE_FAILURE")); setMessage(t('APPS_TWITTER_EDIT_PROFILE_FAILURE'));
} }
}, [updateProfileSuccessful, createTweetSuccessful, t]); }, [updateProfileSuccessful, createTweetSuccessful, t]);
@@ -1,18 +1,18 @@
import React from "react"; import React from 'react';
import { useTranslation } from "react-i18next"; import { useTranslation } from 'react-i18next';
import { makeStyles } from "@material-ui/core/styles"; import { makeStyles } from '@material-ui/core/styles';
import { Button } from "@material-ui/core"; import { Button } from '@material-ui/core';
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
buttons: { buttons: {
display: "flex", display: 'flex',
flexFlow: "row nowrap", flexFlow: 'row nowrap',
justifyContent: "flex-end", justifyContent: 'flex-end',
alignItems: "justify-content", alignItems: 'justify-content',
marginRight: "15px", marginRight: '15px',
}, },
close: { close: {
marginLeft: "8px", marginLeft: '8px',
}, },
})); }));
@@ -27,23 +27,23 @@ export const ControlButtons = ({
const imagePromptVisible = showImagePrompt && !showEmoji; const imagePromptVisible = showImagePrompt && !showEmoji;
const primaryButtonText = imagePromptVisible const primaryButtonText = imagePromptVisible
? t("APPS_TWITTER_SUBMIT_IMAGE") ? t('APPS_TWITTER_SUBMIT_IMAGE')
: t("APPS_TWITTER_TWEET"); : t('APPS_TWITTER_TWEET');
const showCloseButton = showImagePrompt || showEmoji; const showCloseButton = showImagePrompt || showEmoji;
return ( return (
<div className={classes.buttons}> <div className={classes.buttons}>
<Button variant="contained" color="primary" onClick={onPrimaryClick}> <Button variant='contained' color='primary' onClick={onPrimaryClick}>
{primaryButtonText} {primaryButtonText}
</Button> </Button>
{showCloseButton && ( {showCloseButton && (
<Button <Button
className={classes.close} className={classes.close}
variant="contained" variant='contained'
color="secondary" color='secondary'
onClick={onCloseClick} onClick={onCloseClick}
> >
{t("APPS_TWITTER_CLOSE_IMAGE")} {t('APPS_TWITTER_CLOSE_IMAGE')}
</Button> </Button>
)} )}
</div> </div>
@@ -1,20 +1,20 @@
import React from "react"; import React from 'react';
import { makeStyles } from "@material-ui/core/styles"; import { makeStyles } from '@material-ui/core/styles';
import { Button } from "@material-ui/core"; import { Button } from '@material-ui/core';
import InsertPhotoIcon from "@material-ui/icons/InsertPhoto"; import InsertPhotoIcon from '@material-ui/icons/InsertPhoto';
import EmojiIcon from "@material-ui/icons/SentimentSatisfied"; import EmojiIcon from '@material-ui/icons/SentimentSatisfied';
import { usePhone } from "../../../../os/phone/hooks/usePhone"; import { usePhone } from '../../../../os/phone/hooks/usePhone';
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
buttons: { buttons: {
display: "flex", display: 'flex',
flexFlow: "row nowrap", flexFlow: 'row nowrap',
justifyContent: "flex-start", justifyContent: 'flex-start',
paddingLeft: "5px", // re-align left buttons after overriding material-ui spacing paddingLeft: '5px', // re-align left buttons after overriding material-ui spacing
}, },
button: { button: {
background: "transparent", background: 'transparent',
minWidth: "45px", // override default material-ui spacing between buttons minWidth: '45px', // override default material-ui spacing between buttons
}, },
})); }));
@@ -29,12 +29,12 @@ export const IconButtons = ({ onImageClick, onEmojiClick }) => {
<div className={classes.buttons}> <div className={classes.buttons}>
{enableImages && ( {enableImages && (
<Button className={classes.button} onClick={onImageClick}> <Button className={classes.button} onClick={onImageClick}>
<InsertPhotoIcon color="action" /> <InsertPhotoIcon color='action' />
</Button> </Button>
)} )}
{enableEmojis && ( {enableEmojis && (
<Button className={classes.button} onClick={onEmojiClick}> <Button className={classes.button} onClick={onEmojiClick}>
<EmojiIcon color="action" /> <EmojiIcon color='action' />
</Button> </Button>
)} )}
</div> </div>
@@ -1,9 +1,9 @@
import React, { useState } from "react"; import React, { useState } from 'react';
import { Button, CircularProgress } from "@material-ui/core"; import { Button, CircularProgress } from '@material-ui/core';
import FavoriteBorderIcon from "@material-ui/icons/FavoriteBorder"; import FavoriteBorderIcon from '@material-ui/icons/FavoriteBorder';
import FavoriteIcon from "@material-ui/icons/Favorite"; 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; const LOADING_TIME = 1250;
@@ -12,7 +12,7 @@ function LikeButton({ tweetId, isLiked }) {
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const handleClick = () => { const handleClick = () => {
Nui.send("phone:toggleLike", tweetId); Nui.send('phone:toggleLike', tweetId);
setLoading(true); setLoading(true);
window.setTimeout(() => { window.setTimeout(() => {
setLiked(!liked); setLiked(!liked);
@@ -1,18 +1,18 @@
import React, { useState, useEffect } from "react"; import React, { useState, useEffect } from 'react';
import { makeStyles } from "@material-ui/core/styles"; import { makeStyles } from '@material-ui/core/styles';
import { Fab } from "@material-ui/core"; import { Fab } from '@material-ui/core';
import PublishIcon from "@material-ui/icons/Publish"; import PublishIcon from '@material-ui/icons/Publish';
import { useProfile } from "../../hooks/useProfile"; import { useProfile } from '../../hooks/useProfile';
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
root: { root: {
position: "absolute", position: 'absolute',
bottom: "15px", bottom: '15px',
right: "15px", right: '15px',
}, },
button: { button: {
background: "#00acee", background: '#00acee',
}, },
})); }));
@@ -37,7 +37,7 @@ export function ProfileUpdateButton({ handleClick }) {
<div className={classes.root}> <div className={classes.root}>
<Fab <Fab
className={classes.button} className={classes.button}
color="primary" color='primary'
onClick={handleClick} onClick={handleClick}
disabled={isLoading} disabled={isLoading}
> >
@@ -1,9 +1,9 @@
import React from "react"; import React from 'react';
import { useSetRecoilState } from "recoil"; import { useSetRecoilState } from 'recoil';
import { Button } from "@material-ui/core"; import { Button } from '@material-ui/core';
import QuoteIcon from "@material-ui/icons/FormatQuote"; import QuoteIcon from '@material-ui/icons/FormatQuote';
import { twitterState } from "../../hooks/state"; import { twitterState } from '../../hooks/state';
export const QuoteButton = ({ message }) => { export const QuoteButton = ({ message }) => {
const setModalVisible = useSetRecoilState(twitterState.showCreateTweetModal); const setModalVisible = useSetRecoilState(twitterState.showCreateTweetModal);
@@ -1,9 +1,9 @@
import React from "react"; import React from 'react';
import { useSetRecoilState } from "recoil"; import { useSetRecoilState } from 'recoil';
import { Button } from "@material-ui/core"; import { Button } from '@material-ui/core';
import ReplyIcon from "@material-ui/icons/Reply"; import ReplyIcon from '@material-ui/icons/Reply';
import { twitterState } from "../../hooks/state"; import { twitterState } from '../../hooks/state';
export const ReplyButton = ({ profile_name }) => { export const ReplyButton = ({ profile_name }) => {
const setModalVisible = useSetRecoilState(twitterState.showCreateTweetModal); const setModalVisible = useSetRecoilState(twitterState.showCreateTweetModal);
@@ -1,13 +1,9 @@
import React, { useState } from "react"; import React, { useState } from 'react';
import { useTranslation } from "react-i18next"; import { useTranslation } from 'react-i18next';
import { import { Button, CircularProgress, MenuItem } from '@material-ui/core';
Button,
CircularProgress,
MenuItem
} from "@material-ui/core";
import DoneIcon from '@material-ui/icons/Done'; 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; const LOADING_TIME = 1250;
@@ -16,7 +12,7 @@ function ReportButton({ handleClose, tweetId, isReported }) {
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const handleClick = () => { const handleClick = () => {
Nui.send("phone:reportTweet", tweetId); Nui.send('phone:reportTweet', tweetId);
setLoading(true); setLoading(true);
window.setTimeout(() => { window.setTimeout(() => {
setLoading(false); setLoading(false);
@@ -26,24 +22,22 @@ function ReportButton({ handleClose, tweetId, isReported }) {
if (isReported) { if (isReported) {
return ( return (
<MenuItem onClick={handleClose}> <MenuItem onClick={handleClose}>
<DoneIcon /> <DoneIcon />
<span style={{ marginLeft: '5px' }}>{t('APPS_TWITTER_REPORTED')}</span> <span style={{ marginLeft: '5px' }}>{t('APPS_TWITTER_REPORTED')}</span>
</MenuItem > </MenuItem>
); );
} }
if (loading) { if (loading) {
return ( return (
<Button disabled> <Button disabled>
<CircularProgress id="twitter-report-progress" size={22} /> <CircularProgress id='twitter-report-progress' size={22} />
</Button> </Button>
); );
} }
return ( return <MenuItem onClick={handleClick}>{t('APPS_TWITTER_REPORT')}</MenuItem>;
<MenuItem onClick={handleClick}>{t('APPS_TWITTER_REPORT')}</MenuItem >
);
} }
export default ReportButton; export default ReportButton;
@@ -1,16 +1,16 @@
import React from "react"; import React from 'react';
import { makeStyles } from "@material-ui/core/styles"; import { makeStyles } from '@material-ui/core/styles';
import { Fab } from "@material-ui/core"; import { Fab } from '@material-ui/core';
import SearchIcon from "@material-ui/icons/Search"; import SearchIcon from '@material-ui/icons/Search';
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
root: { root: {
position: "absolute", position: 'absolute',
bottom: "15px", bottom: '15px',
right: "15px", right: '15px',
}, },
button: { button: {
background: "#00acee", background: '#00acee',
}, },
})); }));
@@ -19,7 +19,7 @@ export function ProfileUpdateButton({ handleClick }) {
return ( return (
<div className={classes.root}> <div className={classes.root}>
<Fab className={classes.button} color="primary" onClick={handleClick}> <Fab className={classes.button} color='primary' onClick={handleClick}>
<SearchIcon /> <SearchIcon />
</Fab> </Fab>
</div> </div>
@@ -1,16 +1,16 @@
import React from "react"; import React from 'react';
import { makeStyles } from "@material-ui/core/styles"; import { makeStyles } from '@material-ui/core/styles';
import { Fab } from "@material-ui/core"; import { Fab } from '@material-ui/core';
import CreateIcon from "@material-ui/icons/Create"; import CreateIcon from '@material-ui/icons/Create';
const useStyles = makeStyles(() => ({ const useStyles = makeStyles(() => ({
root: { root: {
position: "absolute", position: 'absolute',
bottom: "75px", bottom: '75px',
right: "15px", right: '15px',
}, },
button: { button: {
background: "#00acee", background: '#00acee',
}, },
})); }));
@@ -19,7 +19,7 @@ export function TweetButton({ openModal }) {
return ( return (
<div className={classes.root}> <div className={classes.root}>
<Fab className={classes.button} color="primary" onClick={openModal}> <Fab className={classes.button} color='primary' onClick={openModal}>
<CreateIcon /> <CreateIcon />
</Fab> </Fab>
</div> </div>
@@ -1,38 +1,38 @@
import React from "react"; import React from 'react';
import { IconButton } from "@material-ui/core"; import { IconButton } from '@material-ui/core';
import { makeStyles } from "@material-ui/core/styles"; import { makeStyles } from '@material-ui/core/styles';
import CloseIcon from "@material-ui/icons/Close"; import CloseIcon from '@material-ui/icons/Close';
const useStyles = makeStyles(() => ({ const useStyles = makeStyles(() => ({
root: { root: {
margin: "2px 15px", margin: '2px 15px',
}, },
imageContainer: { imageContainer: {
// catch the close button here so it doesn't go all the way up to the modal // catch the close button here so it doesn't go all the way up to the modal
position: "relative", position: 'relative',
display: "inline-block", display: 'inline-block',
}, },
imgButton: { imgButton: {
position: "absolute", // show the close button in the top right of the image position: 'absolute', // show the close button in the top right of the image
top: "2px", top: '2px',
right: "5px", right: '5px',
backgroundColor: "#000", backgroundColor: '#000',
opacity: 0.7, opacity: 0.7,
"&:hover": { '&:hover': {
// fixes a bug where when the user closes one image material-ui puts // fixes a bug where when the user closes one image material-ui puts
// the hover status on the previous image // the hover status on the previous image
backgroundColor: "#000", backgroundColor: '#000',
}, },
}, },
img: { img: {
maxHeight: "125px", // constrain images so we don't overwhelm the UI maxHeight: '125px', // constrain images so we don't overwhelm the UI
maxWidth: "300px", maxWidth: '300px',
padding: "0px 3px 3px 0px", padding: '0px 3px 3px 0px',
}, },
imgSmall: { imgSmall: {
maxHeight: "200px", // constrain images so we don't overwhelm the UI maxHeight: '200px', // constrain images so we don't overwhelm the UI
maxWidth: "100%", maxWidth: '100%',
padding: "0px 1px 1px 0px", padding: '0px 1px 1px 0px',
}, },
})); }));
@@ -44,13 +44,13 @@ export const Image = ({ link, handleClick, small }) => {
<IconButton <IconButton
className={classes.imgButton} className={classes.imgButton}
onClick={handleClick} onClick={handleClick}
size="small" size='small'
> >
<CloseIcon /> <CloseIcon />
</IconButton> </IconButton>
)} )}
<img <img
alt="small avatar" alt='small avatar'
className={small ? classes.imgSmall : classes.img} className={small ? classes.imgSmall : classes.img}
src={link} src={link}
/> />
@@ -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 }) => { export const ImageDisplay = ({ visible, images, removeImage, small }) => {
if (!visible || !images || images.length === 0) return null; 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 ( return (
<div style={styles}> <div style={styles}>
@@ -1,16 +1,16 @@
import React from "react"; import React from 'react';
import { useTranslation } from "react-i18next"; import { useTranslation } from 'react-i18next';
import { makeStyles } from "@material-ui/core/styles"; import { makeStyles } from '@material-ui/core/styles';
import { TextField } from "@material-ui/core"; import { TextField } from '@material-ui/core';
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
textField: { textField: {
flex: "1 1 100%", flex: '1 1 100%',
padding: "10px 15px", padding: '10px 15px',
marginTop: "15px", marginTop: '15px',
}, },
textFieldInput: { textFieldInput: {
fontSize: "22px", fontSize: '22px',
}, },
})); }));
@@ -26,8 +26,8 @@ export const ImagePrompt = ({ visible, value, handleChange }) => {
className={classes.textField} className={classes.textField}
onChange={handleChange} onChange={handleChange}
multiline multiline
size="small" size='small'
placeholder={t("APPS_TWITTER_IMAGE_PLACEHOLDER")} placeholder={t('APPS_TWITTER_IMAGE_PLACEHOLDER')}
inputRef={(input) => input && input.focus()} inputRef={(input) => input && input.focus()}
/> />
); );
Loaded 100 of 195 files, more files were not shown because too many files have changed in this diff. Show more