Skip to content

Commit

Permalink
conditionally stop scroll to bottom on chatscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
theBstar committed Aug 23, 2024
1 parent f3ae837 commit c3bd56e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 25 deletions.
3 changes: 2 additions & 1 deletion package-dist/chatScreen/ChatScreenPA.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ export interface ChatScreenPAProps<T> {
customMessageActionCardItem?: ReactNode[];
hideNewChatButton?: boolean;
emptyChatComponent?: ReactNode;
disableScrollNewMessageToTop?: boolean;
}
export declare function ChatScreenPA<T extends BaseMessage>({ messages, handleSendFollowupMessage, isMessageLoading, setMessages, showMessageActionCard, hideActionCardItems, customMessageComponent, customMessageActionCardItem, hideNewChatButton, emptyChatComponent, }: ChatScreenPAProps<T>): import("react/jsx-runtime").JSX.Element;
export declare function ChatScreenPA<T extends BaseMessage>({ messages, handleSendFollowupMessage, isMessageLoading, setMessages, showMessageActionCard, hideActionCardItems, customMessageComponent, customMessageActionCardItem, hideNewChatButton, emptyChatComponent, disableScrollNewMessageToTop }: ChatScreenPAProps<T>): import("react/jsx-runtime").JSX.Element;
41 changes: 21 additions & 20 deletions package-dist/ui-gallery.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -94456,14 +94456,15 @@ function crt({
customMessageComponent: a,
customMessageActionCardItem: s,
hideNewChatButton: l = !1,
emptyChatComponent: c
emptyChatComponent: c,
disableScrollNewMessageToTop: u = !1
}) {
const [u, d] = Ie(""), h = ve(null);
const [d, h] = Ie(""), f = ve(null);
Ht(() => {
const p = h.current;
p && (p.scrollTop = p.scrollHeight);
}, [e]);
const f = e.length > 1 && r || e.length === 1;
const g = f.current;
g && !u && (g.scrollTop = g.scrollHeight);
}, [e, u]);
const p = e.length > 1 && r || e.length === 1;
return /* @__PURE__ */ q.jsxs(
ft,
{
Expand Down Expand Up @@ -94505,7 +94506,7 @@ function crt({
/* @__PURE__ */ q.jsxs(
ft,
{
ref: h,
ref: f,
vertical: !0,
style: {
width: "58vw",
Expand All @@ -94520,43 +94521,43 @@ function crt({
rootClassName: "chat-container",
gap: 48,
children: [
!f && e.length === 0 && c && c,
e.filter(Boolean).map((p, g) => p.type === "ai" ? /* @__PURE__ */ q.jsx(
!p && e.length === 0 && c && c,
e.filter(Boolean).map((g, v) => g.type === "ai" ? /* @__PURE__ */ q.jsx(
r9e,
{
index: g,
index: v,
messages: e,
hideActionCardItems: o,
showMessageActionCard: i,
customMessageComponent: (a == null ? void 0 : a.type) === p.type ? a : void 0,
customMessageComponent: (a == null ? void 0 : a.type) === g.type ? a : void 0,
handleRegenerateResponse: t,
customMessageActionCardItem: s
},
g
v
) : /* @__PURE__ */ q.jsx(
n9e,
{
index: g,
index: v,
messages: e,
customMessageComponent: (a == null ? void 0 : a.type) === p.type ? a : void 0
customMessageComponent: (a == null ? void 0 : a.type) === g.type ? a : void 0
},
g
v
)),
f && /* @__PURE__ */ q.jsx(xEe, {})
p && /* @__PURE__ */ q.jsx(xEe, {})
]
}
),
/* @__PURE__ */ q.jsx(
Vm,
{
inputRef: null,
userQuery: u,
setUserQuery: d,
userQuery: d,
setUserQuery: h,
handleSendMessage: () => {
t(u), d("");
t(d), h("");
},
placeholder: "Follow up with your question here...",
isFollowupDisabled: f
isFollowupDisabled: p
}
)
]
Expand Down
Loading

0 comments on commit c3bd56e

Please sign in to comment.