Adjustments

This commit is contained in:
Vitor Pamplona
2026-07-14 08:21:44 -04:00
parent 86da29fa78
commit efae1dec22
2 changed files with 32 additions and 41 deletions
@@ -1834,6 +1834,16 @@ fun FirstUserInfoRow(
NoteUsernameDisplay(baseNote, Modifier.weight(1f), textColor = textColor, accountViewModel = accountViewModel)
}
if (isRepost) {
BoostedMark()
}
CheckAndDisplayEditStatus(editState)
if (isDraft) {
DisplayDraft()
}
if (isDraft) {
ObserveDraftEvent(baseNote, accountViewModel) { draftNote ->
val isCommunityPost =
@@ -1860,16 +1870,22 @@ fun FirstUserInfoRow(
}
}
if (isRepost) {
BoostedMark()
val noteEvent = baseNote.event
val geo = remember(noteEvent) { noteEvent?.geoHashOrScope() }
if (geo != null) {
DisplayLocation(geo, accountViewModel, nav)
}
CheckAndDisplayEditStatus(editState)
DisplayOtsIfInOriginal(baseNote, editState, accountViewModel)
if (isDraft) {
DisplayDraft()
val pow = remember(noteEvent) { noteEvent?.strongPoWOrNull() }
if (pow != null) {
DisplayPoW(pow)
}
Expiration(baseNote)
if (baseNote.isPrivateRumor()) {
PrivateRumorMark()
}
@@ -1878,22 +1894,6 @@ fun FirstUserInfoRow(
PinnedMark()
}
val noteEvent = baseNote.event
val geo = remember(noteEvent) { noteEvent?.geoHashOrScope() }
if (geo != null) {
DisplayLocation(geo, accountViewModel, nav)
}
val pow = remember(noteEvent) { noteEvent?.strongPoWOrNull() }
if (pow != null) {
DisplayPoW(pow)
}
DisplayOtsIfInOriginal(baseNote, editState, accountViewModel)
Expiration(baseNote)
JumpToParentReplyButton(baseNote, accountViewModel, nav)
// The dotted TimeAgo carries its own " • " separator and the options
@@ -29,6 +29,7 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.vitorpamplona.amethyst.commons.model.nip18Reposts.RepostAction.repost
import com.vitorpamplona.amethyst.commons.ui.components.GenericLoadable
import com.vitorpamplona.amethyst.model.FeatureSetType
import com.vitorpamplona.amethyst.model.LocalCache
@@ -100,22 +101,22 @@ fun NoteHeaderFirstRowDensityPreview() {
val now = TimeUtils.now()
val expiresAt = (now + 7200).toString()
val plain: Note
val repost: Note
val rumorPinned: Note
val edited: Note
val editVersion: Note
val draft: Note
val communityPost: Note
val geoPowExpiring: Note
val kitchenSink: Note
val plainEvent = TextNoteEvent(PLAIN_ID, AUTHOR, now - 300, emptyArray(), "GM", "x")
// Drafts are addressable: consumption lands on the AddressableNote, so the
// preview must fetch it by address rather than by event id.
val draftEvent = DraftWrapEvent(DRAFT_ID, AUTHOR, now - 300, arrayOf(arrayOf("d", "preview-draft")), "", "x")
val plain: Note = LocalCache.getOrCreateNote(PLAIN_ID)
val repost: Note = LocalCache.getOrCreateNote(REPOST_ID)
val rumorPinned: Note = LocalCache.getOrCreateNote(RUMOR_ID)
val edited: Note = LocalCache.getOrCreateNote(EDITED_ID)
val editVersion: Note = LocalCache.getOrCreateNote(EDIT_VERSION_ID)
val draft: Note = LocalCache.getOrCreateAddressableNote(draftEvent.address())
val communityPost: Note = LocalCache.getOrCreateNote(COMMUNITY_POST_ID)
val geoPowExpiring: Note = LocalCache.getOrCreateNote(POW_ID)
val kitchenSink: Note = LocalCache.getOrCreateNote(KITCHEN_SINK_ID)
runBlocking {
withContext(Dispatchers.IO) {
LocalCache.justConsume(
@@ -176,16 +177,6 @@ fun NoteHeaderFirstRowDensityPreview() {
null,
true,
)
plain = LocalCache.getOrCreateNote(PLAIN_ID)
repost = LocalCache.getOrCreateNote(REPOST_ID)
rumorPinned = LocalCache.getOrCreateNote(RUMOR_ID)
edited = LocalCache.getOrCreateNote(EDITED_ID)
editVersion = LocalCache.getOrCreateNote(EDIT_VERSION_ID)
draft = LocalCache.getOrCreateAddressableNote(draftEvent.address())
communityPost = LocalCache.getOrCreateNote(COMMUNITY_POST_ID)
geoPowExpiring = LocalCache.getOrCreateNote(POW_ID)
kitchenSink = LocalCache.getOrCreateNote(KITCHEN_SINK_ID)
}
}