mirror of
https://github.com/insidegui/VirtualBuddy.git
synced 2026-12-02 05:09:26 +08:00
53 lines
1.3 KiB
Swift
53 lines
1.3 KiB
Swift
//
|
|
// InstallProgressStepView.swift
|
|
// VirtualUI
|
|
//
|
|
// Created by Guilherme Rambo on 20/07/22.
|
|
//
|
|
|
|
import SwiftUI
|
|
import VirtualCore
|
|
|
|
struct InstallProgressStepView: View {
|
|
@EnvironmentObject var viewModel: VMInstallationViewModel
|
|
|
|
@State private var consoleExpanded = false
|
|
|
|
var body: some View {
|
|
VStack {
|
|
loadingView
|
|
|
|
InstallationConsole(isExpanded: $consoleExpanded)
|
|
}
|
|
}
|
|
|
|
@ViewBuilder
|
|
private var loadingView: some View {
|
|
switch viewModel.state {
|
|
case .loading(let progress, let info):
|
|
VStack {
|
|
ProgressView(value: progress) { }
|
|
.progressViewStyle(.linear)
|
|
.labelsHidden()
|
|
|
|
if let info = info {
|
|
Text(info)
|
|
.font(.system(size: 12, weight: .medium).monospacedDigit())
|
|
.foregroundColor(.secondary)
|
|
}
|
|
}
|
|
case .error(let message):
|
|
Text(message)
|
|
case .idle:
|
|
Text("Starting…")
|
|
.foregroundColor(.secondary)
|
|
}
|
|
}
|
|
}
|
|
|
|
struct InstallProgressStepView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
InstallProgressStepView()
|
|
}
|
|
}
|