Skip to content

Commit

Permalink
fix: message gap styles
Browse files Browse the repository at this point in the history
  • Loading branch information
bang9 committed Aug 29, 2024
1 parent 01112c1 commit cf7633e
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 31 deletions.
1 change: 0 additions & 1 deletion src/components/BotMessageWithBodyInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const Root = styled.span`
display: flex;
flex-direction: row;
align-items: flex-end;
margin-bottom: 6px;
gap: 8px;
position: relative;
`;
Expand Down
2 changes: 0 additions & 2 deletions src/components/CurrentUserMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ const Root = styled.div<{ enableEmojiFeedback: boolean }>`
display: flex;
justify-content: flex-end;
align-items: end;
margin-bottom: 6px;
gap: 4px;
margin-top: ${({ enableEmojiFeedback }) => (enableEmojiFeedback ? '16px' : '0')};
`;

type Props = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/CustomTypingIndicatorBubble.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { TypingBubble } from '../foundation/components/TypingBubble';

function CustomTypingIndicatorBubble({ botProfileUrl }: { botProfileUrl: string }) {
return (
<div style={{ display: 'flex', alignItems: 'flex-end', gap: 8 }}>
<div style={{ display: 'flex', alignItems: 'flex-end', gap: 8, marginTop: 16 }}>
<BotProfileImage size={28} profileUrl={botProfileUrl} />
<TypingBubble />
</div>
Expand Down
12 changes: 7 additions & 5 deletions src/components/SuggestedRepliesContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ interface Props {
const SuggestedRepliesContainer = ({ replies = [], type = 'vertical', sendUserMessage }: Props) => {
if (replies.length <= 0) return null;
return (
<SuggestedReplies
replyOptions={replies}
onSendMessage={({ message }) => sendUserMessage?.({ message })}
type={type}
/>
<div style={{ marginTop: 8 }}>
<SuggestedReplies
replyOptions={replies}
onSendMessage={({ message }) => sendUserMessage?.({ message })}
type={type}
/>
</div>
);
};

Expand Down
1 change: 0 additions & 1 deletion src/components/UserMessageWithBodyInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { formatCreatedAtToAMPM } from '../utils/messageTimestamp';
const Root = styled.div`
display: flex;
align-items: flex-end;
margin-bottom: 6px;
flex-wrap: wrap;
gap: 8px;
position: relative;
Expand Down
44 changes: 23 additions & 21 deletions src/components/chat/ui/ChatMessageList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,29 +62,31 @@ export const ChatMessageList = () => {
formatString={stringSet.DATE_FORMAT__MESSAGE_LIST__DATE_SEPARATOR}
/>
)}
<CustomMessage
message={message as any}
botUser={isSendableMessage(message) ? message.sender : undefined}
activeSpinnerId={typingTargetMessageId}
chainTop={top}
chainBottom={bottom}
/>
<div style={{ marginBottom: index === filteredMessages.length - 1 ? 0 : 16 }}>
<CustomMessage
message={message as any}
botUser={isSendableMessage(message) ? message.sender : undefined}
activeSpinnerId={typingTargetMessageId}
chainTop={top}
chainBottom={bottom}
/>

{message.data &&
isDashboardPreview(customUserAgentParam) &&
message.messageId === channel?.lastMessage?.messageId && (
<MessageDataContent messageData={message.data} />
{message.data &&
isDashboardPreview(customUserAgentParam) &&
message.messageId === channel?.lastMessage?.messageId && (
<MessageDataContent messageData={message.data} />
)}

{showRepliesOnLastMessage && suggestedReplies.length > 0 && (
<SuggestedRepliesContainer
replies={suggestedReplies}
type={botStudioEditProps?.suggestedRepliesDirection}
sendUserMessage={(params) => {
dataSource.sendUserMessage(params, handlers.onAfterSendMessage).then(handlers.onAfterSendMessage);
}}
/>
)}

{showRepliesOnLastMessage && suggestedReplies.length > 0 && (
<SuggestedRepliesContainer
replies={suggestedReplies}
type={botStudioEditProps?.suggestedRepliesDirection}
sendUserMessage={(params) => {
dataSource.sendUserMessage(params, handlers.onAfterSendMessage).then(handlers.onAfterSendMessage);
}}
/>
)}
</div>
</div>
);
}}
Expand Down

0 comments on commit cf7633e

Please sign in to comment.