feat(desktop): tabs-first header for Home / Reads, compact Notifications header

Refactored the three feed screen headers so they all match the Messages
pattern — single compact row padded horizontal = 12, vertical = 8, no
oversized titles, no multi-row metadata.

FeedScreen (Home):
- Replaced the `headlineMedium` "Global Feed" / "Following Feed" title
  plus a redundant Global/Following chip row plus a separate relay-count
  meta-line plus a large "New Post" button with:
    [ Following | Global ]   [relays] [refresh] [+ compose]
  The selected tab IS the screen title. Relay count + followed-user
  count surface through a hover tooltip on the relays icon (desktop
  convention; info is preserved without taking a whole row).
- Relays icon click opens the picker when the account can edit, falls
  through to navigate-to-relays otherwise.

ReadsScreen:
- Same treatment: dropped the "Reads" label, lifted Following/Global
  chips to the left, single refresh icon on the right. "N relays
  connected" moved to the refresh button's content description.

commons/FeedHeader (used by NotificationsScreen):
- Dropped the RelayStatusIndicator (icon + count text + refresh button,
  took 3 slots). Now just titleMedium on the left + a single refresh
  IconButton on the right with relay count in its content description,
  matching the Messages "titleMedium + icon buttons" rhythm.
- Internal padding(horizontal = 12, vertical = 8) baked in so callers
  don't need a trailing Spacer.

https://claude.ai/code/session_01NufduPfZvYQVYwLkbCjCUo
This commit is contained in:
Claude
2026-04-24 14:23:32 +00:00
parent 8fb16bc7a3
commit b198385849
4 changed files with 134 additions and 189 deletions
@@ -23,6 +23,7 @@ package com.vitorpamplona.amethyst.commons.ui.feed
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
@@ -34,10 +35,12 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.vitorpamplona.amethyst.commons.icons.symbols.Icon
import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbols
import com.vitorpamplona.amethyst.commons.ui.theme.RelayStatusColors
/**
* Header component for feed screens with title and relay connection status.
* Compact Messages-style header for feed screens: titleMedium on the left,
* a single refresh IconButton on the right. Relay count is rolled into the
* refresh button's content description so it still surfaces in hover tooltips
* / accessibility readers without stealing a whole row.
*
* @param title The feed title
* @param connectedRelayCount Number of connected relays
@@ -52,62 +55,25 @@ fun FeedHeader(
modifier: Modifier = Modifier,
) {
Row(
modifier = modifier.fillMaxWidth(),
modifier = modifier.fillMaxWidth().padding(horizontal = 12.dp, vertical = 8.dp),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically,
) {
Text(
title,
style = MaterialTheme.typography.headlineMedium,
style = MaterialTheme.typography.titleMedium,
color = MaterialTheme.colorScheme.onBackground,
)
RelayStatusIndicator(
connectedCount = connectedRelayCount,
onRefresh = onRefresh,
)
}
}
/**
* Compact relay connection status indicator with refresh button.
*/
@Composable
fun RelayStatusIndicator(
connectedCount: Int,
onRefresh: () -> Unit,
modifier: Modifier = Modifier,
) {
Row(
modifier = modifier,
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp),
) {
val statusColor =
when {
connectedCount == 0 -> RelayStatusColors.Disconnected
connectedCount < 3 -> RelayStatusColors.Connecting
else -> RelayStatusColors.Connected
}
Icon(
symbol = if (connectedCount > 0) MaterialSymbols.Check else MaterialSymbols.Close,
contentDescription = null,
tint = statusColor,
modifier = Modifier.size(16.dp),
)
Text(
"$connectedCount relay${if (connectedCount != 1) "s" else ""}",
color = MaterialTheme.colorScheme.onSurfaceVariant,
style = MaterialTheme.typography.bodySmall,
)
IconButton(onClick = onRefresh) {
IconButton(
onClick = onRefresh,
modifier = Modifier.size(32.dp),
) {
Icon(
MaterialSymbols.Refresh,
contentDescription = "Reconnect",
contentDescription = "Refresh ($connectedRelayCount relays connected)",
tint = MaterialTheme.colorScheme.primary,
modifier = Modifier.size(20.dp),
)
}
}