diff --git a/phone/src/apps/contacts/components/views/ContactInfo.tsx b/phone/src/apps/contacts/components/views/ContactInfo.tsx index 57dc069..48f0ecc 100644 --- a/phone/src/apps/contacts/components/views/ContactInfo.tsx +++ b/phone/src/apps/contacts/components/views/ContactInfo.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { Avatar as MuiAvatar, Box, @@ -13,12 +13,17 @@ import { useContacts } from '../../hooks/useContacts'; import Nui from '../../../../os/nui-events/utils/Nui'; import ArrowBackIcon from '@material-ui/icons/ArrowBack'; import LogDebugEvent from '../../../../os/debug/LogDebugEvents'; +import { useQueryParams } from '../../../../common/hooks/useQueryParams'; interface ContactInfoRouteParams { mode: string; id: string; } +interface ContactInfoRouteQuery { + addNumber: string; +} + const useStyles = makeStyles((theme: Theme) => ({ root: { height: '100%', @@ -54,6 +59,7 @@ const ContactsInfoPage = () => { const { getContact } = useContacts(); const { id } = useParams(); + const { addNumber } = useQueryParams(); const contact = getContact(parseInt(id)); @@ -64,6 +70,12 @@ const ContactsInfoPage = () => { const { t } = useTranslation(); + useEffect(() => { + if (addNumber) { + setNumber(addNumber); + } + }, [addNumber]); + const handleContactAdd = () => { LogDebugEvent({ action: 'Handling Contact Add', @@ -113,6 +125,7 @@ const ContactsInfoPage = () => {
setName(e.target.value)} diff --git a/phone/src/apps/dialer/components/ContactSearch.tsx b/phone/src/apps/dialer/components/ContactSearch.tsx index f5e1f02..99203a6 100644 --- a/phone/src/apps/dialer/components/ContactSearch.tsx +++ b/phone/src/apps/dialer/components/ContactSearch.tsx @@ -4,7 +4,7 @@ import { makeStyles, Theme } from '@material-ui/core/styles'; const useStyles = makeStyles((theme: Theme) => ({ root: { - backgroundColor: '#e9e9e9', + backgroundColor: theme.palette.background.default, }, })); diff --git a/phone/src/apps/dialer/components/DialerApp.tsx b/phone/src/apps/dialer/components/DialerApp.tsx index 7be6360..4ce7eb0 100644 --- a/phone/src/apps/dialer/components/DialerApp.tsx +++ b/phone/src/apps/dialer/components/DialerApp.tsx @@ -10,6 +10,32 @@ import DialerNavBar from './DialerNavBar'; import { useDialHistory } from '../hooks/useDialHistory'; import InjectDebugData from '../../../os/debug/InjectDebugData'; import { ContactList } from '../../contacts/components/List/ContactList'; +import { DialerThemeProvider } from '../providers/DialerThemeProvider'; + +export const DialerApp = () => { + const history = useDialHistory(); + + const dialer = useApp('DIALER'); + return ( + + + + + + + + + + + + + + + + + + ); +}; InjectDebugData([ { @@ -29,26 +55,3 @@ InjectDebugData([ ], }, ]); - -export const DialerApp = () => { - const history = useDialHistory(); - - const dialer = useApp('DIALER'); - return ( - - - - - - - - - - - - - - - - ); -}; diff --git a/phone/src/apps/dialer/components/DialerInput.tsx b/phone/src/apps/dialer/components/DialerInput.tsx index 4fe1822..45a95a7 100644 --- a/phone/src/apps/dialer/components/DialerInput.tsx +++ b/phone/src/apps/dialer/components/DialerInput.tsx @@ -2,8 +2,10 @@ import React, { useContext } from 'react'; import { Box, IconButton, InputBase, Paper } from '@material-ui/core'; import { makeStyles, Theme } from '@material-ui/core/styles'; import PhoneIcon from '@material-ui/icons/Phone'; +import PersonAddIcon from '@material-ui/icons/PersonAdd'; import { DialInputCtx } from '../context/InputContext'; import Nui from '../../../os/nui-events/utils/Nui'; +import { useHistory } from 'react-router-dom'; const useStyles = makeStyles((theme: Theme) => ({ root: { @@ -26,8 +28,9 @@ const useStyles = makeStyles((theme: Theme) => ({ export const DialerInput = () => { const classes = useStyles(); + const history = useHistory(); - const { inputVal } = useContext(DialInputCtx) + const { inputVal } = useContext(DialInputCtx); const handleCall = (number: string) => { Nui.send('phone:beginCall', { @@ -35,6 +38,10 @@ export const DialerInput = () => { }); }; + const handleNewContact = (number: string) => { + history.push(`/contacts/-1/?addNumber=${number}`) + } + return ( { className={classes.input} value={inputVal} /> + + handleCall(inputVal)} /> + - handleCall(inputVal)} /> + handleNewContact(inputVal)} /> ); diff --git a/phone/src/apps/dialer/components/DialerNavBar.tsx b/phone/src/apps/dialer/components/DialerNavBar.tsx index 4e0bdb5..1904c59 100644 --- a/phone/src/apps/dialer/components/DialerNavBar.tsx +++ b/phone/src/apps/dialer/components/DialerNavBar.tsx @@ -9,10 +9,10 @@ import HistoryIcon from '@material-ui/icons/History'; const useStyles = makeStyles((theme: Theme) => ({ root: { width: '100%', - backgroundColor: theme.palette.background.default, + backgroundColor: theme.palette.background.paper, }, icon: { - color: '#43a047', + color: theme.palette.primary.main, }, })); diff --git a/phone/src/apps/dialer/dialer.theme.ts b/phone/src/apps/dialer/dialer.theme.ts new file mode 100644 index 0000000..4a7127d --- /dev/null +++ b/phone/src/apps/dialer/dialer.theme.ts @@ -0,0 +1,17 @@ +import { common, green } from "@material-ui/core/colors"; + +export const DIALER_APP_PRIMARY_COLOR = green[600]; +export const DIALER_APP_TEXT_COLOR = common.white; + +const theme = { + palette: { + primary: { + main: DIALER_APP_PRIMARY_COLOR, + dark: green[800], + light: green[400], + contrastText: DIALER_APP_TEXT_COLOR + } + } +} + +export default theme; diff --git a/phone/src/apps/dialer/providers/DialerThemeProvider.tsx b/phone/src/apps/dialer/providers/DialerThemeProvider.tsx new file mode 100644 index 0000000..60a334a --- /dev/null +++ b/phone/src/apps/dialer/providers/DialerThemeProvider.tsx @@ -0,0 +1,4 @@ +import { createAppThemeProvider } from '../../../os/apps/utils/createAppThemeProvider'; +import dialerTheme from '../dialer.theme'; + +export const DialerThemeProvider = createAppThemeProvider(dialerTheme);