more formatting

This commit is contained in:
Christopher committed 2021-03-02 20:45:41 +01:00
1 parent 046447b0fb
commit f552c1212c
157 files changed
+558 -1502

No files matched your search

+2
View File
@@ -5,3 +5,5 @@ node_modules
.idea .idea
.github .github
.vscode .vscode
resources/html
resources/dist
-2
View File
@@ -1,2 +0,0 @@
build
node_modules
+1 -10
View File
@@ -65,8 +65,6 @@
"file-loader": "^3.0.1", "file-loader": "^3.0.1",
"html-loader": "^0.5.5", "html-loader": "^0.5.5",
"html-webpack-plugin": "^4.3.0", "html-webpack-plugin": "^4.3.0",
"lint-staged": "^10.5.3",
"prettier": "^2.0.5",
"react-devtools": "^4.10.1", "react-devtools": "^4.10.1",
"react-test-renderer": "^16.13.1", "react-test-renderer": "^16.13.1",
"style-loader": "^0.23.1", "style-loader": "^0.23.1",
@@ -82,22 +80,15 @@
"copy:config": "cp-cli ../config.json ./src/config.autogen.json", "copy:config": "cp-cli ../config.json ./src/config.autogen.json",
"start": "yarn copy:config && react-scripts start", "start": "yarn copy:config && react-scripts start",
"watch": "cra-build-watch --disable-chunks --build-path ../resources/html --output-filename dev.js", "watch": "cra-build-watch --disable-chunks --build-path ../resources/html --output-filename dev.js",
"format": "prettier --write src/**/*.{js,jsx,ts,tsx,json,css,scss,md}",
"build": "yarn copy:config && cross-env NODE_ENV=production webpack --config webpack/prod.config.js --color -p --progress --hide-modules --display-optimization-bailout", "build": "yarn copy:config && cross-env NODE_ENV=production webpack --config webpack/prod.config.js --color -p --progress --hide-modules --display-optimization-bailout",
"build:dev": "cross-env NODE_ENV=development webpack --config webpack/dev.config.js --color -p --progress --hide-modules --display-optimization-bailout --analyze", "build:dev": "cross-env NODE_ENV=development webpack --config webpack/dev.config.js --color -p --progress --hide-modules --display-optimization-bailout --analyze",
"test": "react-scripts test --watchAll=false --testMatch **/src/**/*.test.{ts,js,tsx}", "test": "react-scripts test --watchAll=false --testMatch **/src/**/*.test.{ts,js,tsx}",
"test:watch": "react-scripts test --watchAll --testMatch **/src/**/*.test.{ts,js,tsx}", "test:watch": "react-scripts test --watchAll --testMatch **/src/**/*.test.{ts,js,tsx}",
"eject": "react-scripts eject", "eject": "react-scripts eject"
"precommit": "npm run test && lint-staged"
}, },
"eslintConfig": { "eslintConfig": {
"extends": "react-app" "extends": "react-app"
}, },
"lint-staged": {
"*": [
"prettier --write src/**/*.{js,jsx,ts,tsx,json,css,scss,md}"
]
},
"browserslist": { "browserslist": {
"production": [ "production": [
">0.2%", ">0.2%",
-10
View File
@@ -1,10 +0,0 @@
// Taso: Including some default values for clarity sake
module.exports = {
trailingComma: 'es5',
tabWidth: 2,
semi: true,
singleQuote: true,
jsxSingleQuote: true,
jsxBracketSameLine: false,
bracketSpacing: true,
};
+1 -1
View File
@@ -7,6 +7,6 @@ it('renders Phone', () => {
shallow( shallow(
<RecoilRoot> <RecoilRoot>
<Phone /> <Phone />
</RecoilRoot> </RecoilRoot>,
); );
}); });
+9 -11
View File
@@ -52,11 +52,11 @@ function Phone() {
const { bottom, visibility } = usePhoneVisibility(); const { bottom, visibility } = usePhoneVisibility();
return ( return (
<Slide direction='up' in={visibility}> <Slide direction="up" in={visibility}>
<div className='PhoneWrapper'> <div className="PhoneWrapper">
<div> <div>
<div <div
className='Phone' className="Phone"
style={{ style={{
transformOrigin: 'right bottom', transformOrigin: 'right bottom',
transform: `scale(${settings.zoom}`, transform: `scale(${settings.zoom}`,
@@ -64,26 +64,24 @@ function Phone() {
}} }}
> >
<div <div
className='PhoneFrame' className="PhoneFrame"
style={{ style={{
backgroundImage: `url(./media/frames/${settings.frame})`, backgroundImage: `url(./media/frames/${settings.frame})`,
}} }}
/> />
<div <div
id='phone' id="phone"
className='PhoneScreen' className="PhoneScreen"
style={{ style={{
backgroundImage: `url(./media/backgrounds/${settings.wallpaper})`, backgroundImage: `url(./media/backgrounds/${settings.wallpaper})`,
}} }}
> >
<> <>
<NotificationBar /> <NotificationBar />
<div className='PhoneAppContainer'> <div className="PhoneAppContainer">
<> <>
<Route exact path='/' component={HomeApp} /> <Route exact path="/" component={HomeApp} />
{callModal && ( {callModal && <Route exact path="/call" component={CallModal} />}
<Route exact path='/call' component={CallModal} />
)}
{apps.map((App) => ( {apps.map((App) => (
<App.Route key={App.id} /> <App.Route key={App.id} />
))} ))}
+1 -2
View File
@@ -6,8 +6,7 @@
font-family: 'Bahnschrift Regular'; font-family: 'Bahnschrift Regular';
font-style: normal; font-style: normal;
font-weight: normal; font-weight: normal;
src: local('Bahnschrift Regular'), src: local('Bahnschrift Regular'), url('../fonts/BAHNSCHRIFT.woff') format('woff');
url('../fonts/BAHNSCHRIFT.woff') format('woff');
} }
#account-section, #account-section,
+4 -4
View File
@@ -99,15 +99,15 @@ export const BankApp = () => {
const classes = useStyles(); const classes = useStyles();
return ( return (
<AppWrapper id='bank-app'> <AppWrapper id="bank-app">
<BankTitle /> <BankTitle />
<TransferModal /> <TransferModal />
<div className={showBankModal ? classes.backgroundModal : undefined} /> <div className={showBankModal ? classes.backgroundModal : undefined} />
<AppContent> <AppContent>
<Switch> <Switch>
<Route path='/bank' exact component={BankHome} /> <Route path="/bank" exact component={BankHome} />
<Route path='/bank/account' exact component={BankAccount} /> <Route path="/bank/account" exact component={BankAccount} />
<Route path='/bank/transactions' exact component={TransactionList} /> <Route path="/bank/transactions" exact component={TransactionList} />
</Switch> </Switch>
</AppContent> </AppContent>
<NavigationBar /> <NavigationBar />
+2 -2
View File
@@ -23,8 +23,8 @@ const useStyles = makeStyles((theme) => ({
export const BankTitle = () => { export const BankTitle = () => {
const classes = useStyles(); const classes = useStyles();
return ( return (
<Paper className={classes.root} square variant='outlined' elevation={24}> <Paper className={classes.root} square variant="outlined" elevation={24}>
<Typography id='bank-title' style={{ margin: 0 }} variant='h4'> <Typography id="bank-title" style={{ margin: 0 }} variant="h4">
WhoDis Banking WhoDis Banking
</Typography> </Typography>
</Paper> </Paper>
@@ -16,7 +16,7 @@ export const AccountTransactions = (): any => {
const { transactionList } = useTransactions(); const { transactionList } = useTransactions();
const { t } = useTranslation(); const { t } = useTranslation();
return ( return (
<div id='account-section'> <div id="account-section">
<div className={classes.header}> <div className={classes.header}>
<h2 className={classes.title}>{t('APPS_BANK_ACCOUNT_TRANSACTIONS')}</h2> <h2 className={classes.title}>{t('APPS_BANK_ACCOUNT_TRANSACTIONS')}</h2>
<Button className={classes.seeAll}> <Button className={classes.seeAll}>
@@ -27,7 +27,7 @@ export const BankAccount = () => {
</div> </div>
<BankCard <BankCard
name={credentials.name} name={credentials.name}
account='Checking' account="Checking"
balance={credentials.balance} balance={credentials.balance}
/> />
<AccountTransactions /> <AccountTransactions />
@@ -32,13 +32,10 @@ export const BankHome = () => {
<p className={classes.accountBalance}>{credentials.balance}</p> <p className={classes.accountBalance}>{credentials.balance}</p>
</div> </div>
<div className={classes.actions}> <div className={classes.actions}>
<Button id='actionButton' className={classes.actionButton}> <Button id="actionButton" className={classes.actionButton}>
<NavLink to='/bank/account'>{t('APPS_BANK_ACCOUNT_LINK')}</NavLink> <NavLink to="/bank/account">{t('APPS_BANK_ACCOUNT_LINK')}</NavLink>
</Button> </Button>
<Button <Button onClick={openTransactionsModal} className={classes.actionButton}>
onClick={openTransactionsModal}
className={classes.actionButton}
>
{t('APPS_BANK_ACTIONS_TRANSFER')} {t('APPS_BANK_ACTIONS_TRANSFER')}
</Button> </Button>
</div> </div>
@@ -4,11 +4,7 @@ import { Link } from 'react-router-dom';
import { BottomNavigation, BottomNavigationAction } from '@material-ui/core'; import { BottomNavigation, BottomNavigationAction } from '@material-ui/core';
import { makeStyles } from '@material-ui/core/styles'; import { makeStyles } from '@material-ui/core/styles';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { import { faHome, faList, faMoneyCheck } from '@fortawesome/free-solid-svg-icons';
faHome,
faList,
faMoneyCheck,
} from '@fortawesome/free-solid-svg-icons';
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
root: { root: {
@@ -37,17 +33,17 @@ export const NavigationBar = () => {
<BottomNavigationAction <BottomNavigationAction
component={Link} component={Link}
icon={<FontAwesomeIcon icon={faHome} />} icon={<FontAwesomeIcon icon={faHome} />}
to='/bank' to="/bank"
/> />
<BottomNavigationAction <BottomNavigationAction
component={Link} component={Link}
icon={<FontAwesomeIcon icon={faMoneyCheck} />} icon={<FontAwesomeIcon icon={faMoneyCheck} />}
to='/bank/account' to="/bank/account"
/> />
<BottomNavigationAction <BottomNavigationAction
component={Link} component={Link}
icon={<FontAwesomeIcon icon={faList} />} icon={<FontAwesomeIcon icon={faList} />}
to='/bank/transactions' to="/bank/transactions"
/> />
</BottomNavigation> </BottomNavigation>
); );
@@ -27,7 +27,7 @@ export const TransactionList = () => {
}; };
return ( return (
<div id='transaction-section'> <div id="transaction-section">
<div className={classes.header}> <div className={classes.header}>
<h2 className={classes.title}>{t('APPS_BANK_ACCOUNT_TRANSACTIONS')}</h2> <h2 className={classes.title}>{t('APPS_BANK_ACCOUNT_TRANSACTIONS')}</h2>
</div> </div>
@@ -52,7 +52,7 @@ export const TransactionList = () => {
<TablePagination <TablePagination
rowsPerPageOptions={[3, 5]} rowsPerPageOptions={[3, 5]}
className={classes.pagination} className={classes.pagination}
component='div' component="div"
count={transactionList.length} count={transactionList.length}
rowsPerPage={rowsPerPage} rowsPerPage={rowsPerPage}
page={page} page={page}
@@ -1,12 +1,6 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import Modal from '../../../../ui/components/Modal'; import Modal from '../../../../ui/components/Modal';
import { import { Button, List, ListItem, TextField, makeStyles } from '@material-ui/core';
Button,
List,
ListItem,
TextField,
makeStyles,
} from '@material-ui/core';
import Nui from '../../../../os/nui-events/utils/Nui'; import Nui from '../../../../os/nui-events/utils/Nui';
@@ -64,8 +58,8 @@ export const TransferModal = () => {
<TextField <TextField
inputProps={{ className: classes.modalInputCenter }} inputProps={{ className: classes.modalInputCenter }}
fullWidth fullWidth
type='number' type="number"
placeholder='ID' placeholder="ID"
value={targetID} value={targetID}
onChange={(e) => setTargetID(e.target.value)} onChange={(e) => setTargetID(e.target.value)}
/> />
@@ -73,9 +67,9 @@ export const TransferModal = () => {
<ListItem> <ListItem>
<TextField <TextField
inputProps={{ className: classes.modalInputCenter }} inputProps={{ className: classes.modalInputCenter }}
placeholder='Amount' placeholder="Amount"
fullWidth fullWidth
type='number' type="number"
value={amount} value={amount}
onChange={(e) => setAmount(e.target.value)} onChange={(e) => setAmount(e.target.value)}
/> />
@@ -83,7 +77,7 @@ export const TransferModal = () => {
<ListItem> <ListItem>
<TextField <TextField
inputProps={{ className: classes.modalInput }} inputProps={{ className: classes.modalInput }}
placeholder='Message' placeholder="Message"
fullWidth fullWidth
value={message} value={message}
multiline multiline
@@ -56,14 +56,14 @@ export const Calculator = ({ ...props }) => {
minimumFractionDigits: 0, minimumFractionDigits: 0,
maximumFractionDigits: 4, maximumFractionDigits: 4,
}), }),
[result] [result],
); );
return ( return (
<Box display='flex' flexDirection='column'> <Box display="flex" flexDirection="column">
<Box flexGrow={1} component={Paper} p={4} className={classes.result}> <Box flexGrow={1} component={Paper} p={4} className={classes.result}>
<Fab <Fab
size='small' size="small"
onClick={() => { onClick={() => {
setClipboard(resultStr); setClipboard(resultStr);
addAlert({ message: 'CALCULATOR_COPIED', type: 'info' }); addAlert({ message: 'CALCULATOR_COPIED', type: 'info' });
@@ -75,7 +75,7 @@ export const Calculator = ({ ...props }) => {
{resultStr} {resultStr}
</Box> </Box>
<Box> <Box>
<Grid container justify='space-around'> <Grid container justify="space-around">
<CalcButton button={clear} className={classes.button} /> <CalcButton button={clear} className={classes.button} />
<CalcButton button={clearAll} className={classes.button} /> <CalcButton button={clearAll} className={classes.button} />
<CalcButton button={divider} className={classes.button} /> <CalcButton button={divider} className={classes.button} />
@@ -5,37 +5,37 @@ export const CalculatorIcon = ({ ...props }: SvgIconProps) => {
return ( return (
<SvgIcon {...props}> <SvgIcon {...props}>
<svg <svg
xmlns='http://www.w3.org/2000/svg' xmlns="http://www.w3.org/2000/svg"
x='0' x="0"
y='0' y="0"
enableBackground='new 0 0 56 56' enableBackground="new 0 0 56 56"
version='1.1' version="1.1"
viewBox='0 0 56 56' viewBox="0 0 56 56"
xmlSpace='preserve' xmlSpace="preserve"
> >
<path fill='#EBBA16' d='M0 0H28V28H0z'></path> <path fill="#EBBA16" d="M0 0H28V28H0z"></path>
<path fill='#ED8A19' d='M28 0H56V28H28z'></path> <path fill="#ED8A19" d="M28 0H56V28H28z"></path>
<path fill='#ED8A19' d='M0 28H28V56H0z'></path> <path fill="#ED8A19" d="M0 28H28V56H0z"></path>
<path fill='#556080' d='M28 28H56V56H28z'></path> <path fill="#556080" d="M28 28H56V56H28z"></path>
<path <path
fill='#FFF' fill="#FFF"
d='M48 46H36a1 1 0 110-2h12a1 1 0 110 2zM48 40H36a1 1 0 110-2h12a1 1 0 110 2zM14 43a.999.999 0 01-.707-1.707l5-5a.999.999 0 111.414 1.414l-5 5A.997.997 0 0114 43z' d="M48 46H36a1 1 0 110-2h12a1 1 0 110 2zM48 40H36a1 1 0 110-2h12a1 1 0 110 2zM14 43a.999.999 0 01-.707-1.707l5-5a.999.999 0 111.414 1.414l-5 5A.997.997 0 0114 43z"
></path> ></path>
<path <path
fill='#FFF' fill="#FFF"
d='M9 48a.999.999 0 01-.707-1.707l5-5a.999.999 0 111.414 1.414l-5 5A.997.997 0 019 48z' d="M9 48a.999.999 0 01-.707-1.707l5-5a.999.999 0 111.414 1.414l-5 5A.997.997 0 019 48z"
></path> ></path>
<path <path
fill='#FFF' fill="#FFF"
d='M19 48a.997.997 0 01-.707-.293l-5-5a.999.999 0 111.414-1.414l5 5A.999.999 0 0119 48z' d="M19 48a.997.997 0 01-.707-.293l-5-5a.999.999 0 111.414-1.414l5 5A.999.999 0 0119 48z"
></path> ></path>
<path <path
fill='#FFF' fill="#FFF"
d='M14 43a.997.997 0 01-.707-.293l-5-5a.999.999 0 111.414-1.414l5 5A.999.999 0 0114 43zM20 15H8a1 1 0 110-2h12a1 1 0 110 2z' d="M14 43a.997.997 0 01-.707-.293l-5-5a.999.999 0 111.414-1.414l5 5A.999.999 0 0114 43zM20 15H8a1 1 0 110-2h12a1 1 0 110 2z"
></path> ></path>
<path <path
fill='#FFF' fill="#FFF"
d='M14 21a1 1 0 01-1-1V8a1 1 0 112 0v12a1 1 0 01-1 1zM48 15H36a1 1 0 110-2h12a1 1 0 110 2z' d="M14 21a1 1 0 01-1-1V8a1 1 0 112 0v12a1 1 0 01-1 1zM48 15H36a1 1 0 110-2h12a1 1 0 110 2z"
></path> ></path>
</svg> </svg>
</SvgIcon> </SvgIcon>
@@ -25,11 +25,11 @@ InjectDebugData([
const CameraApp = () => { const CameraApp = () => {
return ( return (
<AppWrapper id='camera-app'> <AppWrapper id="camera-app">
<AppContent> <AppContent>
<Switch> <Switch>
<Route path='/camera' exact component={GalleryGrid} /> <Route path="/camera" exact component={GalleryGrid} />
<Route path='/camera/image' exact component={GalleryModal} /> <Route path="/camera/image" exact component={GalleryModal} />
</Switch> </Switch>
</AppContent> </AppContent>
</AppWrapper> </AppWrapper>
@@ -14,9 +14,7 @@ export const GalleryGrid = () => {
const history = useHistory(); const history = useHistory();
const query = useQueryParams(); const query = useQueryParams();
const referal = query.referal const referal = query.referal ? decodeURIComponent(query.referal) : '/camera/image';
? decodeURIComponent(query.referal)
: '/camera/image';
const photos = usePhotos(); const photos = usePhotos();
@@ -25,17 +23,15 @@ export const GalleryGrid = () => {
}; };
const handlePhotoOpen = (photo) => { const handlePhotoOpen = (photo) => {
history.push( history.push(addQueryToLocation(getLocationFromUrl(referal), 'image', photo.image));
addQueryToLocation(getLocationFromUrl(referal), 'image', photo.image)
);
}; };
if (!photos) if (!photos)
return ( return (
<Box <Box
display='flex' display="flex"
flexWrap='wrap' flexWrap="wrap"
alignContent='flex-start' alignContent="flex-start"
className={classes.root} className={classes.root}
> >
<Box> <Box>
@@ -44,7 +40,7 @@ export const GalleryGrid = () => {
style={{ borderRadius: 0 }} style={{ borderRadius: 0 }}
className={classes.photo} className={classes.photo}
> >
<AddIcon fontSize='large' /> <AddIcon fontSize="large" />
</Button> </Button>
</Box> </Box>
</Box> </Box>
@@ -53,9 +49,9 @@ export const GalleryGrid = () => {
return ( return (
<div> <div>
<Box <Box
display='flex' display="flex"
flexWrap='wrap' flexWrap="wrap"
alignContent='flex-start' alignContent="flex-start"
className={classes.root} className={classes.root}
> >
<Box> <Box>
@@ -64,7 +60,7 @@ export const GalleryGrid = () => {
style={{ borderRadius: 0 }} style={{ borderRadius: 0 }}
className={classes.photo} className={classes.photo}
> >
<AddIcon fontSize='large' /> <AddIcon fontSize="large" />
</Button> </Button>
</Box> </Box>
{photos.map((photo) => ( {photos.map((photo) => (
@@ -20,7 +20,7 @@ export const GalleryModal = () => {
const meta: ICameraPhoto = useMemo( const meta: ICameraPhoto = useMemo(
() => ({ id: query.id as string, image: query.image as string }), () => ({ id: query.id as string, image: query.image as string }),
[query] [query],
); );
const _handleClose = () => { const _handleClose = () => {
@@ -42,11 +42,7 @@ export const GalleryModal = () => {
return ( return (
<> <>
<ShareModal <ShareModal referal={referal} meta={shareOpen} onClose={() => setShareOpen(null)} />
referal={referal}
meta={shareOpen}
onClose={() => setShareOpen(null)}
/>
<Paper className={classes.modal}> <Paper className={classes.modal}>
<div className={shareOpen ? classes.backgroundModal : null} /> <div className={shareOpen ? classes.backgroundModal : null} />
<Button onClick={_handleClose}> <Button onClick={_handleClose}>
@@ -58,10 +54,10 @@ export const GalleryModal = () => {
/> />
<div className={classes.actionDiv}> <div className={classes.actionDiv}>
<Button onClick={handleDeletePhoto}> <Button onClick={handleDeletePhoto}>
<DeleteIcon fontSize='large' /> <DeleteIcon fontSize="large" />
</Button> </Button>
<Button onClick={handleSharePhoto}> <Button onClick={handleSharePhoto}>
<ShareIcon fontSize='large' /> <ShareIcon fontSize="large" />
</Button> </Button>
</div> </div>
</Paper> </Paper>
@@ -33,7 +33,7 @@ export const ShareModal = ({ meta, onClose, referal }: IShareModalProps) => {
</h4> </h4>
<Button>{<MessageIcon />} Message</Button> <Button>{<MessageIcon />} Message</Button>
<h4>Or just copy the image here:</h4> <h4>Or just copy the image here:</h4>
<Button onClick={handleCopyImage} variant='contained'> <Button onClick={handleCopyImage} variant="contained">
Copy image Copy image
</Button> </Button>
</> </>
@@ -15,11 +15,11 @@ export const ContactsApp = () => {
return ( return (
<ContactsThemeProvider> <ContactsThemeProvider>
<AppWrapper id='contact-app'> <AppWrapper id="contact-app">
<AppTitle app={contacts} /> <AppTitle app={contacts} />
<AppContent> <AppContent>
<Route path='/contacts/' exact component={ContactPage} /> <Route path="/contacts/" exact component={ContactPage} />
<Route path='/contacts/:id' exact component={ContactsInfoPage} /> <Route path="/contacts/:id" exact component={ContactsInfoPage} />
</AppContent> </AppContent>
</AppWrapper> </AppWrapper>
</ContactsThemeProvider> </ContactsThemeProvider>
@@ -56,8 +56,7 @@ export const ContactList = () => {
{contacts {contacts
.filter( .filter(
(contact) => (contact) =>
contact.display.match(filteredRegEx) || contact.display.match(filteredRegEx) || contact.number.match(filteredRegEx),
contact.number.match(filteredRegEx)
) )
.map((contact) => ( .map((contact) => (
<ListItem key={contact.id} divider> <ListItem key={contact.id} divider>
@@ -65,25 +64,17 @@ export const ContactList = () => {
{contact.avatar ? ( {contact.avatar ? (
<MuiAvatar src={contact.avatar} /> <MuiAvatar src={contact.avatar} />
) : ( ) : (
<MuiAvatar> <MuiAvatar>{contact.display.slice(0, 1).toUpperCase()}</MuiAvatar>
{contact.display.slice(0, 1).toUpperCase()}
</MuiAvatar>
)} )}
</ListItemAvatar> </ListItemAvatar>
<ListItemText <ListItemText primary={contact.display} secondary={contact.number} />
primary={contact.display}
secondary={contact.number}
/>
<Button onClick={() => startCall(contact.number)}> <Button onClick={() => startCall(contact.number)}>
<PhoneIcon /> <PhoneIcon />
</Button> </Button>
<Button onClick={() => handleMessage(contact.number)}> <Button onClick={() => handleMessage(contact.number)}>
<ChatIcon /> <ChatIcon />
</Button> </Button>
<Button <Button style={{ margin: -15 }} onClick={() => openContactInfo(contact.id)}>
style={{ margin: -15 }}
onClick={() => openContactInfo(contact.id)}
>
<MoreVertIcon /> <MoreVertIcon />
</Button> </Button>
</ListItem> </ListItem>
@@ -53,7 +53,7 @@ const useStyles = makeStyles((theme: Theme) =>
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
}, },
}) }),
); );
export const SearchContacts = () => { export const SearchContacts = () => {
@@ -1,11 +1,5 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { import { Avatar as MuiAvatar, Box, Button, Paper, TextField } from '@material-ui/core';
Avatar as MuiAvatar,
Box,
Button,
Paper,
TextField,
} from '@material-ui/core';
import { makeStyles, Theme } from '@material-ui/core/styles'; import { makeStyles, Theme } from '@material-ui/core/styles';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useHistory, useParams } from 'react-router-dom'; import { useHistory, useParams } from 'react-router-dom';
@@ -123,7 +117,7 @@ const ContactsInfoPage = () => {
return ( return (
<Paper className={classes.root} square> <Paper className={classes.root} square>
<Button style={{ margin: 10 }} onClick={() => history.goBack()}> <Button style={{ margin: 10 }} onClick={() => history.goBack()}>
<ArrowBackIcon fontSize='large' /> <ArrowBackIcon fontSize="large" />
</Button> </Button>
<div className={classes.listContainer}> <div className={classes.listContainer}>
<MuiAvatar className={classes.avatar} src={avatar} /> <MuiAvatar className={classes.avatar} src={avatar} />
@@ -161,21 +155,13 @@ const ContactsInfoPage = () => {
{/* Display if fetched contact */} {/* Display if fetched contact */}
{contact && ( {contact && (
<> <>
<Box py={1} display='block'> <Box py={1} display="block">
<Button <Button color="primary" variant="contained" onClick={handleContactSave}>
color='primary'
variant='contained'
onClick={handleContactSave}
>
{t('GENERIC_UPDATE')} {t('GENERIC_UPDATE')}
</Button> </Button>
</Box> </Box>
<Box py={1} display='block'> <Box py={1} display="block">
<Button <Button variant="contained" color="secondary" onClick={handleContactDelete}>
variant='contained'
color='secondary'
onClick={handleContactDelete}
>
{t('GENERIC_DELETE')} {t('GENERIC_DELETE')}
</Button> </Button>
</Box> </Box>
@@ -183,12 +169,8 @@ const ContactsInfoPage = () => {
)} )}
{/* Display if no fetched contact */} {/* Display if no fetched contact */}
{!contact && ( {!contact && (
<Box display='block'> <Box display="block">
<Button <Button color="primary" variant="contained" onClick={handleContactAdd}>
color='primary'
variant='contained'
onClick={handleContactAdd}
>
{t('APPS_CONTACT_MODAL_BUTTON_ADD')} {t('APPS_CONTACT_MODAL_BUTTON_ADD')}
</Button> </Button>
</Box> </Box>
@@ -26,7 +26,7 @@ export const ContactPage = () => {
<> <>
<ContactList /> <ContactList />
<Fab <Fab
color='primary' color="primary"
onClick={() => history.push('/contacts/-1')} onClick={() => history.push('/contacts/-1')}
className={classes.absolute} className={classes.absolute}
> >
+2 -2
View File
@@ -17,7 +17,7 @@ export const useContacts = (): IUseContacts => {
const found = contacts.find((contact) => contact.number === number); const found = contacts.find((contact) => contact.number === number);
return found ? found.display : number; return found ? found.display : number;
}, },
[contacts] [contacts],
); );
const getContact = useCallback( const getContact = useCallback(
(id: number): Contact | null => { (id: number): Contact | null => {
@@ -25,7 +25,7 @@ export const useContacts = (): IUseContacts => {
if (contact.id === id) return contact; if (contact.id === id) return contact;
} }
}, },
[contacts] [contacts],
); );
return { contacts, getDisplayByNumber, getContact }; return { contacts, getDisplayByNumber, getContact };
}; };
@@ -8,7 +8,7 @@ interface FilterdContactsProps {
export const useFilteredContacts = (): FilterdContactsProps => { export const useFilteredContacts = (): FilterdContactsProps => {
const [filteredContacts, setFilteredContacts] = useRecoilState( const [filteredContacts, setFilteredContacts] = useRecoilState(
contactsState.filterContacts contactsState.filterContacts,
); );
return { filteredContacts, setFilteredContacts }; return { filteredContacts, setFilteredContacts };
}; };
@@ -19,12 +19,7 @@ const ButtonItem = ({ label, onClick }: IBtnItem) => {
const classes = useStyles(); const classes = useStyles();
return ( return (
<Grid key={label} item xs={4}> <Grid key={label} item xs={4}>
<Button <Button fullWidth size="large" className={classes.gridItem} onClick={onClick}>
fullWidth
size='large'
className={classes.gridItem}
onClick={onClick}
>
{label} {label}
</Button> </Button>
</Grid> </Grid>
@@ -35,8 +30,8 @@ export const DialGrid = () => {
const { add, removeOne, clear } = useContext(DialInputCtx); const { add, removeOne, clear } = useContext(DialInputCtx);
return ( return (
<Box height='100%'> <Box height="100%">
<Grid container justify='space-around'> <Grid container justify="space-around">
<ButtonItem label={1} onClick={() => add(1)} /> <ButtonItem label={1} onClick={() => add(1)} />
<ButtonItem label={2} onClick={() => add(2)} /> <ButtonItem label={2} onClick={() => add(2)} />
<ButtonItem label={3} onClick={() => add(3)} /> <ButtonItem label={3} onClick={() => add(3)} />
@@ -46,10 +41,10 @@ export const DialGrid = () => {
<ButtonItem label={7} onClick={() => add(7)} /> <ButtonItem label={7} onClick={() => add(7)} />
<ButtonItem label={8} onClick={() => add(8)} /> <ButtonItem label={8} onClick={() => add(8)} />
<ButtonItem label={9} onClick={() => add(9)} /> <ButtonItem label={9} onClick={() => add(9)} />
<ButtonItem label='*' onClick={clear} /> <ButtonItem label="*" onClick={clear} />
<ButtonItem label={0} onClick={() => add(0)} /> <ButtonItem label={0} onClick={() => add(0)} />
<ButtonItem label='#' onClick={removeOne} /> <ButtonItem label="#" onClick={removeOne} />
<ButtonItem label='-' onClick={() => add('-')} /> <ButtonItem label="-" onClick={() => add('-')} />
</Grid> </Grid>
</Box> </Box>
); );
@@ -22,13 +22,13 @@ export const DialerApp = () => {
<AppTitle app={dialer} /> <AppTitle app={dialer} />
<AppContent> <AppContent>
<Switch> <Switch>
<Route path='/phone/dial'> <Route path="/phone/dial">
<DialPage /> <DialPage />
</Route> </Route>
<Route exact path='/phone'> <Route exact path="/phone">
<DialerHistory calls={history} /> <DialerHistory calls={history} />
</Route> </Route>
<Route path='/phone/contacts' component={ContactList}></Route> <Route path="/phone/contacts" component={ContactList}></Route>
</Switch> </Switch>
</AppContent> </AppContent>
<DialerNavBar /> <DialerNavBar />
@@ -45,18 +45,15 @@ export const DialerInput = () => {
return ( return (
<Box component={Paper} className={classes.root}> <Box component={Paper} className={classes.root}>
<InputBase <InputBase
placeholder='Enter a number' placeholder="Enter a number"
className={classes.input} className={classes.input}
value={inputVal} value={inputVal}
/> />
<IconButton color='primary' className={classes.iconBtn}> <IconButton color="primary" className={classes.iconBtn}>
<PhoneIcon fontSize='large' onClick={() => handleCall(inputVal)} /> <PhoneIcon fontSize="large" onClick={() => handleCall(inputVal)} />
</IconButton> </IconButton>
<IconButton className={classes.iconBtn}> <IconButton className={classes.iconBtn}>
<PersonAddIcon <PersonAddIcon fontSize="large" onClick={() => handleNewContact(inputVal)} />
fontSize='large'
onClick={() => handleNewContact(inputVal)}
/>
</IconButton> </IconButton>
</Box> </Box>
); );
@@ -33,27 +33,27 @@ const DialerNavBar = () => {
className={classes.root} className={classes.root}
> >
<BottomNavigationAction <BottomNavigationAction
label='History' label="History"
value='/phone' value="/phone"
component={NavLink} component={NavLink}
icon={<HistoryIcon />} icon={<HistoryIcon />}
to='/phone' to="/phone"
/> />
<BottomNavigationAction <BottomNavigationAction
label='Dial' label="Dial"
value='/phone/dial' value="/phone/dial"
color='secondary' color="secondary"
component={NavLink} component={NavLink}
icon={<PhoneIcon />} icon={<PhoneIcon />}
to='/phone/dial' to="/phone/dial"
/> />
<BottomNavigationAction <BottomNavigationAction
label='Contacts' label="Contacts"
value='/phone/contacts' value="/phone/contacts"
color='secondary' color="secondary"
component={NavLink} component={NavLink}
icon={<PersonIcon />} icon={<PersonIcon />}
to='/phone/contacts' to="/phone/contacts"
/> />
</BottomNavigation> </BottomNavigation>
); );
@@ -42,15 +42,10 @@ export const DialerHistory = ({ calls }) => {
if (!calls?.length) { if (!calls?.length) {
return ( return (
<Box <Box display="flex" justifyContent="center" alignItems="center" paddingTop={35}>
display='flex'
justifyContent='center'
alignItems='center'
paddingTop={35}
>
<p> <p>
You got no friends! You got no friends!
<span role='img' aria-label='deal with it'> <span role="img" aria-label="deal with it">
😎 😎
</span> </span>
</p> </p>
@@ -79,7 +74,7 @@ export const DialerHistory = ({ calls }) => {
<IconButton <IconButton
onClick={() => onClick={() =>
history.push( history.push(
`/contacts/-1?addNumber=${call.transmitter}&referal=/phone/contacts` `/contacts/-1?addNumber=${call.transmitter}&referal=/phone/contacts`,
) )
} }
> >
@@ -105,7 +100,7 @@ export const DialerHistory = ({ calls }) => {
<IconButton <IconButton
onClick={() => onClick={() =>
history.push( history.push(
`/contacts/-1?addNumber=${call.transmitter}&referal=/phone/contacts` `/contacts/-1?addNumber=${call.transmitter}&referal=/phone/contacts`,
) )
} }
> >
@@ -113,7 +108,7 @@ export const DialerHistory = ({ calls }) => {
</IconButton> </IconButton>
) : null} ) : null}
</ListItem> </ListItem>
) ),
)} )}
</List> </List>
); );
@@ -32,7 +32,7 @@ export const ExampleApp = () => {
<AppTitle app={example} /> <AppTitle app={example} />
<AppContent> <AppContent>
<h1>This is an example</h1> <h1>This is an example</h1>
<Button color='primary'>{example.id}</Button> <Button color="primary">{example.id}</Button>
{/* Here we are using the value in a h3 tag */} {/* Here we are using the value in a h3 tag */}
<h3>{exampleString}</h3> <h3>{exampleString}</h3>
<IconButton onClick={() => (playing ? stop() : play())}> <IconButton onClick={() => (playing ? stop() : play())}>
+1 -1
View File
@@ -8,7 +8,7 @@ export const HomeApp = () => {
const { apps } = useApps(); const { apps } = useApps();
return ( return (
<AppWrapper> <AppWrapper>
<Box component='div' mt={6} px={1}> <Box component="div" mt={6} px={1}>
{apps && <GridMenu xs={3} items={apps} />} {apps && <GridMenu xs={3} items={apps} />}
</Box> </Box>
</AppWrapper> </AppWrapper>
@@ -22,17 +22,14 @@ export const MessagesApp = () => {
return ( return (
<MessagesThemeProvider> <MessagesThemeProvider>
<AppWrapper id='messages-app'> <AppWrapper id="messages-app">
<AppTitle app={messages} /> <AppTitle app={messages} />
<AppContent> <AppContent>
<Switch> <Switch>
<Route <Route path="/messages/conversations/:groupId" component={MessageModal} />
path='/messages/conversations/:groupId'
component={MessageModal}
/>
<Route <Route
exact exact
path='/messages' path="/messages"
render={() => ( render={() => (
<> <>
<MessagesList /> <MessagesList />
@@ -34,9 +34,9 @@ const MessageInput = ({ messageGroupId, onAddImageClick }: IProps) => {
if (!messageGroupId) return null; if (!messageGroupId) return null;
return ( return (
<Paper variant='outlined' className={classes.root}> <Paper variant="outlined" className={classes.root}>
<form onSubmit={handleSubmit}> <form onSubmit={handleSubmit}>
<Box display='flex'> <Box display="flex">
<Box pl={1} flexGrow={1}> <Box pl={1} flexGrow={1}>
<TextField <TextField
fullWidth fullWidth
@@ -51,7 +51,7 @@ const MessageInput = ({ messageGroupId, onAddImageClick }: IProps) => {
<Button onClick={onAddImageClick}> <Button onClick={onAddImageClick}>
<ImageIcon /> <ImageIcon />
</Button> </Button>
<Button type='submit'> <Button type="submit">
<SendIcon /> <SendIcon />
</Button> </Button>
</Box> </Box>
@@ -15,13 +15,11 @@ interface INewMessageGroupButtonProps {
onClick(): void; onClick(): void;
} }
export function NewMessageGroupButton({ export function NewMessageGroupButton({ onClick }: INewMessageGroupButtonProps) {
onClick,
}: INewMessageGroupButtonProps) {
const classes = useStyles(); const classes = useStyles();
return ( return (
<Fab className={classes.root} color='primary' onClick={onClick}> <Fab className={classes.root} color="primary" onClick={onClick}>
<AddIcon /> <AddIcon />
</Fab> </Fab>
); );
@@ -33,7 +33,7 @@ const NewMessageGroupForm = ({ phoneNumber }: { phoneNumber?: string }) => {
// external characters out of them: // external characters out of them:
// 123-4567, 987-6543, 333-4444 // 123-4567, 987-6543, 333-4444
const phoneNumbers = participants.map(({ number }) => const phoneNumbers = participants.map(({ number }) =>
number.replace(/[^0-9]/g, '') number.replace(/[^0-9]/g, ''),
); );
const labelValue = isGroupChat ? label.trim() : null; const labelValue = isGroupChat ? label.trim() : null;
@@ -46,7 +46,7 @@ const NewMessageGroupForm = ({ phoneNumber }: { phoneNumber?: string }) => {
history.push('/messages'); history.push('/messages');
} }
}, },
[history, label, participants, isGroupChat] [history, label, participants, isGroupChat],
); );
const onAutocompleteChange = useCallback((_e, value: any) => { const onAutocompleteChange = useCallback((_e, value: any) => {
@@ -71,7 +71,7 @@ const NewMessageGroupForm = ({ phoneNumber }: { phoneNumber?: string }) => {
}} }}
/> />
), ),
[t] [t],
); );
const submitDisabled = !participants.length || (isGroupChat && !label); const submitDisabled = !participants.length || (isGroupChat && !label);
@@ -103,10 +103,10 @@ const NewMessageGroupForm = ({ phoneNumber }: { phoneNumber?: string }) => {
<Box px={2} py={3}> <Box px={2} py={3}>
<Button <Button
disabled={submitDisabled} disabled={submitDisabled}
variant='contained' variant="contained"
fullWidth fullWidth
color='primary' color="primary"
type='submit' type="submit"
> >
{t('APPS_MESSAGES_NEW_MESSAGE_GROUP_SUBMIT')} {t('APPS_MESSAGES_NEW_MESSAGE_GROUP_SUBMIT')}
</Button> </Button>
@@ -24,9 +24,7 @@ const MessageGroupItem = ({ messageGroup, handleClick }: IProps): any => {
<ListItemAvatar> <ListItemAvatar>
<MuiAvatar src={messageGroup?.avatar} /> <MuiAvatar src={messageGroup?.avatar} />
</ListItemAvatar> </ListItemAvatar>
<ListItemText> <ListItemText>{messageGroup.label || messageGroup.groupDisplay}</ListItemText>
{messageGroup.label || messageGroup.groupDisplay}
</ListItemText>
</ListItem> </ListItem>
); );
}; };
@@ -8,7 +8,7 @@ import useStyles from './list.styles';
interface IProps { interface IProps {
value: string; value: string;
handleChange: ( handleChange: (
event: React.ChangeEvent<HTMLTextAreaElement | HTMLInputElement> event: React.ChangeEvent<HTMLTextAreaElement | HTMLInputElement>,
) => void; ) => void;
} }
@@ -16,7 +16,7 @@ const MessageSearch = ({ value, handleChange }: IProps) => {
const { t } = useTranslation(); const { t } = useTranslation();
const classes = useStyles(); const classes = useStyles();
return ( return (
<Paper elevation={24} variant='outlined' className={classes.bg}> <Paper elevation={24} variant="outlined" className={classes.bg}>
<div className={classes.search}> <div className={classes.search}>
<div className={classes.searchIcon}> <div className={classes.searchIcon}>
<SearchIcon /> <SearchIcon />
@@ -24,17 +24,15 @@ const MessagesList = (): any => {
const goToConversation = useCallback( const goToConversation = useCallback(
(messageGroup) => (messageGroup) =>
history.push( history.push(
`/messages/conversations/${messageGroup.groupId}/?${qs.stringify( `/messages/conversations/${messageGroup.groupId}/?${qs.stringify(messageGroup)}`,
messageGroup
)}`
), ),
[history] [history],
); );
useEffect(() => { useEffect(() => {
if (createMessageGroupResult?.groupId) { if (createMessageGroupResult?.groupId) {
const findGroup = messageGroups.find( const findGroup = messageGroups.find(
(g) => g.groupId === createMessageGroupResult.groupId (g) => g.groupId === createMessageGroupResult.groupId,
); );
clearMessageGroupResult(); clearMessageGroupResult();
if (findGroup) { if (findGroup) {
@@ -53,9 +51,7 @@ const MessagesList = (): any => {
const handleClick = (messageGroup: MessageGroup) => () => { const handleClick = (messageGroup: MessageGroup) => () => {
Nui.send('phone:fetchMessages', { groupId: messageGroup.groupId }); Nui.send('phone:fetchMessages', { groupId: messageGroup.groupId });
history.push( history.push(
`/messages/conversations/${messageGroup.groupId}/?${qs.stringify( `/messages/conversations/${messageGroup.groupId}/?${qs.stringify(messageGroup)}`,
messageGroup
)}`
); );
}; };
@@ -31,9 +31,9 @@ const Conversation = ({ activeMessageGroup, messages }: IProps) => {
/> />
<Box <Box
id={CONVERSATION_ELEMENT_ID} id={CONVERSATION_ELEMENT_ID}
height='90%' height="90%"
display='flex' display="flex"
flexDirection='column' flexDirection="column"
pb={4} pb={4}
className={classes.overflowAutoY} className={classes.overflowAutoY}
> >
@@ -51,23 +51,20 @@ export const MessageBubble = ({
const classes = useStyles(); const classes = useStyles();
return ( return (
<div> <div>
<Paper <Paper className={message.isMine ? classes.mySms : classes.sms} variant="outlined">
className={message.isMine ? classes.mySms : classes.sms}
variant='outlined'
>
<Box> <Box>
{isImage(message.message) ? ( {isImage(message.message) ? (
<img <img
src={message.message} src={message.message}
className={classes.imageMessage} className={classes.imageMessage}
alt='multimedia' alt="multimedia"
/> />
) : ( ) : (
<div>{message.message}</div> <div>{message.message}</div>
)} )}
</Box> </Box>
<Box> <Box>
<Typography variant='subtitle1' color='secondary'> <Typography variant="subtitle1" color="secondary">
{isGroupChat && !message.isMine {isGroupChat && !message.isMine
? message.display || message.phone_number ? message.display || message.phone_number
: null} : null}
@@ -14,10 +14,10 @@ const MessageGroupModal = () => {
const params = useParams<{ phoneNumber?: string }>(); const params = useParams<{ phoneNumber?: string }>();
return ( return (
<Slide direction='left' in> <Slide direction="left" in>
<Paper className={classes.modalRoot}> <Paper className={classes.modalRoot}>
<Button onClick={handleClose}> <Button onClick={handleClose}>
<ArrowBackIcon fontSize='large' /> <ArrowBackIcon fontSize="large" />
</Button> </Button>
<NewMessageGroupForm phoneNumber={params.phoneNumber} /> <NewMessageGroupForm phoneNumber={params.phoneNumber} />
</Paper> </Paper>
@@ -18,12 +18,7 @@ interface IProps {
image?: string; image?: string;
} }
export const MessageImageModal = ({ export const MessageImageModal = ({ isOpen, messageGroupId, onClose, image }: IProps) => {
isOpen,
messageGroupId,
onClose,
image,
}: IProps) => {
const classes = useStyles(); const classes = useStyles();
const history = useHistory(); const history = useHistory();
const { pathname, search } = useLocation(); const { pathname, search } = useLocation();
@@ -45,7 +40,7 @@ export const MessageImageModal = ({
}); });
onClose(); onClose();
}, },
[messageGroupId, onClose] [messageGroupId, onClose],
); );
const sendFromQueryParam = useCallback( const sendFromQueryParam = useCallback(
@@ -53,7 +48,7 @@ export const MessageImageModal = ({
sendImageMessage(image); sendImageMessage(image);
removeQueryParamImage(); removeQueryParamImage();
}, },
[removeQueryParamImage, sendImageMessage] [removeQueryParamImage, sendImageMessage],
); );
useEffect(() => { useEffect(() => {
@@ -81,20 +76,17 @@ export const MessageImageModal = ({
history.push( history.push(
`/camera?${qs.stringify({ `/camera?${qs.stringify({
referal: encodeURIComponent(pathname + search), referal: encodeURIComponent(pathname + search),
})}` })}`,
), ),
}, },
], ],
[history, pathname, search] [history, pathname, search],
); );
return ( return (
<> <>
<ContextMenu open={isOpen} options={menuOptions} onClose={onClose} /> <ContextMenu open={isOpen} options={menuOptions} onClose={onClose} />
<Modal <Modal visible={queryParamImagePreview} handleClose={removeQueryParamImage}>
visible={queryParamImagePreview}
handleClose={removeQueryParamImage}
>
<Box py={1}> <Box py={1}>
<Typography paragraph>Do you want to share this image?</Typography> <Typography paragraph>Do you want to share this image?</Typography>
<PictureResponsive <PictureResponsive
@@ -103,8 +95,8 @@ export const MessageImageModal = ({
/> />
<Button <Button
fullWidth fullWidth
variant='contained' variant="contained"
color='primary' color="primary"
onClick={() => sendFromQueryParam(queryParamImagePreview)} onClick={() => sendFromQueryParam(queryParamImagePreview)}
> >
Share Share
@@ -114,7 +106,7 @@ export const MessageImageModal = ({
<Modal visible={pasteVisible} handleClose={() => setPasteVisible(false)}> <Modal visible={pasteVisible} handleClose={() => setPasteVisible(false)}>
<Box p={1}> <Box p={1}>
<TextField <TextField
placeholder='A link to your image or gif' placeholder="A link to your image or gif"
onChange={(e) => setMessage(e.target.value)} onChange={(e) => setMessage(e.target.value)}
value={message} value={message}
fullWidth fullWidth
@@ -81,26 +81,21 @@ export const MessageModal = () => {
: header; : header;
const headerClass = const headerClass =
header.length > LARGE_HEADER_CHARS header.length > LARGE_HEADER_CHARS ? classes.largeGroupDisplay : classes.groupdisplay;
? classes.largeGroupDisplay
: classes.groupdisplay;
return ( return (
<Slide direction='left' in={!!activeMessageGroup}> <Slide direction="left" in={!!activeMessageGroup}>
<Paper className={classes.modalRoot}> <Paper className={classes.modalRoot}>
<Paper className={classes.topContainer}> <Paper className={classes.topContainer}>
<Button onClick={closeModal}> <Button onClick={closeModal}>
<ArrowBackIcon fontSize='large' /> <ArrowBackIcon fontSize="large" />
</Button> </Button>
<Typography variant='h5' className={headerClass}> <Typography variant="h5" className={headerClass}>
{header} {header}
</Typography> </Typography>
</Paper> </Paper>
{hasLoaded ? ( {hasLoaded ? (
<Conversation <Conversation messages={messages} activeMessageGroup={activeMessageGroup} />
messages={messages}
activeMessageGroup={activeMessageGroup}
/>
) : ( ) : (
<MessageSkeletonList /> <MessageSkeletonList />
)} )}
@@ -18,12 +18,7 @@ export default function MessageSkeleton({ height, isMine = false }) {
const marginLeft = isMine ? '60px' : '8px'; const marginLeft = isMine ? '60px' : '8px';
return ( return (
<div className={classes.root} style={{ marginLeft, height: `${height}px` }}> <div className={classes.root} style={{ marginLeft, height: `${height}px` }}>
<Skeleton <Skeleton className={classes.skeleton} variant="text" width={325} height={height} />
className={classes.skeleton}
variant='text'
width={325}
height={height}
/>
</div> </div>
); );
} }
@@ -7,21 +7,13 @@ export const useMessagesService = () => {
const setMessageGroups = useSetRecoilState(messageState.messageGroups); const setMessageGroups = useSetRecoilState(messageState.messageGroups);
const setMessages = useSetRecoilState(messageState.messages); const setMessages = useSetRecoilState(messageState.messages);
const setCreateMessageGroupResult = useSetRecoilState( const setCreateMessageGroupResult = useSetRecoilState(
messageState.createMessageGroupResult messageState.createMessageGroupResult,
); );
const { addAlert } = useSnackbar(); const { addAlert } = useSnackbar();
useNuiEvent('MESSAGES', 'phone:fetchMessageGroupsSuccess', setMessageGroups); useNuiEvent('MESSAGES', 'phone:fetchMessageGroupsSuccess', setMessageGroups);
useNuiEvent('MESSAGES', 'phone:fetchMessagesSuccess', setMessages); useNuiEvent('MESSAGES', 'phone:fetchMessagesSuccess', setMessages);
useNuiEvent( useNuiEvent('MESSAGES', 'phone:createMessageGroupSuccess', setCreateMessageGroupResult);
'MESSAGES', useNuiEvent('MESSAGES', 'phone:createMessageGroupFailed', setCreateMessageGroupResult);
'phone:createMessageGroupSuccess',
setCreateMessageGroupResult
);
useNuiEvent(
'MESSAGES',
'phone:createMessageGroupFailed',
setCreateMessageGroupResult
);
useNuiEvent('MESSAGES', 'phone:setMessagesAlert', addAlert); useNuiEvent('MESSAGES', 'phone:setMessagesAlert', addAlert);
}; };
+3 -7
View File
@@ -15,18 +15,14 @@ interface IUseMessages {
} }
export default (): IUseMessages => { export default (): IUseMessages => {
const [messages, setMessages] = useRecoilState<Message[] | null>( const [messages, setMessages] = useRecoilState<Message[] | null>(messageState.messages);
messageState.messages const messageGroups = useRecoilValue<MessageGroup[] | null>(messageState.messageGroups);
);
const messageGroups = useRecoilValue<MessageGroup[] | null>(
messageState.messageGroups
);
const [ const [
createMessageGroupResult, createMessageGroupResult,
setCreateMessageGroupResult, setCreateMessageGroupResult,
] = useRecoilState<CreateMessageGroupResult | null>( ] = useRecoilState<CreateMessageGroupResult | null>(
messageState.createMessageGroupResult messageState.createMessageGroupResult,
); );
const clearMessageGroupResult = () => setCreateMessageGroupResult(null); const clearMessageGroupResult = () => setCreateMessageGroupResult(null);
+4 -8
View File
@@ -26,16 +26,12 @@ export const NotesApp = () => {
return ( return (
<NotesThemeProvider> <NotesThemeProvider>
<AppWrapper id='notes-app'> <AppWrapper id="notes-app">
<AppTitle app={notesApp} /> <AppTitle app={notesApp} />
<Route path='/notes/detail' component={NoteModal} /> <Route path="/notes/detail" component={NoteModal} />
<AppContent> <AppContent>
<Route path='/notes' component={NoteList} /> <Route path="/notes" component={NoteList} />
<Fab <Fab className={classes.absolute} onClick={onClickCreate} color="primary">
className={classes.absolute}
onClick={onClickCreate}
color='primary'
>
<AddIcon /> <AddIcon />
</Fab> </Fab>
</AppContent> </AppContent>
+2 -2
View File
@@ -23,8 +23,8 @@ const useStyles = makeStyles((theme) => ({
const NotesTitle = () => { const NotesTitle = () => {
const classes = useStyles(); const classes = useStyles();
return ( return (
<Paper elevation={24} square variant='outlined' className={classes.header}> <Paper elevation={24} square variant="outlined" className={classes.header}>
<FontAwesomeIcon icon={faStickyNote} className={classes.icon} size='lg' /> <FontAwesomeIcon icon={faStickyNote} className={classes.icon} size="lg" />
</Paper> </Paper>
); );
}; };
+1 -6
View File
@@ -19,12 +19,7 @@ const NoteList = () => {
return ( return (
<List disablePadding> <List disablePadding>
{notes.map((note) => ( {notes.map((note) => (
<ListItem <ListItem key={note.id} button divider onClick={() => handleNoteModal(note)}>
key={note.id}
button
divider
onClick={() => handleNoteModal(note)}
>
<ListItemText>{note.title}</ListItemText> <ListItemText>{note.title}</ListItemText>
</ListItem> </ListItem>
))} ))}
+19 -23
View File
@@ -52,7 +52,7 @@ export const NoteModal = () => {
}; };
return ( return (
<Slide direction='left' in={!!detail}> <Slide direction="left" in={!!detail}>
<Paper className={classes.modalRoot}> <Paper className={classes.modalRoot}>
{!detail ? ( {!detail ? (
<CircularProgress /> <CircularProgress />
@@ -61,9 +61,9 @@ export const NoteModal = () => {
<Box> <Box>
<Box py={2}> <Box py={2}>
<Button <Button
color='primary' color="primary"
size='large' size="large"
startIcon={<ArrowBackIcon fontSize='large' />} startIcon={<ArrowBackIcon fontSize="large" />}
onClick={_handleClose} onClick={_handleClose}
> >
{t('APPS_NOTES')} {t('APPS_NOTES')}
@@ -79,9 +79,7 @@ export const NoteModal = () => {
}} }}
fullWidth fullWidth
value={detail.title} value={detail.title}
onChange={(e) => onChange={(e) => setDetail((d) => ({ ...d, title: e.target.value }))}
setDetail((d) => ({ ...d, title: e.target.value }))
}
/> />
<TextField <TextField
className={classes.input} className={classes.input}
@@ -93,29 +91,27 @@ export const NoteModal = () => {
multiline multiline
fullWidth fullWidth
rows={16} rows={16}
variant='outlined' variant="outlined"
value={detail.content} value={detail.content}
onChange={(e) => onChange={(e) => setDetail((d) => ({ ...d, content: e.target.value }))}
setDetail((d) => ({ ...d, content: e.target.value }))
}
/> />
<Typography paragraph>{detail.content.length}/250</Typography> <Typography paragraph>{detail.content.length}/250</Typography>
{!detail.id ? ( {!detail.id ? (
<> <>
<Box display='inline' p={1}> <Box display="inline" p={1}>
<Button <Button
color='primary' color="primary"
variant='contained' variant="contained"
disabled={detail.title.length > 0 ? false : true} disabled={detail.title.length > 0 ? false : true}
onClick={handleNoteSave} onClick={handleNoteSave}
> >
{t('GENERIC_SAVE')} {t('GENERIC_SAVE')}
</Button> </Button>
</Box> </Box>
<Box display='inline' p={1}> <Box display="inline" p={1}>
<StatusButton <StatusButton
color='error' color="error"
variant='contained' variant="contained"
onClick={_handleClose} onClick={_handleClose}
> >
{t('GENERIC_CANCEL')} {t('GENERIC_CANCEL')}
@@ -124,19 +120,19 @@ export const NoteModal = () => {
</> </>
) : ( ) : (
<> <>
<Box display='inline' p={1}> <Box display="inline" p={1}>
<Button <Button
color='primary' color="primary"
variant='contained' variant="contained"
onClick={handleUpdateNote} onClick={handleUpdateNote}
> >
{t('GENERIC_UPDATE')} {t('GENERIC_UPDATE')}
</Button> </Button>
</Box> </Box>
<Box display='inline' p={1}> <Box display="inline" p={1}>
<StatusButton <StatusButton
color='error' color="error"
variant='contained' variant="contained"
onClick={handleDeleteNote} onClick={handleDeleteNote}
> >
{t('GENERIC_DELETE')} {t('GENERIC_DELETE')}
@@ -12,12 +12,12 @@ import { SelloutThemeProvider } from '../providers/SelloutThemeProvider';
export const SelloutApp = () => { export const SelloutApp = () => {
return ( return (
<SelloutThemeProvider> <SelloutThemeProvider>
<AppWrapper id='sellout-app'> <AppWrapper id="sellout-app">
<SelloutTitle /> <SelloutTitle />
<AppContent> <AppContent>
<Switch> <Switch>
<Route path='/sellout' exact component={SelloutListContainer} /> <Route path="/sellout" exact component={SelloutListContainer} />
<Route path='/sellout/new' component={ListingFormContainer} /> <Route path="/sellout/new" component={ListingFormContainer} />
</Switch> </Switch>
</AppContent> </AppContent>
<NavigationBar /> <NavigationBar />
@@ -51,7 +51,7 @@ export const SelloutItem = (listing) => {
<div className={classes.content}> <div className={classes.content}>
<Paper elevation={2} className={classes.paper}> <Paper elevation={2} className={classes.paper}>
<div className={classes.header}> <div className={classes.header}>
<Typography className={classes.headerTypo} variant='h5'> <Typography className={classes.headerTypo} variant="h5">
{listing.name} {listing.name}
</Typography> </Typography>
<Typography <Typography
@@ -60,24 +60,21 @@ export const SelloutItem = (listing) => {
> >
{listing.number} {listing.number}
</Typography> </Typography>
<Typography variant='h5' style={{ padding: 5 }}> <Typography variant="h5" style={{ padding: 5 }}>
{listing.title} {listing.title}
</Typography> </Typography>
</div> </div>
{listing.url ? ( {listing.url ? (
<PictureResponsive <PictureResponsive src={listing.url} alt={`${listing.name} image`} />
src={listing.url}
alt={`${listing.name} image`}
/>
) : ( ) : (
<Typography style={{ margin: 10 }}> <Typography style={{ margin: 10 }}>
No image provided{' '} No image provided{' '}
<span role='img' aria-label='emoji'> <span role="img" aria-label="emoji">
🙁 🙁
</span> </span>
</Typography> </Typography>
)} )}
<Typography variant='h6' className={classes.desc}> <Typography variant="h6" className={classes.desc}>
{listing.description} {listing.description}
</Typography> </Typography>
<div> <div>
@@ -23,7 +23,7 @@ const useStyles = makeStyles((theme) => ({
export const SelloutTitle = () => { export const SelloutTitle = () => {
const classes = useStyles(); const classes = useStyles();
return ( return (
<Paper className={classes.root} square variant='outlined' elevation={24}> <Paper className={classes.root} square variant="outlined" elevation={24}>
<FontAwesomeIcon icon={faAd} className={classes.icon} /> <FontAwesomeIcon icon={faAd} className={classes.icon} />
</Paper> </Paper>
); );
@@ -47,32 +47,32 @@ export const ListingForm = () => {
<TextField <TextField
className={classes.input} className={classes.input}
onChange={(e) => setTitle(e.target.value)} onChange={(e) => setTitle(e.target.value)}
placeholder='Title on listing..' placeholder="Title on listing.."
inputProps={{ className: classes.textFieldInput }} inputProps={{ className: classes.textFieldInput }}
style={{ width: '80%' }} style={{ width: '80%' }}
size='medium' size="medium"
/> />
<TextField <TextField
className={classes.input} className={classes.input}
placeholder='Image URL' placeholder="Image URL"
onChange={(e) => setUrl(e.target.value)} onChange={(e) => setUrl(e.target.value)}
inputProps={{ className: classes.textFieldInput }} inputProps={{ className: classes.textFieldInput }}
style={{ width: '80%' }} style={{ width: '80%' }}
size='medium' size="medium"
variant='outlined' variant="outlined"
/> />
<TextField <TextField
className={classes.input} className={classes.input}
onChange={(e) => setDescription(e.target.value)} onChange={(e) => setDescription(e.target.value)}
placeholder='Description' placeholder="Description"
inputProps={{ className: classes.multilineFieldInput }} inputProps={{ className: classes.multilineFieldInput }}
style={{ width: '80%' }} style={{ width: '80%' }}
size='medium' size="medium"
multiline multiline
rows={4} rows={4}
variant='outlined' variant="outlined"
/> />
<Button onClick={addListing} className={classes.postButton}> <Button onClick={addListing} className={classes.postButton}>
@@ -31,12 +31,12 @@ export const NavigationBar = () => {
<BottomNavigationAction <BottomNavigationAction
component={Link} component={Link}
icon={<FontAwesomeIcon icon={faHome} />} icon={<FontAwesomeIcon icon={faHome} />}
to='/sellout' to="/sellout"
/> />
<BottomNavigationAction <BottomNavigationAction
component={Link} component={Link}
icon={<AddCircleIcon />} icon={<AddCircleIcon />}
to='/sellout/new' to="/sellout/new"
/> />
</BottomNavigation> </BottomNavigation>
); );
@@ -9,13 +9,7 @@ interface IProps {
icon: JSX.Element; icon: JSX.Element;
} }
export const SettingItem = ({ export const SettingItem = ({ options, label, value, onClick, icon }: IProps) => {
options,
label,
value,
onClick,
icon,
}: IProps) => {
return ( return (
<ListItem divider onClick={() => onClick?.(options)} button> <ListItem divider onClick={() => onClick?.(options)} button>
<ListItemIcon>{icon}</ListItemIcon> <ListItemIcon>{icon}</ListItemIcon>
@@ -2,10 +2,7 @@ import React, { useEffect, useState } from 'react';
import { AppWrapper } from '../../../ui/components'; import { AppWrapper } from '../../../ui/components';
import { AppTitle } from '../../../ui/components/AppTitle'; import { AppTitle } from '../../../ui/components/AppTitle';
import { AppContent } from '../../../ui/components/AppContent'; import { AppContent } from '../../../ui/components/AppContent';
import { import { useContextMenu, MapStringOptions } from '../../../ui/hooks/useContextMenu';
useContextMenu,
MapStringOptions,
} from '../../../ui/hooks/useContextMenu';
import { useConfig } from '../../../config/hooks/useConfig'; import { useConfig } from '../../../config/hooks/useConfig';
import { List } from '../../../ui/components/List'; import { List } from '../../../ui/components/List';
import { useSimcard } from '../../../os/simcard/hooks/useSimcard'; import { useSimcard } from '../../../os/simcard/hooks/useSimcard';
@@ -36,7 +33,7 @@ import { useRecoilState } from 'recoil';
import { settingsState } from '../hooks/useSettings'; import { settingsState } from '../hooks/useSettings';
const SubHeaderComp = (props: { text: string }) => ( const SubHeaderComp = (props: { text: string }) => (
<ListSubheader color='primary' component='div' disableSticky> <ListSubheader color="primary" component="div" disableSticky>
{props.text} {props.text}
</ListSubheader> </ListSubheader>
); );
@@ -64,11 +61,7 @@ export const SettingsApp = () => {
} }
return curr; return curr;
}); });
}, [ }, [settings.notificationVol, settings.ringtoneVol, settings.TWITTER_notificationVol]);
settings.notificationVol,
settings.ringtoneVol,
settings.TWITTER_notificationVol,
]);
const handleSliderChange = (idx) => (_e: any, value: number | number[]) => { const handleSliderChange = (idx) => (_e: any, value: number | number[]) => {
setSliders((curr) => { setSliders((curr) => {
@@ -82,39 +75,33 @@ export const SettingsApp = () => {
const wallpapers = config.wallpapers.map( const wallpapers = config.wallpapers.map(
MapStringOptions(settings.wallpaper, (val: string) => MapStringOptions(settings.wallpaper, (val: string) =>
handleSettingChange('wallpaper', val) handleSettingChange('wallpaper', val),
) ),
); );
const frames = config.frames.map( const frames = config.frames.map(
MapStringOptions(settings.frame, (val: string) => MapStringOptions(settings.frame, (val: string) => handleSettingChange('frame', val)),
handleSettingChange('frame', val)
)
); );
const themes = Object.keys(config.themes).map( const themes = Object.keys(config.themes).map(
MapStringOptions(settings.theme, (val: string) => MapStringOptions(settings.theme, (val: string) => handleSettingChange('theme', val)),
handleSettingChange('theme', val)
)
); );
const zoomOptions = config.zoomOptions.map( const zoomOptions = config.zoomOptions.map(
MapStringOptions(settings.zoom, (val: string) => MapStringOptions(settings.zoom, (val: string) => handleSettingChange('zoom', val)),
handleSettingChange('zoom', val)
)
); );
const ringtones = config.ringtones.map( const ringtones = config.ringtones.map(
MapStringOptions(settings.ringtone, (val: string) => MapStringOptions(settings.ringtone, (val: string) =>
handleSettingChange('ringtone', val) handleSettingChange('ringtone', val),
) ),
); );
const notifications = config.notifications.map( const notifications = config.notifications.map(
MapStringOptions(settings.notification, (val: string) => MapStringOptions(settings.notification, (val: string) =>
handleSettingChange('notification', val) handleSettingChange('notification', val),
) ),
); );
const twitterNotifications = config.notifications.map( const twitterNotifications = config.notifications.map(
MapStringOptions(settings.notification, (val: string) => MapStringOptions(settings.notification, (val: string) =>
handleSettingChange('TWITTER_notification', val) handleSettingChange('TWITTER_notification', val),
) ),
); );
const [openMenu, closeMenu, ContextMenu, isMenuOpen] = useContextMenu(); const [openMenu, closeMenu, ContextMenu, isMenuOpen] = useContextMenu();
@@ -122,7 +109,7 @@ export const SettingsApp = () => {
<AppWrapper> <AppWrapper>
<AppTitle app={settingsApp} /> <AppTitle app={settingsApp} />
<AppContent backdrop={isMenuOpen} onClickBackdrop={closeMenu}> <AppContent backdrop={isMenuOpen} onClickBackdrop={closeMenu}>
<List disablePadding subheader={<SubHeaderComp text='Phone' />}> <List disablePadding subheader={<SubHeaderComp text="Phone" />}>
<SettingItem <SettingItem
label={t('APPS_SETTINGS_PHONE_NUMBER')} label={t('APPS_SETTINGS_PHONE_NUMBER')}
value={simcard.number} value={simcard.number}
@@ -150,9 +137,7 @@ export const SettingsApp = () => {
min={0} min={0}
max={100} max={100}
onChange={handleSliderChange(0)} onChange={handleSliderChange(0)}
onChangeCommitted={() => onChangeCommitted={() => handleSettingChange('ringtoneVol', sliders[0])}
handleSettingChange('ringtoneVol', sliders[0])
}
/> />
</Box> </Box>
</ListItemSecondaryAction> </ListItemSecondaryAction>
@@ -187,7 +172,7 @@ export const SettingsApp = () => {
</ListItemSecondaryAction> </ListItemSecondaryAction>
</ListItem> </ListItem>
</List> </List>
<List disablePadding subheader={<SubHeaderComp text='Appearance' />}> <List disablePadding subheader={<SubHeaderComp text="Appearance" />}>
<SettingItem <SettingItem
label={t('APPS_SETTINGS_OPTION_THEME')} label={t('APPS_SETTINGS_OPTION_THEME')}
value={settings.theme} value={settings.theme}
@@ -217,10 +202,7 @@ export const SettingsApp = () => {
icon={<ZoomIn />} icon={<ZoomIn />}
/> />
</List> </List>
<List <List disablePadding subheader={<SubHeaderComp text={t('APPS_TWITTER')} />}>
disablePadding
subheader={<SubHeaderComp text={t('APPS_TWITTER')} />}
>
<SettingItem <SettingItem
label={t('APPS_SETTINGS_OPTION_NOTIFICATION')} label={t('APPS_SETTINGS_OPTION_NOTIFICATION')}
value={settings.TWITTER_notification} value={settings.TWITTER_notification}
@@ -86,9 +86,7 @@ export const AddTweetModal = () => {
const handleimageChange = useCallback((link) => setLink(link), []); const handleimageChange = useCallback((link) => setLink(link), []);
const handleMessageChange = useCallback((message) => setMessage(message), [ const handleMessageChange = useCallback((message) => setMessage(message), [setMessage]);
setMessage,
]);
useEffect(() => { useEffect(() => {
window.addEventListener('keydown', _handleEscape, true); window.addEventListener('keydown', _handleEscape, true);
@@ -138,8 +136,7 @@ export const AddTweetModal = () => {
setShowImagePrompt(false); setShowImagePrompt(false);
setLink(''); setLink('');
}; };
const removeImage = (id) => const removeImage = (id) => setImages(images.filter((image) => id !== image.id));
setImages(images.filter((image) => id !== image.id));
const toggleShowImagePrompt = () => { const toggleShowImagePrompt = () => {
setShowEmoji(false); // clear the emoji so we can switch between emoji/images setShowEmoji(false); // clear the emoji so we can switch between emoji/images
@@ -180,9 +177,7 @@ export const AddTweetModal = () => {
<div className={classes.buttonsContainer}> <div className={classes.buttonsContainer}>
<IconButtons <IconButtons
onImageClick={ onImageClick={
images.length < config.twitter.maxImages images.length < config.twitter.maxImages ? toggleShowImagePrompt : null
? toggleShowImagePrompt
: null
} }
onEmojiClick={toggleShowEmoji} onEmojiClick={toggleShowEmoji}
/> />
+2 -2
View File
@@ -30,14 +30,14 @@ function Avatar({ avatarUrl, showInvalidImage, height, width }) {
<img <img
className={classes.img} className={classes.img}
src={showInvalidImage ? IMG_INVALID_AVATAR : IMG_DEFAULT_AVATAR} src={showInvalidImage ? IMG_INVALID_AVATAR : IMG_DEFAULT_AVATAR}
alt='Invalid avatar' alt="Invalid avatar"
style={{ height, width }} style={{ height, width }}
/> />
)} )}
<img <img
className={classes.img} className={classes.img}
src={avatarUrl || IMG_DEFAULT_AVATAR} src={avatarUrl || IMG_DEFAULT_AVATAR}
alt='Your profile avatar' alt="Your profile avatar"
onError={handleImageError} onError={handleImageError}
onLoad={handleImageLoad} onLoad={handleImageLoad}
style={{ display: showImageError ? 'none' : 'block', height, width }} style={{ display: showImageError ? 'none' : 'block', height, width }}
@@ -16,24 +16,16 @@ export function TwitterBottomNavigation({ activePage, handleChange }) {
const classes = useStyles(); const classes = useStyles();
return ( return (
<BottomNavigation <BottomNavigation value={activePage} onChange={handleChange} className={classes.root}>
value={activePage} <BottomNavigationAction component={Link} to="/twitter" icon={<HomeIcon />} />
onChange={handleChange}
className={classes.root}
>
<BottomNavigationAction <BottomNavigationAction
component={Link} component={Link}
to='/twitter' to="/twitter/search"
icon={<HomeIcon />}
/>
<BottomNavigationAction
component={Link}
to='/twitter/search'
icon={<SearchIcon />} icon={<SearchIcon />}
/> />
<BottomNavigationAction <BottomNavigationAction
component={Link} component={Link}
to='/twitter/profile' to="/twitter/profile"
icon={<ProfileIcon />} icon={<ProfileIcon />}
/> />
</BottomNavigation> </BottomNavigation>
@@ -4,14 +4,7 @@ import { Picker } from 'emoji-mart';
export const EmojiSelect = ({ visible, onEmojiClick }) => { export const EmojiSelect = ({ visible, onEmojiClick }) => {
if (!visible) return null; if (!visible) return null;
return ( return <Picker onClick={onEmojiClick} set="google" theme="dark" showPreview={false} />;
<Picker
onClick={onEmojiClick}
set='google'
theme='dark'
showPreview={false}
/>
);
}; };
export default memo(EmojiSelect); // The picker is an expensive render export default memo(EmojiSelect); // The picker is an expensive render
@@ -67,7 +67,7 @@ export const TwitterApp = () => {
const showTweetButton = !promptProfileName && activePage === 0; const showTweetButton = !promptProfileName && activePage === 0;
return ( return (
<AppWrapper id='twitter-app'> <AppWrapper id="twitter-app">
<AddTweetModal /> <AddTweetModal />
<div className={modalVisible ? classes.backgroundModal : undefined} /> <div className={modalVisible ? classes.backgroundModal : undefined} />
<TwitterTitle /> <TwitterTitle />
@@ -76,18 +76,15 @@ export const TwitterApp = () => {
<ProfilePrompt /> <ProfilePrompt />
) : ( ) : (
<Switch> <Switch>
<Route path='/twitter' exact component={TweetListContainer} /> <Route path="/twitter" exact component={TweetListContainer} />
<Route path='/twitter/search' component={TwitterSearch} /> <Route path="/twitter/search" component={TwitterSearch} />
<Route path='/twitter/profile' component={TwitterProfile} /> <Route path="/twitter/profile" component={TwitterProfile} />
</Switch> </Switch>
)} )}
</AppContent> </AppContent>
{showTweetButton && <TweetButton openModal={openModal} />} {showTweetButton && <TweetButton openModal={openModal} />}
{!promptProfileName && ( {!promptProfileName && (
<BottomNavigation <BottomNavigation activePage={activePage} handleChange={handlePageChange} />
activePage={activePage}
handleChange={handlePageChange}
/>
)} )}
</AppWrapper> </AppWrapper>
); );
@@ -191,5 +188,5 @@ InjectDebugData(
}, },
}, },
], ],
3000 3000,
); );
@@ -47,7 +47,7 @@ function TwitterSearch() {
label={t('APPS_TWITTER_SEARCH_TWEETS')} label={t('APPS_TWITTER_SEARCH_TWEETS')}
value={searchValue} value={searchValue}
onChange={handleChange} onChange={handleChange}
size='medium' size="medium"
inputRef={(input) => input && input.focus()} inputRef={(input) => input && input.focus()}
/> />
</div> </div>
@@ -22,7 +22,7 @@ const useStyles = makeStyles((theme) => ({
export function TwitterTitle() { export function TwitterTitle() {
const classes = useStyles(); const classes = useStyles();
return ( return (
<Paper elevation={24} variant='outlined' square className={classes.root}> <Paper elevation={24} variant="outlined" square className={classes.root}>
<TwitterIcon className={classes.icon} /> <TwitterIcon className={classes.icon} />
</Paper> </Paper>
); );
@@ -33,14 +33,14 @@ export const ControlButtons = ({
return ( return (
<div className={classes.buttons}> <div className={classes.buttons}>
<Button variant='contained' color='primary' onClick={onPrimaryClick}> <Button variant="contained" color="primary" onClick={onPrimaryClick}>
{primaryButtonText} {primaryButtonText}
</Button> </Button>
{showCloseButton && ( {showCloseButton && (
<Button <Button
className={classes.close} className={classes.close}
variant='contained' variant="contained"
color='secondary' color="secondary"
onClick={onCloseClick} onClick={onCloseClick}
> >
{t('APPS_TWITTER_CLOSE_IMAGE')} {t('APPS_TWITTER_CLOSE_IMAGE')}
@@ -29,12 +29,12 @@ export const IconButtons = ({ onImageClick, onEmojiClick }) => {
<div className={classes.buttons}> <div className={classes.buttons}>
{enableImages && ( {enableImages && (
<Button className={classes.button} onClick={onImageClick}> <Button className={classes.button} onClick={onImageClick}>
<InsertPhotoIcon color='action' /> <InsertPhotoIcon color="action" />
</Button> </Button>
)} )}
{enableEmojis && ( {enableEmojis && (
<Button className={classes.button} onClick={onEmojiClick}> <Button className={classes.button} onClick={onEmojiClick}>
<EmojiIcon color='action' /> <EmojiIcon color="action" />
</Button> </Button>
)} )}
</div> </div>
@@ -37,7 +37,7 @@ export function ProfileUpdateButton({ handleClick }) {
<div className={classes.root}> <div className={classes.root}>
<Fab <Fab
className={classes.button} className={classes.button}
color='primary' color="primary"
onClick={handleClick} onClick={handleClick}
disabled={isLoading} disabled={isLoading}
> >
@@ -32,7 +32,7 @@ function ReportButton({ handleClose, tweetId, isReported }) {
if (loading) { if (loading) {
return ( return (
<Button disabled> <Button disabled>
<CircularProgress id='twitter-report-progress' size={22} /> <CircularProgress id="twitter-report-progress" size={22} />
</Button> </Button>
); );
} }
@@ -19,7 +19,7 @@ export function ProfileUpdateButton({ handleClick }) {
return ( return (
<div className={classes.root}> <div className={classes.root}>
<Fab className={classes.button} color='primary' onClick={handleClick}> <Fab className={classes.button} color="primary" onClick={handleClick}>
<SearchIcon /> <SearchIcon />
</Fab> </Fab>
</div> </div>
@@ -19,7 +19,7 @@ export function TweetButton({ openModal }) {
return ( return (
<div className={classes.root}> <div className={classes.root}>
<Fab className={classes.button} color='primary' onClick={openModal}> <Fab className={classes.button} color="primary" onClick={openModal}>
<CreateIcon /> <CreateIcon />
</Fab> </Fab>
</div> </div>
@@ -41,16 +41,12 @@ export const Image = ({ link, handleClick, small }) => {
return ( return (
<div className={classes.imageContainer}> <div className={classes.imageContainer}>
{handleClick && ( {handleClick && (
<IconButton <IconButton className={classes.imgButton} onClick={handleClick} size="small">
className={classes.imgButton}
onClick={handleClick}
size='small'
>
<CloseIcon /> <CloseIcon />
</IconButton> </IconButton>
)} )}
<img <img
alt='small avatar' alt="small avatar"
className={small ? classes.imgSmall : classes.img} className={small ? classes.imgSmall : classes.img}
src={link} src={link}
/> />
@@ -35,7 +35,7 @@ export const ImagePrompt = ({ visible, value, handleChange }) => {
className={classes.textField} className={classes.textField}
onChange={handleImageChange} onChange={handleImageChange}
multiline multiline
size='small' size="small"
placeholder={t('APPS_TWITTER_IMAGE_PLACEHOLDER')} placeholder={t('APPS_TWITTER_IMAGE_PLACEHOLDER')}
inputRef={textFieldRef} inputRef={textFieldRef}
/> />
@@ -12,14 +12,7 @@ const useStyles = makeStyles({
}, },
}); });
function ProfileField({ function ProfileField({ label, value, handleChange, allowChange, multiline, inputRef }) {
label,
value,
handleChange,
allowChange,
multiline,
inputRef,
}) {
const classes = useStyles(); const classes = useStyles();
const _handleChange = (e) => handleChange(e.target.value); const _handleChange = (e) => handleChange(e.target.value);
@@ -58,20 +58,15 @@ export const ShowMore = ({ id, isReported, isMine }) => {
// if the user cannot perform any actions in show more then don't // if the user cannot perform any actions in show more then don't
// allow them to interact with it // allow them to interact with it
let _handleClick = let _handleClick = allowedToDelete || allowedToReport ? handleClick : () => null;
allowedToDelete || allowedToReport ? handleClick : () => null;
return ( return (
<> <>
<Button <Button aria-controls="simple-menu" aria-haspopup="true" onClick={_handleClick}>
aria-controls='simple-menu'
aria-haspopup='true'
onClick={_handleClick}
>
<MoreIcon /> <MoreIcon />
</Button> </Button>
<Menu <Menu
id='simple-menu' id="simple-menu"
anchorEl={anchorEl} anchorEl={anchorEl}
keepMounted keepMounted
open={Boolean(anchorEl)} open={Boolean(anchorEl)}
@@ -82,16 +77,10 @@ export const ShowMore = ({ id, isReported, isMine }) => {
}} }}
> >
{allowedToDelete && ( {allowedToDelete && (
<MenuItem onClick={handleDeleteTweet}> <MenuItem onClick={handleDeleteTweet}>{t('APPS_TWITTER_DELETE')}</MenuItem>
{t('APPS_TWITTER_DELETE')}
</MenuItem>
)} )}
{allowedToReport && ( {allowedToReport && (
<ReportButton <ReportButton handleClose={handleClose} isReported={isReported} tweetId={id} />
handleClose={handleClose}
isReported={isReported}
tweetId={id}
/>
)} )}
</Menu> </Menu>
</> </>
@@ -98,7 +98,7 @@ export const Tweet = (tweet) => {
{enableAvatars && ( {enableAvatars && (
<ListItemAvatar> <ListItemAvatar>
<MuiAvatar> <MuiAvatar>
<Avatar avatarUrl={avatar_url} height='40px' width='40px' /> <Avatar avatarUrl={avatar_url} height="40px" width="40px" />
</MuiAvatar> </MuiAvatar>
</ListItemAvatar> </ListItemAvatar>
)} )}
@@ -107,9 +107,9 @@ export const Tweet = (tweet) => {
<div className={classes.profile}>{profileName}</div> <div className={classes.profile}>{profileName}</div>
<Typography <Typography
className={classes.date} className={classes.date}
component='div' component="div"
variant='body2' variant="body2"
color='textSecondary' color="textSecondary"
> >
{secondsToHumanReadable(t, seconds_since_tweet)} {secondsToHumanReadable(t, seconds_since_tweet)}
</Typography> </Typography>
@@ -43,7 +43,7 @@ export const TweetMessage = ({ modalVisible, message, handleChange }) => {
textFieldRef.current.scrollTop = textFieldRef.current.scrollHeight; textFieldRef.current.scrollTop = textFieldRef.current.scrollHeight;
handleChange(e.target.value); handleChange(e.target.value);
}, },
[handleChange] [handleChange],
); );
if (!config) return null; if (!config) return null;
@@ -52,12 +52,12 @@ export const TweetMessage = ({ modalVisible, message, handleChange }) => {
const overCharacterLimit = message.trim().length > characterLimit; const overCharacterLimit = message.trim().length > characterLimit;
const characterWarningPrompt = `${t( const characterWarningPrompt = `${t(
'APPS_TWITTER_TWEET_MESSAGE_CHAR_LIMIT' 'APPS_TWITTER_TWEET_MESSAGE_CHAR_LIMIT',
)} (${characterLimit})`; )} (${characterLimit})`;
const overNewLineLimit = getNewLineCount(message) > newLineLimit; const overNewLineLimit = getNewLineCount(message) > newLineLimit;
const newLineWarningPrompt = `${t( const newLineWarningPrompt = `${t(
'APPS_TWITTER_TWEET_MESSAGE_NEW_LINE_LIMIT' 'APPS_TWITTER_TWEET_MESSAGE_NEW_LINE_LIMIT',
)} (${newLineLimit})`; )} (${newLineLimit})`;
if (overCharacterLimit) { if (overCharacterLimit) {
@@ -25,11 +25,11 @@ export default function TweetSkeleton() {
<> <>
<div className={classes.root}> <div className={classes.root}>
<div className={classes.left}> <div className={classes.left}>
<Skeleton variant='circle' width={60} height={60} /> <Skeleton variant="circle" width={60} height={60} />
</div> </div>
<div className={classes.right}> <div className={classes.right}>
<Skeleton variant='text' /> <Skeleton variant="text" />
<Skeleton variant='rect' width={250} height={118} /> <Skeleton variant="rect" width={250} height={118} />
</div> </div>
</div> </div>
+1 -1
View File
@@ -3,7 +3,7 @@ import { twitterState } from './state';
export const useModal = () => { export const useModal = () => {
const [modalVisible, setModalVisible] = useRecoilState( const [modalVisible, setModalVisible] = useRecoilState(
twitterState.showCreateTweetModal twitterState.showCreateTweetModal,
); );
const [message, setMessage] = useRecoilState(twitterState.modalMessage); const [message, setMessage] = useRecoilState(twitterState.modalMessage);
return { modalVisible, setModalVisible, message, setMessage }; return { modalVisible, setModalVisible, message, setMessage };
+2 -4
View File
@@ -18,11 +18,9 @@ interface IUseProfile {
export const useProfile = (): IUseProfile => { export const useProfile = (): IUseProfile => {
const profile = useRecoilValue(twitterState.profile); const profile = useRecoilValue(twitterState.profile);
const updateProfileLoading = useRecoilValue( const updateProfileLoading = useRecoilValue(twitterState.updateProfileLoading);
twitterState.updateProfileLoading
);
const [updateProfileSuccessful, setUpdateProfileSuccessful] = useRecoilState( const [updateProfileSuccessful, setUpdateProfileSuccessful] = useRecoilState(
twitterState.updateProfileSuccess twitterState.updateProfileSuccess,
); );
return { return {
profile, profile,
@@ -5,7 +5,7 @@ import { twitterState } from './state';
export const useTweetStatus = () => { export const useTweetStatus = () => {
const createTweetLoading = useRecoilValue(twitterState.createTweetLoading); const createTweetLoading = useRecoilValue(twitterState.createTweetLoading);
const [createTweetSuccessful, setCreateTweetSuccessful] = useRecoilState( const [createTweetSuccessful, setCreateTweetSuccessful] = useRecoilState(
twitterState.createTweetSuccessful twitterState.createTweetSuccessful,
); );
return { return {
createTweetLoading, createTweetLoading,
@@ -14,9 +14,7 @@ export const useTwitterNotifications = () => {
const { icon, notificationIcon } = useApp('TWITTER'); const { icon, notificationIcon } = useApp('TWITTER');
const [unreadCount, setUnreadCount] = useRecoilState( const [unreadCount, setUnreadCount] = useRecoilState(twitterState.unreadTweetsCount);
twitterState.unreadTweetsCount
);
const setNotification = useCallback( const setNotification = useCallback(
({ profile_name, message }) => { ({ profile_name, message }) => {
@@ -38,12 +36,12 @@ export const useTwitterNotifications = () => {
count: unread, count: unread,
}), }),
content: null, content: null,
} },
); );
return unread; return unread;
}); });
}, },
[setUnreadCount, addNotificationAlert, t, icon, notificationIcon, history] [setUnreadCount, addNotificationAlert, t, icon, notificationIcon, history],
); );
return { setNotification, setUnreadCount, unreadCount }; return { setNotification, setUnreadCount, unreadCount };
@@ -34,9 +34,7 @@ export const useTwitterService = () => {
const { setNotification } = useTwitterNotifications(); const { setNotification } = useTwitterNotifications();
const setProfile = useSetRecoilState(twitterState.profile); const setProfile = useSetRecoilState(twitterState.profile);
const setUpdateProfileLoading = useSetRecoilState( const setUpdateProfileLoading = useSetRecoilState(twitterState.updateProfileLoading);
twitterState.updateProfileLoading
);
const setTweets = useSetRecoilState(twitterState.tweets); const setTweets = useSetRecoilState(twitterState.tweets);
const setFilteredTweets = useSetRecoilState(twitterState.filteredTweets); const setFilteredTweets = useSetRecoilState(twitterState.filteredTweets);
+1 -1
View File
@@ -14,7 +14,7 @@ const DAYS = 'APPS_TWITTER_TIME_DAYS';
*/ */
export function secondsToHumanReadable( export function secondsToHumanReadable(
t: (input: string) => string, t: (input: string) => string,
seconds: number seconds: number,
): string { ): string {
if (seconds < 60) { if (seconds < 60) {
return t(JUST_NOW); return t(JUST_NOW);
+1 -3
View File
@@ -10,9 +10,7 @@ import { useLocation } from 'react-router-dom';
* *
* const { id, title } = useQueryParams<{ id: string, title: string }>(); * const { id, title } = useQueryParams<{ id: string, title: string }>();
*/ */
export function useQueryParams<T = Record<string, string>>( export function useQueryParams<T = Record<string, string>>(defaultValues: T = null) {
defaultValues: T = null
) {
const query = qs.parse(useLocation().search, { ignoreQueryPrefix: true }); const query = qs.parse(useLocation().search, { ignoreQueryPrefix: true });
if (!defaultValues) { if (!defaultValues) {
return query as T & Partial<ParsedQs>; return query as T & Partial<ParsedQs>;
+1 -1
View File
@@ -9,7 +9,7 @@ interface IRouterLocation {
export const addQueryToLocation = ( export const addQueryToLocation = (
{ pathname = '', search = '' }: Record<string, unknown> & IRouterLocation, { pathname = '', search = '' }: Record<string, unknown> & IRouterLocation,
key = '', key = '',
value = '' value = '',
) => { ) => {
const { query } = url(pathname + search); const { query } = url(pathname + search);
return `${pathname}?${qs.stringify({ return `${pathname}?${qs.stringify({
@@ -8,7 +8,7 @@ interface IRouterLocation {
export const deleteQueryFromLocation = ( export const deleteQueryFromLocation = (
location: Record<string, unknown> & IRouterLocation, location: Record<string, unknown> & IRouterLocation,
key = '' key = '',
) => { ) => {
const { query } = url(location.pathname + location.search); const { query } = url(location.pathname + location.search);
return `${location.pathname}/?${qs.stringify({ return `${location.pathname}/?${qs.stringify({
+1 -7
View File
@@ -1,13 +1,7 @@
{ {
"cellProvider": "AT&T", "cellProvider": "AT&T",
"language": "en", "language": "en",
"wallpapers": [ "wallpapers": ["beach.jpg", "minimal.jpg", "surf.jpg", "waves.jpg", "projecterror.jpg"],
"beach.jpg",
"minimal.jpg",
"surf.jpg",
"waves.jpg",
"projecterror.jpg"
],
"defaultSettings": { "defaultSettings": {
"wallpaper": "projecterror.jpg", "wallpaper": "projecterror.jpg",
"frame": "default.png", "frame": "default.png",
+2 -3
View File
@@ -12,8 +12,7 @@ import { PhoneContainer } from './PhoneContainer';
// Enable Sentry when config setting is true // Enable Sentry when config setting is true
if (PhoneConfig.SentryErrorMetrics) { if (PhoneConfig.SentryErrorMetrics) {
Sentry.init({ Sentry.init({
dsn: dsn: 'https://[email protected]/5581619',
'https://[email protected]/5581619',
autoSessionTracking: true, autoSessionTracking: true,
integrations: [new Integrations.BrowserTracing()], integrations: [new Integrations.BrowserTracing()],
// We recommend adjusting this value in production, or using tracesSampler // We recommend adjusting this value in production, or using tracesSampler
@@ -28,5 +27,5 @@ ReactDOM.render(
<PhoneContainer /> <PhoneContainer />
</RecoilRoot> </RecoilRoot>
</HashRouter>, </HashRouter>,
document.getElementById('root') document.getElementById('root'),
); );
+3 -5
View File
@@ -1,7 +1,6 @@
body { body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
font-size: 20px; font-size: 20px;
@@ -13,8 +12,7 @@ body {
} }
code { code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;
monospace;
} }
a, a,
+28 -42
View File
@@ -65,115 +65,103 @@ export const APPS: IAppConfig[] = [
id: 'DIALER', id: 'DIALER',
nameLocale: 'APPS_DIALER', nameLocale: 'APPS_DIALER',
icon: <FontAwesomeIcon icon={faPhoneAlt} />, icon: <FontAwesomeIcon icon={faPhoneAlt} />,
notificationIcon: <FontAwesomeIcon icon={faPhoneAlt} size='xs' />, notificationIcon: <FontAwesomeIcon icon={faPhoneAlt} size="xs" />,
backgroundColor: DIALER_APP_PRIMARY_COLOR, backgroundColor: DIALER_APP_PRIMARY_COLOR,
color: DIALER_APP_TEXT_COLOR, color: DIALER_APP_TEXT_COLOR,
path: '/phone', path: '/phone',
Route: () => <AppRoute id='DIALER' path='/phone' component={DialerApp} />, Route: () => <AppRoute id="DIALER" path="/phone" component={DialerApp} />,
}, },
{ {
id: 'MESSAGES', id: 'MESSAGES',
nameLocale: 'APPS_MESSAGES', nameLocale: 'APPS_MESSAGES',
icon: <MessageIcon fontSize='large' />, icon: <MessageIcon fontSize="large" />,
notificationIcon: <MessageIcon fontSize='small' />, notificationIcon: <MessageIcon fontSize="small" />,
backgroundColor: MESSAGES_APP_PRIMARY_COLOR, backgroundColor: MESSAGES_APP_PRIMARY_COLOR,
color: MESSAGES_APP_TEXT_COLOR, color: MESSAGES_APP_TEXT_COLOR,
path: '/messages', path: '/messages',
Route: () => ( Route: () => <AppRoute id="MESSAGE" path="/messages" component={MessagesApp} />,
<AppRoute id='MESSAGE' path='/messages' component={MessagesApp} />
),
}, },
{ {
id: 'CONTACTS', id: 'CONTACTS',
nameLocale: 'APPS_CONTACTS', nameLocale: 'APPS_CONTACTS',
icon: <ContactsIcon fontSize='large' />, icon: <ContactsIcon fontSize="large" />,
notificationIcon: <ContactsIcon fontSize='small' />, notificationIcon: <ContactsIcon fontSize="small" />,
backgroundColor: CONTACTS_APP_PRIMARY_COLOR, backgroundColor: CONTACTS_APP_PRIMARY_COLOR,
color: CONTACTS_APP_TEXT_COLOR, color: CONTACTS_APP_TEXT_COLOR,
path: '/contacts', path: '/contacts',
Route: () => ( Route: () => <AppRoute id="CONTACTS" path="/contacts" component={ContactsApp} />,
<AppRoute id='CONTACTS' path='/contacts' component={ContactsApp} />
),
}, },
{ {
id: 'CALCULATOR', id: 'CALCULATOR',
nameLocale: 'APPS_CALCULATOR', nameLocale: 'APPS_CALCULATOR',
icon: <CalculatorIcon fontSize='large' />, icon: <CalculatorIcon fontSize="large" />,
notificationIcon: <CalculatorIcon fontSize='small' />, notificationIcon: <CalculatorIcon fontSize="small" />,
backgroundColor: purple[500], backgroundColor: purple[500],
color: grey[50], color: grey[50],
path: '/calculator', path: '/calculator',
Route: () => ( Route: () => (
<AppRoute id='CALCULATOR' path='/calculator' component={CalculatorApp} /> <AppRoute id="CALCULATOR" path="/calculator" component={CalculatorApp} />
), ),
}, },
{ {
id: 'SETTINGS', id: 'SETTINGS',
nameLocale: 'APPS_SETTINGS', nameLocale: 'APPS_SETTINGS',
icon: <SettingsIcon fontSize='large' />, icon: <SettingsIcon fontSize="large" />,
notificationIcon: <SettingsIcon fontSize='small' />, notificationIcon: <SettingsIcon fontSize="small" />,
backgroundColor: '#383838', backgroundColor: '#383838',
color: grey[50], color: grey[50],
path: '/settings', path: '/settings',
Route: () => ( Route: () => <AppRoute id="SETTINGS" path="/settings" component={SettingsApp} />,
<AppRoute id='SETTINGS' path='/settings' component={SettingsApp} />
),
}, },
{ {
id: 'BANK', id: 'BANK',
nameLocale: 'APPS_BANK', nameLocale: 'APPS_BANK',
icon: <FontAwesomeIcon icon={faWonSign} />, icon: <FontAwesomeIcon icon={faWonSign} />,
notificationIcon: <FontAwesomeIcon icon={faWonSign} size='xs' />, notificationIcon: <FontAwesomeIcon icon={faWonSign} size="xs" />,
backgroundColor: blue[900], backgroundColor: blue[900],
color: common.white, color: common.white,
path: '/bank', path: '/bank',
Route: () => <AppRoute id='BANK' path='/bank' component={BankApp} />, Route: () => <AppRoute id="BANK" path="/bank" component={BankApp} />,
}, },
{ {
id: 'TWITTER', id: 'TWITTER',
nameLocale: 'APPS_TWITTER', nameLocale: 'APPS_TWITTER',
icon: <FontAwesomeIcon icon={faTwitter} fixedWidth />, icon: <FontAwesomeIcon icon={faTwitter} fixedWidth />,
notificationIcon: <FontAwesomeIcon icon={faTwitter} fixedWidth size='xs' />, notificationIcon: <FontAwesomeIcon icon={faTwitter} fixedWidth size="xs" />,
backgroundColor: blue[600], backgroundColor: blue[600],
color: common.white, color: common.white,
path: '/twitter', path: '/twitter',
Route: () => ( Route: () => <AppRoute id="TWITTER" path="/twitter" component={TwitterApp} />,
<AppRoute id='TWITTER' path='/twitter' component={TwitterApp} />
),
}, },
{ {
id: 'SELLOUT', id: 'SELLOUT',
nameLocale: 'APPS_SELLOUT', nameLocale: 'APPS_SELLOUT',
icon: <FontAwesomeIcon icon={faAd} fixedWidth />, icon: <FontAwesomeIcon icon={faAd} fixedWidth />,
notificationIcon: <FontAwesomeIcon icon={faAd} fixedWidth size='xs' />, notificationIcon: <FontAwesomeIcon icon={faAd} fixedWidth size="xs" />,
backgroundColor: SELLOUT_APP_PRIMARY_COLOR, backgroundColor: SELLOUT_APP_PRIMARY_COLOR,
color: SELLOUT_APP_ICON_COLOR, color: SELLOUT_APP_ICON_COLOR,
path: '/sellout', path: '/sellout',
Route: () => ( Route: () => <AppRoute id="SELLOUT" path="/sellout" component={SelloutApp} />,
<AppRoute id='SELLOUT' path='/sellout' component={SelloutApp} />
),
}, },
{ {
id: 'NOTES', id: 'NOTES',
nameLocale: 'APPS_NOTES', nameLocale: 'APPS_NOTES',
icon: <FontAwesomeIcon icon={faStickyNote} fixedWidth />, icon: <FontAwesomeIcon icon={faStickyNote} fixedWidth />,
notificationIcon: ( notificationIcon: <FontAwesomeIcon icon={faStickyNote} fixedWidth size="xs" />,
<FontAwesomeIcon icon={faStickyNote} fixedWidth size='xs' />
),
backgroundColor: NOTES_APP_PRIMARY_COLOR, backgroundColor: NOTES_APP_PRIMARY_COLOR,
color: NOTES_APP_ICON_COLOR, color: NOTES_APP_ICON_COLOR,
path: '/notes', path: '/notes',
Route: () => <AppRoute id='NOTES' path='/notes' component={NotesApp} />, Route: () => <AppRoute id="NOTES" path="/notes" component={NotesApp} />,
}, },
{ {
id: 'CAMERA', id: 'CAMERA',
nameLocale: 'APPS_CAMERA', nameLocale: 'APPS_CAMERA',
icon: <CameraAltIcon fontSize='large' />, icon: <CameraAltIcon fontSize="large" />,
notificationIcon: <CameraAltIcon fontSize='small' />, notificationIcon: <CameraAltIcon fontSize="small" />,
backgroundColor: grey['A400'], backgroundColor: grey['A400'],
color: common.white, color: common.white,
path: '/camera', path: '/camera',
Route: () => <AppRoute id='CAMERA' path='/camera' component={CameraApp} />, Route: () => <AppRoute id="CAMERA" path="/camera" component={CameraApp} />,
}, },
]; ];
@@ -182,13 +170,11 @@ if (process.env.NODE_ENV === 'development') {
APPS.push({ APPS.push({
id: 'EXAMPLE', id: 'EXAMPLE',
nameLocale: 'APPS_EXAMPLE', nameLocale: 'APPS_EXAMPLE',
icon: <FontAwesomeIcon icon={faPlaneArrival} size='sm' />, icon: <FontAwesomeIcon icon={faPlaneArrival} size="sm" />,
notificationIcon: <FontAwesomeIcon icon={faPlaneArrival} size='xs' />, notificationIcon: <FontAwesomeIcon icon={faPlaneArrival} size="xs" />,
backgroundColor: blue[500], backgroundColor: blue[500],
color: blue[50], color: blue[50],
path: '/example', path: '/example',
Route: () => ( Route: () => <AppRoute id="EXAMPLE" path="/example" component={ExampleApp} />,
<AppRoute id='EXAMPLE' path='/example' component={ExampleApp} />
),
}); });
} }
+2 -2
View File
@@ -10,11 +10,11 @@ export const useApps = () => {
...a, ...a,
notification: icons.find((i) => i.key === a.id), notification: icons.find((i) => i.key === a.id),
})), })),
[icons] [icons],
); );
const getApp = useCallback( const getApp = useCallback(
(id: string): IAppConfig => apps.find((a) => a.id === id) || null, (id: string): IAppConfig => apps.find((a) => a.id === id) || null,
[apps] [apps],
); );
return { apps, getApp }; return { apps, getApp };
}; };
@@ -50,24 +50,20 @@ export const CallControls = ({ size }: { size?: 'small' | 'medium' }) => {
if (accepted || isTransmitter) { if (accepted || isTransmitter) {
return ( return (
<StatusIconButton color='error' size={size} onClick={handleEndCall}> <StatusIconButton color="error" size={size} onClick={handleEndCall}>
<CallEndIcon /> <CallEndIcon />
</StatusIconButton> </StatusIconButton>
); );
} }
return ( return (
<> <>
<Box m={SIZES_SPACING[size] || 1} display='inline'> <Box m={SIZES_SPACING[size] || 1} display="inline">
<StatusIconButton color='error' size={size} onClick={handleRejectCall}> <StatusIconButton color="error" size={size} onClick={handleRejectCall}>
<CallEndIcon className={classes.icon} /> <CallEndIcon className={classes.icon} />
</StatusIconButton> </StatusIconButton>
</Box> </Box>
<Box m={SIZES_SPACING[size] || 1} display='inline'> <Box m={SIZES_SPACING[size] || 1} display="inline">
<StatusIconButton <StatusIconButton color="success" size={size} onClick={handleAcceptCall}>
color='success'
size={size}
onClick={handleAcceptCall}
>
<CallIcon className={classes.icon} /> <CallIcon className={classes.icon} />
</StatusIconButton> </StatusIconButton>
</Box> </Box>
+1 -1
View File
@@ -19,7 +19,7 @@ export const CallModal = () => {
<CallTimer isAccepted={call?.accepted} /> <CallTimer isAccepted={call?.accepted} />
</Box> </Box>
<div className={classes.actions}> <div className={classes.actions}>
<CallControls size='medium' /> <CallControls size="medium" />
</div> </div>
</AppContent> </AppContent>
</AppWrapper> </AppWrapper>
@@ -18,17 +18,13 @@ const useStyles = makeStyles((theme) => ({
}, },
})); }));
export const CallNotification = ({ export const CallNotification = ({ children }: { children: React.ReactNode }) => {
children,
}: {
children: React.ReactNode;
}) => {
const classes = useStyles(); const classes = useStyles();
return ( return (
<div className={classes.root}> <div className={classes.root}>
<Box>{children}</Box> <Box>{children}</Box>
<Box className={classes.controls}> <Box className={classes.controls}>
<CallControls size='small' /> <CallControls size="small" />
</Box> </Box>
</div> </div>
); );
@@ -12,11 +12,7 @@ const NOTIFICATION_ID = 'call:current';
export const useCallNotifications = () => { export const useCallNotifications = () => {
const { t } = useTranslation(); const { t } = useTranslation();
const history = useHistory(); const history = useHistory();
const { const { addNotificationAlert, removeId, addNotification } = useNotifications();
addNotificationAlert,
removeId,
addNotification,
} = useNotifications();
const { play, stop } = useRingtoneSound(); const { play, stop } = useRingtoneSound();
@@ -69,7 +65,7 @@ export const useCallNotifications = () => {
</CallNotification> </CallNotification>
), ),
}, },
true true,
); );
} }
}; };
+3 -4
View File
@@ -5,10 +5,9 @@ import { callerState } from './state';
export const useDuration = () => { export const useDuration = () => {
const [duration, setDuration] = useRecoilState(callerState.callDuration); const [duration, setDuration] = useRecoilState(callerState.callDuration);
const resetDuration = useCallback( const resetDuration = useCallback(() => setDuration({ ms: 0, s: 0, m: 0, h: 0 }), [
() => setDuration({ ms: 0, s: 0, m: 0, h: 0 }), setDuration,
[setDuration] ]);
);
return { duration, setDuration, resetDuration }; return { duration, setDuration, resetDuration };
}; };
Loaded 100 of 157 files, more files were not shown because too many files have changed in this diff. Show more