mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 06:28:51 +00:00
Task/improve hardcoded styles and types (#107)
* Add working notifications with only twitter for now * feat(notification-bar): I didnt copy from NP * feat(notifications): Collapse when no more notifications after closing one * Improve overall messages styling code * Improve Routing performance * improve use keyboard hook * Remove unused returns * Button hover color :) * Button hover color :) x2 * Added hover style to containedPrimary msg btn * Replace custom components for custom theme providers for Messages and Contacts apps * Improve createAppThemeProvider * Improve createAppThemeProvider * Final housekeeping for messages styles * Change placeholder to label in Contacts app text fields * Fix alerts style with navigation and fix calc copy alerrt * Split Phone code for snackbar * Add more options and style Context Menu * Enable Sellout theme provider and make it work with light themes
This commit is contained in:
1 parent
75e23b783c
commit
4acb214ec9
56 files changed
+738
-578
No files matched your search
@@ -3,6 +3,7 @@ import { useCalculator, CalcButton } from '../hooks/useCalculator';
|
||||
import { Grid, makeStyles, Box, Paper, Fab } from '@material-ui/core';
|
||||
import { setClipboard } from '../../../os/phone/hooks/useClipboard';
|
||||
import FileCopyIcon from '@material-ui/icons/FileCopy';
|
||||
import { useSnackbar } from '../../../ui/hooks/useSnackbar';
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
button: {
|
||||
@@ -45,6 +46,9 @@ export const Calculator = ({ ...props }) => {
|
||||
eight,
|
||||
nine,
|
||||
} = useCalculator();
|
||||
|
||||
const { addAlert } = useSnackbar();
|
||||
|
||||
const classes = useStyles();
|
||||
const resultStr = useMemo(
|
||||
() =>
|
||||
@@ -58,7 +62,14 @@ export const Calculator = ({ ...props }) => {
|
||||
return (
|
||||
<Box display='flex' flexDirection='column'>
|
||||
<Box flexGrow={1} component={Paper} p={4} className={classes.result}>
|
||||
<Fab size="small" onClick={() => setClipboard(resultStr)} className={classes.copyFab}>
|
||||
<Fab
|
||||
size='small'
|
||||
onClick={() => {
|
||||
setClipboard(resultStr);
|
||||
addAlert({ message: 'CALCULATOR_COPIED', type: 'info' });
|
||||
}}
|
||||
className={classes.copyFab}
|
||||
>
|
||||
<FileCopyIcon />
|
||||
</Fab>
|
||||
{resultStr}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import { useSetRecoilState } from 'recoil';
|
||||
import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
|
||||
import { photoState } from './state';
|
||||
import { usePhotos } from './usePhotos';
|
||||
|
||||
export const usePhotoService = () => {
|
||||
const setPhotos = useSetRecoilState(photoState.photos);
|
||||
useNuiEvent('CAMERA', 'setPhotos', setPhotos);
|
||||
return usePhotos();
|
||||
};
|
||||
@@ -1,3 +0,0 @@
|
||||
#contact-app .Mui-focused::after {
|
||||
border-bottom: #2196f3 solid 4px;
|
||||
}
|
||||
@@ -8,6 +8,23 @@ import { Route } from 'react-router-dom';
|
||||
|
||||
import ContactsInfoPage from './views/ContactInfo';
|
||||
import { ContactPage } from './views/ContactsPage';
|
||||
import { ContactsThemeProvider } from '../providers/ContactsThemeProvider';
|
||||
|
||||
export const ContactsApp = () => {
|
||||
const contacts = useApp('CONTACTS');
|
||||
|
||||
return (
|
||||
<ContactsThemeProvider>
|
||||
<AppWrapper id='contact-app'>
|
||||
<AppTitle app={contacts} />
|
||||
<AppContent>
|
||||
<Route path='/contacts/' exact component={ContactPage} />
|
||||
<Route path='/contacts/:id' exact component={ContactsInfoPage} />
|
||||
</AppContent>
|
||||
</AppWrapper>
|
||||
</ContactsThemeProvider>
|
||||
);
|
||||
};
|
||||
|
||||
InjectDebugData([
|
||||
{
|
||||
@@ -33,17 +50,3 @@ InjectDebugData([
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
export const ContactsApp = () => {
|
||||
const contacts = useApp('CONTACTS');
|
||||
|
||||
return (
|
||||
<AppWrapper id='contact-app'>
|
||||
<AppTitle app={contacts} />
|
||||
<AppContent>
|
||||
<Route path='/contacts/' exact component={ContactPage} />
|
||||
<Route path='/contacts/:id' exact component={ContactsInfoPage} />
|
||||
</AppContent>
|
||||
</AppWrapper>
|
||||
);
|
||||
};
|
||||
@@ -7,17 +7,12 @@ import {
|
||||
List,
|
||||
ListItem,
|
||||
} from '@material-ui/core';
|
||||
|
||||
import { useFilteredContacts } from '../../hooks/useFilteredContacts';
|
||||
|
||||
import PhoneIcon from '@material-ui/icons/Phone';
|
||||
import ChatIcon from '@material-ui/icons/Chat';
|
||||
import MoreVertIcon from '@material-ui/icons/MoreVert';
|
||||
import { useContacts } from '../../hooks/useContacts';
|
||||
|
||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||
|
||||
import '../Contact.css';
|
||||
import { SearchContacts } from './SearchContacts';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import LogDebugEvent from '../../../../os/debug/LogDebugEvents';
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React, { useState } from 'react';
|
||||
import {
|
||||
Avatar as MuiAvatar,
|
||||
Box,
|
||||
Button,
|
||||
Paper,
|
||||
TextField,
|
||||
@@ -43,28 +44,6 @@ const useStyles = makeStyles((theme: Theme) => ({
|
||||
inputProps: {
|
||||
fontSize: 22,
|
||||
},
|
||||
updateButton: {
|
||||
background: '#2196f3',
|
||||
width: 150,
|
||||
height: 45,
|
||||
fontSize: 16,
|
||||
marginTop: 29,
|
||||
marginBottom: 29,
|
||||
},
|
||||
deleteButton: {
|
||||
background: '#d32f2f',
|
||||
width: 150,
|
||||
height: 40,
|
||||
fontSize: 16,
|
||||
},
|
||||
saveButton: {
|
||||
background: theme.palette.success.dark,
|
||||
color: '#fff',
|
||||
width: 150,
|
||||
height: 45,
|
||||
fontsize: 22,
|
||||
marginTop: theme.spacing(2),
|
||||
},
|
||||
}));
|
||||
|
||||
const ContactsInfoPage = () => {
|
||||
@@ -96,7 +75,7 @@ const ContactsInfoPage = () => {
|
||||
number,
|
||||
avatar,
|
||||
});
|
||||
history.goBack()
|
||||
history.goBack();
|
||||
};
|
||||
|
||||
const handleContactSave = () => {
|
||||
@@ -111,7 +90,7 @@ const ContactsInfoPage = () => {
|
||||
number,
|
||||
avatar,
|
||||
});
|
||||
history.goBack()
|
||||
history.goBack();
|
||||
};
|
||||
|
||||
const handleContactDelete = () => {
|
||||
@@ -123,7 +102,7 @@ const ContactsInfoPage = () => {
|
||||
Nui.send('phone:deleteContact', {
|
||||
id: contact.id,
|
||||
});
|
||||
history.goBack()
|
||||
history.goBack();
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -137,7 +116,7 @@ const ContactsInfoPage = () => {
|
||||
className={classes.input}
|
||||
value={name}
|
||||
onChange={(e) => setName(e.target.value)}
|
||||
placeholder={t('APPS_CONTACT_FORM_NAME')}
|
||||
label={t('APPS_CONTACT_FORM_NAME')}
|
||||
fullWidth
|
||||
inputProps={{
|
||||
className: classes.inputProps,
|
||||
@@ -147,7 +126,7 @@ const ContactsInfoPage = () => {
|
||||
className={classes.input}
|
||||
value={number}
|
||||
onChange={(e) => setNumber(e.target.value)}
|
||||
placeholder={t('APPS_CONTACT_FORM_NUMBER')}
|
||||
label={t('APPS_CONTACT_FORM_NUMBER')}
|
||||
fullWidth
|
||||
inputProps={{
|
||||
className: classes.inputProps,
|
||||
@@ -155,7 +134,7 @@ const ContactsInfoPage = () => {
|
||||
/>
|
||||
<TextField
|
||||
className={classes.input}
|
||||
placeholder={t('APPS_CONTACT_FORM_AVATAR')}
|
||||
label={t('APPS_CONTACT_FORM_AVATAR')}
|
||||
fullWidth
|
||||
value={avatar}
|
||||
onChange={(e) => setAvatar(e.target.value)}
|
||||
@@ -165,28 +144,38 @@ const ContactsInfoPage = () => {
|
||||
/>
|
||||
{/* Display if fetched contact */}
|
||||
{contact && (
|
||||
<div style={{ display: 'block' }}>
|
||||
<Button
|
||||
onClick={handleContactSave}
|
||||
className={classes.updateButton}
|
||||
>
|
||||
{t('GENERIC_UPDATE')}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={handleContactDelete}
|
||||
className={classes.deleteButton}
|
||||
>
|
||||
{t('GENERIC_DELETE')}
|
||||
</Button>
|
||||
</div>
|
||||
<>
|
||||
<Box py={1} display='block'>
|
||||
<Button
|
||||
color='primary'
|
||||
variant='contained'
|
||||
onClick={handleContactSave}
|
||||
>
|
||||
{t('GENERIC_UPDATE')}
|
||||
</Button>
|
||||
</Box>
|
||||
<Box py={1} display='block'>
|
||||
<Button
|
||||
variant='contained'
|
||||
color='secondary'
|
||||
onClick={handleContactDelete}
|
||||
>
|
||||
{t('GENERIC_DELETE')}
|
||||
</Button>
|
||||
</Box>
|
||||
</>
|
||||
)}
|
||||
{/* Display if no fetched contact */}
|
||||
{!contact && (
|
||||
<div style={{ display: 'block' }}>
|
||||
<Button onClick={handleContactAdd} className={classes.saveButton}>
|
||||
<Box display='block'>
|
||||
<Button
|
||||
color='primary'
|
||||
variant='contained'
|
||||
onClick={handleContactAdd}
|
||||
>
|
||||
{t('APPS_CONTACT_MODAL_BUTTON_ADD')}
|
||||
</Button>
|
||||
</div>
|
||||
</Box>
|
||||
)}
|
||||
</div>
|
||||
</Paper>
|
||||
|
||||
@@ -26,8 +26,8 @@ export const ContactPage = () => {
|
||||
<>
|
||||
<ContactList />
|
||||
<Fab
|
||||
color='primary'
|
||||
onClick={() => history.push('/contacts/-1')}
|
||||
style={{ backgroundColor: '#2196f3', color: '#fff' }}
|
||||
className={classes.absolute}
|
||||
>
|
||||
<PersonAddIcon />
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
import { blue, common } from '@material-ui/core/colors';
|
||||
|
||||
export const CONTACTS_APP_BG_COLOR = blue[500];
|
||||
export const CONTACTS_APP_COLOR = common.white;
|
||||
@@ -0,0 +1,27 @@
|
||||
import { blue, common } from '@material-ui/core/colors';
|
||||
|
||||
export const CONTACTS_APP_PRIMARY_COLOR = blue[500];
|
||||
export const CONTACTS_APP_TEXT_COLOR = common.white;
|
||||
|
||||
const theme = {
|
||||
palette: {
|
||||
primary: {
|
||||
main: CONTACTS_APP_PRIMARY_COLOR,
|
||||
dark: blue[700],
|
||||
light: blue[300],
|
||||
contrastText: CONTACTS_APP_TEXT_COLOR,
|
||||
},
|
||||
secondary: {
|
||||
main: '#d32f2f',
|
||||
light: '#eb4242',
|
||||
dark: '#941212',
|
||||
contrastText: CONTACTS_APP_TEXT_COLOR,
|
||||
},
|
||||
success: {
|
||||
main: '#2196f3',
|
||||
contrastText: CONTACTS_APP_TEXT_COLOR,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default theme;
|
||||
@@ -1,13 +1,10 @@
|
||||
import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
|
||||
import { useSetRecoilState } from 'recoil';
|
||||
import { contactsState } from './state';
|
||||
import { useContacts } from './useContacts';
|
||||
import { useContactAlert } from './useAlert';
|
||||
|
||||
export const useContactsService = () => {
|
||||
const setContacts = useSetRecoilState(contactsState.contacts);
|
||||
const setAlert = useSetRecoilState(contactsState.contactAlert);
|
||||
useNuiEvent('CONTACTS', 'setContacts', setContacts);
|
||||
useNuiEvent('CONTACTS', 'setAlert', setAlert);
|
||||
return { useContacts, useContactAlert };
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
import { createAppThemeProvider } from '../../../os/apps/utils/createAppThemeProvider';
|
||||
|
||||
import contactsTheme from '../contacts.theme';
|
||||
|
||||
export const ContactsThemeProvider = createAppThemeProvider(contactsTheme);
|
||||
@@ -1,11 +1,8 @@
|
||||
import { useSetRecoilState } from 'recoil';
|
||||
import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
|
||||
import { dialState } from './state';
|
||||
import { useDialHistory } from './useDialHistory';
|
||||
|
||||
export const useDialService = () => {
|
||||
const setHistory = useSetRecoilState(dialState.history);
|
||||
useNuiEvent('DAILER', 'setHistory', setHistory);
|
||||
|
||||
return useDialHistory();
|
||||
};
|
||||
@@ -4,20 +4,25 @@ import { AppWrapper } from '../../../ui/components';
|
||||
import { AppContent } from '../../../ui/components/AppContent';
|
||||
import { useApp } from '../../../os/apps/hooks/useApps';
|
||||
import { useExample } from '../hooks/useExample';
|
||||
import { ExampleThemeProvider } from '../providers/ExampleThemeProvider';
|
||||
import { AppTitle } from '../../../ui/components/AppTitle';
|
||||
import { Button } from '@material-ui/core';
|
||||
|
||||
export const ExampleApp = () => {
|
||||
// calling the example hook, and we assign the value to a variable
|
||||
|
||||
const exampleString = useExample();
|
||||
const example = useApp('EXAMPLE');
|
||||
return (
|
||||
<AppWrapper>
|
||||
<AppContent>
|
||||
<h1>This is an example</h1>
|
||||
<h2>{example.id}</h2>
|
||||
{/* Here we are using the value in a h3 tag */}
|
||||
<h3>{exampleString}</h3>
|
||||
</AppContent>
|
||||
</AppWrapper>
|
||||
<ExampleThemeProvider>
|
||||
<AppWrapper>
|
||||
<AppTitle app={example} />
|
||||
<AppContent>
|
||||
<h1>This is an example</h1>
|
||||
<Button color='primary'>{example.id}</Button>
|
||||
{/* Here we are using the value in a h3 tag */}
|
||||
<h3>{exampleString}</h3>
|
||||
</AppContent>
|
||||
</AppWrapper>
|
||||
</ExampleThemeProvider>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
const theme = {
|
||||
palette: {
|
||||
primary: {
|
||||
main: '#f23123'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default theme;
|
||||
@@ -0,0 +1,5 @@
|
||||
import { createAppThemeProvider } from '../../../os/apps/utils/createAppThemeProvider';
|
||||
|
||||
import exampleTheme from '../example.theme';
|
||||
|
||||
export const ExampleThemeProvider = createAppThemeProvider(exampleTheme);
|
||||
@@ -5,11 +5,11 @@ import { GridMenu } from '../../../ui/components/GridMenu';
|
||||
import { useApps } from '../../../os/apps/hooks/useApps';
|
||||
|
||||
export const HomeApp = () => {
|
||||
const { allApps } = useApps();
|
||||
const { apps } = useApps();
|
||||
return (
|
||||
<AppWrapper>
|
||||
<Box width='100%' mt={6} px={1}>
|
||||
{allApps && <GridMenu items={allApps} />}
|
||||
{apps && <GridMenu items={apps} />}
|
||||
</Box>
|
||||
</AppWrapper>
|
||||
);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import './messages.css';
|
||||
import React, { useEffect } from 'react';
|
||||
import { AppWrapper } from '../../../ui/components';
|
||||
import { AppTitle } from '../../../ui/components/AppTitle';
|
||||
@@ -10,8 +9,9 @@ import MessagesList from './list/MessagesList';
|
||||
import { Route, Switch, useHistory } from 'react-router-dom';
|
||||
import { MessageModal } from './modal/MessageModal';
|
||||
import InjectDebugData from '../../../os/debug/InjectDebugData';
|
||||
import NewMessageGroupButton from './buttons/NewMessageGroupButton';
|
||||
import NewMessageGroupButton from './form/NewMessageGroupButton';
|
||||
import Nui from '../../../os/nui-events/utils/Nui';
|
||||
import { MessagesThemeProvider } from '../providers/MessagesThemeProvider';
|
||||
|
||||
export const MessagesApp = () => {
|
||||
const messages = useApp('MESSAGES');
|
||||
@@ -22,37 +22,37 @@ export const MessagesApp = () => {
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<AppWrapper id='messages-app'>
|
||||
<AppTitle app={messages} />
|
||||
<AppContent>
|
||||
<Switch>
|
||||
<Route
|
||||
path='/messages/conversations/:groupId'
|
||||
component={MessageModal}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path='/messages'
|
||||
render={() => (
|
||||
<>
|
||||
<MessagesList />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
</Switch>
|
||||
<Switch>
|
||||
<Route
|
||||
exact
|
||||
path={['/messages/new/:phoneNumber', '/messages/new']}
|
||||
render={() => <MessageGroupModal />}
|
||||
/>
|
||||
</Switch>
|
||||
</AppContent>
|
||||
<NewMessageGroupButton
|
||||
onClick={() => history.push('/messages/new')}
|
||||
/>
|
||||
<AlertBar />
|
||||
</AppWrapper>
|
||||
<MessagesThemeProvider>
|
||||
<AppWrapper id='messages-app'>
|
||||
<AppTitle app={messages} />
|
||||
<AppContent>
|
||||
<Switch>
|
||||
<Route
|
||||
path='/messages/conversations/:groupId'
|
||||
component={MessageModal}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path='/messages'
|
||||
render={() => (
|
||||
<>
|
||||
<MessagesList />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
</Switch>
|
||||
<Switch>
|
||||
<Route
|
||||
exact
|
||||
path={['/messages/new/:phoneNumber', '/messages/new']}
|
||||
render={() => <MessageGroupModal />}
|
||||
/>
|
||||
</Switch>
|
||||
</AppContent>
|
||||
<NewMessageGroupButton onClick={() => history.push('/messages/new')} />
|
||||
<AlertBar />
|
||||
</AppWrapper>
|
||||
</MessagesThemeProvider>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -73,7 +73,7 @@ InjectDebugData([
|
||||
updatedAt: Date.now(),
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
id: 2,
|
||||
message: 'sup!',
|
||||
user_identifier: '1234',
|
||||
phone_number: '444-4444',
|
||||
@@ -84,7 +84,7 @@ InjectDebugData([
|
||||
updatedAt: Date.now(),
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
id: 3,
|
||||
message: 'sup!',
|
||||
user_identifier: '1234',
|
||||
phone_number: '444-4444',
|
||||
@@ -95,7 +95,7 @@ InjectDebugData([
|
||||
updatedAt: Date.now(),
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
id: 4,
|
||||
message: 'sup!',
|
||||
user_identifier: '1234',
|
||||
phone_number: '444-4444',
|
||||
@@ -106,7 +106,7 @@ InjectDebugData([
|
||||
updatedAt: Date.now(),
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
id: 5,
|
||||
message: 'sup!',
|
||||
user_identifier: '1234',
|
||||
phone_number: '444-4444',
|
||||
@@ -117,7 +117,7 @@ InjectDebugData([
|
||||
updatedAt: Date.now(),
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
id: 6,
|
||||
message: 'sup!',
|
||||
user_identifier: '1234',
|
||||
phone_number: '444-4444',
|
||||
@@ -128,7 +128,7 @@ InjectDebugData([
|
||||
updatedAt: Date.now(),
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
id: 7,
|
||||
message: 'sup!',
|
||||
user_identifier: '1234',
|
||||
phone_number: '444-4444',
|
||||
@@ -139,7 +139,7 @@ InjectDebugData([
|
||||
updatedAt: Date.now(),
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
id: 8,
|
||||
message: 'sup!',
|
||||
user_identifier: '1234',
|
||||
phone_number: '444-4444',
|
||||
@@ -150,7 +150,7 @@ InjectDebugData([
|
||||
updatedAt: Date.now(),
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
id: 9,
|
||||
message: 'sup!',
|
||||
user_identifier: '1234',
|
||||
phone_number: '444-4444',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { FormEvent, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Paper, TextField, Button, Box, makeStyles } from '@material-ui/core';
|
||||
import { Paper, Box, makeStyles, TextField, Button } from '@material-ui/core';
|
||||
import SendIcon from '@material-ui/icons/Send';
|
||||
import ImageIcon from '@material-ui/icons/Image';
|
||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import { Fab } from '@material-ui/core';
|
||||
import AddIcon from '@material-ui/icons/Add';
|
||||
import { Fab } from '@material-ui/core';
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { FormEvent, useCallback, useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { TextField, Button, Box } from '@material-ui/core';
|
||||
import { Box, Button, TextField } from '@material-ui/core';
|
||||
|
||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
@@ -102,7 +102,7 @@ const NewMessageGroupForm = ({ phoneNumber }: { phoneNumber?: string }) => {
|
||||
)}
|
||||
<Box px={2} py={3}>
|
||||
<Button disabled={submitDisabled} variant='contained' fullWidth color='primary' type='submit'>
|
||||
{t('APPS_MESSAGES_NEW_MESSAGE_GROUP_SUBMIT')}
|
||||
{t('APPS_MESSAGES_NEW_MESSAGE_GROUP_SUBMIT')}
|
||||
</Button>
|
||||
</Box>
|
||||
</form>
|
||||
|
||||
@@ -17,6 +17,8 @@ const useStyles = makeStyles((theme) => ({
|
||||
inputRoot: {
|
||||
fontWeight: 400,
|
||||
fontSize: 18,
|
||||
border: '1px solid',
|
||||
borderColor: theme.palette.divider,
|
||||
},
|
||||
inputInput: {
|
||||
padding: theme.spacing(1, 4, 1, 4),
|
||||
@@ -27,7 +29,7 @@ const useStyles = makeStyles((theme) => ({
|
||||
[theme.breakpoints.up('sm')]: {
|
||||
width: '13ch',
|
||||
'&:focus': {
|
||||
width: '20ch',
|
||||
width: '24ch',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
#messages-app {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* override the FAB (action buttons) background when selected */
|
||||
#messages-app .MuiFab-primary {
|
||||
background: #ffa000 !important;
|
||||
}
|
||||
|
||||
/* override the underlines of text fields */
|
||||
#messages-app .Mui-focused:after {
|
||||
border-bottom-color: #ffa000 !important;
|
||||
}
|
||||
|
||||
/* override form submit button */
|
||||
#messages-app .MuiButton-containedPrimary {
|
||||
background-color: #ffa000 !important;
|
||||
}
|
||||
|
||||
#messages-app .MuiSkeleton-text {
|
||||
border-radius: 20px !important;
|
||||
transform: none;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
import { makeStyles } from '@material-ui/core';
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
addMessageFab: {
|
||||
position: 'sticky',
|
||||
bottom: theme.spacing(2),
|
||||
left: theme.spacing(3),
|
||||
},
|
||||
}));
|
||||
|
||||
export default useStyles;
|
||||
@@ -1,11 +1,12 @@
|
||||
import React, { useState } from 'react';
|
||||
import { Box, Paper, Typography } from '@material-ui/core';
|
||||
import { Box } from '@material-ui/core';
|
||||
|
||||
import { Message, MessageGroup } from '../../../../common/typings/messages';
|
||||
import MessageInput from '../form/MessageInput';
|
||||
import useStyles from './modal.styles';
|
||||
import { MessageImageModal } from './MessageImageModal';
|
||||
import { useQueryParams } from '../../../../common/hooks/useQueryParams';
|
||||
import { MessageBubble } from './MessageBubble';
|
||||
|
||||
interface IProps {
|
||||
activeMessageGroup: MessageGroup;
|
||||
@@ -20,10 +21,6 @@ const Conversation = ({ activeMessageGroup, messages }: IProps) => {
|
||||
const query = useQueryParams();
|
||||
const referalImage = query?.image || null;
|
||||
|
||||
const isImage = (url) => {
|
||||
return /(http(s?):)([/|.|\w|\s|-])*\.(?:jpg|png|jpeg|gif)/g.test(url);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<MessageImageModal
|
||||
@@ -41,27 +38,11 @@ const Conversation = ({ activeMessageGroup, messages }: IProps) => {
|
||||
className={classes.overflowAutoY}
|
||||
>
|
||||
{messages.map((message) => (
|
||||
<div key={message.id}>
|
||||
<Paper
|
||||
className={message.isMine ? classes.sourceSms : classes.sms}
|
||||
variant='outlined'
|
||||
>
|
||||
{isImage(message.message) ? (
|
||||
<img
|
||||
src={message.message}
|
||||
className={classes.imageMessage}
|
||||
alt='multimedia'
|
||||
/>
|
||||
) : (
|
||||
<div>{message.message}</div>
|
||||
)}
|
||||
<Typography variant='subtitle1' color='secondary'>
|
||||
{activeMessageGroup.isGroupChat && !message.isMine
|
||||
? message.display || message.phone_number
|
||||
: null}
|
||||
</Typography>
|
||||
</Paper>
|
||||
</div>
|
||||
<MessageBubble
|
||||
key={message.id}
|
||||
message={message}
|
||||
isGroupChat={activeMessageGroup?.isGroupChat}
|
||||
/>
|
||||
))}
|
||||
</Box>
|
||||
<MessageInput
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
import { Box, makeStyles, Paper, Typography } from '@material-ui/core';
|
||||
import React from 'react';
|
||||
import { Message } from '../../../../common/typings/messages';
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
imageMessage: {
|
||||
width: '80%',
|
||||
maxWidth: '80%',
|
||||
height: '80%',
|
||||
maxHeight: '80%',
|
||||
},
|
||||
mySms: {
|
||||
float: 'right',
|
||||
margin: theme.spacing(1),
|
||||
padding: '6px 12px',
|
||||
height: 'auto',
|
||||
width: '80%',
|
||||
background: theme.palette.background.default,
|
||||
color: theme.palette.text.primary,
|
||||
borderRadius: '20px',
|
||||
textOverflow: 'ellipsis',
|
||||
},
|
||||
sms: {
|
||||
float: 'left',
|
||||
margin: theme.spacing(1),
|
||||
padding: '6px 12px',
|
||||
width: '80%',
|
||||
height: 'auto',
|
||||
background: theme.palette.primary.light,
|
||||
color: theme.palette.getContrastText(theme.palette.primary.light),
|
||||
borderRadius: '15px',
|
||||
textOverflow: 'ellipsis',
|
||||
},
|
||||
}));
|
||||
|
||||
const isImage = (url) => {
|
||||
return /(http(s?):)([/|.|\w|\s|-])*\.(?:jpg|png|jpeg|gif)/g.test(url);
|
||||
};
|
||||
|
||||
export const MessageBubble = ({
|
||||
message,
|
||||
isGroupChat,
|
||||
}: {
|
||||
message: Message;
|
||||
isGroupChat: boolean;
|
||||
}) => {
|
||||
const classes = useStyles();
|
||||
return (
|
||||
<div>
|
||||
<Paper
|
||||
className={message.isMine ? classes.mySms : classes.sms}
|
||||
variant='outlined'
|
||||
>
|
||||
<Box>
|
||||
{isImage(message.message) ? (
|
||||
<img
|
||||
src={message.message}
|
||||
className={classes.imageMessage}
|
||||
alt='multimedia'
|
||||
/>
|
||||
) : (
|
||||
<div>{message.message}</div>
|
||||
)}
|
||||
</Box>
|
||||
<Box textAlign='right'>
|
||||
<Typography variant='subtitle1' color='secondary'>
|
||||
{isGroupChat && !message.isMine
|
||||
? message.display || message.phone_number
|
||||
: null}
|
||||
</Typography>
|
||||
</Box>
|
||||
</Paper>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -1,10 +1,9 @@
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import qs from 'qs';
|
||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||
import CloseIcon from '@material-ui/icons/Close';
|
||||
import Modal from '../../../../ui/components/Modal';
|
||||
import PhotoLibraryIcon from '@material-ui/icons/PhotoLibrary';
|
||||
import { Box, Button, TextField, Typography } from '@material-ui/core';
|
||||
import { Box, Typography, TextField, Button } from '@material-ui/core';
|
||||
import FileCopyIcon from '@material-ui/icons/FileCopy';
|
||||
import useStyles from './modal.styles';
|
||||
import { useHistory, useLocation } from 'react-router-dom';
|
||||
@@ -85,13 +84,9 @@ export const MessageImageModal = ({
|
||||
})}`
|
||||
),
|
||||
},
|
||||
{
|
||||
label: 'Cancel',
|
||||
icon: <CloseIcon />,
|
||||
onClick: onClose,
|
||||
},
|
||||
|
||||
],
|
||||
[onClose, history, pathname, search]
|
||||
[history, pathname, search]
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -110,6 +105,7 @@ export const MessageImageModal = ({
|
||||
<Button
|
||||
fullWidth
|
||||
variant='contained'
|
||||
color='primary'
|
||||
onClick={() => sendFromQueryParam(queryParamImagePreview)}
|
||||
>
|
||||
Share
|
||||
@@ -117,19 +113,19 @@ export const MessageImageModal = ({
|
||||
</Box>
|
||||
</Modal>
|
||||
<Modal visible={pasteVisible} handleClose={() => setPasteVisible(false)}>
|
||||
<div>
|
||||
<Box p={1}>
|
||||
<TextField
|
||||
placeholder='A link to your image or gif'
|
||||
onChange={(e) => setMessage(e.target.value)}
|
||||
value={message}
|
||||
className={classes.input}
|
||||
fullWidth
|
||||
inputProps={{
|
||||
className: classes.messagesInput,
|
||||
}}
|
||||
inputRef={(input) => input && input.focus()}
|
||||
onKeyPress={sendFromClipboard}
|
||||
/>
|
||||
</div>
|
||||
</Box>
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import { Slide, Paper, Button, Typography } from '@material-ui/core';
|
||||
import { Slide, Paper, Typography, Button } from '@material-ui/core';
|
||||
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
|
||||
|
||||
import useStyles from './modal.styles';
|
||||
|
||||
@@ -6,6 +6,10 @@ const useStyles = makeStyles({
|
||||
root: {
|
||||
margin: '0px 0px 12px 8px',
|
||||
},
|
||||
skeleton: {
|
||||
borderRadius: '20px',
|
||||
transform: 'none',
|
||||
},
|
||||
});
|
||||
|
||||
export default function MessageSkeleton({ height, isMine = false }) {
|
||||
@@ -14,7 +18,12 @@ export default function MessageSkeleton({ height, isMine = false }) {
|
||||
const marginLeft = isMine ? '60px' : '8px';
|
||||
return (
|
||||
<div className={classes.root} style={{ marginLeft, height: `${height}px` }}>
|
||||
<Skeleton variant='text' width={325} height={height} />
|
||||
<Skeleton
|
||||
className={classes.skeleton}
|
||||
variant='text'
|
||||
width={325}
|
||||
height={height}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
import { makeStyles } from '@material-ui/core';
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
const useStyles = makeStyles({
|
||||
modalRoot: {
|
||||
zIndex: 10,
|
||||
zIndex: 9,
|
||||
position: 'absolute',
|
||||
height: '100%',
|
||||
width: '100%',
|
||||
@@ -31,40 +31,9 @@ const useStyles = makeStyles((theme) => ({
|
||||
paddingTop: '8px',
|
||||
fontSize: '20px',
|
||||
},
|
||||
sourceSms: {
|
||||
float: 'right',
|
||||
margin: 10,
|
||||
padding: '6px 12px',
|
||||
height: 'auto',
|
||||
width: '80%',
|
||||
background: '#0288d1',
|
||||
borderRadius: '20px',
|
||||
textOverflow: 'ellipsis',
|
||||
},
|
||||
sms: {
|
||||
float: 'left',
|
||||
margin: 10,
|
||||
padding: '6px 12px',
|
||||
width: '80%',
|
||||
height: 'auto',
|
||||
background: '#ddd',
|
||||
color: '#232323',
|
||||
borderRadius: '15px',
|
||||
textOverflow: 'ellipsis',
|
||||
},
|
||||
messagesInput: {
|
||||
fontSize: 20,
|
||||
},
|
||||
input: {
|
||||
width: '100%',
|
||||
margin: 10,
|
||||
},
|
||||
imageMessage: {
|
||||
width: '80%',
|
||||
maxWidth: '80%',
|
||||
height: '80%',
|
||||
maxHeight: '80%',
|
||||
},
|
||||
}));
|
||||
});
|
||||
|
||||
export default useStyles;
|
||||
@@ -0,0 +1,17 @@
|
||||
import { amber, common } from '@material-ui/core/colors';
|
||||
|
||||
export const MESSAGES_APP_PRIMARY_COLOR = amber[800];
|
||||
export const MESSAGES_APP_TEXT_COLOR = common.white;
|
||||
|
||||
const theme = {
|
||||
palette: {
|
||||
primary: {
|
||||
main: MESSAGES_APP_PRIMARY_COLOR,
|
||||
dark: amber[900],
|
||||
light: amber[100],
|
||||
contrastText: MESSAGES_APP_TEXT_COLOR
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default theme;
|
||||
@@ -0,0 +1,4 @@
|
||||
import { createAppThemeProvider } from '../../../os/apps/utils/createAppThemeProvider';
|
||||
import messagesTheme from '../messages.theme';
|
||||
|
||||
export const MessagesThemeProvider = createAppThemeProvider(messagesTheme);
|
||||
@@ -1,6 +1,5 @@
|
||||
import { useSetRecoilState } from 'recoil';
|
||||
import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
|
||||
import { useNotes } from './useNotes';
|
||||
import { noteStates } from './state';
|
||||
import { useSnackbar } from '../../../ui/hooks/useSnackbar';
|
||||
|
||||
@@ -10,5 +9,4 @@ export const useNotesService = () => {
|
||||
|
||||
useNuiEvent('NOTES', 'setNotes', setNotes);
|
||||
useNuiEvent('NOTES', 'setAlert', addAlert);
|
||||
return useNotes();
|
||||
};
|
||||
@@ -1,7 +0,0 @@
|
||||
#sellout-app .Mui-selected {
|
||||
color: #f44336 !important;
|
||||
}
|
||||
|
||||
#sellout-app .Mui-focused::after {
|
||||
border-bottom: #f44336 solid 3px;
|
||||
}
|
||||
@@ -5,10 +5,26 @@ import { SelloutTitle } from './SelloutTitle';
|
||||
import { SelloutListContainer } from './SelloutList/SelloutListContainer';
|
||||
import { NavigationBar } from './navigation/NavigationBar';
|
||||
import { Switch, Route } from 'react-router-dom';
|
||||
|
||||
import './Sellout.css';
|
||||
import { ListingFormContainer } from './form/ListingFormContainer';
|
||||
import InjectDebugData from '../../../os/debug/InjectDebugData';
|
||||
import { SelloutThemeProvider } from '../providers/SelloutThemeProvider';
|
||||
|
||||
export const SelloutApp = () => {
|
||||
return (
|
||||
<SelloutThemeProvider>
|
||||
<AppWrapper id='sellout-app'>
|
||||
<SelloutTitle />
|
||||
<AppContent>
|
||||
<Switch>
|
||||
<Route path='/sellout' exact component={SelloutListContainer} />
|
||||
<Route path='/sellout/new' component={ListingFormContainer} />
|
||||
</Switch>
|
||||
</AppContent>
|
||||
<NavigationBar />
|
||||
</AppWrapper>
|
||||
</SelloutThemeProvider>
|
||||
);
|
||||
};
|
||||
|
||||
InjectDebugData([
|
||||
{
|
||||
@@ -34,18 +50,3 @@ InjectDebugData([
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
export const SelloutApp = () => {
|
||||
return (
|
||||
<AppWrapper id='sellout-app'>
|
||||
<SelloutTitle />
|
||||
<AppContent>
|
||||
<Switch>
|
||||
<Route path='/sellout' exact component={SelloutListContainer} />
|
||||
<Route path='/sellout/new' component={ListingFormContainer} />
|
||||
</Switch>
|
||||
</AppContent>
|
||||
<NavigationBar />
|
||||
</AppWrapper>
|
||||
);
|
||||
};
|
||||
@@ -27,9 +27,12 @@ const useStyles = makeStyles((theme) => ({
|
||||
flexFlow: 'column',
|
||||
alignItems: 'flex',
|
||||
height: 'auto',
|
||||
background: '#232323',
|
||||
background: theme.palette.background.default,
|
||||
marginBottom: 20,
|
||||
},
|
||||
icon: {
|
||||
color: theme.palette.primary.main
|
||||
},
|
||||
header: {
|
||||
margin: 10,
|
||||
},
|
||||
@@ -79,10 +82,10 @@ export const SelloutItem = (listing) => {
|
||||
</Typography>
|
||||
<div>
|
||||
<Button>
|
||||
<ChatIcon style={{ color: '#f44336' }} />
|
||||
<ChatIcon className={classes.icon} />
|
||||
</Button>
|
||||
<Button>
|
||||
<PhoneIcon style={{ color: '#f44336' }} />
|
||||
<PhoneIcon className={classes.icon} />
|
||||
</Button>
|
||||
</div>
|
||||
</Paper>
|
||||
|
||||
@@ -12,10 +12,10 @@ const useStyles = makeStyles((theme) => ({
|
||||
flexFlow: 'row nowrap',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
background: '#262525',
|
||||
background: theme.palette.background.default,
|
||||
},
|
||||
icon: {
|
||||
color: '#f44336',
|
||||
color: theme.palette.primary.main,
|
||||
fontSize: 40,
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -2,8 +2,6 @@ import React, { useState } from 'react';
|
||||
import { makeStyles, Button, TextField } from '@material-ui/core';
|
||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||
|
||||
import '../Sellout.css';
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
width: '100%',
|
||||
@@ -22,7 +20,7 @@ const useStyles = makeStyles((theme) => ({
|
||||
postButton: {
|
||||
display: 'block',
|
||||
margin: 'auto',
|
||||
background: '#f44336',
|
||||
background: theme.palette.primary.main,
|
||||
width: '80%',
|
||||
fontSize: 20,
|
||||
},
|
||||
|
||||
@@ -9,10 +9,10 @@ import AddCircleIcon from '@material-ui/icons/AddCircle';
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
width: '100%',
|
||||
backgroundColor: '#262525',
|
||||
backgroundColor: theme.palette.background.default,
|
||||
},
|
||||
icon: {
|
||||
color: '#f44336',
|
||||
color: theme.palette.primary.main,
|
||||
},
|
||||
}));
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
import { createAppThemeProvider } from "../../../os/apps/utils/createAppThemeProvider";
|
||||
|
||||
import selloutTheme from '../sellout.theme';
|
||||
|
||||
export const SelloutThemeProvider = createAppThemeProvider(selloutTheme);
|
||||
@@ -0,0 +1,14 @@
|
||||
import { common } from "@material-ui/core/colors";
|
||||
|
||||
const theme = {
|
||||
palette: {
|
||||
primary: {
|
||||
main: '#f44336',
|
||||
dark: '#b3251b',
|
||||
light: 'f87f76',
|
||||
contrastText: common.black
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default theme;
|
||||
Reference in new issue
Block a user