Skip to content

Commit

Permalink
Merge pull request #661 from Syn-McJ/fix/home-ui
Browse files Browse the repository at this point in the history
fix: home UI
  • Loading branch information
Syn-McJ authored Jul 18, 2024
2 parents d409fbf + ab422fd commit 9a93a73
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
6 changes: 2 additions & 4 deletions DashWallet/Sources/UI/Home/Views/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -274,22 +274,20 @@ struct TransactionList<Content: View>: View {
@State private var selectedTxDataItem: TransactionListDataItem? = nil

@StateObject var viewModel: HomeViewModel

@ViewBuilder var balanceHeader: () -> Content
@ViewBuilder var syncingHeader: () -> Content


private let topOverscrollSize: CGFloat = 1000 // Fixed value for top overscroll area

var body: some View {
ScrollView {
ZStack { Color.dashBlue } // Top overscroll area
ZStack { Color.navigationBarColor } // Top overscroll area
.frame(height: topOverscrollSize)
.padding(EdgeInsets(top: -topOverscrollSize, leading: 0, bottom: 0, trailing: 0))

LazyVStack(pinnedViews: [.sectionHeaders]) {
balanceHeader()
.frame(height: 250)
.frame(height: viewModel.hasNetwork ? 250 : 335)

syncingHeader()
.frame(height: 50)
Expand Down
9 changes: 9 additions & 0 deletions DashWallet/Sources/UI/Home/Views/HomeViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ import Foundation

class HomeViewModel: ObservableObject {
@Published var txItems: Array<(DateKey, [TransactionListDataItem])> = []
@Published var hasNetwork: Bool = true
private var model: SyncModel = SyncModelImpl()

init() {
model.networkStatusDidChange = { status in
self.hasNetwork = status == .online
}
self.hasNetwork = model.networkStatus == .online
}

func updateItems(transactions: [DSTransaction]) {
Task.detached {
Expand Down
4 changes: 4 additions & 0 deletions DashWallet/Sources/UI/SwiftUI Components/Color+DWStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ extension Color {
Color("DashBlueColor")
}

static var navigationBarColor: Color {
Color("DashNavigationBarBlueColor")
}

static var buttonRed: Color {
Color("ButtonRedColor")
}
Expand Down

0 comments on commit 9a93a73

Please sign in to comment.