Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(ai): add custom scrollbar to block-chat (#1059)

Jacob Beckerman2ed7668f6ef7
diff --git a/js/app/packages/app/component/rightbar/Rightbar.tsx b/js/app/packages/app/component/rightbar/Rightbar.tsx
index 4b21f5412f..a758adf2ec 100644
--- a/js/app/packages/app/component/rightbar/Rightbar.tsx
+++ b/js/app/packages/app/component/rightbar/Rightbar.tsx
@@ -18,6 +18,7 @@ import {
getChatInputStoredState,
storeChatState,
} from '@core/component/AI/util/storage';
+import { CustomScrollbar } from '@core/component/CustomScrollbar';
import { DeprecatedIconButton } from '@core/component/DeprecatedIconButton';
import { DropdownMenuContent, MenuItem } from '@core/component/Menu';
import { ReferencesModal } from '@core/component/ReferencesModal';
@@ -265,7 +266,8 @@ export function Rightbar(props: {
isBig?: boolean;
setIsBig?: (val: boolean) => void;
}) {
- let messagesContainerRef!: HTMLDivElement;
+ const [messagesContainerRef, setMessagesContainerRef] =
+ createSignal<HTMLElement>();
createEffect(() => {
const stream_ = props.stream();
@@ -377,19 +379,22 @@ export function Rightbar(props: {
</div>
</Show>
<Show when={props.messages().length > 0 || !props.isBig}>
- <div
- data-chat-scroll
- class="flex-1 overflow-y-auto overflow-x-hidden scroll-smooth flex justify-center w-full"
- ref={messagesContainerRef}
- >
- <div class="w-full macro-message-width">
- <ChatMessages
- chatId={props.chatId}
- messages={[props.messages, props.setState.setMessages]}
- messageActions={undefined}
- stream={[props.stream, props.setState.setStream]}
- />
+ <div class="relative flex-1 min-h-0 w-full">
+ <div
+ data-chat-scroll
+ class="size-full overflow-y-auto overflow-x-hidden scroll-smooth flex justify-center scrollbar-hidden"
+ ref={setMessagesContainerRef}
+ >
+ <div class="w-full macro-message-width">
+ <ChatMessages
+ chatId={props.chatId}
+ messages={[props.messages, props.setState.setMessages]}
+ messageActions={undefined}
+ stream={[props.stream, props.setState.setStream]}
+ />
+ </div>
</div>
+ <CustomScrollbar scrollContainer={messagesContainerRef} />
</div>
</Show>
diff --git a/js/app/packages/block-chat/component/Chat.tsx b/js/app/packages/block-chat/component/Chat.tsx
index 9fb2663ad8..ffb5d7c80f 100644
--- a/js/app/packages/block-chat/component/Chat.tsx
+++ b/js/app/packages/block-chat/component/Chat.tsx
@@ -17,6 +17,7 @@ import {
type StoredStuff,
storeChatState,
} from '@core/component/AI/util/storage';
+import { CustomScrollbar } from '@core/component/CustomScrollbar';
import { usePaywallState } from '@core/constant/PaywallState';
import { TOKENS } from '@core/hotkey/tokens';
import { registerScopeSignalHotkey } from '@core/hotkey/utils';
@@ -41,6 +42,7 @@ export function Chat(props: { data: ChatData }) {
const blockElement = blockElementSignal.get;
const { navigatedFromJK } = useNavigatedFromJK();
const [chatEditor, setChatEditor] = createSignal<LexicalEditor>();
+ const [scrollRef, setScrollRef] = createSignal<HTMLElement>();
const [stream, setStream] = createSignal<MessageStream>();
const cancelStream = () => {
@@ -179,12 +181,17 @@ export function Chat(props: { data: ChatData }) {
uploadQueue={uploadQueue}
>
<TopBar />
- <div class="size-full flex-1 min-h-0 p-2">
- <div data-chat-scroll class="h-full min-h-0 overflow-auto">
+ <div class="size-full flex-1 min-h-0 p-2 relative">
+ <div
+ data-chat-scroll
+ class="h-full min-h-0 overflow-auto scrollbar-hidden"
+ ref={setScrollRef}
+ >
<div class="mx-auto w-full max-w-3xl">
<ChatMessages />
</div>
</div>
+ <CustomScrollbar scrollContainer={scrollRef} />
</div>
<Show when={!disabled()}>
<div class="flex w-full justify-center pb-2 px-4">