@@ -4,10 +4,12 @@ import androidx.compose.foundation.background
44import androidx.compose.foundation.layout.Arrangement
55import androidx.compose.foundation.layout.Box
66import androidx.compose.foundation.layout.Column
7+ import androidx.compose.foundation.layout.PaddingValues
78import androidx.compose.foundation.layout.Row
89import androidx.compose.foundation.layout.Spacer
910import androidx.compose.foundation.layout.fillMaxWidth
1011import androidx.compose.foundation.layout.padding
12+ import androidx.compose.foundation.shape.CircleShape
1113import androidx.compose.material.Icon
1214import androidx.compose.material.Text
1315import androidx.compose.runtime.Composable
@@ -23,6 +25,7 @@ import androidx.compose.ui.text.style.TextAlign
2325import androidx.compose.ui.tooling.preview.Preview
2426import androidx.lifecycle.compose.collectAsStateWithLifecycle
2527import com.flipcash.app.balance.internal.components.BalanceHeader
28+ import com.flipcash.app.balance.internal.components.CashReservesRow
2629import com.flipcash.app.core.AppRoute
2730import com.flipcash.app.core.money.formatted
2831import com.flipcash.app.core.tokens.TokenPurpose
@@ -37,6 +40,8 @@ import com.getcode.opencode.model.financial.CurrencyCode
3740import com.getcode.opencode.model.financial.Rate
3841import com.getcode.theme.CodeTheme
3942import com.getcode.ui.core.rememberedClickable
43+ import com.getcode.ui.theme.ButtonState
44+ import com.getcode.ui.theme.CodeButton
4045
4146@Composable
4247internal fun BalanceScreen (
@@ -95,53 +100,58 @@ private fun BalanceScreenContent(
95100
96101 Text (
97102 modifier = Modifier .fillMaxWidth(0.6f ),
98- text = stringResource(R .string.description_noBalanceYet),
103+ text = if (tokenState.discoveryEnabled) {
104+ stringResource(R .string.description_noBalanceYetDiscover)
105+ } else {
106+ stringResource(R .string.description_noBalanceYet)
107+ },
99108 style = CodeTheme .typography.textSmall,
100109 color = CodeTheme .colors.textSecondary,
101110 textAlign = TextAlign .Center ,
102111 )
112+
113+ if (tokenState.discoveryEnabled) {
114+ CodeButton (
115+ onClick = {
116+ dispatchEvent(
117+ BalanceViewModel .Event .OpenScreen (AppRoute .Token .Discovery )
118+ )
119+ },
120+ modifier = Modifier .align(Alignment .CenterHorizontally ),
121+ contentPadding = PaddingValues (),
122+ text = stringResource(R .string.action_discoverCurrencies),
123+ shape = CircleShape ,
124+ buttonState = ButtonState .Filled
125+ )
126+ }
103127 }
104128 }
105129 },
106- footer = { mint, reserves ->
107- Row (
108- modifier = Modifier
109- .fillMaxWidth()
110- .rememberedClickable {
130+ reserves = { mint, reserves ->
131+ CashReservesRow (reserves) {
132+ dispatchEvent(
133+ BalanceViewModel .Event .OpenScreen (
134+ AppRoute .Token .Info (mint)
135+ )
136+ )
137+ }
138+ },
139+ footer = if (tokenState.discoveryEnabled) {
140+ {
141+ CodeButton (
142+ modifier = Modifier
143+ .fillMaxWidth()
144+ .padding(horizontal = CodeTheme .dimens.inset),
145+ text = stringResource(R .string.action_discoverCurrencies),
146+ buttonState = ButtonState .Filled10 ,
147+ onClick = {
111148 dispatchEvent(
112- BalanceViewModel .Event .OpenScreen (
113- AppRoute .Token .Info (mint)
114- )
149+ BalanceViewModel .Event .OpenScreen (AppRoute .Token .Discovery )
115150 )
116151 }
117- .padding(
118- vertical = CodeTheme .dimens.grid.x3,
119- horizontal = CodeTheme .dimens.inset),
120- verticalAlignment = Alignment .CenterVertically ,
121- ) {
122- Text (
123- text = stringResource(R .string.title_cashReserves),
124- style = CodeTheme .typography.screenTitle,
125- color = CodeTheme .colors.textSecondary,
126- )
127-
128- Icon (
129- modifier = Modifier
130- .padding(start = CodeTheme .dimens.grid.x2),
131- painter = painterResource(id = R .drawable.ic_chevron_right),
132- contentDescription = null ,
133- tint = CodeTheme .colors.textSecondary,
134- )
135-
136- Spacer (Modifier .weight(1f ))
137-
138- Text (
139- text = reserves.formatted(),
140- style = CodeTheme .typography.screenTitle,
141- color = CodeTheme .colors.textMain,
142152 )
143153 }
144- },
154+ } else null ,
145155 tokens = tokens,
146156 onTokenSelected = {
147157 dispatchEvent(
0 commit comments