Skip to content

Commit

Permalink
feat: Added messageStackDirection in Constant
Browse files Browse the repository at this point in the history
  • Loading branch information
liamcho committed Dec 17, 2024
1 parent bc82954 commit 9fc159e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/chat/ui/ChatMessageList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ import { useTypingTargetMessageId } from '../hooks/useTypingTargetMessageId';

export const ChatMessageList = () => {
const { channel, dataSource, scrollSource, handlers } = useChatContext();
const { botStudioEditProps, customUserAgentParam, stringSet, dateLocale, enableMessageGrouping } = useConstantState();
const {
botStudioEditProps,
customUserAgentParam,
stringSet,
dateLocale,
enableMessageGrouping,
messageStackDirection = 'bottom',
} = useConstantState();

const typingTargetMessageId = useTypingTargetMessageId();
const { filteredMessages, shouldShowOriginalDate, renderBotStudioWelcomeMessages } = useBotStudioView();
Expand All @@ -42,7 +49,7 @@ export const ChatMessageList = () => {
scrollPositionRef={scrollSource.scrollPositionRef}
scrollDistanceFromBottomRef={scrollSource.scrollDistanceFromBottomRef}
onScrollPosition={(it) => scrollSource.setIsScrollBottomReached(it === 'bottom')}
stackDirection={'bottom'}
stackDirection={messageStackDirection}
messages={filteredMessages}
onLoadPrev={dataSource.loadPrevious}
onLoadNext={dataSource.loadNext}
Expand Down
5 changes: 5 additions & 0 deletions src/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ export interface Constant extends ConstantFeatureFlags, ConstantAIFeatures, Cons
* @description Message input state controlling properties.
*/
messageInputControls?: MessageInputControls;
/**
* @public
* @description
* */
messageStackDirection?: 'top' | 'bottom';
/**
* @private
* @description Whether to show the beta mark.
Expand Down

0 comments on commit 9fc159e

Please sign in to comment.