Skip to content

Commit a6b2cb9

Browse files
author
kqlio67
committed
Improve sidebar toggle and mobile responsiveness
- Add fixed sidebar logic for mobile - Animate chat container margin - Refine expand/collapse logic - Use transitions for smooth effect
1 parent 832dd39 commit a6b2cb9

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

g4f/gui/client/static/css/style.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,13 +957,22 @@ input.model:hover
957957
}
958958

959959
@media only screen and (min-width: 40em) {
960+
.sidebar {
961+
position: static;
962+
height: auto;
963+
background-color: transparent;
964+
}
965+
960966
.sidebar.expanded {
961967
width: 400px;
962968
}
963969

964970
.sidebar.expanded + .chat-container {
965971
margin-left: 400px;
966972
width: calc(100% - 400px);
973+
position: relative;
974+
left: 0;
975+
transition: left 0.3s ease; /* Add transition for smooth animation */
967976
}
968977

969978
.stop_generating {
@@ -997,6 +1006,15 @@ input.model:hover
9971006
}
9981007
}
9991008

1009+
body.mobile-sidebar-open .sidebar {
1010+
position: fixed;
1011+
}
1012+
1013+
body.mobile-sidebar-open .chat-container {
1014+
margin-left: 400px; /* Push chat container to the right */
1015+
transition: margin-left 0.3s ease; /* Add transition for smooth animation */
1016+
}
1017+
10001018
.input-area {
10011019
display: flex;
10021020
}

g4f/gui/client/static/js/chat.v1.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,13 +1890,14 @@ window.addEventListener('popstate', hide_sidebar, false);
18901890

18911891
// Create a reusable function for sidebar toggle logic
18921892
const toggleSidebar = async () => {
1893-
if (sidebar.classList.contains("expanded") ||
1893+
if (sidebar.classList.contains("expanded") ||
18941894
document.querySelector(".sidebar-button.rotated")) {
18951895
await hide_sidebar();
1896-
chat.classList.remove("hidden");
1896+
document.body.classList.remove('mobile-sidebar-open');
18971897
sidebar_buttons.forEach(btn => btn.classList.remove("rotated"));
1898-
} else {
1898+
} else {
18991899
await show_menu();
1900+
document.body.classList.add('mobile-sidebar-open');
19001901
}
19011902
window.scrollTo(0, 0);
19021903
};

0 commit comments

Comments
 (0)