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
+2
View File
@@ -1,4 +1,6 @@
Adds support for creating and rendering NIP-85 Polls Adds support for creating and rendering NIP-85 Polls
- Redesign of the poll and zap poll cards
- Adds Special notification card that stays while the poll is running
Adds support for Relay Feeds Adds support for Relay Feeds
- Adds support for NIP-51 favorite relay feeds - Adds support for NIP-51 favorite relay feeds
@@ -28,11 +28,14 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyListState import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.foundation.lazy.itemsIndexed import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material3.Card
import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable 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.stringRes
import com.vitorpamplona.amethyst.ui.theme.DividerThickness import com.vitorpamplona.amethyst.ui.theme.DividerThickness
import com.vitorpamplona.amethyst.ui.theme.FeedPadding 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.StdVertSpacer
import com.vitorpamplona.amethyst.ui.theme.imageModifier
@Composable @Composable
fun RefreshableCardView( fun RefreshableCardView(
@@ -177,30 +182,33 @@ private fun FeedLoaded(
} }
if (openPolls.isNotEmpty()) { if (openPolls.isNotEmpty()) {
item {
OpenPollsSectionHeader()
}
itemsIndexed( itemsIndexed(
items = openPolls, items = openPolls,
key = { _, item -> "open-poll-${item.idHex}" }, key = { _, item -> "open-poll-${item.idHex}" },
contentType = { _, _ -> "OpenPoll" }, contentType = { _, _ -> "OpenPoll" },
) { _, note -> ) { _, note ->
Row(Modifier.fillMaxWidth().animateItem()) { Row(modifier = Modifier.padding(start = Size10dp, end = Size10dp, bottom = Size10dp)) {
NoteCompose( Card(
baseNote = note, modifier = MaterialTheme.colorScheme.imageModifier,
modifier = Modifier.fillMaxWidth(), ) {
routeForLastRead = routeForLastRead, OpenPollsSectionHeader()
isBoostedNote = false, Row(Modifier.fillMaxWidth().animateItem()) {
isQuotedNote = false, NoteCompose(
quotesLeft = 3, baseNote = note,
accountViewModel = accountViewModel, modifier = Modifier.fillMaxWidth(),
nav = nav, 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 @Composable
fun OpenPollsSectionHeader() { fun OpenPollsSectionHeader() {
Text( Text(
text = stringRes(R.string.open_polls), text = stringRes(R.string.open_poll),
style = MaterialTheme.typography.titleSmall, style = MaterialTheme.typography.titleSmall,
fontWeight = FontWeight.Bold, fontWeight = FontWeight.Bold,
modifier = Modifier.padding(horizontal = 12.dp, vertical = 8.dp), 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="error_loading_replies">"Error loading replies: "</string>
<string name="try_again">Try again</string> <string name="try_again">Try again</string>
<string name="notification_feed_is_empty">No notifications yet.</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="feed_is_empty">Feed is empty.</string>
<string name="refresh">Refresh</string> <string name="refresh">Refresh</string>
<string name="created">created</string> <string name="created">created</string>