Skip to content

Commit 514e85e

Browse files
committed
Merge branch 'master' into feat/button-variant-props
# Conflicts: # src/components/Badge/Badge.tsx # src/components/MessageList/ScrollToLatestMessageButton.tsx # src/components/MessageList/UnreadMessagesNotification.tsx # src/components/MessageList/UnreadMessagesSeparator.tsx # src/components/MessageList/VirtualizedMessageList.tsx # src/components/MessageList/styling/ScrollToLatestMessageButton.scss
2 parents 3f8c19b + 64fd76b commit 514e85e

File tree

8 files changed

+46
-10
lines changed

8 files changed

+46
-10
lines changed

src/components/Badge/Badge.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const Badge = ({
2020
children,
2121
className,
2222
size = 'md',
23-
variant = 'primary',
23+
variant = 'default',
2424
...spanProps
2525
}: BadgeProps) => (
2626
<span

src/components/Button/styling/Button.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@
111111
box-shadow: var(--light-elevation-2);
112112
}
113113

114+
&::after {
115+
border-radius: inherit;
116+
}
117+
114118
&.str-chat__button--size-lg {
115119
padding-block: var(--button-padding-y-lg);
116120
padding-inline: var(--button-padding-x-with-label-lg);

src/components/MessageInput/AttachmentSelector/CommandsMenu.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,11 @@ export const CommandsMenu = () => {
5959
const channelConfig = messageComposer.channel.getConfig();
6060
const commands = useMemo<(CommandResponse & { name: string })[]>(
6161
() =>
62-
(channelConfig?.commands ?? []).filter(
63-
(command): command is CommandResponse & { name: string } => !!command.name,
64-
),
62+
(channelConfig?.commands ?? [])
63+
.filter(
64+
(command): command is CommandResponse & { name: string } => !!command.name,
65+
)
66+
.sort((a, b) => (a.name ?? '').localeCompare(b.name ?? '')),
6567
[channelConfig],
6668
);
6769

src/components/MessageList/MessageList.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,16 @@ const MessageListWithContext = (props: MessageListWithContextProps) => {
299299
threadList={threadList}
300300
/>
301301
</div>
302+
<NewMessageNotification
303+
newMessageCount={channelUnreadUiState?.unread_messages}
304+
showNotification={hasNewMessages || hasMoreNewer}
305+
/>
306+
<ScrollToLatestMessageButton
307+
isMessageListScrolledToBottom={isMessageListScrolledToBottom}
308+
isNotAtLatestMessageSet={hasMoreNewer}
309+
onClick={scrollToBottomFromNotification}
310+
threadList={threadList}
311+
/>
302312
</DialogManagerProvider>
303313
</MessageListMainPanel>
304314
<MessageListNotifications notifications={notifications} />

src/components/MessageList/styling/MessageList.scss

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010
align-items: center;
1111
}
1212

13+
.str-chat__message-list-main-panel {
14+
--str-chat__message-list-scroll-max-width: calc(
15+
var(--str-chat__message-composer-max-width) +
16+
var(--str-chat__message-composer-padding)
17+
);
18+
}
19+
1320
.str-chat__message-list {
1421
@include utils.scrollable;
1522
display: flex;
@@ -24,10 +31,7 @@
2431
.str-chat__message-list-scroll {
2532
@include utils.message-list-spacing;
2633
/* Max container 800px, 16px padding → 768px readable content; matches composer width + padding */
27-
max-width: calc(
28-
var(--str-chat__message-composer-max-width) +
29-
var(--str-chat__message-composer-padding)
30-
);
34+
max-width: var(--str-chat__message-list-scroll-max-width);
3135
.str-chat__ul {
3236
list-style: none;
3337
padding: 0;

src/components/MessageList/styling/ScrollToLatestMessageButton.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
width: 40px;
44
position: absolute;
55
inset-block-end: var(--spacing-md);
6-
inset-inline-end: var(--spacing-md);
6+
inset-inline-end: max(
7+
var(--spacing-md),
8+
calc((100% - var(--str-chat__message-list-scroll-max-width)) / 2 + var(--spacing-md))
9+
);
710
z-index: 2;
811
border-radius: var(--radius-max);
912
background-color: var(--background-elevation-elevation-1);

src/components/MessageList/styling/VirtualizedMessageList.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
// Layout
66
.str-chat__virtual-list {
77
@include utils.scrollable;
8+
--str-chat__message-list-scroll-max-width: calc(
9+
var(--str-chat__message-composer-max-width) +
10+
var(--str-chat__message-composer-padding)
11+
);
812
position: relative;
913
flex: 1;
1014
-webkit-overflow-scrolling: touch; /* enable smooth scrolling on ios */

src/components/TextareaComposer/SuggestionList/SuggestionList.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,15 @@ export const SuggestionList = ({
118118

119119
const contextMenuItems = useMemo<ContextMenuItemComponent[]>(() => {
120120
if (!component) return [];
121-
return (items ?? []).map((item, i) => {
121+
const sortedItems =
122+
suggestions?.searchSource.type === 'commands'
123+
? [...(items ?? [])].sort((a, b) =>
124+
String((a as { name?: string }).name ?? '').localeCompare(
125+
String((b as { name?: string }).name ?? ''),
126+
),
127+
)
128+
: (items ?? []);
129+
return sortedItems.map((item, i) => {
122130
const Item: ContextMenuItemComponent = ({
123131
closeMenu: _, // eslint-disable-line @typescript-eslint/no-unused-vars
124132
openSubmenu: __, //eslint-disable-line @typescript-eslint/no-unused-vars
@@ -141,6 +149,7 @@ export const SuggestionList = ({
141149
focusedItemIndex,
142150
setFocusedItemIndex,
143151
AutocompleteSuggestionItem,
152+
suggestions?.searchSource.type,
144153
]);
145154

146155
const ItemsWrapper = useCallback(

0 commit comments

Comments
 (0)