Skip to content

Commit 7a06a0f

Browse files
Minor adjustments and test fixes
1 parent 3642fbb commit 7a06a0f

File tree

3 files changed

+81
-41
lines changed

3 files changed

+81
-41
lines changed

src/components/ChannelList/hooks/useChannelListShape.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ export const useChannelListShapeDefaults = <SCG extends ExtendableGenerics>() =>
390390
}
391391

392392
// FIXME: oh no...
393-
const newChannel = channel; // dumb workaround for linter
393+
const newChannel = channel;
394394
newChannel.state.members[event.user.id].user = event.user;
395395

396396
return newChannel;
@@ -452,6 +452,7 @@ type UseDefaultHandleChannelListShapeParameters<SCG extends ExtendableGenerics>
452452
> & {
453453
setChannels: SetChannels<SCG>;
454454
customHandleChannelListShape?: (data: {
455+
// can't use ReturnType<typeof useChannelListShapeDefaults<SCG>> until we upgrade prettier to at least v2.7.0
455456
defaults: ReturnType<typeof useChannelListShapeDefaults>;
456457
event: Event<SCG>;
457458
setChannels: SetChannels<SCG>;
@@ -558,7 +559,6 @@ export const usePrepareShapeHandlers = <SCG extends ExtendableGenerics>({
558559
});
559560
break;
560561
default:
561-
console.log(`ChannelList[${event.type}]: no event handler registered`);
562562
break;
563563
}
564564
};

src/components/ChannelPreview/__tests__/__snapshots__/ChannelPreviewMessenger.test.js.snap

Lines changed: 76 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,59 +5,97 @@ exports[`ChannelPreviewMessenger should render correctly 1`] = `
55
aria-label="Select Channel"
66
role="listbox"
77
>
8-
<button
9-
aria-label="Select Channel: Channel name"
10-
className="str-chat__channel-preview-messenger str-chat__channel-preview str-chat__channel-preview-messenger--unread"
11-
data-testid="channel-preview-button"
12-
onClick={[Function]}
13-
role="option"
8+
<div
9+
className="str-chat__channel-preview-container"
1410
>
1511
<div
16-
className="str-chat__channel-preview-messenger--left"
12+
className="str-chat__channel-preview__action-buttons"
1713
>
18-
<div
19-
className="str-chat__avatar str-chat__message-sender-avatar str-chat__avatar--channel-preview str-chat__avatar--one-letter"
20-
data-testid="avatar"
14+
<button
15+
className="str-chat__channel-preview__action-button str-chat__channel-preview__action-button--pin"
2116
onClick={[Function]}
22-
onMouseOver={[Function]}
23-
role="button"
24-
title="Channel name"
2517
>
26-
<img
27-
alt="C"
28-
className="str-chat__avatar-image"
29-
data-testid="avatar-img"
30-
onError={[Function]}
31-
src="https://randomimage.com/src.jpg"
32-
/>
33-
</div>
18+
<svg
19+
className="str-chat__icon str-chat__icon--pin"
20+
fill="currentColor"
21+
viewBox="0 0 384 512"
22+
xmlns="http://www.w3.org/2000/svg"
23+
>
24+
<path
25+
d="M32 32C32 14.3 46.3 0 64 0L320 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-29.5 0 11.4 148.2c36.7 19.9 65.7 53.2 79.5 94.7l1 3c3.3 9.8 1.6 20.5-4.4 28.8s-15.7 13.3-26 13.3L32 352c-10.3 0-19.9-4.9-26-13.3s-7.7-19.1-4.4-28.8l1-3c13.8-41.5 42.8-74.8 79.5-94.7L93.5 64 64 64C46.3 64 32 49.7 32 32zM160 384l64 0 0 96c0 17.7-14.3 32-32 32s-32-14.3-32-32l0-96z"
26+
/>
27+
</svg>
28+
</button>
29+
<button
30+
className="str-chat__channel-preview__action-button str-chat__channel-preview__action-button--archive"
31+
onClick={[Function]}
32+
>
33+
<svg
34+
className="str-chat__icon str-chat__icon--archive-box"
35+
fill="currentColor"
36+
viewBox="0 0 512 512"
37+
xmlns="http://www.w3.org/2000/svg"
38+
>
39+
<path
40+
d="M32 32l448 0c17.7 0 32 14.3 32 32l0 32c0 17.7-14.3 32-32 32L32 128C14.3 128 0 113.7 0 96L0 64C0 46.3 14.3 32 32 32zm0 128l448 0 0 256c0 35.3-28.7 64-64 64L96 480c-35.3 0-64-28.7-64-64l0-256zm128 80c0 8.8 7.2 16 16 16l160 0c8.8 0 16-7.2 16-16s-7.2-16-16-16l-160 0c-8.8 0-16 7.2-16 16z"
41+
/>
42+
</svg>
43+
</button>
3444
</div>
35-
<div
36-
className="str-chat__channel-preview-end"
45+
<button
46+
aria-label="Select Channel: Channel name"
47+
className="str-chat__channel-preview-messenger str-chat__channel-preview str-chat__channel-preview-messenger--unread"
48+
data-testid="channel-preview-button"
49+
onClick={[Function]}
50+
role="option"
3751
>
3852
<div
39-
className="str-chat__channel-preview-end-first-row"
53+
className="str-chat__channel-preview-messenger--left"
4054
>
4155
<div
42-
className="str-chat__channel-preview-messenger--name"
56+
className="str-chat__avatar str-chat__message-sender-avatar str-chat__avatar--channel-preview str-chat__avatar--one-letter"
57+
data-testid="avatar"
58+
onClick={[Function]}
59+
onMouseOver={[Function]}
60+
role="button"
61+
title="Channel name"
4362
>
44-
<span>
45-
Channel name
46-
</span>
47-
</div>
48-
<div
49-
className="str-chat__channel-preview-unread-badge"
50-
data-testid="unread-badge"
51-
>
52-
10
63+
<img
64+
alt="C"
65+
className="str-chat__avatar-image"
66+
data-testid="avatar-img"
67+
onError={[Function]}
68+
src="https://randomimage.com/src.jpg"
69+
/>
5370
</div>
5471
</div>
5572
<div
56-
className="str-chat__channel-preview-messenger--last-message"
73+
className="str-chat__channel-preview-end"
5774
>
58-
Latest message!
75+
<div
76+
className="str-chat__channel-preview-end-first-row"
77+
>
78+
<div
79+
className="str-chat__channel-preview-messenger--name"
80+
>
81+
<span>
82+
Channel name
83+
</span>
84+
</div>
85+
<div
86+
className="str-chat__channel-preview-unread-badge"
87+
data-testid="unread-badge"
88+
>
89+
10
90+
</div>
91+
</div>
92+
<div
93+
className="str-chat__channel-preview-messenger--last-message"
94+
>
95+
Latest message!
96+
</div>
5997
</div>
60-
</div>
61-
</button>
98+
</button>
99+
</div>
62100
</div>
63101
`;

src/components/ChannelSearch/__tests__/SearchResults.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ describe('SearchResults', () => {
9696
await act(() => {
9797
fireEvent.keyDown(searchResultList, { key: 'ArrowDown' });
9898
});
99-
expect(searchResultList.children[1]).toHaveClass('str-chat__channel-search-result--focused');
99+
expect(searchResultList.children[1].lastChild).toHaveClass(
100+
'str-chat__channel-search-result--focused',
101+
);
100102
});
101103

102104
it('should add class "inline" to the results list root by default', () => {

0 commit comments

Comments
 (0)