Skip to content

Commit

Permalink
Merge pull request #306 from farrah-deriv/FEQ-2635/safety-disclaimer
Browse files Browse the repository at this point in the history
farrah/FEQ-2635/feat: safety disclaimer
  • Loading branch information
farrah-deriv authored Sep 10, 2024
2 parents 1b31921 + 6ba5b69 commit 077894b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ type TChatMessageTextProps = {

const ChatMessageText = ({ children, color, type = '' }: PropsWithChildren<TChatMessageTextProps>) => {
const { isDesktop } = useDevice();
const isAdmin = type === 'admin';

return (
<div className='chat-message-text'>
<Text color={color} lineHeight='xl' size={type === 'admin' && isDesktop ? 'xs' : 'sm'}>
<Text color={color} lineHeight={isAdmin ? 'lg' : 'xl'} size={isAdmin && isDesktop ? 'xs' : 'sm'}>
{children}
</Text>
</div>
Expand Down
11 changes: 11 additions & 0 deletions src/pages/orders/components/ChatMessages/ChatMessages.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
@include mobile-or-tablet-screen {
height: 100%;
}

&__date {
margin-top: 1.6rem;
text-align: center;
}

&__item {
display: flex;
flex-direction: column;
Expand All @@ -26,6 +28,7 @@
&__file {
color: inherit;
}

&__image {
width: 50%;

Expand All @@ -40,6 +43,7 @@
}
}
}

&__pdf {
background-color: #ffffff;
border-radius: 0.8rem;
Expand All @@ -48,11 +52,13 @@
align-items: center;
gap: 1rem;
margin-bottom: 0.4rem;

a {
color: #999999;
text-decoration: none;
}
}

&__timestamp {
align-items: center;
display: flex;
Expand All @@ -67,6 +73,7 @@
border-bottom-left-radius: 0;
}
}

&__outgoing {
align-items: flex-end;

Expand All @@ -82,6 +89,10 @@
border: 1px solid #ffad3a;
padding: 0.8rem 0;
border-radius: 0.8rem;

&--text {
margin-bottom: 1rem;
}
}
}
}
11 changes: 10 additions & 1 deletion src/pages/orders/components/ChatMessages/ChatMessages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,16 @@ type TChatMessagesProps = {
const AdminMessage = () => (
<div className='chat-messages__item chat-messages__item__admin'>
<ChatMessageText color='general' type='admin'>
<Localize i18n_default_text='Hello! This is where you can chat with the counterparty to confirm the order details.<br /> Note: In case of a dispute, we’ll use this chat as a reference.' />
<div className='chat-messages__item__admin--text'>
<Localize
components={[<strong key={0} />]}
i18n_default_text='<0>Important:</0> Deriv will never contact you via WhatsApp to ask for your personal information. Always ignore any messages from numbers claiming to be from Deriv.'
/>
</div>
<Localize
components={[<strong key={0} />]}
i18n_default_text="<0>Note:</0> In case of a dispute, we'll use this chat as a reference."
/>
</ChatMessageText>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ describe('ChatMessages', () => {
it('should render the messages as expected', () => {
render(<ChatMessages {...mockProps} />);
expect(
screen.getByText(/Hello! This is where you can chat with the counterparty to confirm the order details./)
screen.getByText(
/Deriv will never contact you via WhatsApp to ask for your personal information. Always ignore any messages from numbers claiming to be from Deriv./
)
).toBeInTheDocument();
});
it('should display the message sent by the user', () => {
Expand Down

0 comments on commit 077894b

Please sign in to comment.