Skip to content

Commit

Permalink
feat: add date to Survey and Announcement headers
Browse files Browse the repository at this point in the history
  • Loading branch information
gwynndp committed Feb 19, 2022
1 parent c02af75 commit 02190d6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/components/Messaging/MessageBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useState, useContext, useEffect } from 'react';
import { makeStyles } from '@material-ui/core/styles';
import { Avatar, Grid, Typography, Paper, Button } from '@material-ui/core';
import { TextInput } from './TextInput.js';
import dateFormat from 'dateformat';

import { MessagingContext } from 'context/MessagingContext.js';

Expand Down Expand Up @@ -244,7 +245,7 @@ export const SentMessage = ({ message }) => {
);
};

const SenderInformation = ({ messageRecipient, subject, id }) => {
const SenderInformation = ({ message, messageRecipient, subject, id }) => {
const { senderInfo, senderItem, avatar, button, dataContainer } = useStyles();

return (
Expand All @@ -256,6 +257,13 @@ const SenderInformation = ({ messageRecipient, subject, id }) => {
<Typography variant="h5">
{subject === 'Survey' ? subject : messageRecipient}
</Typography>

{(subject === 'Survey' || subject === 'Announce') && (
<Typography>
DATE: {dateFormat(message?.composed_at, 'yyyy/mm/dd')}
</Typography>
)}

<Typography align="left" color="primary" variant="h6">
{subject === 'Survey' ? messageRecipient : `ID: ${id}`}
</Typography>
Expand Down Expand Up @@ -317,6 +325,7 @@ const MessageBody = ({ messages, messageRecipient }) => {
<Paper className={paper}>
{messageRecipient && messages ? (
<SenderInformation
message={messages[0]}
messageRecipient={messageRecipient}
subject={subject}
id={recipientId}
Expand Down

0 comments on commit 02190d6

Please sign in to comment.