Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(dashboard): keep chat media usable on small screens

Yudhi Armyndharis5af0d617e36a
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 710203a94..65dcb572d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
+- Keep narrow chat panes scrollable and prevent message actions from shrinking previews.
+- Open archived images in the dashboard media viewer without fetching them again.
- Forward container shutdown signals after dropping process privileges in Compose and Helm.
- Preserve webhook outbox payloads until delivery or durable failure storage succeeds.
- Enforce webhook replay retention and keep later eligible failures moving through batches.
diff --git a/dashboard/src/components/chats/ArchivedMediaPreview.test.ts b/dashboard/src/components/chats/ArchivedMediaPreview.test.ts
index 509705b66..9e1474f79 100644
--- a/dashboard/src/components/chats/ArchivedMediaPreview.test.ts
+++ b/dashboard/src/components/chats/ArchivedMediaPreview.test.ts
@@ -57,6 +57,16 @@ test('an archived image loads once from the media route and renders from an obje
assert.equal(img.getAttribute('src'), 'blob:mock-0');
assert.equal(calls, 1, 'the bytes are fetched exactly once');
assert.deepEqual(revoked, [], 'the URL stays valid while the image is on screen');
+ rtl.fireEvent.click(img);
+ const dialog = await rtl.screen.findByRole('dialog');
+ assert.ok(dialog.querySelector('img[src="blob:mock-0"]'), 'the viewer uses the already loaded bytes');
+ rtl.fireEvent.click(rtl.screen.getByRole('button', { name: 'Close' }));
+ await rtl.act(() => new Promise(resolve => setTimeout(resolve, 500)));
+ assert.equal(rtl.screen.queryByRole('dialog'), null);
+ assert.equal(calls, 1, 'opening the viewer does not fetch the image again');
+ assert.deepEqual(revoked, [], 'closing the viewer keeps the preview URL valid');
+ rtl.fireEvent.keyDown(img, { key: 'Enter' });
+ assert.ok(rtl.screen.getByRole('dialog'), 'the viewer opens from the keyboard');
unmount();
assert.deepEqual(revoked, ['blob:mock-0'], 'unmounting releases the object URL');
});
diff --git a/dashboard/src/components/chats/ArchivedMediaPreview.tsx b/dashboard/src/components/chats/ArchivedMediaPreview.tsx
index 3960bc609..c98c382b1 100644
--- a/dashboard/src/components/chats/ArchivedMediaPreview.tsx
+++ b/dashboard/src/components/chats/ArchivedMediaPreview.tsx
@@ -1,5 +1,6 @@
import { useEffect, useRef, useState, type ReactNode } from 'react';
import { Loader2 } from 'lucide-react';
+import MediaLightbox from './MediaLightbox';
export type ArchivedMediaKind = 'image' | 'video' | 'audio';
@@ -29,6 +30,7 @@ type PreviewState = { phase: 'waiting' | 'loading' | 'failed' } | { phase: 'read
// scrolling through a long thread does not accumulate blobs.
function ArchivedMediaPreview({ kind, load, alt, fallback, measureMedia, onMediaLoad }: ArchivedMediaPreviewProps) {
const [state, setState] = useState<PreviewState>({ phase: 'waiting' });
+ const [imageOpen, setImageOpen] = useState(false);
const anchorRef = useRef<HTMLDivElement | null>(null);
// `load` is usually an inline arrow, so a fresh identity every render; holding it in a ref keeps
// the effects below from re-running (and re-fetching) on each parent render.
@@ -103,9 +105,32 @@ function ArchivedMediaPreview({ kind, load, alt, fallback, measureMedia, onMedia
switch (kind) {
case 'image':
return (
- <div className="message-media-image">
- <img src={state.url} alt={alt ?? ''} className="chat-image-media" ref={measureMedia} onLoad={onMediaLoad} />
- </div>
+ <>
+ <div className="message-media-image">
+ <img
+ src={state.url}
+ alt={alt ?? ''}
+ className="chat-image-media"
+ ref={measureMedia}
+ onLoad={onMediaLoad}
+ role="button"
+ tabIndex={0}
+ onClick={() => setImageOpen(true)}
+ onKeyDown={event => {
+ if (event.key === 'Enter' || event.key === ' ') {
+ event.preventDefault();
+ setImageOpen(true);
+ }
+ }}
+ />
+ </div>
+ <MediaLightbox
+ items={[{ id: 'archived-image', url: state.url, alt, filename: alt }]}
+ index={imageOpen ? 0 : null}
+ onClose={() => setImageOpen(false)}
+ onNavigate={() => {}}
+ />
+ </>
);
case 'video':
return (
diff --git a/dashboard/src/pages/Chats.css b/dashboard/src/pages/Chats.css
index 2ee7fd9cc..c645b9518 100644
--- a/dashboard/src/pages/Chats.css
+++ b/dashboard/src/pages/Chats.css
@@ -10,6 +10,7 @@
.chats-page .chats-layout {
display: flex;
flex: 1;
+ min-height: 0;
background: var(--bg-white);
border: 1px solid var(--border);
border-radius: 16px;
@@ -294,6 +295,7 @@
.chats-page .chats-room {
flex: 1;
min-width: 0;
+ min-height: 0;
display: flex;
flex-direction: column;
background: var(--bg-light);
@@ -334,6 +336,7 @@
.chats-page .room-container {
flex: 1;
+ min-height: 0;
display: flex;
flex-direction: column;
height: 100%;
@@ -886,7 +889,7 @@
@media (max-width: 768px) {
.chats-page {
padding: 1rem;
- height: auto;
+ height: calc(100dvh - 3.5rem);
}
.chats-page .chats-layout {
@@ -1074,6 +1077,9 @@
/* Hover Menu */
.chats-page .message-actions-menu {
+ position: absolute;
+ top: 0.5rem;
+ inset-inline-end: 0.5rem;
display: none;
align-items: center;
gap: 0.25rem;