From 2aa84c98add365d958fb414b0c8ac9c56b87f242 Mon Sep 17 00:00:00 2001 From: nrobi144 Date: Tue, 17 Mar 2026 13:53:58 +0200 Subject: [PATCH] fix(media): cap feed media height to 70% of window height Replace hardcoded 400.dp max with window-relative height so media (images and videos) never overflow the visible area and controls are always accessible without scrolling. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../vitorpamplona/amethyst/desktop/ui/note/NoteCard.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/note/NoteCard.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/note/NoteCard.kt index c6ee3c0f5..0691f62f2 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/note/NoteCard.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/note/NoteCard.kt @@ -56,6 +56,7 @@ import com.vitorpamplona.amethyst.commons.ui.components.UserAvatar import com.vitorpamplona.amethyst.commons.util.toTimeAgo import com.vitorpamplona.amethyst.desktop.ui.media.AudioPlayer import com.vitorpamplona.amethyst.desktop.ui.media.DesktopVideoPlayer +import com.vitorpamplona.amethyst.desktop.ui.media.LocalWindowState private val AUDIO_EXTENSIONS = setOf("mp3", "ogg", "wav", "flac", "aac", "opus", "m4a") @@ -129,6 +130,10 @@ fun NoteCard( ) } + // Cap media height to 70% of window height so controls are never clipped + val windowState = LocalWindowState.current + val maxMediaHeight = if (windowState != null) windowState.size.height * 0.7f else 400.dp + Card( modifier = modifier.fillMaxWidth(), colors = @@ -200,7 +205,7 @@ fun NoteCard( modifier = Modifier .fillMaxWidth() - .heightIn(max = 400.dp) + .heightIn(max = maxMediaHeight) .clip(RoundedCornerShape(8.dp)) .then( if (onImageClick != null) { @@ -225,7 +230,7 @@ fun NoteCard( for ((index, url) in videoUrls.withIndex()) { DesktopVideoPlayer( url = url, - modifier = Modifier.fillMaxWidth().heightIn(max = 400.dp), + modifier = Modifier.fillMaxWidth().heightIn(max = maxMediaHeight), onFullscreen = if (onMediaClick != null) { { seekPos -> onMediaClick(videoUrls, index, seekPos) }