diff --git a/phone/src/apps/email/components/EmailApp.tsx b/phone/src/apps/email/components/EmailApp.tsx
new file mode 100644
index 0000000..7af1b5e
--- /dev/null
+++ b/phone/src/apps/email/components/EmailApp.tsx
@@ -0,0 +1,27 @@
+import { Box, makeStyles } from '@material-ui/core';
+import React from 'react';
+import { AppWrapper } from '../../../ui/components';
+import { AppContent } from '../../../ui/components/AppContent';
+import { EmailThemeProvider } from '../providers/EmailThemeProvider';
+import EmailNavBar from './EmailNavBar';
+import { Route, Switch } from 'react-router-dom';
+import { InboxPage } from './InboxPage';
+import { EmailAppHeader } from './EmailAppHeader';
+
+export const EmailApp = () => {
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
diff --git a/phone/src/apps/email/components/EmailAppHeader.tsx b/phone/src/apps/email/components/EmailAppHeader.tsx
new file mode 100644
index 0000000..8df0edc
--- /dev/null
+++ b/phone/src/apps/email/components/EmailAppHeader.tsx
@@ -0,0 +1,44 @@
+import React from 'react';
+import { Box, IconButton, makeStyles } from '@material-ui/core';
+import ArrowBackIcon from '@material-ui/icons/ArrowBack';
+import SearchIcon from '@material-ui/icons/Search';
+import { useApp } from '../../../os/apps/hooks/useApps';
+
+const useStyles = makeStyles((theme) => ({
+ root: {
+ position: 'relative',
+ backgroundColor: theme.palette.primary.main,
+ color: theme.palette.primary.contrastText,
+ },
+ back: {
+ position: 'absolute',
+ left: '12px',
+ },
+ search: {
+ position: 'absolute',
+ right: '12px',
+ },
+}));
+
+export const EmailAppHeader = () => {
+ const classes = useStyles();
+ const { icon } = useApp('EMAIL');
+
+ return (
+
+
+
+
+ {icon}
+
+
+
+
+ );
+};
diff --git a/phone/src/apps/email/components/EmailNavBar.tsx b/phone/src/apps/email/components/EmailNavBar.tsx
new file mode 100644
index 0000000..c34016a
--- /dev/null
+++ b/phone/src/apps/email/components/EmailNavBar.tsx
@@ -0,0 +1,62 @@
+import React, { useState } from 'react';
+import { BottomNavigation, BottomNavigationAction } from '@material-ui/core';
+import { NavLink, useLocation } from 'react-router-dom';
+import { makeStyles, Theme } from '@material-ui/core/styles';
+import AllInboxIcon from '@material-ui/icons/AllInbox';
+import DraftsIcon from '@material-ui/icons/Drafts';
+import SentIcon from '@material-ui/icons/LabelImportant';
+
+const useStyles = makeStyles((theme: Theme) => ({
+ root: {
+ width: '100%',
+ backgroundColor: theme.palette.primary.main,
+ },
+ icon: {
+ color: theme.palette.primary.contrastText,
+ '&.Mui-selected': {
+ color: theme.palette.primary.light,
+ },
+ },
+}));
+
+const EmailNavBar = () => {
+ const classes = useStyles();
+ const { pathname } = useLocation();
+ const [page, setPage] = useState(pathname);
+
+ const handleChange = (_e, newPage) => {
+ setPage(newPage);
+ };
+
+ return (
+
+ }
+ to="/email"
+ />
+ }
+ to="/email/new"
+ />
+ }
+ to="/email/sent"
+ />
+
+ );
+};
+
+export default EmailNavBar;
diff --git a/phone/src/apps/email/components/InboxPage.tsx b/phone/src/apps/email/components/InboxPage.tsx
new file mode 100644
index 0000000..258995e
--- /dev/null
+++ b/phone/src/apps/email/components/InboxPage.tsx
@@ -0,0 +1,31 @@
+import React, { useState } from 'react';
+import { Box, makeStyles } from '@material-ui/core';
+import { SearchField } from '../../../ui/components/SearchField';
+import { useQueryParams } from '../../../common/hooks/useQueryParams';
+
+const useStyles = makeStyles({
+ search: {
+ position: 'absolute',
+ top: 0,
+ margin: '0 auto',
+ },
+});
+
+export const InboxPage = () => {
+ const classes = useStyles();
+ const [search, setSearch] = useState('');
+
+ const { autoSearch } = useQueryParams<{ autoSearch }>();
+
+ const handleSearch = (e) => {
+ setSearch(e.target.value);
+ };
+
+ return (
+
+
+
+
+
+ );
+};
diff --git a/phone/src/apps/email/email.theme.ts b/phone/src/apps/email/email.theme.ts
new file mode 100644
index 0000000..463dd8f
--- /dev/null
+++ b/phone/src/apps/email/email.theme.ts
@@ -0,0 +1,24 @@
+import { red, common, grey } from '@material-ui/core/colors';
+
+export const EMAIL_APP_DEFAULT_PRIMARY_COLOR = '#00695c';
+export const EMAIL_APP_DEFAULT_TEXT_COLOR = common.white;
+
+const theme = {
+ palette: {
+ primary: {
+ main: EMAIL_APP_DEFAULT_PRIMARY_COLOR,
+ dark: '#004940',
+ light: '#33877c',
+ contrastText: EMAIL_APP_DEFAULT_TEXT_COLOR,
+ },
+ text: {
+ primary: grey[900],
+ },
+ background: {
+ default: grey[100],
+ paper: grey[50],
+ },
+ },
+};
+
+export default theme;
diff --git a/phone/src/apps/email/hooks/state.ts b/phone/src/apps/email/hooks/state.ts
new file mode 100644
index 0000000..c1c5abb
--- /dev/null
+++ b/phone/src/apps/email/hooks/state.ts
@@ -0,0 +1,9 @@
+import { atom } from 'recoil';
+import { IEmail } from '../../../common/typings/email';
+
+export const emailState = {
+ emails: atom({
+ default: null,
+ key: 'EMAIL:emails',
+ }),
+};
diff --git a/phone/src/apps/email/hooks/useEmail.ts b/phone/src/apps/email/hooks/useEmail.ts
new file mode 100644
index 0000000..3e4a2cd
--- /dev/null
+++ b/phone/src/apps/email/hooks/useEmail.ts
@@ -0,0 +1,8 @@
+import { useRecoilValue } from 'recoil';
+import { emailState } from './state';
+
+export const useEmail = () => {
+ const emails = useRecoilValue(emailState.emails);
+
+ return { emails };
+};
diff --git a/phone/src/apps/email/hooks/useEmailService.ts b/phone/src/apps/email/hooks/useEmailService.ts
new file mode 100644
index 0000000..c2ecff6
--- /dev/null
+++ b/phone/src/apps/email/hooks/useEmailService.ts
@@ -0,0 +1,9 @@
+import { useSetRecoilState } from 'recoil';
+import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
+import { emailState } from './state';
+
+export const useEmailService = () => {
+ const setEmails = useSetRecoilState(emailState.emails);
+
+ useNuiEvent('EMAIL', 'phone:fetchAllEmailsSuccess', setEmails);
+};
diff --git a/phone/src/apps/email/providers/EmailThemeProvider.ts b/phone/src/apps/email/providers/EmailThemeProvider.ts
new file mode 100644
index 0000000..e79bbc4
--- /dev/null
+++ b/phone/src/apps/email/providers/EmailThemeProvider.ts
@@ -0,0 +1,4 @@
+import { createAppThemeProvider } from '../../../os/apps/utils/createAppThemeProvider';
+import theme from '../email.theme';
+
+export const EmailThemeProvider = createAppThemeProvider(theme);
diff --git a/phone/src/common/typings/email.ts b/phone/src/common/typings/email.ts
new file mode 100644
index 0000000..7efd6ee
--- /dev/null
+++ b/phone/src/common/typings/email.ts
@@ -0,0 +1,20 @@
+export interface IEmailPhoneAction {
+ path: string;
+}
+
+export interface IEmailExternalAction {
+ eventName: string;
+ args: Array;
+ closePhone?: boolean;
+}
+
+export interface IEmail {
+ id: number;
+ receivers: string[];
+ sender: string;
+ sendDate: number;
+ subject: string;
+ body: string;
+ phoneActions: Array;
+ externalActions: Array;
+}
diff --git a/phone/src/locale/en.json b/phone/src/locale/en.json
index 36d1d0d..6f816ae 100644
--- a/phone/src/locale/en.json
+++ b/phone/src/locale/en.json
@@ -48,6 +48,7 @@
"APPS_TWITTER": "Twitter",
"APPS_SELLOUT": "Market",
"APPS_CAMERA": "Camera",
+ "APPS_EMAIL": "E-mail",
"APPS_DIALER_INCOMING_CALL_TITLE": "Incoming Phone Call",
"APPS_DIALER_CURRENT_CALL_TITLE": "Current Phone Call",
diff --git a/phone/src/os/apps/config/apps.tsx b/phone/src/os/apps/config/apps.tsx
index 9255670..b588bde 100644
--- a/phone/src/os/apps/config/apps.tsx
+++ b/phone/src/os/apps/config/apps.tsx
@@ -16,6 +16,7 @@ import MessageIcon from '@material-ui/icons/Message';
import FireIcon from '@material-ui/icons/Whatshot';
import { CalculatorIcon } from '../../../apps/calculator/components/CalculatorIcon';
import CameraAltIcon from '@material-ui/icons/CameraAlt';
+import MailIcon from '@material-ui/icons/Mail';
import { DialerApp } from '../../../apps/dialer/components/DialerApp';
import { ContactsApp } from '../../../apps/contacts/components/ContactsApp';
import { CalculatorApp } from '../../../apps/calculator/components/CalculatorApp';
@@ -27,29 +28,39 @@ import { TwitterApp } from '../../../apps/twitter/components/TwitterApp';
import { ExampleApp } from '../../../apps/example/components/ExampleApp';
import { MarketplaceApp } from '../../../apps/marketplace/components/MarketplaceApp';
import { NotesApp } from '../../../apps/notes/NotesApp';
+import { EmailApp } from '../../../apps/email/components/EmailApp';
import CameraApp from '../../../apps/camera/components/CameraApp';
import { AppRoute } from '../components/AppRoute';
+import { NOTES_APP_ICON_COLOR, NOTES_APP_PRIMARY_COLOR } from '../../../apps/notes/notes.theme';
+
+import { DIALER_APP_PRIMARY_COLOR, DIALER_APP_TEXT_COLOR } from '../../../apps/dialer/dialer.theme';
+
import {
MESSAGES_APP_PRIMARY_COLOR,
MESSAGES_APP_TEXT_COLOR,
} from '../../../apps/messages/messages.theme';
+
import {
CONTACTS_APP_PRIMARY_COLOR,
CONTACTS_APP_TEXT_COLOR,
} from '../../../apps/contacts/contacts.theme';
+
import {
SELLOUT_APP_PRIMARY_COLOR,
SELLOUT_APP_ICON_COLOR,
} from '../../../apps/marketplace/marketplace.theme';
-import { NOTES_APP_ICON_COLOR, NOTES_APP_PRIMARY_COLOR } from '../../../apps/notes/notes.theme';
-import { DIALER_APP_PRIMARY_COLOR, DIALER_APP_TEXT_COLOR } from '../../../apps/dialer/dialer.theme';
import {
TWITTER_APP_PRIMARY_COLOR,
TWITTER_APP_TEXT_COLOR,
} from '../../../apps/twitter/twitter.theme';
import { MATCH_APP_PRIMARY_COLOR, MATCH_APP_TEXT_COLOR } from '../../../apps/match/match.theme';
+import {
+ EMAIL_APP_DEFAULT_PRIMARY_COLOR,
+ EMAIL_APP_DEFAULT_TEXT_COLOR,
+} from '../../../apps/email/email.theme';
+
export interface IAppConfig {
id: string;
nameLocale: string;
@@ -172,6 +183,16 @@ export const APPS: IAppConfig[] = [
path: '/camera',
Route: () => ,
},
+ {
+ id: 'EMAIL',
+ nameLocale: 'APPS_EMAIL',
+ icon: ,
+ notificationIcon: ,
+ backgroundColor: EMAIL_APP_DEFAULT_PRIMARY_COLOR,
+ color: EMAIL_APP_DEFAULT_TEXT_COLOR,
+ path: '/email',
+ Route: () => ,
+ },
];
// Example app only in dev
diff --git a/phone/src/ui/components/SearchField.tsx b/phone/src/ui/components/SearchField.tsx
index 8d83097..3b94c07 100644
--- a/phone/src/ui/components/SearchField.tsx
+++ b/phone/src/ui/components/SearchField.tsx
@@ -52,16 +52,23 @@ const useStyles = makeStyles((theme) => ({
interface IProps {
onChange: (event: React.ChangeEvent) => void;
value: string;
+ autoFocus?: boolean;
placeholder?: string;
}
const DEFAULT_PROPS = {
onChange: () => {},
value: '',
+ autoFocus: false,
placeholder: 'Search...',
};
-export const SearchField = ({ value, onChange, placeholder }: IProps = DEFAULT_PROPS) => {
+export const SearchField = ({
+ value,
+ onChange,
+ placeholder,
+ autoFocus,
+}: IProps = DEFAULT_PROPS) => {
const classes = useStyles();
return (
@@ -72,6 +79,7 @@ export const SearchField = ({ value, onChange, placeholder }: IProps = DEFAULT_P