From 68c881b6a48ae95b8bb682d8da23c09cfbc25d91 Mon Sep 17 00:00:00 2001 From: Rui <102453770+ruixhuang@users.noreply.github.com> Date: Thu, 11 Apr 2024 10:00:19 -0700 Subject: [PATCH] Fix margin issues with portfolio position items (#67) --- .../DydxPortfolioPositionItemView.kt | 4 ++-- .../positions/DydxPortfolioPositionsView.kt | 21 ++++++++++--------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/v4/feature/portfolio/src/main/java/exchange/dydx/trading/feature/portfolio/components/positions/DydxPortfolioPositionItemView.kt b/v4/feature/portfolio/src/main/java/exchange/dydx/trading/feature/portfolio/components/positions/DydxPortfolioPositionItemView.kt index 078faa6a..64db05e8 100644 --- a/v4/feature/portfolio/src/main/java/exchange/dydx/trading/feature/portfolio/components/positions/DydxPortfolioPositionItemView.kt +++ b/v4/feature/portfolio/src/main/java/exchange/dydx/trading/feature/portfolio/components/positions/DydxPortfolioPositionItemView.kt @@ -65,12 +65,12 @@ object DydxPortfolioPositionItemView { Row( modifier = modifier .padding( - // outer padding first, before widht and height + // outer padding first, before width and height horizontal = ThemeShapes.HorizontalPadding, vertical = ThemeShapes.VerticalPadding, ) .fillMaxWidth() - .height((if (isIsolatedMarketEnabled) 148.dp else 64.dp) + ThemeShapes.VerticalPadding * 2) + .height((if (isIsolatedMarketEnabled) 148.dp else 48.dp) + ThemeShapes.VerticalPadding * 2) .background( brush = position.gradientType.brush(ThemeColor.SemanticColor.layer_3), shape = shape, diff --git a/v4/feature/portfolio/src/main/java/exchange/dydx/trading/feature/portfolio/components/positions/DydxPortfolioPositionsView.kt b/v4/feature/portfolio/src/main/java/exchange/dydx/trading/feature/portfolio/components/positions/DydxPortfolioPositionsView.kt index e3ae0706..f7cb2233 100644 --- a/v4/feature/portfolio/src/main/java/exchange/dydx/trading/feature/portfolio/components/positions/DydxPortfolioPositionsView.kt +++ b/v4/feature/portfolio/src/main/java/exchange/dydx/trading/feature/portfolio/components/positions/DydxPortfolioPositionsView.kt @@ -3,7 +3,6 @@ package exchange.dydx.trading.feature.portfolio.components.positions import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.foundation.lazy.LazyColumn @@ -66,8 +65,10 @@ object DydxPortfolioPositionsView : DydxComponent { val viewModel: DydxPortfolioPositionsViewModel = hiltViewModel() val state = viewModel.state.collectAsStateWithLifecycle(initialValue = null).value - LazyColumn { - ListContent(this, modifier, state) + LazyColumn( + modifier = modifier, + ) { + ListContent(this, Modifier, state) } } @@ -76,28 +77,28 @@ object DydxPortfolioPositionsView : DydxComponent { if (state.positions.isEmpty()) { scope.item(key = "placeholder") { - DydxPortfolioPlaceholderView.Content(modifier.padding(vertical = 0.dp)) + DydxPortfolioPlaceholderView.Content(Modifier.padding(vertical = 0.dp)) } } else { if (!state.isIsolatedMarketEnabled) { scope.item(key = "header") { - CreateHeader(modifier, state) + CreateHeader(Modifier, state) } } scope.items(items = state.positions, key = { it.id }) { position -> - if (!state.isIsolatedMarketEnabled && position === state.positions.first()) { - Spacer(modifier = Modifier.height(16.dp)) - } +// if (!state.isIsolatedMarketEnabled && position === state.positions.first()) { +// Spacer(modifier = Modifier.height(16.dp)) +// } DydxPortfolioPositionItemView.Content( - modifier = modifier, + modifier = Modifier, localizer = state.localizer, position = position, isIsolatedMarketEnabled = state.isIsolatedMarketEnabled, onTapAction = state.onPositionTapAction, ) - Spacer(modifier = Modifier.height(10.dp)) +// Spacer(modifier = Modifier.height(10.dp)) } } }