diff --git a/Apps/MagnumOpus/ContentView.swift b/Apps/MagnumOpus/ContentView.swift index 3017cbc..df5d772 100644 --- a/Apps/MagnumOpus/ContentView.swift +++ b/Apps/MagnumOpus/ContentView.swift @@ -35,12 +35,46 @@ struct ContentView: View { messages: viewModel.messages ) } + .safeAreaInset(edge: .bottom) { + statusBanner + } .task { await viewModel.syncNow() viewModel.startPeriodicSync() } } + @ViewBuilder + private var statusBanner: some View { + switch viewModel.syncState { + case .error(let message): + HStack { + Image(systemName: "wifi.slash") + Text("Offline — showing cached mail") + Spacer() + Button("Retry") { + Task { await viewModel.syncNow() } + } + .buttonStyle(.borderless) + } + .font(.caption) + .padding(8) + .background(.yellow.opacity(0.2)) + case .syncing(let mailbox): + HStack { + ProgressView() + .controlSize(.small) + Text("Syncing\(mailbox.map { " \($0)" } ?? "")…") + .font(.caption) + Spacer() + } + .padding(8) + .background(.blue.opacity(0.1)) + case .idle: + EmptyView() + } + } + private func connectAccount() { guard let (config, credentials) = accountSetup.buildConfig() else { return } do {