mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
Create email and Reply functionality
This commit is contained in:
1 parent
15a8db1293
commit
b83a890f48
18 files changed
+229
-179
No files matched your search
@@ -1,10 +1,14 @@
|
||||
import { Box, Card, CardContent } from '@material-ui/core';
|
||||
import React from 'react';
|
||||
import ReplyAllIcon from '@material-ui/icons/ReplyAll';
|
||||
import ReplyIcon from '@material-ui/icons/Reply';
|
||||
import { Box, Button, Card, CardActions, CardContent, Typography } from '@material-ui/core';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { IEmailMessage } from '../../../../common/typings/email';
|
||||
import { IEmailMessage } from '../../../../../../typings/email';
|
||||
import { useEmail } from '../../hooks/useEmail';
|
||||
|
||||
export const EmailMessage = ({ message }: { message: IEmailMessage }) => {
|
||||
export const EmailMessage = ({ message, subject }: { message: IEmailMessage; subject: string }) => {
|
||||
const { t } = useTranslation();
|
||||
const { replyEmail } = useEmail();
|
||||
return (
|
||||
<Box px={2}>
|
||||
<Card>
|
||||
@@ -16,13 +20,37 @@ export const EmailMessage = ({ message }: { message: IEmailMessage }) => {
|
||||
</CardContent>
|
||||
|
||||
<CardContent>
|
||||
{t('APPS_EMAIL_SUBJECT')}: <i>{message.subject || '( - )'}</i>
|
||||
{t('APPS_EMAIL_SUBJECT')}: <i>{subject || '( - )'}</i>
|
||||
</CardContent>
|
||||
</Card>
|
||||
<Box mt={2}>
|
||||
<Card>
|
||||
<CardContent>{message.body}</CardContent>
|
||||
<CardContent>
|
||||
{message.body.split('\n').map((paragraph) => (
|
||||
<Typography variant="caption" paragraph>
|
||||
{paragraph}
|
||||
</Typography>
|
||||
))}
|
||||
</CardContent>
|
||||
</Card>
|
||||
<CardActions>
|
||||
<Box textAlign="right" width="100%">
|
||||
<Button
|
||||
onClick={() => replyEmail({ ...message, subject })}
|
||||
color="primary"
|
||||
startIcon={<ReplyAllIcon />}
|
||||
>
|
||||
{t('GENERIC_REPLY_ALL')}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => replyEmail({ ...message, subject, receivers: [message.sender] })}
|
||||
color="primary"
|
||||
startIcon={<ReplyIcon />}
|
||||
>
|
||||
{t('GENERIC_REPLY')}
|
||||
</Button>
|
||||
</Box>
|
||||
</CardActions>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user