Files
ds-chat/frontend/src/components/Composer.css
T
ksmith f2a59f798b Add image uploads in chat messages (Gitea issue #10)
Images live on the app server's local disk (uploads/), served through an
authenticated, room-membership-gated endpoint since rooms can be private.
Uploads are streamed with a byte-count cap, validated as genuine decodable
images with Pillow (not just a spoofed Content-Type), and downscaled to
2000px on the longer side (except GIF, to preserve animation).

Backend: MessageImage model + nullable Message.content/image_id with a
content-or-image CheckConstraint, upload/serve endpoints in rooms.py, WS
message envelope gains image_id, push notification body says "sent an
image" for image-only messages.

Frontend: Composer gets an attach button with upload progress and a
thumbnail chip; MessageList renders images inline with a click-to-zoom
ImageLightbox.
2026-08-14 12:21:42 -06:00

131 lines
2.3 KiB
CSS

.composer {
padding: var(--sp-3) var(--sp-4);
border-top: 1px solid var(--ds-border);
background: var(--ds-surface);
display: flex;
flex-direction: column;
gap: 6px;
}
.composer-box {
display: flex;
gap: var(--sp-2);
align-items: flex-end;
}
.composer-box textarea {
flex: 1;
resize: none;
background: var(--ds-surface-2);
border: 1px solid var(--ds-border);
border-radius: var(--radius);
padding: 9px 12px;
color: var(--ds-text);
font-size: 0.88rem;
outline: none;
max-height: 120px;
}
.composer-box textarea:focus {
border-color: var(--ds-accent);
}
.composer-send {
width: 36px;
height: 36px;
flex: none;
border-radius: var(--radius);
background: var(--ds-accent);
color: var(--ds-void);
border: none;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.composer-send:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.composer-file-input {
display: none;
}
.composer-attach {
width: 36px;
height: 36px;
flex: none;
border-radius: var(--radius);
background: transparent;
color: var(--ds-muted);
border: 1px solid var(--ds-border);
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.composer-attach:hover:not(:disabled) {
color: var(--ds-text);
border-color: var(--ds-accent);
}
.composer-attach:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.composer-spinner {
animation: composer-spin 0.8s linear infinite;
}
@keyframes composer-spin {
to {
transform: rotate(360deg);
}
}
.composer-attachment {
position: relative;
width: fit-content;
}
.composer-attachment-thumb {
max-height: 72px;
max-width: 140px;
border-radius: var(--radius);
border: 1px solid var(--ds-border);
display: block;
object-fit: cover;
}
.composer-attachment-remove {
position: absolute;
top: -6px;
right: -6px;
width: 18px;
height: 18px;
border-radius: 50%;
background: var(--ds-surface-2);
border: 1px solid var(--ds-border);
color: var(--ds-text);
font-size: 0.7rem;
line-height: 1;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.composer-status {
font-size: 0.76rem;
color: var(--ds-muted);
padding-left: 2px;
}
.composer-error {
color: var(--ds-danger, #e5484d);
}