mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
add date break with full date when older than a week
This commit is contained in:
parent
2825b66ef6
commit
2e9cd0ada6
|
@ -15,15 +15,19 @@ const DateBreakText = styled.div`
|
|||
color: ${props => props.theme.colors.lastSeenIndicatorTextColor};
|
||||
`;
|
||||
|
||||
export const MessageDateBreak = (props: { timestamp: number }) => {
|
||||
const { timestamp } = props;
|
||||
moment().calendar();
|
||||
|
||||
const text = moment().calendar(timestamp, {
|
||||
export const MessageDateBreak = (props: { timestamp: number; messageId: string }) => {
|
||||
const { timestamp, messageId } = props;
|
||||
const text = moment(timestamp).calendar(undefined, {
|
||||
lastDay: '[Yesterday at] LT',
|
||||
sameDay: '[Today at] LT',
|
||||
nextDay: '[Tomorrow at] LT',
|
||||
lastWeek: '[last] dddd [at] LT',
|
||||
nextWeek: 'dddd [at] LT',
|
||||
sameElse: 'llll',
|
||||
});
|
||||
|
||||
return (
|
||||
<DateBreakContainer id={`date-break-${timestamp}`}>
|
||||
<DateBreakContainer id={`date-break-${messageId}`}>
|
||||
<DateBreakText>{text}</DateBreakText>
|
||||
</DateBreakContainer>
|
||||
);
|
||||
|
|
|
@ -33,6 +33,7 @@ export const SessionMessagesList = (props: {
|
|||
<MessageDateBreak
|
||||
key={`date-break-${messageId}`}
|
||||
timestamp={messageProps.showDateBreak}
|
||||
messageId={messageId}
|
||||
/>
|
||||
) : null;
|
||||
if (messageProps.message?.messageType === 'group-notification') {
|
||||
|
|
Loading…
Reference in a new issue