From 28e5812b607635f5768152e2547a99ebf361354b Mon Sep 17 00:00:00 2001 From: mike-dydx Date: Mon, 6 Nov 2023 14:04:18 -0500 Subject: [PATCH] clean up and add animation --- .../Orderbook/dydxOrderbookSideView.swift | 35 ++++++------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/dydx/dydxViews/dydxViews/_v4/Trade/TradeInput/Components/Orderbook/dydxOrderbookSideView.swift b/dydx/dydxViews/dydxViews/_v4/Trade/TradeInput/Components/Orderbook/dydxOrderbookSideView.swift index c8bf4010d..fca413871 100644 --- a/dydx/dydxViews/dydxViews/_v4/Trade/TradeInput/Components/Orderbook/dydxOrderbookSideView.swift +++ b/dydx/dydxViews/dydxViews/_v4/Trade/TradeInput/Components/Orderbook/dydxOrderbookSideView.swift @@ -96,34 +96,19 @@ public class dydxOrderbookSideViewModel: PlatformViewModel, Equatable { let additionalLineHeight: CGFloat = intendedLineHeight * (numLinesToDisplayExact.truncatingRemainder(dividingBy: 1)) / numLinesToDisplayFloored let actualLineHeight: CGFloat = intendedLineHeight + additionalLineHeight - switch self.displayStyle { - case .sideBySide: + LazyVStack(spacing: spacing) { - LazyVStack(spacing: spacing) { - - ForEach(lines.prefix(numLinesToDisplayInt), id: \.self.id) { line in - AnyView( - self.cell(line: line, maxDepth: maxDepth, fixedHeight: actualLineHeight) - ) - .id(line.id) - } - - Spacer() + ForEach(lines.prefix(numLinesToDisplayInt), id: \.self.id) { line in + AnyView( + self.cell(line: line, maxDepth: maxDepth, fixedHeight: actualLineHeight) + ) + .id(line.id) } - .topAligned() - - case .topDown: - LazyVStack(spacing: spacing) { - ForEach(lines.prefix(numLinesToDisplayInt), id: \.self.id) { line in - AnyView( - self.cell(line: line, maxDepth: maxDepth, fixedHeight: actualLineHeight) - ) - .id(line.id) - } - Spacer() - } - .topAligned() + + Spacer() } + .animation(.default, value: lines) // Here the animation is applied to the LazyVStack + .topAligned() } } }