Files
ds-chat/frontend/src/components/TopBar.css
T
ksmith 8ca3e2e23d Add user profile management: display name + avatar upload (Gitea issue #12)
Users can set a display name (shown instead of username in the message
list, room member list, TopBar, and admin Users tab) and upload a real
avatar, replacing the generated color-initial avatars everywhere a user
appears. Avatars are square-cropped and downscaled to 512px, reusing
app/storage.py's upload primitives from image uploads with a new square
option.

Two deliberate divergences from message-image handling, documented in
backend/README.md: the previous avatar file is deleted on replace/remove
(safe since it's strictly one file per user), and avatar serving is not
room-gated and uses a short cache (identity-addressed and mutable, unlike
a message image's permanent content-addressed URL).

Frontend: new ProfileModal reachable from the TopBar account menu;
AuthContext gains updateUser() so a profile change reflects instantly
everywhere without a refetch.
2026-08-14 16:59:56 -06:00

104 lines
1.7 KiB
CSS

.top-bar {
height: 56px;
min-height: 56px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 var(--sp-4);
background: var(--ds-surface);
border-bottom: 1px solid var(--ds-border);
}
.top-bar-brand {
display: flex;
align-items: center;
gap: 10px;
min-width: 0;
}
.top-bar-logo {
width: 28px;
height: 28px;
border-radius: 6px;
object-fit: cover;
flex: none;
}
.top-bar-title {
font-weight: 700;
font-size: 1.02rem;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.top-bar-user {
position: relative;
flex: none;
}
.top-bar-avatar {
width: 30px;
height: 30px;
padding: 0;
border: none;
background: transparent;
cursor: pointer;
display: flex;
}
.top-bar-menu-scrim {
position: fixed;
inset: 0;
z-index: 30;
}
.top-bar-menu {
position: absolute;
top: calc(100% + 8px);
right: 0;
z-index: 31;
background: var(--card-bg);
border: 1px solid var(--ds-border);
border-radius: var(--radius);
padding: var(--sp-2);
min-width: 160px;
display: flex;
flex-direction: column;
gap: 2px;
}
.top-bar-menu-username {
font-size: 0.78rem;
color: var(--ds-muted);
padding: 6px 8px 4px;
font-weight: 700;
}
.top-bar-menu button[role='menuitem'] {
background: transparent;
border: none;
color: var(--ds-text);
text-align: left;
padding: 8px;
border-radius: 6px;
font-size: 0.86rem;
cursor: pointer;
}
.top-bar-menu button[role='menuitem']:hover {
background: var(--ds-surface-2);
}
.top-bar-menu button[role='menuitem']:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.top-bar-menu-error {
color: var(--ds-danger);
font-size: 0.74rem;
padding: 2px 8px 6px;
max-width: 220px;
}