summaryrefslogtreecommitdiff
path: root/Hutch/Views/Home/HomeView.swift
diff options
context:
space:
mode:
Diffstat (limited to 'Hutch/Views/Home/HomeView.swift')
-rw-r--r--Hutch/Views/Home/HomeView.swift47
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