Fixed Recurring Problem of Mobile UI
Browse files- static/script.js +3 -3
- static/style.css +97 -1
static/script.js
CHANGED
|
@@ -11,13 +11,13 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
| 11 |
const refreshChatButton = document.getElementById("refresh-chat-button");
|
| 12 |
const menuToggle = document.getElementById("menu-toggle");
|
| 13 |
|
| 14 |
-
// ---
|
| 15 |
const closeMenuButton = document.getElementById("close-menu-button");
|
| 16 |
const pageOverlay = document.getElementById("page-overlay");
|
| 17 |
|
| 18 |
let conversationState = {};
|
| 19 |
|
| 20 |
-
// ---
|
| 21 |
const openMenu = () => {
|
| 22 |
leftColumn.classList.add('active');
|
| 23 |
pageOverlay.classList.add('active');
|
|
@@ -115,7 +115,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
| 115 |
}
|
| 116 |
const featureName = featureCard.dataset.value;
|
| 117 |
sendMessage(featureName);
|
| 118 |
-
closeMenu(); //
|
| 119 |
});
|
| 120 |
|
| 121 |
const updatePlaceholder = () => {
|
|
|
|
| 11 |
const refreshChatButton = document.getElementById("refresh-chat-button");
|
| 12 |
const menuToggle = document.getElementById("menu-toggle");
|
| 13 |
|
| 14 |
+
// --- Elements for mobile menu ---
|
| 15 |
const closeMenuButton = document.getElementById("close-menu-button");
|
| 16 |
const pageOverlay = document.getElementById("page-overlay");
|
| 17 |
|
| 18 |
let conversationState = {};
|
| 19 |
|
| 20 |
+
// --- Functions to open and close the mobile menu ---
|
| 21 |
const openMenu = () => {
|
| 22 |
leftColumn.classList.add('active');
|
| 23 |
pageOverlay.classList.add('active');
|
|
|
|
| 115 |
}
|
| 116 |
const featureName = featureCard.dataset.value;
|
| 117 |
sendMessage(featureName);
|
| 118 |
+
closeMenu(); // Close menu after selection
|
| 119 |
});
|
| 120 |
|
| 121 |
const updatePlaceholder = () => {
|
static/style.css
CHANGED
|
@@ -1,4 +1,11 @@
|
|
| 1 |
/* General Setup */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
body {
|
| 3 |
font-family: 'Inter', sans-serif;
|
| 4 |
margin: 0;
|
|
@@ -486,6 +493,95 @@ body.dark .left-column {
|
|
| 486 |
}
|
| 487 |
|
| 488 |
.left-column {
|
| 489 |
-
padding-top: 4rem;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 490 |
}
|
|
|
|
|
|
|
| 491 |
}
|
|
|
|
| 1 |
/* General Setup */
|
| 2 |
+
html, body {
|
| 3 |
+
margin: 0;
|
| 4 |
+
padding: 0;
|
| 5 |
+
overflow-x: hidden; /* Prevents horizontal scroll */
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
/* General Setup 2*/
|
| 9 |
body {
|
| 10 |
font-family: 'Inter', sans-serif;
|
| 11 |
margin: 0;
|
|
|
|
| 493 |
}
|
| 494 |
|
| 495 |
.left-column {
|
| 496 |
+
padding-top: 4rem;
|
| 497 |
+
}
|
| 498 |
+
}
|
| 499 |
+
|
| 500 |
+
/* --- Mobile Menu Elements*/
|
| 501 |
+
.menu-toggle-button { display: none; background: none; border: none; color: white; cursor: pointer; padding: 0 1rem 0 0; }
|
| 502 |
+
#page-overlay { display: none; }
|
| 503 |
+
.close-menu-button { display: none; }
|
| 504 |
+
|
| 505 |
+
/* --- Mobile Responsiveness --- */
|
| 506 |
+
@media (max-width: 768px) {
|
| 507 |
+
body.menu-open {
|
| 508 |
+
overflow: hidden; /* Prevent background from scrolling when menu is open */
|
| 509 |
+
}
|
| 510 |
+
.main-container {
|
| 511 |
+
flex-direction: column;
|
| 512 |
+
padding: 0;
|
| 513 |
+
gap: 0;
|
| 514 |
+
height: 100vh;
|
| 515 |
+
}
|
| 516 |
+
/* Left Column becomes slide-out menu */
|
| 517 |
+
.left-column {
|
| 518 |
+
position: fixed;
|
| 519 |
+
top: 0;
|
| 520 |
+
left: 0;
|
| 521 |
+
width: 80%;
|
| 522 |
+
max-width: 300px;
|
| 523 |
+
height: 100%;
|
| 524 |
+
z-index: 1000;
|
| 525 |
+
transform: translateX(-100%);
|
| 526 |
+
transition: transform 0.3s ease-in-out;
|
| 527 |
+
border-right: 1px solid;
|
| 528 |
+
padding: 1rem;
|
| 529 |
+
padding-top: 4rem; /* Make space for close button */
|
| 530 |
+
box-sizing: border-box;
|
| 531 |
+
overflow-y: auto;
|
| 532 |
+
}
|
| 533 |
+
.left-column.active {
|
| 534 |
+
transform: translateX(0);
|
| 535 |
+
}
|
| 536 |
+
body.light .left-column { background-color: #f8f9fa; }
|
| 537 |
+
body.dark .left-column { background-color: #1e1e1e; }
|
| 538 |
+
|
| 539 |
+
/* Right Column takes full width */
|
| 540 |
+
.right-column {
|
| 541 |
+
width: 100%;
|
| 542 |
+
height: 100%;
|
| 543 |
+
}
|
| 544 |
+
.chat-window {
|
| 545 |
+
border-radius: 0;
|
| 546 |
+
box-shadow: none;
|
| 547 |
+
height: 100%;
|
| 548 |
+
}
|
| 549 |
+
.chat-header {
|
| 550 |
+
border-radius: 0;
|
| 551 |
+
}
|
| 552 |
+
|
| 553 |
+
/* Show Mobile Menu Elements */
|
| 554 |
+
.menu-toggle-button {
|
| 555 |
+
display: block;
|
| 556 |
+
}
|
| 557 |
+
#page-overlay {
|
| 558 |
+
position: fixed;
|
| 559 |
+
top: 0;
|
| 560 |
+
left: 0;
|
| 561 |
+
width: 100%;
|
| 562 |
+
height: 100%;
|
| 563 |
+
background-color: rgba(0, 0, 0, 0.5);
|
| 564 |
+
z-index: 999;
|
| 565 |
+
opacity: 0;
|
| 566 |
+
transition: opacity 0.3s ease-in-out;
|
| 567 |
+
pointer-events: none;
|
| 568 |
+
}
|
| 569 |
+
#page-overlay.active {
|
| 570 |
+
opacity: 1;
|
| 571 |
+
pointer-events: auto;
|
| 572 |
+
}
|
| 573 |
+
.close-menu-button {
|
| 574 |
+
display: block;
|
| 575 |
+
position: absolute;
|
| 576 |
+
top: 10px;
|
| 577 |
+
right: 15px;
|
| 578 |
+
background: none;
|
| 579 |
+
border: none;
|
| 580 |
+
font-size: 2.5rem;
|
| 581 |
+
font-weight: 300;
|
| 582 |
+
line-height: 1;
|
| 583 |
+
cursor: pointer;
|
| 584 |
}
|
| 585 |
+
body.light .close-menu-button { color: #212529; }
|
| 586 |
+
body.dark .close-menu-button { color: #e9ecef; }
|
| 587 |
}
|