You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
1.9 KiB
TypeScript
77 lines
1.9 KiB
TypeScript
import React from 'react';
|
|
import styled, { useTheme } from 'styled-components';
|
|
import { MessageDeliveryStatus } from '../../../models/messageType';
|
|
import { SessionIcon, SessionIconType } from '../../session/icon';
|
|
|
|
const MessageStatusSendingContainer = styled.div`
|
|
display: inline-block;
|
|
margin-bottom: 2px;
|
|
margin-inline-start: 5px;
|
|
`;
|
|
|
|
const MessageStatusSending = () => {
|
|
const iconColor = useTheme().colors.textColor;
|
|
return (
|
|
<MessageStatusSendingContainer>
|
|
<SessionIcon
|
|
rotateDuration={2}
|
|
iconColor={iconColor}
|
|
iconType={SessionIconType.Sending}
|
|
iconSize={'tiny'}
|
|
/>
|
|
</MessageStatusSendingContainer>
|
|
);
|
|
};
|
|
|
|
const MessageStatusSent = () => {
|
|
const iconColor = useTheme().colors.textColor;
|
|
|
|
return (
|
|
<MessageStatusSendingContainer>
|
|
<SessionIcon iconColor={iconColor} iconType={SessionIconType.CircleCheck} iconSize={'tiny'} />
|
|
</MessageStatusSendingContainer>
|
|
);
|
|
};
|
|
|
|
const MessageStatusRead = () => {
|
|
const iconColor = useTheme().colors.textColor;
|
|
|
|
return (
|
|
<MessageStatusSendingContainer>
|
|
<SessionIcon
|
|
iconColor={iconColor}
|
|
iconType={SessionIconType.DoubleCheckCircleFilled}
|
|
iconSize={'tiny'}
|
|
/>
|
|
</MessageStatusSendingContainer>
|
|
);
|
|
};
|
|
|
|
const MessageStatusError = () => {
|
|
const theme = useTheme();
|
|
return (
|
|
<MessageStatusSendingContainer title={window.i18n('sendFailed')}>
|
|
<SessionIcon
|
|
iconColor={theme.colors.destructive}
|
|
iconType={SessionIconType.Error}
|
|
iconSize={'tiny'}
|
|
/>
|
|
</MessageStatusSendingContainer>
|
|
);
|
|
};
|
|
|
|
export const OutgoingMessageStatus = (props: { status?: MessageDeliveryStatus | null }) => {
|
|
switch (props.status) {
|
|
case 'sending':
|
|
return <MessageStatusSending />;
|
|
case 'sent':
|
|
return <MessageStatusSent />;
|
|
case 'read':
|
|
return <MessageStatusRead />;
|
|
case 'error':
|
|
return <MessageStatusError />;
|
|
default:
|
|
return null;
|
|
}
|
|
};
|