diff options
| author | Christian Cleberg <[email protected]> | 2026-04-11 23:36:35 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-04-11 23:36:35 -0500 |
| commit | 00cc231e9b419d27b412036d93457c2cbabe0b16 (patch) | |
| tree | 6b042b802fcddcd1e03f1ae0f666965620225485 /Hutch/Views/Home/HomeView.swift | |
| parent | 0fde7529ceaebf1cd9baa01826d95d587023d001 (diff) | |
| download | hutch-00cc231e9b419d27b412036d93457c2cbabe0b16.tar.gz hutch-00cc231e9b419d27b412036d93457c2cbabe0b16.tar.bz2 hutch-00cc231e9b419d27b412036d93457c2cbabe0b16.zip | |
Add SourceHut system status screen and home disruption banner
Diffstat (limited to 'Hutch/Views/Home/HomeView.swift')
| -rw-r--r-- | Hutch/Views/Home/HomeView.swift | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/Hutch/Views/Home/HomeView.swift b/Hutch/Views/Home/HomeView.swift index f9d3de5..695a31d 100644 --- a/Hutch/Views/Home/HomeView.swift +++ b/Hutch/Views/Home/HomeView.swift @@ -33,7 +33,11 @@ struct HomeView: View { if let viewModel { vm = viewModel } else { - let newViewModel = HomeViewModel(currentUser: currentUser, client: appState.client) + let newViewModel = HomeViewModel( + currentUser: currentUser, + client: appState.client, + systemStatusRepository: appState.systemStatusRepository + ) viewModel = newViewModel vm = newViewModel } @@ -51,6 +55,7 @@ struct HomeView: View { @ViewBuilder private func content(_ viewModel: HomeViewModel) -> some View { List { + systemStatusBannerSection(viewModel) projectsSection(viewModel) assignedTicketsSection(viewModel) recentBuildsSection(viewModel) @@ -76,6 +81,20 @@ struct HomeView: View { } @ViewBuilder + private func systemStatusBannerSection(_ viewModel: HomeViewModel) -> some View { + if let bannerTitle = viewModel.systemStatusBannerTitle { + Section { + Button { + appState.openSystemStatus() + } label: { + HomeSystemStatusBanner(title: bannerTitle) + } + .buttonStyle(.plain) + } + } + } + + @ViewBuilder private func projectsSection(_ viewModel: HomeViewModel) -> some View { if !viewModel.projects.isEmpty { Section { @@ -233,6 +252,32 @@ private struct HomeInboxToolbarIcon: View { } } +private struct HomeSystemStatusBanner: View { + let title: String + + var body: some View { + HStack(spacing: 12) { + Image(systemName: "exclamationmark.triangle.fill") + .foregroundStyle(.orange) + VStack(alignment: .leading, spacing: 2) { + Text("SourceHut service disruption") + .font(.subheadline.weight(.semibold)) + .foregroundStyle(.primary) + Text(title) + .font(.caption) + .foregroundStyle(.secondary) + .lineLimit(1) + } + Spacer() + Image(systemName: "chevron.right") + .font(.caption.weight(.semibold)) + .foregroundStyle(.tertiary) + } + .padding(.vertical, 4) + .contentShape(Rectangle()) + } +} + private struct HomeProjectRow: View { let project: Project |
