Skip to content

Commit 6605f63

Browse files
authored
fix: correct various UI glitches (#3110)
1 parent be8ed26 commit 6605f63

18 files changed

Lines changed: 95 additions & 54 deletions

File tree

examples/vite/src/ChatLayout/Panels.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import clsx from 'clsx';
22
import type { ChannelFilters, ChannelOptions, ChannelSort } from 'stream-chat';
3-
import { useRef } from 'react';
3+
import { useEffect, useRef } from 'react';
44
import {
55
AIStateIndicator,
66
Channel,
@@ -22,6 +22,7 @@ import {
2222
useThreadsViewContext,
2323
} from 'stream-chat-react';
2424

25+
import { DESKTOP_LAYOUT_BREAKPOINT } from './constants.ts';
2526
import { SidebarResizeHandle, ThreadResizeHandle } from './Resize.tsx';
2627
import { useSidebar } from './SidebarContext.tsx';
2728
import { ThreadStateSync } from './Sync.tsx';
@@ -94,9 +95,15 @@ export const ChannelsPanels = ({
9495
sort: ChannelSort;
9596
}) => {
9697
const { channel } = useChatContext('ChannelsPanels');
97-
const { sidebarOpen } = useSidebar();
98+
const { closeSidebar, sidebarOpen } = useSidebar();
9899
const channelsLayoutRef = useRef<HTMLDivElement | null>(null);
99100

101+
useEffect(() => {
102+
if (!channel?.id || typeof window === 'undefined') return;
103+
if (window.innerWidth >= DESKTOP_LAYOUT_BREAKPOINT) return;
104+
closeSidebar();
105+
}, [channel?.id, closeSidebar]);
106+
100107
return (
101108
<ChatView.Channels>
102109
<div

src/components/Button/styling/Button.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@
160160
align-items: center;
161161
justify-content: center;
162162
border-radius: var(--button-radius-full);
163+
164+
.str-chat__icon {
165+
height: var(--icon-size-sm);
166+
width: var(--icon-size-sm);
167+
}
163168
}
164169

165170
.str-chat__button__content {

src/components/Icons/icons.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,8 @@ export const IconBellOff = createIcon(
143143
/>,
144144
);
145145

146-
// was: IconBookmark
147-
export const IconSave = createIcon(
148-
'IconSave',
146+
export const IconBookmark = createIcon(
147+
'IconBookmark',
149148
<path
150149
d='M15 17.5L10 14.375L5 17.5V3.75C5 3.58424 5.06585 3.42527 5.18306 3.30806C5.30027 3.19085 5.45924 3.125 5.625 3.125H14.375C14.5408 3.125 14.6997 3.19085 14.8169 3.30806C14.9342 3.42527 15 3.58424 15 3.75V17.5Z'
151150
fill='none'
@@ -156,9 +155,8 @@ export const IconSave = createIcon(
156155
/>,
157156
);
158157

159-
// was: IconBookmarkRemove
160-
export const IconUnsave = createIcon(
161-
'IconUnsave',
158+
export const IconBookmarkRemove = createIcon(
159+
'IconBookmarkRemove',
162160
<path
163161
d='M5 6.49074V17.5L10 14.375L15 17.5V16M5.125 3.125H14.375C14.5408 3.125 14.6997 3.19085 14.8169 3.30806C14.9342 3.42527 15 3.58424 15 3.75V13M5.125 3.125L3.5 1.5M5.125 3.125L15 13M15 13L17.5 15.5'
164162
fill='none'
@@ -425,7 +423,7 @@ export const IconXmark = createIcon(
425423
stroke='currentColor'
426424
strokeLinecap='round'
427425
strokeLinejoin='round'
428-
strokeWidth='1.5'
426+
strokeWidth='2'
429427
/>,
430428
);
431429

@@ -827,7 +825,7 @@ export const IconPlus = createIcon(
827825
stroke='currentColor'
828826
strokeLinecap='round'
829827
strokeLinejoin='round'
830-
strokeWidth='1.5'
828+
strokeWidth='2'
831829
/>,
832830
);
833831

src/components/Message/ReminderNotification.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import { useTranslationContext } from '../../context';
33
import { useStateStore } from '../../store';
44
import type { Reminder, ReminderState } from 'stream-chat';
5-
import { IconBell, IconSave } from '../Icons';
5+
import { IconBell, IconBookmark } from '../Icons';
66

77
export type ReminderNotificationProps = {
88
reminder?: Reminder;
@@ -15,10 +15,10 @@ const reminderStateSelector = (state: ReminderState) => ({
1515
function SavedForLaterContent() {
1616
const { t } = useTranslationContext();
1717
return (
18-
<p className='str-chat__message-saved-for-later'>
19-
<IconSave />
18+
<div className='str-chat__message-saved-for-later'>
19+
<IconBookmark />
2020
<span>{t('Saved for later')}</span>
21-
</p>
21+
</div>
2222
);
2323
}
2424

src/components/Message/__tests__/__snapshots__/ReminderNotification.test.tsx.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
exports[`ReminderNotification > displays text for bookmark notifications (saved for later) 1`] = `
44
<div>
5-
<p
5+
<div
66
class="str-chat__message-saved-for-later"
77
>
88
<svg
9-
class="str-chat__icon str-chat__icon--save"
9+
class="str-chat__icon str-chat__icon--bookmark"
1010
viewBox="0 0 20 20"
1111
xmlns="http://www.w3.org/2000/svg"
1212
>
@@ -22,7 +22,7 @@ exports[`ReminderNotification > displays text for bookmark notifications (saved
2222
<span>
2323
Saved for later
2424
</span>
25-
</p>
25+
</div>
2626
</div>
2727
`;
2828

src/components/Message/styling/Message.scss

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,13 @@
110110
overflow: visible;
111111
}
112112
}
113+
114+
// remove paddings for large-emoji-only messages
115+
.str-chat__message-bubble,
116+
.str-chat__message-inner .str-chat__message-bubble .str-chat__message-text,
117+
.str-chat__message-inner .str-chat__message-replies-count-button-wrapper {
118+
padding-inline: 0;
119+
}
113120
}
114121

115122
&.str-chat__message--is-emoji-only-count-1 {
@@ -133,13 +140,6 @@
133140
}
134141
}
135142

136-
// remove paddings for certain elements in emoji-only messages
137-
.str-chat__message-bubble,
138-
.str-chat__message-inner .str-chat__message-bubble .str-chat__message-text,
139-
.str-chat__message-inner .str-chat__message-replies-count-button-wrapper {
140-
padding-inline: 0;
141-
}
142-
143143
.str-chat__message-replies-count-button-wrapper::after {
144144
display: none;
145145
}
@@ -175,7 +175,7 @@
175175
@include utils.component-layer-overrides('message');
176176

177177
@mixin chat-bubble-spacing {
178-
padding-inline: var(--spacing-sm);
178+
padding-inline: var(--spacing-xxs);
179179

180180
p {
181181
white-space: pre-line;
@@ -240,8 +240,22 @@
240240
display: flex;
241241
align-items: center;
242242
gap: var(--spacing-xxs);
243-
font: var(--str-chat__metadata-default-text);
243+
font: var(--str-chat__metadata-emphasis-text);
244244
color: var(--text-primary-text);
245+
246+
.str-chat__message-pin-indicator__icon {
247+
display: flex;
248+
align-items: center;
249+
250+
.str-chat__icon {
251+
width: var(--icon-size-xs);
252+
height: var(--icon-size-xs);
253+
254+
path {
255+
stroke-width: 2px;
256+
}
257+
}
258+
}
245259
}
246260
}
247261

@@ -436,6 +450,7 @@
436450
grid-area: metadata;
437451
display: flex;
438452
flex-wrap: wrap;
453+
gap: var(--spacing-xxs);
439454
align-items: center;
440455
height: var(--size-24);
441456
color: var(--chat-text-timestamp);

src/components/Message/styling/MessageAlsoSentInChannelIndicator.scss

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,14 @@
2020
@include utils.component-layer-overrides('message-also-sent-in-channel');
2121
font: var(--str-chat__metadata-emphasis-text);
2222

23-
svg path {
24-
stroke-width: 1.5px;
25-
stroke: var(--str-chat__message-also-sent-in-channel-color);
23+
.str-chat__icon {
24+
height: var(--spacing-sm);
25+
width: var(--spacing-sm);
26+
27+
path {
28+
stroke-width: 2px;
29+
stroke: var(--str-chat__message-also-sent-in-channel-color);
30+
}
2631
}
2732

2833
.str-chat__message-also-sent-in-channel__link-button {

src/components/Message/styling/ReminderNotification.scss

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,14 @@
3131
@include utils.component-layer-overrides('message-saved-for-later');
3232
font: var(--str-chat__metadata-emphasis-text);
3333

34-
svg path {
35-
stroke-width: 1.5px;
36-
stroke: var(--str-chat__message-saved-for-later-color);
34+
svg {
35+
width: var(--icon-size-xs);
36+
height: var(--icon-size-xs);
37+
38+
path {
39+
stroke-width: 2px;
40+
stroke: var(--str-chat__message-saved-for-later-color);
41+
}
3742
}
3843
}
3944

src/components/MessageActions/MessageActions.defaults.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import {
66
IconAudio,
77
IconBell,
88
IconBellOff,
9+
IconBookmark,
10+
IconBookmarkRemove,
911
IconCopy,
1012
IconDelete,
1113
IconEdit,
@@ -19,10 +21,8 @@ import {
1921
IconQuote,
2022
IconReply,
2123
IconRetry,
22-
IconSave,
2324
IconThread,
2425
IconUnpin,
25-
IconUnsave,
2626
IconUserCheck,
2727
} from '../Icons';
2828
import { isUserMuted } from '../Message/utils';
@@ -344,7 +344,7 @@ const DefaultMessageActionComponents = {
344344
reminder ? t('aria/Remove Save For Later') : t('aria/Bookmark Message')
345345
}
346346
className={msgActionsBoxButtonClassName}
347-
Icon={reminder ? IconUnsave : IconSave}
347+
Icon={reminder ? IconBookmarkRemove : IconBookmark}
348348
onClick={async () => {
349349
try {
350350
if (reminder) {

src/components/MessageComposer/QuotedMessagePreview.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ import { useChannelStateContext } from '../../context/ChannelStateContext';
3434
import type { MessageContextValue } from '../../context';
3535
import { RemoveAttachmentPreviewButton } from './RemoveAttachmentPreviewButton';
3636
import {
37+
IconCamera,
3738
IconFile,
3839
IconLink,
3940
IconLocation,
4041
IconPlayFill,
4142
IconPoll,
4243
IconVideo,
43-
IconVideoFill,
4444
IconVoice,
4545
} from '../Icons';
4646
import clsx from 'clsx';
@@ -268,7 +268,7 @@ const getAttachmentIconWithType = (
268268
const imageAttachment = groupedAttachments.images[0];
269269
return {
270270
...result,
271-
Icon: IconVideoFill,
271+
Icon: IconCamera,
272272
PreviewImage: (
273273
<BaseImage
274274
alt={imageAttachment.fallback}

0 commit comments

Comments
 (0)