Skip to content

Commit

Permalink
refactor: re-center the message suggestions for new threads (#1025)
Browse files Browse the repository at this point in the history
- Updates the scroll-area component to take classNames for it's viewport subcomponent for more flexible styling
  • Loading branch information
ryanhopperlowe authored Dec 23, 2024
1 parent 31c39b7 commit f03c070
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
5 changes: 4 additions & 1 deletion ui/admin/app/components/chat/MessagePane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ export function MessagePane({
startScrollAt="bottom"
enableScrollTo="bottom"
enableScrollStick="bottom"
className={cn("h-full w-full relative", classNames.messageList)}
classNames={{
root: cn("h-full w-full relative", classNames.messageList),
viewport: cn(isEmpty && "flex flex-col justify-center"),
}}
>
{isEmpty ? (
<NoMessages />
Expand Down
16 changes: 14 additions & 2 deletions ui/admin/app/components/ui/scroll-area.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ const ScrollArea = React.forwardRef<
startScrollAt?: "bottom";
enableScrollStick?: "bottom";
enableScrollTo?: "bottom";
classNames?: {
root?: string;
viewport?: string;
};
}
>((props, ref) => {
const {
Expand All @@ -23,6 +27,7 @@ const ScrollArea = React.forwardRef<
startScrollAt,
enableScrollTo,
enableScrollStick,
classNames = {},
...rootProps
} = props;

Expand Down Expand Up @@ -60,11 +65,18 @@ const ScrollArea = React.forwardRef<
return (
<ScrollAreaPrimitive.Root
ref={ref}
className={cn("relative overflow-hidden", className)}
className={cn(
"relative overflow-hidden",
className,
classNames.root
)}
{...rootProps}
>
<ScrollAreaPrimitive.Viewport
className="h-full w-full rounded-[inherit] max-h-[inherit]"
className={cn(
"h-full w-full rounded-[inherit] max-h-[inherit]",
classNames.viewport
)}
ref={initRef}
onScroll={(e) =>
setShouldStickToBottom(isScrolledToBottom(e.currentTarget))
Expand Down

0 comments on commit f03c070

Please sign in to comment.