From efae1dec22023378e486c67bed7b402f848cbc4b Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Tue, 14 Jul 2026 08:21:44 -0400 Subject: [PATCH] Adjustments --- .../amethyst/ui/note/NoteCompose.kt | 42 +++++++++---------- .../note/elements/NoteHeaderMarkersPreview.kt | 31 +++++--------- 2 files changed, 32 insertions(+), 41 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt index 88b1c511eb..041d3b37ff 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt @@ -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 diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/NoteHeaderMarkersPreview.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/NoteHeaderMarkersPreview.kt index 432e585803..5ea22ae855 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/NoteHeaderMarkersPreview.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/NoteHeaderMarkersPreview.kt @@ -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) } }