Skip to content

Commit e745d69

Browse files
authored
feat: redesign EmptyStateIndicator for channel message list (#2960)
1 parent d2a72b5 commit e745d69

20 files changed

Lines changed: 60 additions & 29 deletions

File tree

src/components/Channel/styling/Channel.scss

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,6 @@
2121
}
2222
}
2323

24-
.str-chat__empty-channel {
25-
--str-chat-icon-height: calc(var(--str-chat__spacing-px) * 136);
26-
@include utils.empty-layout;
27-
position: relative;
28-
29-
.str-chat__empty-channel-notifications {
30-
position: absolute;
31-
inset-block-end: var(--str-chat__spacing-2);
32-
}
33-
}
34-
3524
.str-chat__loading-channel {
3625
$text-height: calc(var(--str-chat__spacing-px) * 16);
3726
height: 100%;
@@ -169,9 +158,6 @@
169158
/* The icon color used when no channel is selected */
170159
--str-chat__channel-empty-indicator-color: var(--str-chat__disabled-color);
171160

172-
/* The text color used when no channel is selected */
173-
--str-chat__channel-empty-color: var(--str-chat__text-low-emphasis-color);
174-
175161
/* The color of the loading indicator */
176162
--str-chat__channel-loading-state-color: var(--str-chat__disabled-color);
177163
}
@@ -180,16 +166,6 @@
180166
@include utils.component-layer-overrides('channel');
181167
}
182168

183-
.str-chat__empty-channel {
184-
--str-chat-icon-color: var(--str-chat__channel-empty-color);
185-
@include utils.component-layer-overrides('channel');
186-
@include utils.empty-theme('channel');
187-
188-
.str-chat__empty-channel-text {
189-
color: var(--str-chat__channel-empty-color);
190-
}
191-
}
192-
193169
.str-chat__loading-channel {
194170
@include utils.loading-animation;
195171

src/components/EmptyStateIndicator/EmptyStateIndicator.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22

33
import { useTranslationContext } from '../../context/TranslationContext';
44
import { ChatBubble } from './icons';
5+
import { IconBubble3ChatMessage } from '../Icons';
56

67
export type EmptyStateIndicatorProps = {
78
/** List Type: channel | message */
@@ -28,10 +29,10 @@ const UnMemoizedEmptyStateIndicator = (props: EmptyStateIndicatorProps) => {
2829
}
2930

3031
if (listType === 'message') {
31-
const text = t('No chats here yet…');
32+
const text = t('Send a message to start the conversation');
3233
return (
3334
<div className='str-chat__empty-channel'>
34-
<ChatBubble />
35+
<IconBubble3ChatMessage />
3536
<p className='str-chat__empty-channel-text' role='listitem'>
3637
{text}
3738
</p>

src/components/EmptyStateIndicator/__tests__/EmptyStateIndicator.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ describe('EmptyStateIndicator', () => {
2222

2323
it('should display correct text when listType is message', () => {
2424
render(<EmptyStateIndicator listType='message' />);
25-
expect(screen.queryByText('No chats here yet…')).toBeInTheDocument();
25+
expect(
26+
screen.queryByText('Send a message to start the conversation'),
27+
).toBeInTheDocument();
2628
});
2729

2830
it('should display correct text when listType is channel', () => {
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
@use '../../../styling/utils';
2+
3+
.str-chat {
4+
/* The text color used when no channel is selected */
5+
--str-chat__channel-empty-color: var(--text-secondary);
6+
}
7+
8+
.str-chat__empty-channel {
9+
--str-chat-icon-color: var(--text-tertiary);
10+
display: flex;
11+
flex-direction: column;
12+
align-items: center;
13+
justify-content: center;
14+
height: 100%;
15+
padding: var(--spacing-md);
16+
position: relative;
17+
gap: var(--spacing-xs);
18+
text-align: center;
19+
@include utils.component-layer-overrides('channel');
20+
color: var(--text-secondary);
21+
font: var(--str-chat__caption-default-text);
22+
23+
svg {
24+
width: 32px;
25+
height: 32px;
26+
color: var(--str-chat-icon-color);
27+
}
28+
29+
.str-chat__empty-channel-notifications {
30+
position: absolute;
31+
inset-block-end: var(--str-chat__spacing-2);
32+
}
33+
34+
.str-chat__empty-channel-text {
35+
margin: 0;
36+
max-width: 160px;
37+
}
38+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@use 'EmptyStateIndicator';

src/components/MessageList/__tests__/__snapshots__/VirtualizedMessageList.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ exports[`VirtualizedMessageList should render the list without any message 1`] =
4747
class="str-chat__empty-channel-text"
4848
role="listitem"
4949
>
50-
No chats here yet…
50+
Send a message to start the conversation
5151
</p>
5252
</div>
5353
</div>

src/components/MessageList/__tests__/__snapshots__/VirtualizedMessageListComponents.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ exports[`VirtualizedMessageComponents EmptyPlaceholder should render for main me
4242
class="str-chat__empty-channel-text"
4343
role="listitem"
4444
>
45-
No chats here yet…
45+
Send a message to start the conversation
4646
</p>
4747
</div>
4848
</div>

src/i18n/de.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@
253253
"Select up to {{count}}_one": "Bis zu {{count}} auswählen",
254254
"Select up to {{count}}_other": "Bis zu {{count}} auswählen",
255255
"Send": "Senden",
256+
"Send a message to start the conversation": "Senden Sie eine Nachricht, um die Unterhaltung zu beginnen",
256257
"Send Anyway": "Trotzdem senden",
257258
"Send message request failed": "Senden der Nachrichtenanfrage fehlgeschlagen",
258259
"Send poll": "Umfrage senden",

src/i18n/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@
253253
"Select up to {{count}}_one": "Select up to {{count}}",
254254
"Select up to {{count}}_other": "Select up to {{count}}",
255255
"Send": "Send",
256+
"Send a message to start the conversation": "Send a message to start the conversation",
256257
"Send Anyway": "Send Anyway",
257258
"Send message request failed": "Send message request failed",
258259
"Send poll": "Send poll",

src/i18n/es.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@
262262
"Select up to {{count}}_many": "Selecciona hasta {{count}}",
263263
"Select up to {{count}}_other": "Selecciona hasta {{count}}",
264264
"Send": "Enviar",
265+
"Send a message to start the conversation": "Envía un mensaje para iniciar la conversación",
265266
"Send Anyway": "Enviar de todos modos",
266267
"Send message request failed": "Error al enviar la solicitud de mensaje",
267268
"Send poll": "Enviar encuesta",

0 commit comments

Comments
 (0)