feat(badges): add accept controls to notification card
The notification card BadgeCompose rendered the awarded badge via BadgeDisplay (definition-only) and stopped there, so a recipient viewing a fresh badge in their inbox had no way to add it to their profile without navigating to the award's thread first. Expose AcceptBadgeControls (was private inside Badge.kt) and call it from BadgeCompose under the BadgeDisplay row when the underlying note is a BadgeAwardEvent. Other surfaces are unchanged: - RenderBadgeAward (Badge feed / threads) keeps its own call to the same composable; behaviour is identical because the controls were already package-private. - BadgeCompose has only one caller (CardFeedView, the notifications feed), so the new row only appears there.
This commit is contained in:
@@ -46,11 +46,13 @@ import com.vitorpamplona.amethyst.service.relayClient.reqCommand.event.observeNo
|
||||
import com.vitorpamplona.amethyst.ui.navigation.navs.INav
|
||||
import com.vitorpamplona.amethyst.ui.navigation.routes.routeFor
|
||||
import com.vitorpamplona.amethyst.ui.note.elements.MoreOptionsButton
|
||||
import com.vitorpamplona.amethyst.ui.note.types.AcceptBadgeControls
|
||||
import com.vitorpamplona.amethyst.ui.note.types.BadgeDisplay
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.notifications.BadgeCard
|
||||
import com.vitorpamplona.amethyst.ui.stringRes
|
||||
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
||||
import com.vitorpamplona.quartz.nip58Badges.award.BadgeAwardEvent
|
||||
|
||||
@OptIn(ExperimentalFoundationApi::class)
|
||||
@Composable
|
||||
@@ -128,6 +130,10 @@ fun BadgeCompose(
|
||||
note.replyTo?.firstOrNull()?.let {
|
||||
BadgeDisplay(baseNote = it, accountViewModel)
|
||||
}
|
||||
|
||||
(note.event as? BadgeAwardEvent)?.let { award ->
|
||||
AcceptBadgeControls(award, accountViewModel)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,7 +297,7 @@ private fun BadgeAwardeesRow(
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun AcceptBadgeControls(
|
||||
fun AcceptBadgeControls(
|
||||
award: BadgeAwardEvent,
|
||||
accountViewModel: AccountViewModel,
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user