mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
Merge branch 'master' into feat/alerts-for-apps
This commit is contained in:
58 files changed
+769
-697
No files matched your search
@@ -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;
|
||||
@@ -7,7 +7,8 @@ import { useSnackbar } from '../../../ui/hooks/useSnackbar';
|
||||
export const useContactsService = () => {
|
||||
const setContacts = useSetRecoilState(contactsState.contacts);
|
||||
const { addAlert } = useSnackbar()
|
||||
|
||||
useNuiEvent('CONTACTS', 'setContacts', setContacts);
|
||||
useNuiEvent('CONTACTS', 'setAlert', addAlert);
|
||||
return useContacts();
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
import { createAppThemeProvider } from '../../../os/apps/utils/createAppThemeProvider';
|
||||
|
||||
import contactsTheme from '../contacts.theme';
|
||||
|
||||
export const ContactsThemeProvider = createAppThemeProvider(contactsTheme);
|
||||
Reference in new issue
Block a user