Updated on 2026-08-14
This commit is contained in:
parent
714eb51ce5
commit
d5ca4e59b5
5 changed files with 49 additions and 14 deletions
|
|
@ -16,7 +16,7 @@ internal sealed interface OnrampOffersBlockUM {
|
|||
data class Content(
|
||||
val recentOffer: OnrampOfferUM?,
|
||||
val recommended: ImmutableList<OnrampOfferUM>,
|
||||
val onrampAllOffersButtonConfig: OnrampAllOffersButtonConfig,
|
||||
val onrampAllOffersButtonConfig: OnrampAllOffersButtonConfig?,
|
||||
) : OnrampOffersBlockUM
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,10 +76,14 @@ internal class OnrampOffersStateFactory(
|
|||
return OnrampOffersBlockUM.Content(
|
||||
recentOffer = allOffersUM.firstOrNull { it.category == OnrampOfferCategoryUM.RecentlyUsed },
|
||||
recommended = allOffersUM.filter { it.category == OnrampOfferCategoryUM.Recommended }.toPersistentList(),
|
||||
onrampAllOffersButtonConfig = OnrampAllOffersButtonConfig(
|
||||
title = TextReference.Res(R.string.onramp_all_offers_button_title),
|
||||
onClick = { onrampIntents.openProviders() },
|
||||
),
|
||||
onrampAllOffersButtonConfig = if (offersBlocks.any { it.hasMoreOffers }) {
|
||||
OnrampAllOffersButtonConfig(
|
||||
title = TextReference.Res(R.string.onramp_all_offers_button_title),
|
||||
onClick = { onrampIntents.openProviders() },
|
||||
)
|
||||
} else {
|
||||
null
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -79,12 +79,14 @@ internal fun OnrampOffersContent(state: OnrampOffersBlockUM) {
|
|||
}
|
||||
}
|
||||
|
||||
SpacerH(12.dp)
|
||||
SecondaryButton(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
text = state.onrampAllOffersButtonConfig.title.resolveReference(),
|
||||
onClick = state.onrampAllOffersButtonConfig.onClick,
|
||||
)
|
||||
state.onrampAllOffersButtonConfig?.let {
|
||||
SpacerH(12.dp)
|
||||
SecondaryButton(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
text = it.title.resolveReference(),
|
||||
onClick = it.onClick,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
OnrampOffersBlockUM.Loading -> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue