//
//  LoadingView.swift
//  SiiLibSample
//

import SwiftUI

struct LoadingView: View {
    @Environment(\.dismiss) var dismiss
    var body: some View {
        ZStack {
            Rectangle()
                .foregroundColor(Color.gray.opacity(0.7))
            ProgressView().progressViewStyle(.circular)
        }.zIndex(1)
    }
}

struct PrinterListLoadingView: View {
    @ObservedObject var siiPrinterModel: SiiPrinterModel
    @Environment(\.dismiss) var dismiss
    var body: some View {
        ZStack {
            Rectangle()
                .foregroundColor(Color.gray.opacity(0.7))
            VStack {
                ProgressView().progressViewStyle(.circular)
                Button("cancel") {
                    cancelDiscoveryTcpPrinter()
                    siiPrinterModel.showPrinterListLoadingView(false)
                }
                .padding()
                .buttonStyle(.bordered)
            }
        }.zIndex(1)
    }
}
