fix(swift-ios): remove done status from thread headers
This commit is contained in:
3 files changed
+66
-24
No files matched your search
@@ -192,23 +192,31 @@ public struct ThreadDetailView: View {
|
||||
|
||||
@ViewBuilder
|
||||
private func headerStatus(at now: Date) -> some View {
|
||||
HStack(spacing: 5) {
|
||||
if let icon = headerStatusIcon {
|
||||
Image(systemName: icon)
|
||||
}
|
||||
if let duration = currentThread.homeWorkingDuration(at: now) {
|
||||
Text(duration)
|
||||
.monospaced()
|
||||
.monospacedDigit()
|
||||
} else {
|
||||
Text(currentThread.homeStatusLabel ?? "Ready")
|
||||
let duration = currentThread.homeWorkingDuration(at: now)
|
||||
if let label = duration ?? currentThread.detailHeaderStatusLabel {
|
||||
HStack(spacing: 5) {
|
||||
if let icon = currentThread.detailHeaderStatusIcon {
|
||||
Image(systemName: icon)
|
||||
}
|
||||
headerStatusText(label, isDuration: duration != nil)
|
||||
}
|
||||
.font(T3Typography.status)
|
||||
.foregroundStyle(headerStatusColor)
|
||||
.lineLimit(1)
|
||||
.accessibilityElement(children: .combine)
|
||||
.accessibilityLabel(currentThread.homeStatusAccessibilityLabel(at: now))
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private func headerStatusText(_ label: String, isDuration: Bool) -> some View {
|
||||
if isDuration {
|
||||
Text(label)
|
||||
.monospaced()
|
||||
.monospacedDigit()
|
||||
} else {
|
||||
Text(label)
|
||||
}
|
||||
.font(T3Typography.status)
|
||||
.foregroundStyle(headerStatusColor)
|
||||
.lineLimit(1)
|
||||
.accessibilityElement(children: .combine)
|
||||
.accessibilityLabel(currentThread.homeStatusAccessibilityLabel(at: now))
|
||||
}
|
||||
|
||||
private var threadActionsMenu: some View {
|
||||
@@ -283,15 +291,6 @@ public struct ThreadDetailView: View {
|
||||
return "workspace"
|
||||
}
|
||||
|
||||
private var headerStatusIcon: String? {
|
||||
switch currentThread.homeStatus {
|
||||
case .working: "circle.dotted"
|
||||
case .done: "checkmark.circle"
|
||||
case .failed: "exclamationmark.circle"
|
||||
case .approval, .input, .monitoring, .ready: nil
|
||||
}
|
||||
}
|
||||
|
||||
private var headerStatusColor: Color {
|
||||
switch currentThread.homeStatus {
|
||||
case .working: T3Colors.statusRunning
|
||||
|
||||
@@ -715,6 +715,28 @@ extension FeatureThread {
|
||||
}
|
||||
}
|
||||
|
||||
var detailHeaderStatusLabel: String? {
|
||||
switch homeStatus {
|
||||
case .done:
|
||||
nil
|
||||
case .ready:
|
||||
"Ready"
|
||||
case .approval, .input, .working, .monitoring, .failed:
|
||||
homeStatusLabel
|
||||
}
|
||||
}
|
||||
|
||||
var detailHeaderStatusIcon: String? {
|
||||
switch homeStatus {
|
||||
case .working:
|
||||
"circle.dotted"
|
||||
case .failed:
|
||||
"exclamationmark.circle"
|
||||
case .done, .approval, .input, .monitoring, .ready:
|
||||
nil
|
||||
}
|
||||
}
|
||||
|
||||
func homeRowStatusLabel(at now: Date) -> String {
|
||||
switch homeStatus {
|
||||
case .done, .ready:
|
||||
|
||||
@@ -53,6 +53,27 @@ struct HomeThreadMetadataTests {
|
||||
#expect(idle.homeRowStatusLabel(at: now) == "2m")
|
||||
}
|
||||
|
||||
@Test
|
||||
func completedDetailHeadersDoNotShowAStatusBadge() {
|
||||
let completed = FeatureThread(
|
||||
id: "completed",
|
||||
projectID: "project",
|
||||
title: "Completed task",
|
||||
state: .completed
|
||||
)
|
||||
let working = FeatureThread(
|
||||
id: "working",
|
||||
projectID: "project",
|
||||
title: "Working task",
|
||||
state: .working
|
||||
)
|
||||
|
||||
#expect(completed.detailHeaderStatusLabel == nil)
|
||||
#expect(completed.detailHeaderStatusIcon == nil)
|
||||
#expect(working.detailHeaderStatusLabel == "Working")
|
||||
#expect(working.detailHeaderStatusIcon == "circle.dotted")
|
||||
}
|
||||
|
||||
@Test
|
||||
func workingDurationMatchesTheCompactWebFormatAndClampsFutureDates() {
|
||||
let thread = FeatureThread(
|
||||
|
||||
Reference in new issue
Block a user