mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2024-09-30 17:00:45 +00:00
add a shortpreview to not mess up grid layout on load
This commit is contained in:
parent
1d42440e26
commit
b12d14d6f5
@ -59,6 +59,7 @@ fun BlankNotePreview() {
|
|||||||
fun BlankNote(
|
fun BlankNote(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
idHex: String? = null,
|
idHex: String? = null,
|
||||||
|
shortPreview: Boolean = false,
|
||||||
) {
|
) {
|
||||||
Column(modifier = modifier) {
|
Column(modifier = modifier) {
|
||||||
Row {
|
Row {
|
||||||
@ -75,7 +76,12 @@ fun BlankNote(
|
|||||||
horizontalArrangement = Arrangement.Center,
|
horizontalArrangement = Arrangement.Center,
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = stringRes(R.string.post_not_found) + if (idHex != null) ": $idHex" else "",
|
text =
|
||||||
|
if (shortPreview) {
|
||||||
|
stringRes(R.string.post_not_found_short)
|
||||||
|
} else {
|
||||||
|
stringRes(R.string.post_not_found) + if (idHex != null) ": $idHex" else ""
|
||||||
|
},
|
||||||
modifier = Modifier.padding(30.dp),
|
modifier = Modifier.padding(30.dp),
|
||||||
color = Color.Gray,
|
color = Color.Gray,
|
||||||
textAlign = TextAlign.Center,
|
textAlign = TextAlign.Center,
|
||||||
|
@ -37,6 +37,7 @@ fun WatchNoteEvent(
|
|||||||
baseNote: Note,
|
baseNote: Note,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
|
shortPreview: Boolean = false,
|
||||||
onNoteEventFound: @Composable () -> Unit,
|
onNoteEventFound: @Composable () -> Unit,
|
||||||
) {
|
) {
|
||||||
WatchNoteEvent(
|
WatchNoteEvent(
|
||||||
@ -54,6 +55,7 @@ fun WatchNoteEvent(
|
|||||||
onLongClick = showPopup,
|
onLongClick = showPopup,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
shortPreview = shortPreview,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -45,6 +45,7 @@ object ScrollStateKeys {
|
|||||||
const val DISCOVER_SCREEN = "Discover"
|
const val DISCOVER_SCREEN = "Discover"
|
||||||
val HOME_FOLLOWS = Route.Home.base + "Follows"
|
val HOME_FOLLOWS = Route.Home.base + "Follows"
|
||||||
val HOME_REPLIES = Route.Home.base + "FollowsReplies"
|
val HOME_REPLIES = Route.Home.base + "FollowsReplies"
|
||||||
|
val PROFILE_GALLERY = Route.Home.base + "ProfileGallery"
|
||||||
|
|
||||||
val DRAFTS = Route.Home.base + "Drafts"
|
val DRAFTS = Route.Home.base + "Drafts"
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ fun GalleryCardCompose(
|
|||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
nav: (String) -> Unit,
|
nav: (String) -> Unit,
|
||||||
) {
|
) {
|
||||||
WatchNoteEvent(baseNote = baseNote, accountViewModel = accountViewModel) {
|
WatchNoteEvent(baseNote = baseNote, accountViewModel = accountViewModel, shortPreview = true) {
|
||||||
CheckHiddenFeedWatchBlockAndReport(
|
CheckHiddenFeedWatchBlockAndReport(
|
||||||
note = baseNote,
|
note = baseNote,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
@ -228,7 +228,6 @@ private fun CheckNewAndRenderChannelCard(
|
|||||||
showPopup = showPopup,
|
showPopup = showPopup,
|
||||||
nav = nav,
|
nav = nav,
|
||||||
) {
|
) {
|
||||||
// baseNote.event?.let { Text(text = it.pubKey()) }
|
|
||||||
InnerGalleryCardWithReactions(
|
InnerGalleryCardWithReactions(
|
||||||
baseNote = baseNote,
|
baseNote = baseNote,
|
||||||
accountViewModel = accountViewModel,
|
accountViewModel = accountViewModel,
|
||||||
@ -342,7 +341,6 @@ fun InnerRenderGalleryThumb(
|
|||||||
videoUri = it,
|
videoUri = it,
|
||||||
mimeType = null,
|
mimeType = null,
|
||||||
title = "",
|
title = "",
|
||||||
dimensions = "1x1",
|
|
||||||
authorName = note.author?.toBestDisplayName(),
|
authorName = note.author?.toBestDisplayName(),
|
||||||
roundedCorner = false,
|
roundedCorner = false,
|
||||||
gallery = true,
|
gallery = true,
|
||||||
@ -361,48 +359,6 @@ fun InnerRenderGalleryThumb(
|
|||||||
}
|
}
|
||||||
?: run { DisplayGalleryAuthorBanner(note) }
|
?: run { DisplayGalleryAuthorBanner(note) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Row(
|
|
||||||
Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.background(Color.Black.copy(0.6f))
|
|
||||||
.padding(Size5dp),
|
|
||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
|
||||||
) {
|
|
||||||
card.title?.let {
|
|
||||||
Text(
|
|
||||||
text = it,
|
|
||||||
fontWeight = FontWeight.Medium,
|
|
||||||
maxLines = 1,
|
|
||||||
overflow = TextOverflow.Ellipsis,
|
|
||||||
color = Color.White,
|
|
||||||
modifier = Modifier.weight(1f),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
card.price?.let {
|
|
||||||
val priceTag =
|
|
||||||
remember(card) {
|
|
||||||
val newAmount = it.amount.toBigDecimalOrNull()?.let { showAmountAxis(it) } ?: it.amount
|
|
||||||
|
|
||||||
if (it.frequency != null && it.currency != null) {
|
|
||||||
"$newAmount ${it.currency}/${it.frequency}"
|
|
||||||
} else if (it.currency != null) {
|
|
||||||
"$newAmount ${it.currency}"
|
|
||||||
} else {
|
|
||||||
newAmount
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Text(
|
|
||||||
text = priceTag,
|
|
||||||
maxLines = 1,
|
|
||||||
overflow = TextOverflow.Ellipsis,
|
|
||||||
color = Color.White,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -42,7 +42,6 @@ import androidx.compose.foundation.layout.padding
|
|||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.grid.LazyGridState
|
|
||||||
import androidx.compose.foundation.lazy.itemsIndexed
|
import androidx.compose.foundation.lazy.itemsIndexed
|
||||||
import androidx.compose.foundation.pager.HorizontalPager
|
import androidx.compose.foundation.pager.HorizontalPager
|
||||||
import androidx.compose.foundation.pager.PagerState
|
import androidx.compose.foundation.pager.PagerState
|
||||||
@ -153,11 +152,13 @@ import com.vitorpamplona.amethyst.ui.screen.NostrUserProfileGalleryFeedViewModel
|
|||||||
import com.vitorpamplona.amethyst.ui.screen.NostrUserProfileNewThreadsFeedViewModel
|
import com.vitorpamplona.amethyst.ui.screen.NostrUserProfileNewThreadsFeedViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.screen.NostrUserProfileReportFeedViewModel
|
import com.vitorpamplona.amethyst.ui.screen.NostrUserProfileReportFeedViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.screen.NostrUserProfileZapsFeedViewModel
|
import com.vitorpamplona.amethyst.ui.screen.NostrUserProfileZapsFeedViewModel
|
||||||
|
import com.vitorpamplona.amethyst.ui.screen.RefresheableBox
|
||||||
import com.vitorpamplona.amethyst.ui.screen.RefresheableFeedView
|
import com.vitorpamplona.amethyst.ui.screen.RefresheableFeedView
|
||||||
import com.vitorpamplona.amethyst.ui.screen.RefreshingFeedUserFeedView
|
import com.vitorpamplona.amethyst.ui.screen.RefreshingFeedUserFeedView
|
||||||
import com.vitorpamplona.amethyst.ui.screen.RelayFeedView
|
import com.vitorpamplona.amethyst.ui.screen.RelayFeedView
|
||||||
import com.vitorpamplona.amethyst.ui.screen.RelayFeedViewModel
|
import com.vitorpamplona.amethyst.ui.screen.RelayFeedViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.screen.SaveableGridFeedState
|
import com.vitorpamplona.amethyst.ui.screen.SaveableGridFeedState
|
||||||
|
import com.vitorpamplona.amethyst.ui.screen.ScrollStateKeys
|
||||||
import com.vitorpamplona.amethyst.ui.screen.UserFeedViewModel
|
import com.vitorpamplona.amethyst.ui.screen.UserFeedViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.stringRes
|
import com.vitorpamplona.amethyst.ui.stringRes
|
||||||
import com.vitorpamplona.amethyst.ui.theme.BitcoinOrange
|
import com.vitorpamplona.amethyst.ui.theme.BitcoinOrange
|
||||||
@ -1567,24 +1568,22 @@ fun TabGallery(
|
|||||||
) {
|
) {
|
||||||
LaunchedEffect(Unit) { feedViewModel.invalidateData() }
|
LaunchedEffect(Unit) { feedViewModel.invalidateData() }
|
||||||
|
|
||||||
Column(Modifier.fillMaxHeight()) {
|
// Column(Modifier.fillMaxHeight()) {
|
||||||
Column(
|
|
||||||
modifier = Modifier.padding(vertical = 0.dp),
|
|
||||||
) {
|
|
||||||
var state = LazyGridState()
|
|
||||||
|
|
||||||
SaveableGridFeedState(feedViewModel, scrollStateKey = "gallery") { listState ->
|
RefresheableBox(feedViewModel, true) {
|
||||||
|
SaveableGridFeedState(feedViewModel, scrollStateKey = ScrollStateKeys.PROFILE_GALLERY) { listState ->
|
||||||
RenderGalleryFeed(
|
RenderGalleryFeed(
|
||||||
feedViewModel,
|
feedViewModel,
|
||||||
null,
|
null,
|
||||||
0,
|
0,
|
||||||
state,
|
listState,
|
||||||
accountViewModel = accountViewModel,
|
accountViewModel = accountViewModel,
|
||||||
nav = nav,
|
nav = nav,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@Composable
|
/*@Composable
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
<string name="post_was_hidden">This post was hidden because it mentions your hidden users or words</string>
|
<string name="post_was_hidden">This post was hidden because it mentions your hidden users or words</string>
|
||||||
<string name="post_was_flagged_as_inappropriate_by">Post was muted or reported by</string>
|
<string name="post_was_flagged_as_inappropriate_by">Post was muted or reported by</string>
|
||||||
<string name="post_not_found">Event is loading or can\'t be found in your relay list</string>
|
<string name="post_not_found">Event is loading or can\'t be found in your relay list</string>
|
||||||
|
<string name="post_not_found_short">👀</string>
|
||||||
<string name="channel_image">Channel Image</string>
|
<string name="channel_image">Channel Image</string>
|
||||||
<string name="referenced_event_not_found">Referenced event not found</string>
|
<string name="referenced_event_not_found">Referenced event not found</string>
|
||||||
<string name="could_not_decrypt_the_message">Could not decrypt the message</string>
|
<string name="could_not_decrypt_the_message">Could not decrypt the message</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user