Redesign sidebar user section to fix overlap issue
All checks were successful
CI / Format (push) Successful in 5s
CI / Clippy (push) Successful in 3m21s
CI / Security Audit (push) Successful in 1m41s
CI / Tests (push) Successful in 4m44s

Restructured layout: avatar, truncated username, and logout icon
in a single row. Collapsed state stacks vertically. Logout button
uses a subtle icon-only style with red hover. Proper text ellipsis
prevents name overflow.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Sharang Parnerkar
2026-03-08 18:24:58 +01:00
parent d490359591
commit 3a01a28591
2 changed files with 87 additions and 10 deletions

View File

@@ -300,6 +300,84 @@ tr:hover {
color: var(--text-secondary); color: var(--text-secondary);
} }
/* Sidebar User Section */
.sidebar-user {
display: flex;
align-items: center;
gap: 10px;
padding: 12px 14px;
margin: 8px;
border-top: 1px solid var(--border);
padding-top: 16px;
}
.sidebar-user-collapsed {
flex-direction: column;
gap: 8px;
padding: 12px 4px;
margin: 8px 4px;
}
.user-avatar {
width: 34px;
height: 34px;
border-radius: 10px;
background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(56, 189, 248, 0.08));
border: 1px solid rgba(56, 189, 248, 0.15);
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.avatar-initials {
font-size: 13px;
font-weight: 700;
color: var(--accent);
line-height: 1;
}
.avatar-img {
width: 100%;
height: 100%;
border-radius: 10px;
object-fit: cover;
}
.user-name {
flex: 1;
font-size: 13px;
font-weight: 500;
color: var(--text-primary);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
min-width: 0;
}
.logout-btn {
display: flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
border-radius: 8px;
color: var(--text-secondary);
text-decoration: none;
flex-shrink: 0;
transition: all 0.15s;
}
.logout-btn:hover {
background: rgba(239, 68, 68, 0.12);
color: #fca5a5;
}
.logout-btn-collapsed {
width: 34px;
height: 34px;
}
@media (max-width: 768px) { @media (max-width: 768px) {
.sidebar { .sidebar {
transform: translateX(-100%); transform: translateX(-100%);

View File

@@ -130,8 +130,9 @@ pub fn Sidebar() -> Element {
let auth_info = use_context::<Signal<AuthInfo>>(); let auth_info = use_context::<Signal<AuthInfo>>();
let info = auth_info(); let info = auth_info();
let initials = info.name.chars().next().unwrap_or('U').to_uppercase().to_string(); let initials = info.name.chars().next().unwrap_or('U').to_uppercase().to_string();
let user_class = if collapsed() { "sidebar-user sidebar-user-collapsed" } else { "sidebar-user" };
rsx! { rsx! {
div { class: "sidebar-user", div { class: "{user_class}",
div { class: "user-avatar", div { class: "user-avatar",
if info.avatar_url.is_empty() { if info.avatar_url.is_empty() {
span { class: "avatar-initials", "{initials}" } span { class: "avatar-initials", "{initials}" }
@@ -140,15 +141,13 @@ pub fn Sidebar() -> Element {
} }
} }
if !collapsed() { if !collapsed() {
div { class: "user-info", span { class: "user-name", "{info.name}" }
span { class: "user-name", "{info.name}" } }
a { a {
href: "/logout", href: "/logout",
class: "logout-link", class: if collapsed() { "logout-btn logout-btn-collapsed" } else { "logout-btn" },
Icon { icon: BsBoxArrowRight, width: 14, height: 14 } title: "Sign out",
" Logout" Icon { icon: BsBoxArrowRight, width: 16, height: 16 }
}
}
} }
} }
} }