@@ -5,9 +5,13 @@ import androidx.compose.animation.core.tween
55import androidx.compose.animation.fadeIn
66import androidx.compose.animation.fadeOut
77import androidx.compose.animation.togetherWith
8+ import androidx.compose.foundation.layout.Box
89import androidx.compose.foundation.layout.fillMaxSize
910import androidx.compose.foundation.layout.fillMaxWidth
11+ import androidx.compose.foundation.layout.height
12+ import androidx.compose.foundation.layout.navigationBarsPadding
1013import androidx.compose.foundation.layout.padding
14+ import androidx.compose.foundation.lazy.rememberLazyListState
1115import androidx.compose.material3.Text
1216import androidx.compose.material3.pulltorefresh.PullToRefreshBox
1317import androidx.compose.runtime.Composable
@@ -19,12 +23,15 @@ import androidx.compose.runtime.setValue
1923import androidx.compose.ui.Modifier
2024import androidx.compose.ui.res.stringResource
2125import androidx.compose.ui.tooling.preview.Preview
26+ import androidx.compose.ui.unit.dp
2227import androidx.lifecycle.compose.collectAsStateWithLifecycle
2328import com.flipcash.app.core.data.Loadable
2429import com.flipcash.app.core.data.isLoading
2530import com.flipcash.app.discovery.internal.components.TokenLeaderboard
2631import com.flipcash.app.theme.FlipcashPreview
2732import com.flipcash.features.discovery.R
33+ import com.getcode.manager.BottomBarAction
34+ import com.getcode.manager.BottomBarManager
2835import com.getcode.opencode.model.financial.HolderMetrics
2936import com.getcode.opencode.model.financial.MintMetadata
3037import com.getcode.opencode.model.financial.Token
@@ -34,8 +41,13 @@ import com.getcode.opencode.model.ui.WindowedRange
3441import com.getcode.solana.keys.Mint
3542import com.getcode.solana.keys.PublicKey
3643import com.getcode.theme.CodeTheme
44+ import com.getcode.ui.core.drawWithGradient
45+ import com.getcode.ui.core.measured
46+ import com.getcode.ui.core.verticalScrollStateGradient
47+ import com.getcode.ui.theme.CodeButton
3748import com.getcode.ui.theme.CodeScaffold
3849import com.getcode.ui.theme.CodeSegmentedControl
50+ import com.getcode.util.resources.LocalResources
3951import kotlinx.coroutines.delay
4052
4153@Composable
@@ -49,7 +61,7 @@ private fun TokenDiscoveryScreenContent(
4961 state : TokenDiscoveryViewModel .State ,
5062 dispatch : (TokenDiscoveryViewModel .Event ) -> Unit
5163) {
52-
64+ val listState = rememberLazyListState()
5365 CodeScaffold (
5466 topBar = {
5567 CodeSegmentedControl (
@@ -74,7 +86,41 @@ private fun TokenDiscoveryScreenContent(
7486 )
7587 },
7688 bottomBar = {
77- // TODO: add create button when ready
89+ val resources = LocalResources .current
90+ if (state.createEnabled) {
91+ Box {
92+ var buttonHeight by remember { mutableStateOf(0 .dp) }
93+ Box (
94+ modifier = Modifier
95+ .fillMaxWidth()
96+ .height(buttonHeight)
97+ .drawWithGradient(
98+ color = CodeTheme .colors.background,
99+ startY = { 0f },
100+ endY = { size.height * 0.38f }
101+ )
102+ )
103+ CodeButton (
104+ modifier = Modifier
105+ .fillMaxWidth()
106+ .measured { buttonHeight = it.height }
107+ .navigationBarsPadding()
108+ .padding(horizontal = CodeTheme .dimens.inset)
109+ .padding(
110+ top = CodeTheme .dimens.grid.x9,
111+ bottom = CodeTheme .dimens.grid.x3
112+ ),
113+ text = stringResource(R .string.action_createYourOwnCurrency),
114+ ) {
115+ BottomBarManager .showMessage(
116+ title = resources.getString(R .string.prompt_title_notYetAvailable),
117+ subtitle = resources.getString(R .string.prompt_message_currencyCreateNotYetAvailable),
118+ type = BottomBarManager .BottomBarMessageType .INFO ,
119+ actions = listOf (BottomBarAction .Ok )
120+ )
121+ }
122+ }
123+ }
78124 },
79125 ) { padding ->
80126 PullToRefreshBox (
@@ -90,12 +136,22 @@ private fun TokenDiscoveryScreenContent(
90136 transitionSpec = { fadeIn(tween()) togetherWith fadeOut(tween()) },
91137 contentKey = { it::class }, // only crossfade on type change, not data updates
92138 ) { tokens ->
93- TokenLeaderboard (
94- category = state.category,
95- tokens = tokens,
96- padding = padding,
97- dispatch = dispatch
98- )
139+ Box (
140+ modifier = Modifier .verticalScrollStateGradient(
141+ listState,
142+ color = CodeTheme .colors.background,
143+ isLongGradient = true ,
144+ showAtEnd = ! state.createEnabled,
145+ )
146+ ) {
147+ TokenLeaderboard (
148+ category = state.category,
149+ state = listState,
150+ tokens = tokens,
151+ padding = padding,
152+ dispatch = dispatch
153+ )
154+ }
99155 }
100156 }
101157 }
0 commit comments