Improves layout of the open poll cards

This commit is contained in:
Vitor Pamplona
2026-03-20 18:41:11 -04:00
parent f2e60986d6
commit aca62ec81f
4 changed files with 30 additions and 20 deletions
@@ -28,11 +28,14 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material3.Card
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
@@ -64,7 +67,9 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.notifications.donations.Sho
import com.vitorpamplona.amethyst.ui.stringRes
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
import com.vitorpamplona.amethyst.ui.theme.FeedPadding
import com.vitorpamplona.amethyst.ui.theme.Size10dp
import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer
import com.vitorpamplona.amethyst.ui.theme.imageModifier
@Composable
fun RefreshableCardView(
@@ -177,30 +182,33 @@ private fun FeedLoaded(
}
if (openPolls.isNotEmpty()) {
item {
OpenPollsSectionHeader()
}
itemsIndexed(
items = openPolls,
key = { _, item -> "open-poll-${item.idHex}" },
contentType = { _, _ -> "OpenPoll" },
) { _, note ->
Row(Modifier.fillMaxWidth().animateItem()) {
NoteCompose(
baseNote = note,
modifier = Modifier.fillMaxWidth(),
routeForLastRead = routeForLastRead,
isBoostedNote = false,
isQuotedNote = false,
quotesLeft = 3,
accountViewModel = accountViewModel,
nav = nav,
)
Row(modifier = Modifier.padding(start = Size10dp, end = Size10dp, bottom = Size10dp)) {
Card(
modifier = MaterialTheme.colorScheme.imageModifier,
) {
OpenPollsSectionHeader()
Row(Modifier.fillMaxWidth().animateItem()) {
NoteCompose(
baseNote = note,
modifier = Modifier.fillMaxWidth(),
routeForLastRead = routeForLastRead,
isBoostedNote = false,
isQuotedNote = false,
quotesLeft = 3,
accountViewModel = accountViewModel,
nav = nav,
)
}
HorizontalDivider(
thickness = DividerThickness,
)
}
}
HorizontalDivider(
thickness = DividerThickness,
)
}
}
@@ -87,7 +87,7 @@ private fun filterOpenPolls(notes: List<Note>): List<Note> {
@Composable
fun OpenPollsSectionHeader() {
Text(
text = stringRes(R.string.open_polls),
text = stringRes(R.string.open_poll),
style = MaterialTheme.typography.titleSmall,
fontWeight = FontWeight.Bold,
modifier = Modifier.padding(horizontal = 12.dp, vertical = 8.dp),
+1 -1
View File
@@ -258,7 +258,7 @@
<string name="error_loading_replies">"Error loading replies: "</string>
<string name="try_again">Try again</string>
<string name="notification_feed_is_empty">No notifications yet.</string>
<string name="open_polls">Open Polls</string>
<string name="open_poll">Open Poll</string>
<string name="feed_is_empty">Feed is empty.</string>
<string name="refresh">Refresh</string>
<string name="created">created</string>