diff --git a/phone/src/Phone.tsx b/phone/src/Phone.tsx
index e9f1bbe..e1d5b0a 100644
--- a/phone/src/Phone.tsx
+++ b/phone/src/Phone.tsx
@@ -33,6 +33,7 @@ import WindowSnackbar from './ui/components/WindowSnackbar';
import { usePhone } from './os/phone/hooks/usePhone';
import { useTranslation } from 'react-i18next';
import { useSnackbar } from './ui/hooks/useSnackbar';
+import { useEmailService } from './apps/email/hooks/useEmailService';
function Phone() {
const { t, i18n } = useTranslation();
@@ -75,6 +76,7 @@ function Phone() {
usePhotoService();
useCallService();
useDialService();
+ useEmailService();
const { modal: callModal } = useCallModal();
const { bottom, visibility } = usePhoneVisibility();
diff --git a/phone/src/apps/email/components/EmailApp.tsx b/phone/src/apps/email/components/EmailApp.tsx
index 7af1b5e..1025282 100644
--- a/phone/src/apps/email/components/EmailApp.tsx
+++ b/phone/src/apps/email/components/EmailApp.tsx
@@ -1,4 +1,3 @@
-import { Box, makeStyles } from '@material-ui/core';
import React from 'react';
import { AppWrapper } from '../../../ui/components';
import { AppContent } from '../../../ui/components/AppContent';
@@ -7,6 +6,7 @@ import EmailNavBar from './EmailNavBar';
import { Route, Switch } from 'react-router-dom';
import { InboxPage } from './InboxPage';
import { EmailAppHeader } from './EmailAppHeader';
+import { NewEmailPage } from './NewEmailPage';
export const EmailApp = () => {
return (
@@ -18,6 +18,9 @@ export const EmailApp = () => {
+
+
+
diff --git a/phone/src/apps/email/components/InboxPage.tsx b/phone/src/apps/email/components/InboxPage.tsx
index 258995e..7e2444b 100644
--- a/phone/src/apps/email/components/InboxPage.tsx
+++ b/phone/src/apps/email/components/InboxPage.tsx
@@ -1,18 +1,38 @@
import React, { useState } from 'react';
-import { Box, makeStyles } from '@material-ui/core';
-import { SearchField } from '../../../ui/components/SearchField';
+import {
+ Avatar,
+ Box,
+ IconButton,
+ List,
+ ListItem,
+ ListItemAvatar,
+ ListItemSecondaryAction,
+ ListItemText,
+ makeStyles,
+ TextField,
+} from '@material-ui/core';
+import MarkRead from '@material-ui/icons/Markunread';
+import MarkUnread from '@material-ui/icons/MarkunreadMailbox';
import { useQueryParams } from '../../../common/hooks/useQueryParams';
+import { useEmail } from '../hooks/useEmail';
+import dayjs from 'dayjs';
+import { useTranslation } from 'react-i18next';
-const useStyles = makeStyles({
+const useStyles = makeStyles((theme) => ({
search: {
+ zIndex: 5,
position: 'absolute',
+ backgroundColor: theme.palette.primary.light,
top: 0,
- margin: '0 auto',
},
-});
+}));
export const InboxPage = () => {
const classes = useStyles();
+ const { t } = useTranslation();
+
+ const { emails } = useEmail();
+
const [search, setSearch] = useState('');
const { autoSearch } = useQueryParams<{ autoSearch }>();
@@ -21,10 +41,47 @@ export const InboxPage = () => {
setSearch(e.target.value);
};
+ const getSendDate = (email) => dayjs.unix(email.sendDate).format(t('DATE_FORMAT'));
+
return (
-
-
-
+
+
+
+
+
+
+ {emails &&
+ emails.map((email) => (
+
+
+ {email.sender.charAt(0).toUpperCase()}
+
+ {getSendDate(email)}
+ ) : (
+ {getSendDate(email)}
+ )
+ }
+ >
+ {email.isRead ? {email.subject} : {email.subject}}
+
+
+
+ {email.isRead ? : }
+
+
+
+ ))}
+
);
diff --git a/phone/src/apps/email/components/NewEmailPage.tsx b/phone/src/apps/email/components/NewEmailPage.tsx
new file mode 100644
index 0000000..6153313
--- /dev/null
+++ b/phone/src/apps/email/components/NewEmailPage.tsx
@@ -0,0 +1,49 @@
+import React from 'react';
+import { Box, makeStyles, TextField } from '@material-ui/core';
+
+const useStyles = makeStyles((theme) => ({
+ search: {
+ backgroundColor: theme.palette.primary.light,
+ color: theme.palette.common.white,
+ position: 'absolute',
+ width: '100%',
+ top: 0,
+ },
+}));
+
+export const NewEmailPage = () => {
+ const classes = useStyles();
+ // const [subject, setSubject] = useState('');
+ // const [receivers, setReceivers] = useState('');
+
+ const handleSubject = (e) => {
+ // setSubject(e.target.value || '');
+ };
+
+ const handleReceiver = (e) => {
+ // setReceivers(e.target.value || '');
+ };
+
+ return (
+
+
+
+
+
+ New Email
+
+ );
+};
diff --git a/phone/src/apps/email/email.theme.ts b/phone/src/apps/email/email.theme.ts
index 463dd8f..e5a1a66 100644
--- a/phone/src/apps/email/email.theme.ts
+++ b/phone/src/apps/email/email.theme.ts
@@ -1,4 +1,4 @@
-import { red, common, grey } from '@material-ui/core/colors';
+import { common, grey } from '@material-ui/core/colors';
export const EMAIL_APP_DEFAULT_PRIMARY_COLOR = '#00695c';
export const EMAIL_APP_DEFAULT_TEXT_COLOR = common.white;
@@ -8,12 +8,16 @@ const theme = {
primary: {
main: EMAIL_APP_DEFAULT_PRIMARY_COLOR,
dark: '#004940',
- light: '#33877c',
+ light: '#99d5cf',
contrastText: EMAIL_APP_DEFAULT_TEXT_COLOR,
},
text: {
primary: grey[900],
+ secondary: grey[700],
+ disabled: grey[600],
+ hint: grey[800],
},
+ divider: '#99d5cf',
background: {
default: grey[100],
paper: grey[50],
diff --git a/phone/src/apps/email/hooks/useEmailService.ts b/phone/src/apps/email/hooks/useEmailService.ts
index c2ecff6..728a48a 100644
--- a/phone/src/apps/email/hooks/useEmailService.ts
+++ b/phone/src/apps/email/hooks/useEmailService.ts
@@ -1,4 +1,6 @@
import { useSetRecoilState } from 'recoil';
+import { IEmail } from '../../../common/typings/email';
+import InjectDebugData from '../../../os/debug/InjectDebugData';
import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
import { emailState } from './state';
@@ -7,3 +9,84 @@ export const useEmailService = () => {
useNuiEvent('EMAIL', 'phone:fetchAllEmailsSuccess', setEmails);
};
+
+InjectDebugData([
+ {
+ app: 'EMAIL',
+ method: 'phone:fetchAllEmailsSuccess',
+ data: [
+ {
+ id: 1,
+ subject: 'Try this great app!',
+ body: 'Hey did you try this email app? Looking good bruh',
+ receivers: ['rocky@projecterror.org'],
+ sender: 'kidz@projecterror.org',
+ sendDate: Date.now() / 1000,
+ isRead: false,
+ },
+ {
+ id: 2,
+ subject: 'Try this great app!',
+ body: 'Hey did you try this email app? Looking good bruh',
+ receivers: ['rocky@projecterror.org'],
+ sender: 'kidz@projecterror.org',
+ sendDate: Date.now() / 1000,
+ isRead: false,
+ },
+ {
+ id: 3,
+ subject: 'Try this great app!',
+ body: 'Hey did you try this email app? Looking good bruh',
+ receivers: ['rocky@projecterror.org'],
+ sender: 'kidz@projecterror.org',
+ sendDate: Date.now() / 1000,
+ isRead: true,
+ },
+ {
+ id: 4,
+ subject: 'Try this great app!',
+ body: 'Hey did you try this email app? Looking good bruh',
+ receivers: ['rocky@projecterror.org'],
+ sender: 'chip@projecterror.org',
+ sendDate: Date.now() / 1000,
+ isRead: true,
+ },
+ {
+ id: 5,
+ subject: 'Try this great app!',
+ body: 'Hey did you try this email app? Looking good bruh',
+ receivers: ['rocky@projecterror.org'],
+ sender: 'taso@projecterror.org',
+ sendDate: Date.now() / 1000,
+ isRead: true,
+ },
+ {
+ id: 6,
+ subject: 'Try this great app!',
+ body: 'Hey did you try this email app? Looking good bruh',
+ receivers: ['rocky@projecterror.org'],
+ sender: 'kidz@projecterror.org',
+ sendDate: Date.now() / 1000,
+ isRead: false,
+ },
+ {
+ id: 7,
+ subject: 'Try this great app!',
+ body: 'Hey did you try this email app? Looking good bruh',
+ receivers: ['rocky@projecterror.org'],
+ sender: 'kidz@projecterror.org',
+ sendDate: Date.now() / 1000,
+ isRead: false,
+ },
+ {
+ id: 8,
+ subject: 'Try this great app!',
+ body: 'Hey did you try this email app? Looking good bruh',
+ receivers: ['rocky@projecterror.org'],
+ sender: 'kidz@projecterror.org',
+ sendDate: Date.now() / 1000,
+ isRead: false,
+ },
+ ],
+ },
+]);
diff --git a/phone/src/common/typings/email.ts b/phone/src/common/typings/email.ts
index 7efd6ee..52582d6 100644
--- a/phone/src/common/typings/email.ts
+++ b/phone/src/common/typings/email.ts
@@ -10,11 +10,12 @@ export interface IEmailExternalAction {
export interface IEmail {
id: number;
+ isRead: boolean;
receivers: string[];
sender: string;
sendDate: number;
subject: string;
body: string;
- phoneActions: Array;
- externalActions: Array;
+ phoneActions?: Array;
+ externalActions?: Array;
}