Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update margin in messages #180

Merged
merged 2 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/kind-zebras-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@openassistantgpt/ui': patch
---

Update marging and padding issue
8 changes: 5 additions & 3 deletions packages/ui/components/chat-message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,15 @@
background: chatbot.userReplyBackgroundColor,
fontSize, // Apply font size in pixels here
}}
className="p-2 rounded-lg mr-3 whitespace-pre-wrap"
className={`p-2 rounded-lg whitespace-pre-wrap ${
withChatMessageIcon ? 'mr-4' : 'mr-3'
}`}
dir={getDirection(chatbot.rightToLeftLanguage)} // Set text direction
>
<svg
fill={chatbot.userReplyBackgroundColor}
className={`absolute bottom-[0px] ${
chatbot.withChatMessageIcon ? 'right-14' : 'right-2'
chatbot.withChatMessageIcon ? 'right-11' : 'right-2'
}`}
height="14"
width="13"
Expand All @@ -80,7 +82,7 @@
{withChatMessageIcon && (
<div
className={cn(
'flex size-8 shrink-0 mr-4 select-none items-center justify-center rounded-md border shadow',
'flex size-8 shrink-0 select-none items-center justify-center rounded-md border shadow',
'bg-background',
)}
>
Expand All @@ -96,7 +98,7 @@
{withChatMessageIcon &&
(chatbot.chatbotLogoURL ? (
<div className="size-8" style={{ width: '30px', height: '30px' }}>
<img

Check warning on line 101 in packages/ui/components/chat-message.tsx

View workflow job for this annotation

GitHub Actions / ESLint

Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element
src={chatbot.chatbotLogoURL}
alt="chatbot logo"
width={50}
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,19 @@
variant: 'destructive',
});
}
}, [error]);

Check warning on line 114 in packages/ui/components/chat.tsx

View workflow job for this annotation

GitHub Actions / ESLint

React Hook useEffect has a missing dependency: 'toast'. Either include it or remove the dependency array

useEffect(() => {
if (onThreadIdChange) {
onThreadIdChange(threadId);
}
}, [threadId]);

Check warning on line 120 in packages/ui/components/chat.tsx

View workflow job for this annotation

GitHub Actions / ESLint

React Hook useEffect has a missing dependency: 'onThreadIdChange'. Either include it or remove the dependency array. If 'onThreadIdChange' changes too often, find the parent component that defines it and wrap that definition in useCallback

useEffect(() => {
if (onMessagesChange) {
onMessagesChange(messages);
}
}, [messages]);

Check warning on line 126 in packages/ui/components/chat.tsx

View workflow job for this annotation

GitHub Actions / ESLint

React Hook useEffect has a missing dependency: 'onMessagesChange'. Either include it or remove the dependency array. If 'onMessagesChange' changes too often, find the parent component that defines it and wrap that definition in useCallback

useEffect(() => {
if (defaultMessage !== '') {
Expand All @@ -132,7 +132,7 @@
target: { value: defaultMessage },
} as React.ChangeEvent<HTMLInputElement>);
}
}, [defaultMessage]);

Check warning on line 135 in packages/ui/components/chat.tsx

View workflow job for this annotation

GitHub Actions / ESLint

React Hook useEffect has missing dependencies: 'handleInputChange' and 'input'. Either include them or remove the dependency array

function closeChat() {
window.parent.postMessage('closeChat', '*');
Expand Down Expand Up @@ -224,7 +224,7 @@
setUploadQueue([]);
}
},
[setAttachments],

Check warning on line 227 in packages/ui/components/chat.tsx

View workflow job for this annotation

GitHub Actions / ESLint

React Hook useCallback has a missing dependency: 'uploadFile'. Either include it or remove the dependency array
);

return (
Expand All @@ -249,7 +249,7 @@
<div
ref={messagesContainerRef}
className={cn(
'pb-[200px] overflow-auto max-h-max pl-2 pr-2 sm:pl-20 sm:pr-20 md:pb-[100px] pt-4 md:pt-10',
'pb-[200px] overflow-auto max-h-max pl-6 pr-6 sm:pl-20 sm:pr-20 md:pb-[100px] pt-4 md:pt-10',
className,
)}
>
Expand Down
Loading