//
//  NetworkDisconnectedView.swift
//  punchnet
//
//  Created by 安礼成 on 2026/4/17.
//
import SwiftUI

struct NetworkDisconnectedView: View {
    var model: NetworkModel

    var body: some View {
        VStack(spacing: 20) {
            Spacer()
            Image(systemName: "antenna.radiowaves.left.and.right")
                .font(.system(size: 40, weight: .ultraLight))
                .foregroundStyle(.tertiary)
                .symbolEffect(.pulse, options: .repeating)
            
            Text("尚未接入网络")
                .font(.headline)
            
            Button(action: {
                Task { @MainActor in
                    await self.model.connect()
                }
            }) {
                Text("建立安全连接")
                    .frame(width: 80)
            }
            .buttonStyle(.borderedProminent)
            .disabled(self.model.phase == .connecting || self.model.networkSession == nil)
            Spacer()
        }
    }
}
