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) <noreply@anthropic.com>
This commit is contained in:
+7
-2
@@ -56,6 +56,7 @@ import com.vitorpamplona.amethyst.commons.ui.components.UserAvatar
|
|||||||
import com.vitorpamplona.amethyst.commons.util.toTimeAgo
|
import com.vitorpamplona.amethyst.commons.util.toTimeAgo
|
||||||
import com.vitorpamplona.amethyst.desktop.ui.media.AudioPlayer
|
import com.vitorpamplona.amethyst.desktop.ui.media.AudioPlayer
|
||||||
import com.vitorpamplona.amethyst.desktop.ui.media.DesktopVideoPlayer
|
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")
|
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(
|
Card(
|
||||||
modifier = modifier.fillMaxWidth(),
|
modifier = modifier.fillMaxWidth(),
|
||||||
colors =
|
colors =
|
||||||
@@ -200,7 +205,7 @@ fun NoteCard(
|
|||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.heightIn(max = 400.dp)
|
.heightIn(max = maxMediaHeight)
|
||||||
.clip(RoundedCornerShape(8.dp))
|
.clip(RoundedCornerShape(8.dp))
|
||||||
.then(
|
.then(
|
||||||
if (onImageClick != null) {
|
if (onImageClick != null) {
|
||||||
@@ -225,7 +230,7 @@ fun NoteCard(
|
|||||||
for ((index, url) in videoUrls.withIndex()) {
|
for ((index, url) in videoUrls.withIndex()) {
|
||||||
DesktopVideoPlayer(
|
DesktopVideoPlayer(
|
||||||
url = url,
|
url = url,
|
||||||
modifier = Modifier.fillMaxWidth().heightIn(max = 400.dp),
|
modifier = Modifier.fillMaxWidth().heightIn(max = maxMediaHeight),
|
||||||
onFullscreen =
|
onFullscreen =
|
||||||
if (onMediaClick != null) {
|
if (onMediaClick != null) {
|
||||||
{ seekPos -> onMediaClick(videoUrls, index, seekPos) }
|
{ seekPos -> onMediaClick(videoUrls, index, seekPos) }
|
||||||
|
|||||||
Reference in New Issue
Block a user