mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
Fix: Dialer Routing, added contacts and styling. (#77)
* Fix dialer routing and add contacts to it * Fix styling * Delete unused component
This commit is contained in:
1 parent
84d9b08bff
commit
2bb32c453b
8 files changed
+54
-43
No files matched your search
@@ -6,7 +6,6 @@ import { ContactList } from './List/ContactList';
|
|||||||
import { useApp } from '../../../os/apps/hooks/useApps';
|
import { useApp } from '../../../os/apps/hooks/useApps';
|
||||||
import { AddContactModal } from './ContactModal';
|
import { AddContactModal } from './ContactModal';
|
||||||
import { useModal } from '../hooks/useModal';
|
import { useModal } from '../hooks/useModal';
|
||||||
import { SearchContacts } from './List/SearchContacts';
|
|
||||||
import PersonAddIcon from '@material-ui/icons/PersonAdd';
|
import PersonAddIcon from '@material-ui/icons/PersonAdd';
|
||||||
import Fab from '@material-ui/core/Fab';
|
import Fab from '@material-ui/core/Fab';
|
||||||
import { InfoModal } from './modal/InfoModal';
|
import { InfoModal } from './modal/InfoModal';
|
||||||
@@ -48,7 +47,6 @@ export const ContactsApp = () => {
|
|||||||
return (
|
return (
|
||||||
<AppWrapper id='contact-app'>
|
<AppWrapper id='contact-app'>
|
||||||
<AppTitle app={contacts} />
|
<AppTitle app={contacts} />
|
||||||
<SearchContacts />
|
|
||||||
<AddContactModal />
|
<AddContactModal />
|
||||||
<InfoModal key={contactDetail?.id} />
|
<InfoModal key={contactDetail?.id} />
|
||||||
<div className={showModal ? classes.backgroundModal : undefined} />
|
<div className={showModal ? classes.backgroundModal : undefined} />
|
||||||
|
|||||||
@@ -20,18 +20,18 @@ import { useContactDetail } from '../../hooks/useContactDetail';
|
|||||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||||
|
|
||||||
import '../Contact.css';
|
import '../Contact.css';
|
||||||
|
import { SearchContacts } from './SearchContacts';
|
||||||
|
|
||||||
export const ContactList = () => {
|
export const ContactList = () => {
|
||||||
const { filteredContacts } = useFilteredContacts();
|
const { filteredContacts } = useFilteredContacts();
|
||||||
const { setShowContactModal } = useContactModal();
|
const { setShowContactModal } = useContactModal();
|
||||||
const { contactDetail, setContactDetail } = useContactDetail();
|
const { setContactDetail } = useContactDetail();
|
||||||
|
|
||||||
const contacts = useContacts();
|
const contacts = useContacts();
|
||||||
|
|
||||||
const openContactInfo = (contact) => {
|
const openContactInfo = (contact) => {
|
||||||
setShowContactModal(true);
|
setShowContactModal(true);
|
||||||
setContactDetail(contact);
|
setContactDetail(contact);
|
||||||
console.log('CONTACT', contactDetail);
|
|
||||||
};
|
};
|
||||||
const startCall = (number) => {
|
const startCall = (number) => {
|
||||||
console.log(number);
|
console.log(number);
|
||||||
@@ -40,14 +40,17 @@ export const ContactList = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const filteredRegEx = new RegExp(filteredContacts, "gi")
|
const filteredRegEx = new RegExp(filteredContacts, 'gi');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
|
<SearchContacts />
|
||||||
<List>
|
<List>
|
||||||
{contacts.contacts
|
{contacts.contacts
|
||||||
.filter(
|
.filter(
|
||||||
(contact) =>
|
(contact) =>
|
||||||
contact.display.match(filteredRegEx) || contact.number.match(filteredRegEx)
|
contact.display.match(filteredRegEx) ||
|
||||||
|
contact.number.match(filteredRegEx)
|
||||||
)
|
)
|
||||||
.map((contact) => (
|
.map((contact) => (
|
||||||
<>
|
<>
|
||||||
@@ -85,5 +88,6 @@ export const ContactList = () => {
|
|||||||
</>
|
</>
|
||||||
))}
|
))}
|
||||||
</List>
|
</List>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -3,7 +3,6 @@ import { InputBase } from '@material-ui/core';
|
|||||||
import SearchIcon from '@material-ui/icons/Search';
|
import SearchIcon from '@material-ui/icons/Search';
|
||||||
import {
|
import {
|
||||||
createStyles,
|
createStyles,
|
||||||
fade,
|
|
||||||
Theme,
|
Theme,
|
||||||
makeStyles,
|
makeStyles,
|
||||||
} from '@material-ui/core/styles';
|
} from '@material-ui/core/styles';
|
||||||
@@ -15,7 +14,7 @@ import { useFilteredContacts } from '../../hooks/useFilteredContacts';
|
|||||||
const useStyles = makeStyles((theme: Theme) =>
|
const useStyles = makeStyles((theme: Theme) =>
|
||||||
createStyles({
|
createStyles({
|
||||||
bg: {
|
bg: {
|
||||||
backgroundColor: '#232323',
|
backgroundColor: theme.palette.background.paper,
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
height: 60,
|
height: 60,
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
@@ -25,14 +24,13 @@ const useStyles = makeStyles((theme: Theme) =>
|
|||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
},
|
},
|
||||||
inputRoot: {
|
inputRoot: {
|
||||||
color: '#fff',
|
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
|
border: '1px solid',
|
||||||
|
borderColor: theme.palette.divider,
|
||||||
},
|
},
|
||||||
inputInput: {
|
inputInput: {
|
||||||
padding: theme.spacing(1, 4, 1, 4),
|
padding: theme.spacing(1, 4, 1, 4),
|
||||||
transition: theme.transitions.create('width'),
|
transition: theme.transitions.create('width'),
|
||||||
width: '100%',
|
|
||||||
|
|
||||||
[theme.breakpoints.up('sm')]: {
|
[theme.breakpoints.up('sm')]: {
|
||||||
width: '13ch',
|
width: '13ch',
|
||||||
'&:focus': {
|
'&:focus': {
|
||||||
@@ -43,10 +41,6 @@ const useStyles = makeStyles((theme: Theme) =>
|
|||||||
search: {
|
search: {
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
borderRadius: theme.shape.borderRadius,
|
borderRadius: theme.shape.borderRadius,
|
||||||
backgroundColor: fade(theme.palette.common.white, 0.15),
|
|
||||||
'&:hover': {
|
|
||||||
backgroundColor: fade(theme.palette.common.white, 0.25),
|
|
||||||
},
|
|
||||||
marginLeft: 0,
|
marginLeft: 0,
|
||||||
width: '100%',
|
width: '100%',
|
||||||
[theme.breakpoints.up('sm')]: {
|
[theme.breakpoints.up('sm')]: {
|
||||||
@@ -75,16 +69,17 @@ export const SearchContacts = () => {
|
|||||||
<div className={classes.bg}>
|
<div className={classes.bg}>
|
||||||
<div className={classes.search}>
|
<div className={classes.search}>
|
||||||
<div className={classes.searchIcon}>
|
<div className={classes.searchIcon}>
|
||||||
<SearchIcon style={{ color: '#fff' }} />
|
<SearchIcon />
|
||||||
</div>
|
</div>
|
||||||
<InputBase
|
<InputBase
|
||||||
onChange={e => setFilteredContacts(e.target.value)}
|
fullWidth
|
||||||
|
onChange={(e) => setFilteredContacts(e.target.value)}
|
||||||
placeholder={t('APPS_CONTACT_PLACEHOLDER_SEARCH_CONTACTS')}
|
placeholder={t('APPS_CONTACT_PLACEHOLDER_SEARCH_CONTACTS')}
|
||||||
classes={{
|
classes={{
|
||||||
root: classes.inputRoot,
|
root: classes.inputRoot,
|
||||||
input: classes.inputInput,
|
input: classes.inputInput,
|
||||||
}}
|
}}
|
||||||
inputProps={{ 'aria-label': 'search', 'autoFocus': true }}
|
inputProps={{ 'aria-label': 'search', autoFocus: true }}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -19,7 +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 fullWidth className={classes.gridItem} onClick={onClick}>
|
<Button fullWidth size="large" className={classes.gridItem} onClick={onClick}>
|
||||||
{label}
|
{label}
|
||||||
</Button>
|
</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -30,7 +30,7 @@ export const DialGrid = () => {
|
|||||||
const { add, removeOne, clear} = useContext(DialInputCtx)
|
const { add, removeOne, clear} = useContext(DialInputCtx)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<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)} />
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import DialPage from './views/DialPage';
|
|||||||
import DialerNavBar from './DialerNavBar';
|
import DialerNavBar from './DialerNavBar';
|
||||||
import { useDialHistory } from '../hooks/useDialHistory';
|
import { useDialHistory } from '../hooks/useDialHistory';
|
||||||
import InjectDebugData from '../../../os/debug/InjectDebugData';
|
import InjectDebugData from '../../../os/debug/InjectDebugData';
|
||||||
|
import { ContactList } from '../../contacts/components/List/ContactList';
|
||||||
|
|
||||||
InjectDebugData([
|
InjectDebugData([
|
||||||
{
|
{
|
||||||
@@ -41,10 +42,10 @@ export const DialerApp = () => {
|
|||||||
<Route path='/phone/dial'>
|
<Route path='/phone/dial'>
|
||||||
<DialPage />
|
<DialPage />
|
||||||
</Route>
|
</Route>
|
||||||
<Route path='/phone'>
|
<Route exact path='/phone'>
|
||||||
<DialerHistory calls={history} />
|
<DialerHistory calls={history} />
|
||||||
</Route>
|
</Route>
|
||||||
{/*<Route path='/phone/contacts'></Route>*/}
|
<Route path='/phone/contacts' component={ContactList}></Route>
|
||||||
</Switch>
|
</Switch>
|
||||||
</AppContent>
|
</AppContent>
|
||||||
<DialerNavBar />
|
<DialerNavBar />
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import React, { ChangeEvent, useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { BottomNavigation, BottomNavigationAction } from '@material-ui/core';
|
import { BottomNavigation, BottomNavigationAction } from '@material-ui/core';
|
||||||
import { Link } from 'react-router-dom';
|
import { NavLink, useLocation } from 'react-router-dom';
|
||||||
import { makeStyles, Theme } from '@material-ui/core/styles';
|
import { makeStyles, Theme } from '@material-ui/core/styles';
|
||||||
import PhoneIcon from '@material-ui/icons/Phone';
|
import PhoneIcon from '@material-ui/icons/Phone';
|
||||||
import { History } from '@material-ui/icons';
|
import PersonIcon from '@material-ui/icons/Person';
|
||||||
|
import HistoryIcon from '@material-ui/icons/History';
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) => ({
|
const useStyles = makeStyles((theme: Theme) => ({
|
||||||
root: {
|
root: {
|
||||||
@@ -17,10 +18,10 @@ const useStyles = makeStyles((theme: Theme) => ({
|
|||||||
|
|
||||||
const DialerNavBar = () => {
|
const DialerNavBar = () => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
|
const { pathname } = useLocation();
|
||||||
|
const [page, setPage] = useState(pathname);
|
||||||
|
|
||||||
const [page, setPage] = useState(0);
|
const handleChange = (_e, newPage) => {
|
||||||
|
|
||||||
const handleChange = (event: ChangeEvent<{}>, newPage) => {
|
|
||||||
setPage(newPage);
|
setPage(newPage);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -33,15 +34,26 @@ const DialerNavBar = () => {
|
|||||||
>
|
>
|
||||||
<BottomNavigationAction
|
<BottomNavigationAction
|
||||||
label='History'
|
label='History'
|
||||||
component={Link}
|
value='/phone'
|
||||||
icon={<History />}
|
component={NavLink}
|
||||||
|
icon={<HistoryIcon />}
|
||||||
to='/phone'
|
to='/phone'
|
||||||
/>
|
/>
|
||||||
<BottomNavigationAction
|
<BottomNavigationAction
|
||||||
component={Link}
|
label='Dial'
|
||||||
|
value='/phone/dial'
|
||||||
|
color="secondary"
|
||||||
|
component={NavLink}
|
||||||
icon={<PhoneIcon />}
|
icon={<PhoneIcon />}
|
||||||
to='/phone/dial'
|
to='/phone/dial'
|
||||||
label='Call'
|
/>
|
||||||
|
<BottomNavigationAction
|
||||||
|
label='Contacts'
|
||||||
|
value='/phone/contacts'
|
||||||
|
color="secondary"
|
||||||
|
component={NavLink}
|
||||||
|
icon={<PersonIcon />}
|
||||||
|
to='/phone/contacts'
|
||||||
/>
|
/>
|
||||||
</BottomNavigation>
|
</BottomNavigation>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import React, { useState } from 'react';
|
|||||||
import { makeStyles, Theme } from '@material-ui/core/styles';
|
import { makeStyles, Theme } from '@material-ui/core/styles';
|
||||||
import DialGrid from '../DialPadGrid';
|
import DialGrid from '../DialPadGrid';
|
||||||
import { DialerInput } from '../DialerInput';
|
import { DialerInput } from '../DialerInput';
|
||||||
import ContactSearch from '../ContactSearch';
|
|
||||||
import { DialInputCtx } from '../../context/InputContext';
|
import { DialInputCtx } from '../../context/InputContext';
|
||||||
|
import { useQueryParams } from '../../../../common/hooks/useQueryParams';
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) => ({
|
const useStyles = makeStyles((theme: Theme) => ({
|
||||||
root: {
|
root: {
|
||||||
@@ -16,8 +16,9 @@ const useStyles = makeStyles((theme: Theme) => ({
|
|||||||
|
|
||||||
const DialPage = () => {
|
const DialPage = () => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
|
const query = useQueryParams();
|
||||||
const [inputVal, setInputVal] = useState('');
|
const queryNumber = query.number;
|
||||||
|
const [inputVal, setInputVal] = useState(queryNumber || '');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classes.root}>
|
<div className={classes.root}>
|
||||||
@@ -29,7 +30,6 @@ const DialPage = () => {
|
|||||||
clear: () => setInputVal(''),
|
clear: () => setInputVal(''),
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ContactSearch />
|
|
||||||
<DialerInput />
|
<DialerInput />
|
||||||
<DialGrid />
|
<DialGrid />
|
||||||
</DialInputCtx.Provider>
|
</DialInputCtx.Provider>
|
||||||
|
|||||||
@@ -1,12 +1,7 @@
|
|||||||
{
|
{
|
||||||
"cellProvider": "AT&T",
|
"cellProvider": "AT&T",
|
||||||
"language": "en",
|
"language": "en",
|
||||||
"wallpapers": [
|
"wallpapers": ["beach.jpg", "minimal.jpg", "surf.jpg", "waves.jpg"],
|
||||||
"beach.jpg",
|
|
||||||
"minimal.jpg",
|
|
||||||
"surf.jpg",
|
|
||||||
"waves.jpg"
|
|
||||||
],
|
|
||||||
"defaultSettings": {
|
"defaultSettings": {
|
||||||
"wallpaper": "minimal.png",
|
"wallpaper": "minimal.png",
|
||||||
"frame": "s10.png",
|
"frame": "s10.png",
|
||||||
@@ -25,7 +20,10 @@
|
|||||||
"themes": {
|
"themes": {
|
||||||
"default-dark": {
|
"default-dark": {
|
||||||
"palette": {
|
"palette": {
|
||||||
"type": "dark"
|
"type": "dark",
|
||||||
|
"primary": {
|
||||||
|
"main": "#a6d4fa"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"default-light": {
|
"default-light": {
|
||||||
@@ -37,6 +35,9 @@
|
|||||||
"common": {},
|
"common": {},
|
||||||
"palette": {
|
"palette": {
|
||||||
"type": "dark",
|
"type": "dark",
|
||||||
|
"primary": {
|
||||||
|
"main": "#a6d4fa"
|
||||||
|
},
|
||||||
"background": {
|
"background": {
|
||||||
"paper": "#1c1c1c",
|
"paper": "#1c1c1c",
|
||||||
"default": "#121212",
|
"default": "#121212",
|
||||||
|
|||||||
Reference in new issue
Block a user