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