feat: use relative and absolute dates in email (#15827)
Closes #15322 Used `formatToHumanReadableDate` to show absolute dates, rather than only relative dates. When the date is clicked, it flips between relative and absolute. The click on the date, doesn't show or hide the email body. Attaching a recording of the same below. https://github.com/user-attachments/assets/77adcd3e-8efe-4af9-a57e-6317c93bcf22 https://github.com/user-attachments/assets/0731de02-60bb-42b1-a28c-55a94cff24b8 --------- Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
committed by
GitHub
parent
8998f3bd84
commit
98e44ed92a
+12
-2
@@ -3,8 +3,12 @@ import { useRecoilValue } from 'recoil';
|
||||
|
||||
import { ParticipantChip } from '@/activities/components/ParticipantChip';
|
||||
import { type EmailThreadMessageParticipant } from '@/activities/emails/types/EmailThreadMessageParticipant';
|
||||
import { AppTooltip, TooltipPosition } from 'twenty-ui/display';
|
||||
import { dateLocaleState } from '~/localization/states/dateLocaleState';
|
||||
import { beautifyPastDateRelativeToNow } from '~/utils/date-utils';
|
||||
import {
|
||||
beautifyPastDateRelativeToNow,
|
||||
formatToHumanReadableDate,
|
||||
} from '~/utils/date-utils';
|
||||
|
||||
const StyledEmailThreadMessageSender = styled.div`
|
||||
display: flex;
|
||||
@@ -28,13 +32,19 @@ export const EmailThreadMessageSender = ({
|
||||
sentAt,
|
||||
}: EmailThreadMessageSenderProps) => {
|
||||
const { localeCatalog } = useRecoilValue(dateLocaleState);
|
||||
const tooltipId = `date-tooltip-${sentAt.replace(/[^a-zA-Z0-9]/g, '-')}`;
|
||||
|
||||
return (
|
||||
<StyledEmailThreadMessageSender>
|
||||
<ParticipantChip participant={sender} variant="bold" />
|
||||
<StyledThreadMessageSentAt>
|
||||
<StyledThreadMessageSentAt id={tooltipId}>
|
||||
{beautifyPastDateRelativeToNow(sentAt, localeCatalog)}
|
||||
</StyledThreadMessageSentAt>
|
||||
<AppTooltip
|
||||
anchorSelect={`#${tooltipId}`}
|
||||
content={formatToHumanReadableDate(sentAt)}
|
||||
place={TooltipPosition.Top}
|
||||
/>
|
||||
</StyledEmailThreadMessageSender>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user