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

Fix: overflow UI #1

Merged
merged 2 commits into from
Aug 30, 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
1 change: 1 addition & 0 deletions src/components/ai_ball.astro
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
display: flex;
justify-content: center;
align-items: center;
padding: 40px 0px 0;
}

#inner_div,
Expand Down
39 changes: 31 additions & 8 deletions src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,24 @@ import SendButton from "../components/send_btn.astro";
/>
<div id="main_chat_root">
<AiBall />
<div id="main_chat"></div>
</div>
<div id="input_root">
<ResizeInput />
<SendButton />
<div id="chat_box">
<div id="chat_container">
<div id="main_chat"></div>
</div>
</div>
<div id="input_root">
<ResizeInput />
<SendButton />
</div>

</div>
<script>
import "../components/chat_mess";
send.addEventListener("click", async () => {
send.disabled = true;
let bot = document.createElement("chat-message");
main_chat.appendChild(bot);

let text = "Hello, I am the bot. How can I help you?";
let out = "";
for (let i of text) {
Expand All @@ -32,6 +38,8 @@ import SendButton from "../components/send_btn.astro";
await new Promise(r => setTimeout(r, 10));
}
send.disabled = false;

chat_container.scrollTop = chat_container.scrollHeight;
})

</script>
Expand All @@ -49,10 +57,10 @@ import SendButton from "../components/send_btn.astro";
</style>
<style>
#main_chat {
bottom: 0%;
margin: 10px;
margin-top: 20px;
max-width: 100%;
height: 93%;
overflow-x: hidden;
display: flex;
flex-direction: column;
Expand All @@ -67,11 +75,26 @@ import SendButton from "../components/send_btn.astro";
align-items: center;
}

#chat_container {
height: fit-content
max-height: 100%;
overflow-y: auto;
top: 50%;
}
#chat_box {
height: 80%;
max-height: 100%;
display: flex;
flex-direction: column;
justify-content: flex-end;
}
#main_chat_root {
height: 100%;
width: 100%;
margin-top: 50px;

gap: 25px;
display: flex;
flex-direction: column;
justify-content: space-between;
}
</style>
</Layout>