Skip to content

Commit

Permalink
Merge branch 'feature/MOB-356-Trade-Input' into feature/MOB-360-targe…
Browse files Browse the repository at this point in the history
…t-leverage

# Conflicts:
#	v4/feature/trade/src/main/java/exchange/dydx/trading/feature/trade/tradeinput/DydxTradeInputMarginModeView.kt
  • Loading branch information
johnqh committed Apr 5, 2024
2 parents d1c0ea9 + b376d4f commit 5eed95a
Show file tree
Hide file tree
Showing 19 changed files with 1,026 additions and 45 deletions.
2 changes: 1 addition & 1 deletion v4/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ ext {
compileSdkVersion = 34

// App dependencies
abacusVersion = '1.6.26'
abacusVersion = '1.6.30'
carteraVersion = '0.1.13'
kollectionsVersion = '2.0.16'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import androidx.compose.animation.ExitTransition
import androidx.compose.animation.core.Easing
import androidx.compose.animation.core.FastOutSlowInEasing
import androidx.compose.animation.core.tween
import androidx.compose.animation.expandVertically
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.shrinkVertically
import androidx.compose.runtime.Composable
import androidx.navigation.NavBackStackEntry
import kotlinx.serialization.json.JsonNull.content
Expand Down Expand Up @@ -144,4 +146,17 @@ object DydxAnimation {
content = content,
)
}

@Composable
fun AnimateExpandInOut(
visible: Boolean,
content: @Composable AnimatedVisibilityScope.() -> Unit
) {
AnimatedVisibility(
visible = visible,
enter = expandVertically(),
exit = shrinkVertically(),
content = content,
)
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package exchange.dydx.trading.feature.market.marketinfo.components.paging

import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.AnimatedVisibilityScope
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
Expand Down Expand Up @@ -88,17 +84,4 @@ object DydxMarketInfoPagingView : DydxComponent {
DydxMarketFundingRateView.Content(modifier)
}
}

@Composable
private fun AnimateFadeInOut(
visible: Boolean,
content: @Composable AnimatedVisibilityScope.() -> Unit
) {
AnimatedVisibility(
visible = visible,
enter = fadeIn(),
exit = fadeOut(),
content = content,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,26 @@ object DydxTradeInputMarginModeView : DydxComponent {
.fillMaxSize()
.themeColor(ThemeColor.SemanticColor.layer_4),
) {
NavigationHeader(state)
NavigationHeader(
modifier = Modifier,
state = state
)
PlatformDivider()
Selection(state.crossMargin)
Selection(
modifier = Modifier,
marginModeState = state.crossMargin
)
Spacer(modifier = Modifier.height(8.dp))
Selection(state.isolatedMargin)
Selection(
modifier = Modifier,
marginModeState = state.isolatedMargin
)
}
}

@Composable
fun NavigationHeader(
modifier: Modifier,
state: ViewState,
) {
Row(
Expand Down Expand Up @@ -156,7 +166,10 @@ object DydxTradeInputMarginModeView : DydxComponent {
}

@Composable
fun Selection(marginModeState: MarginTypeSelection) {
fun Selection(
modifier: Modifier,
marginModeState: MarginTypeSelection
) {
val shape = RoundedCornerShape(10.dp)
Row(
modifier = Modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,22 +89,38 @@ object DydxTradeInputTargetLeverageView : DydxComponent {
.fillMaxSize()
.themeColor(ThemeColor.SemanticColor.layer_4),
) {
NavigationHeader(state)
NavigationHeader(
modifier = Modifier,
state = state,
)
PlatformDivider()
Description(state)
LeverageEditField(state)
LeverageOptions(state)
Description(
modifier = Modifier,
state = state,
)
LeverageEditField(
modifier = Modifier,
state = state,
)
LeverageOptions(
modifier = Modifier,
state = state,
)
Spacer(modifier = Modifier.weight(1f))
ActionButton(state)
ActionButton(
modifier = Modifier,
state = state,
)
}
}

@Composable
fun NavigationHeader(
modifier: Modifier,
state: ViewState,
) {
Row(
modifier = Modifier
modifier = modifier
.fillMaxWidth()
.padding(vertical = 8.dp),
verticalAlignment = Alignment.CenterVertically,
Expand All @@ -130,6 +146,7 @@ object DydxTradeInputTargetLeverageView : DydxComponent {

@Composable
fun Description(
modifier: Modifier,
state: ViewState,
) {
Row(
Expand All @@ -150,7 +167,10 @@ object DydxTradeInputTargetLeverageView : DydxComponent {
}

@Composable
fun LeverageEditField(state: ViewState?) {
fun LeverageEditField(
modifier: Modifier,
state: ViewState?
) {
Row(
modifier = Modifier
.padding(
Expand All @@ -176,7 +196,10 @@ object DydxTradeInputTargetLeverageView : DydxComponent {
}

@Composable
fun LeverageOptions(state: ViewState?) {
fun LeverageOptions(
modifier: Modifier,
state: ViewState?
) {
Row(
modifier = Modifier
.padding(
Expand Down Expand Up @@ -207,7 +230,7 @@ object DydxTradeInputTargetLeverageView : DydxComponent {
.themeColor(ThemeColor.SemanticColor.text_tertiary)
.themeFont(fontSize = ThemeFont.FontSize.small),

)
)
}
}
} ?: listOf(),
Expand All @@ -228,7 +251,7 @@ object DydxTradeInputTargetLeverageView : DydxComponent {
.themeColor(ThemeColor.SemanticColor.text_primary)
.themeFont(fontSize = ThemeFont.FontSize.small),

)
)
}
}
} ?: listOf(),
Expand All @@ -242,7 +265,10 @@ object DydxTradeInputTargetLeverageView : DydxComponent {
}

@Composable
fun ActionButton(state: ViewState?) {
fun ActionButton(
modifier: Modifier,
state: ViewState?
) {
PlatformButton(
modifier = Modifier
.padding(
Expand Down
Loading

0 comments on commit 5eed95a

Please sign in to comment.