Skip to content

Commit

Permalink
removed: scrollToBottom
Browse files Browse the repository at this point in the history
  • Loading branch information
PrinceBaghel258025 committed Jul 8, 2024
1 parent 5977547 commit 7f02edb
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 37 deletions.
10 changes: 0 additions & 10 deletions src/components/audiowaveform.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,6 @@ const AudioWaveForm = (props: Props) => {
props.setIsRecording(true);
};

useEffect(() => {
if (window !== undefined) {
startRecording();
}
const timeout = setTimeout(() => {
window.scrollTo({ top: document.body.scrollHeight, behavior: "smooth" });
}, 100);

return () => clearTimeout(timeout);
}, []);

const onData = (recordedBlob: Blob) => {
// console.log("isRecording", props.isOpen);
Expand Down
15 changes: 0 additions & 15 deletions src/components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,20 +226,6 @@ export default function Chat(props: ChatProps) {
sheetContentRef.current.scrollIntoView({ behavior: "smooth" });
}
}, [messages]);
const scrollToBottom = () => {
const isMobile = window.innerWidth <= 500;
const scrollFunction = () => {
if (sheetContentRef.current) {
sheetContentRef.current.scrollIntoView({ behavior: "smooth" });
}
};
if (isMobile) {
setTimeout(scrollFunction, 1000);
} else {
scrollFunction();
}
return null;
};
return (
<div className="flex flex-col gap-1 mx-auto">
{props.type === "tldraw" && !props.onClickOpenChatSheet ? (
Expand Down Expand Up @@ -338,7 +324,6 @@ export default function Chat(props: ChatProps) {
</>
)}
<div className="h-0" ref={sheetContentRef} />
{scrollToBottom()}
</div>
);
}
8 changes: 0 additions & 8 deletions src/components/chatmessagecombinator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,6 @@ const ChatMessageCombinator = ({
const titleSplit = chatTitle.replaceAll('"', "").split(":");
const chat_title = titleSplit[0];
const chat_sub_title = titleSplit.length > 1 ? titleSplit[1] : "";
const scrollToBottom = () => {
if (sheetContentRef.current) {
sheetContentRef.current.scrollIntoView({ behavior: "smooth" });
}
};
useEffect(() => {
scrollToBottom(); // Scroll to bottom when component mounts
}, [onClickOpenChatSheet]); // Empty dependency array ensures it only runs once when component mounts

let messageIndex = 0;
return (
Expand Down
4 changes: 0 additions & 4 deletions src/components/contextwrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ export function ContextWrapper(props: Props) {
};
props.append(message as Message);
selection?.deleteFromDocument();
window.scrollTo({
top: document.body.scrollHeight + 200,
behavior: "smooth",
});
}
};

Expand Down

0 comments on commit 7f02edb

Please sign in to comment.