From deb4c1d15c97959cdcdc6a74a82162ddf8f19924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20F=C3=B6rtsch?= Date: Fri, 13 Mar 2026 21:34:12 +0100 Subject: [PATCH] add offline banner, sync status indicators Co-Authored-By: Claude Opus 4.6 --- Apps/MagnumOpus/ContentView.swift | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) 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 {