Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import SwiftUI
- struct BarriersView: View {
- // MARK: Properties
- @ObservedObject let viewModel: MainScreenViewModel
- // MARK: UI
- var body: some View {
- if viewModel.addressesSource.isEmpty {
- if viewModel.isLoading {
- DarkProgressView()
- .frame(height: 100)
- } else {
- HelperLabel(text: Localization.Main.noDeviceHelperTitle)
- .padding(.horizontal, 16)
- }
- } else {
- if viewModel.isLoadingDevices {
- DarkProgressView()
- .frame(height: 100)
- }
- let barriers = viewModel.barrierSource
- ForEach(barriers) { barrierSource in
- VStack(alignment: .leading) {
- Text(barrierSource.location)
- .foregroundColor(Colors.Neutral.neutral500.color)
- .textStyle(.body13reg)
- .frame(maxWidth: .infinity, alignment: .leading)
- ZStack {
- ListBackground()
- VStack {
- ForEach(barrierSource.barriers, id: \.0) { index, barrier in
- let lastIndex = barrierSource.barriers.count - 1
- let isOuterPadding = index == 0 || index == lastIndex
- let isAvailable = barrier.isAvailable
- DoorRow(
- title: barrier.title,
- isAvailable: true,
- sipPanelId: barrier.deviceId
- ) {}
- .padding(
- EdgeInsets(
- top: isOuterPadding ? 20 : 16,
- leading: 0,
- bottom: isOuterPadding ? 20 : 16,
- trailing: 0
- )
- )
- .disabled(!isAvailable)
- }
- }
- }
- }
- .padding(.top, 24)
- }
- .padding(.horizontal, 16)
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement