Updates: stack the channels under the status on a small phone

Side by side in a pane under 720dp, each channel's name and date were cut to a
word in every language. Also lowercase the relative time inside "Checked
...", which Android capitalizes to stand alone (Spanish "Comprobado Hace 5
minutos").
This commit is contained in:
maxjivi05 committed 2026-10-05 00:55:42 -04:00
1 parent 8e4bade2b4
commit ed41001005
1 file changed
+21 -14
@@ -15,6 +15,7 @@ import androidx.compose.foundation.hoverable
import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
@@ -104,25 +105,31 @@ internal fun UpdatesPage(s: FrontEndState, a: FrontEndActions, modifier: Modifie
maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f).padding(top = 6.dp), maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f).padding(top = 6.dp),
) )
val checked = u.catalog?.checkedAt?.takeIf { it > 0 } val checked = u.catalog?.checkedAt?.takeIf { it > 0 }
// The relative time comes capitalized to stand alone (Spanish "Hace 5 minutos"); here it
// ends a sentence.
if (!LocalNarrowPane.current) Text( if (!LocalNarrowPane.current) Text(
if (u.checking) stringResource(R.string.common_checking) else if (checked != null) stringResource(R.string.upd_checked, ago(checked)) else stringResource(R.string.upd_not_checked), if (u.checking) stringResource(R.string.common_checking) else if (checked != null) stringResource(R.string.upd_checked, ago(checked).replaceFirstChar { it.lowercase() }) else stringResource(R.string.upd_not_checked),
fontSize = 13.sp, color = colors.onSurfaceVariant, fontSize = 13.sp, color = colors.onSurfaceVariant,
) )
ToolIcon(Icons.Outlined.Refresh, stringResource(R.string.store_check_updates), busy = u.checking, enabled = !u.checking && u.stage == null, onClick = ua.onCheck) ToolIcon(Icons.Outlined.Refresh, stringResource(R.string.store_check_updates), busy = u.checking, enabled = !u.checking && u.stage == null, onClick = ua.onCheck)
} }
Column(modifier = Modifier.weight(1f).fillMaxWidth().verticalScroll(rememberScrollState()).padding(bottom = 8.dp)) { BoxWithConstraints(Modifier.weight(1f).fillMaxWidth()) {
// Landscape has the width for channels and status side by side; a narrow pane stacks them. // Landscape has the width for channels and status side by side; a narrow pane, or a small
if (LocalNarrowPane.current) { // phone's (where each channel's name and date would be cut to a word), stacks them.
StatusPanel(s, u, ua, me) val stacked = LocalNarrowPane.current || maxWidth < 720.dp
Box(Modifier.height(18.dp)) Column(modifier = Modifier.fillMaxSize().verticalScroll(rememberScrollState()).padding(bottom = 8.dp)) {
ChannelLabel() if (stacked) {
ChannelPicker(u, ua) StatusPanel(s, u, ua, me)
} else { Box(Modifier.height(18.dp))
// The label sits over both columns, so the status card lines up with the first channel. ChannelLabel()
ChannelLabel() ChannelPicker(u, ua)
Row(horizontalArrangement = Arrangement.spacedBy(18.dp)) { } else {
Box(Modifier.weight(1f)) { ChannelPicker(u, ua) } // The label sits over both columns, so the status card lines up with the first channel.
Box(Modifier.weight(1.15f)) { StatusPanel(s, u, ua, me) } ChannelLabel()
Row(horizontalArrangement = Arrangement.spacedBy(18.dp)) {
Box(Modifier.weight(1f)) { ChannelPicker(u, ua) }
Box(Modifier.weight(1.15f)) { StatusPanel(s, u, ua, me) }
}
} }
} }
} }