From 37474b2e06eda77cb46309795ada1a01951ed185 Mon Sep 17 00:00:00 2001 From: joshavant <830519+joshavant@users.noreply.github.com> Date: Fri, 3 Jul 2026 18:20:40 -0500 Subject: [PATCH] Restore branded button disabled states --- apps/.i18n/native-source.json | 12 +++++----- .../Design/OpenClawProComponents.swift | 23 ++++++++++++++----- apps/ios/Tests/OpenClawTypographyTests.swift | 2 ++ 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/apps/.i18n/native-source.json b/apps/.i18n/native-source.json index aae0de64b7b1..8b64b227f618 100644 --- a/apps/.i18n/native-source.json +++ b/apps/.i18n/native-source.json @@ -8275,7 +8275,7 @@ }, { "kind": "ui-modifier", - "line": 649, + "line": 660, "path": "apps/ios/Sources/Design/OpenClawProComponents.swift", "source": "OpenClaw", "surface": "apple", @@ -8283,7 +8283,7 @@ }, { "kind": "ui-modifier", - "line": 677, + "line": 688, "path": "apps/ios/Sources/Design/OpenClawProComponents.swift", "source": "Gateway \\(self.title)", "surface": "apple", @@ -8291,7 +8291,7 @@ }, { "kind": "conditional-branch", - "line": 682, + "line": 693, "path": "apps/ios/Sources/Design/OpenClawProComponents.swift", "source": "Online", "surface": "apple", @@ -8299,7 +8299,7 @@ }, { "kind": "conditional-branch", - "line": 684, + "line": 695, "path": "apps/ios/Sources/Design/OpenClawProComponents.swift", "source": "Connecting", "surface": "apple", @@ -8307,7 +8307,7 @@ }, { "kind": "conditional-branch", - "line": 686, + "line": 697, "path": "apps/ios/Sources/Design/OpenClawProComponents.swift", "source": "Attention", "surface": "apple", @@ -8315,7 +8315,7 @@ }, { "kind": "conditional-branch", - "line": 688, + "line": 699, "path": "apps/ios/Sources/Design/OpenClawProComponents.swift", "source": "Offline", "surface": "apple", diff --git a/apps/ios/Sources/Design/OpenClawProComponents.swift b/apps/ios/Sources/Design/OpenClawProComponents.swift index 496aee854544..6be9f93c655b 100644 --- a/apps/ios/Sources/Design/OpenClawProComponents.swift +++ b/apps/ios/Sources/Design/OpenClawProComponents.swift @@ -563,37 +563,48 @@ struct OpenClawStatusBadge: View { } struct OpenClawPrimaryButtonStyle: ButtonStyle { + @Environment(\.isEnabled) private var isEnabled + func makeBody(configuration: Configuration) -> some View { configuration.label .font(OpenClawType.headline) - .foregroundStyle(.white) + .foregroundStyle(self.isEnabled ? Color.white : OpenClawBrand.textSecondary) .frame(maxWidth: .infinity, minHeight: 48) .background { RoundedRectangle(cornerRadius: OpenClawRadius.sm, style: .continuous) .fill( - configuration.isPressed + !self.isEnabled + ? Color(uiColor: .tertiarySystemFill) + : configuration.isPressed ? OpenClawBrand.accentPressed : OpenClawBrand.accent) } .animation(.easeOut(duration: 0.15), value: configuration.isPressed) + .animation(.easeOut(duration: 0.15), value: self.isEnabled) } } struct OpenClawSecondaryButtonStyle: ButtonStyle { + @Environment(\.isEnabled) private var isEnabled + func makeBody(configuration: Configuration) -> some View { configuration.label .font(OpenClawType.headline) - .foregroundStyle(OpenClawBrand.textPrimary) + .foregroundStyle(self.isEnabled ? OpenClawBrand.textPrimary : OpenClawBrand.textSecondary.opacity(0.68)) .frame(maxWidth: .infinity, minHeight: 48) .background { RoundedRectangle(cornerRadius: OpenClawRadius.sm, style: .continuous) - .fill(Color(uiColor: .secondarySystemBackground)) + .fill(Color(uiColor: self.isEnabled ? .secondarySystemBackground : .tertiarySystemFill)) .overlay { RoundedRectangle(cornerRadius: OpenClawRadius.sm, style: .continuous) - .strokeBorder(Color(uiColor: .separator).opacity(0.35), lineWidth: 1) + .strokeBorder( + Color(uiColor: .separator).opacity(self.isEnabled ? 0.35 : 0.20), + lineWidth: 1) } } - .opacity(configuration.isPressed ? 0.82 : 1) + .opacity(!self.isEnabled ? 0.74 : configuration.isPressed ? 0.82 : 1) + .animation(.easeOut(duration: 0.15), value: configuration.isPressed) + .animation(.easeOut(duration: 0.15), value: self.isEnabled) } } diff --git a/apps/ios/Tests/OpenClawTypographyTests.swift b/apps/ios/Tests/OpenClawTypographyTests.swift index 3868b9d24fd6..e9d1873f02a0 100644 --- a/apps/ios/Tests/OpenClawTypographyTests.swift +++ b/apps/ios/Tests/OpenClawTypographyTests.swift @@ -169,6 +169,8 @@ struct OpenClawTypographyTests { #expect(proComponents.contains(".font(OpenClawType.subheadSemiBold)")) #expect(proComponents.contains("Text(primaryActionTitle)")) #expect(proComponents.contains("Text(secondaryActionTitle)")) + #expect(proComponents.contains("@Environment(\\.isEnabled)")) + #expect(proComponents.contains(".animation(.easeOut(duration: 0.15), value: self.isEnabled)")) #expect(!quickSetup.contains("Button(\"Close\")")) #expect(quickSetup.contains("Text(\"Quick Setup\")"))