Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix margin issues with portfolio position items #67

Merged
merged 1 commit into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
}

Expand All @@ -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()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just remove code instead of commenting out?

// 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))
}
}
}
Expand Down
Loading