//
//  LoadingView.swift
//  SIIMpaPrinterSample
//

import SwiftUI

struct LoadingView: View {
    var body: some View {
        ZStack {
            Rectangle()
                .foregroundColor(Color.gray.opacity(0.7))
                .ignoresSafeArea(edges: .all)
            ProgressView().progressViewStyle(.circular)
        }.zIndex(1)
    }
}

struct PrinterListLoadingView: View {
    @ObservedObject var printerViewModel: PrinterViewModel
    var body: some View {
        ZStack {
            Rectangle()
                .foregroundColor(Color.gray.opacity(0.7))
            VStack {
                ProgressView().progressViewStyle(.circular)
                Button("cancel") {
                    DiscoverManager.cancelDiscoveryTcpPrinter()
                    printerViewModel.showPrinterListViewIndicator(false)
                }
                .padding()
                .buttonStyle(.bordered)
            }
        }.zIndex(1)
    }
}
