Skip to content

Commit 638205d

Browse files
committed
Restore branded button disabled states
1 parent 69a5831 commit 638205d

3 files changed

Lines changed: 25 additions & 12 deletions

File tree

‎apps/.i18n/native-source.json‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8275,47 +8275,47 @@
82758275
},
82768276
{
82778277
"kind": "ui-modifier",
8278-
"line": 649,
8278+
"line": 660,
82798279
"path": "apps/ios/Sources/Design/OpenClawProComponents.swift",
82808280
"source": "OpenClaw",
82818281
"surface": "apple",
82828282
"id": "native.apple.cf9bb65f8e405cc8"
82838283
},
82848284
{
82858285
"kind": "ui-modifier",
8286-
"line": 677,
8286+
"line": 688,
82878287
"path": "apps/ios/Sources/Design/OpenClawProComponents.swift",
82888288
"source": "Gateway \\(self.title)",
82898289
"surface": "apple",
82908290
"id": "native.apple.51c566ed34b67acf"
82918291
},
82928292
{
82938293
"kind": "conditional-branch",
8294-
"line": 682,
8294+
"line": 693,
82958295
"path": "apps/ios/Sources/Design/OpenClawProComponents.swift",
82968296
"source": "Online",
82978297
"surface": "apple",
82988298
"id": "native.apple.72baecec6cf1b462"
82998299
},
83008300
{
83018301
"kind": "conditional-branch",
8302-
"line": 684,
8302+
"line": 695,
83038303
"path": "apps/ios/Sources/Design/OpenClawProComponents.swift",
83048304
"source": "Connecting",
83058305
"surface": "apple",
83068306
"id": "native.apple.ca9dfb05d9034ff7"
83078307
},
83088308
{
83098309
"kind": "conditional-branch",
8310-
"line": 686,
8310+
"line": 697,
83118311
"path": "apps/ios/Sources/Design/OpenClawProComponents.swift",
83128312
"source": "Attention",
83138313
"surface": "apple",
83148314
"id": "native.apple.d7a3d53412e23e88"
83158315
},
83168316
{
83178317
"kind": "conditional-branch",
8318-
"line": 688,
8318+
"line": 699,
83198319
"path": "apps/ios/Sources/Design/OpenClawProComponents.swift",
83208320
"source": "Offline",
83218321
"surface": "apple",

‎apps/ios/Sources/Design/OpenClawProComponents.swift‎

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -563,37 +563,48 @@ struct OpenClawStatusBadge: View {
563563
}
564564

565565
struct OpenClawPrimaryButtonStyle: ButtonStyle {
566+
@Environment(\.isEnabled) private var isEnabled
567+
566568
func makeBody(configuration: Configuration) -> some View {
567569
configuration.label
568570
.font(OpenClawType.headline)
569-
.foregroundStyle(.white)
571+
.foregroundStyle(self.isEnabled ? Color.white : OpenClawBrand.textSecondary)
570572
.frame(maxWidth: .infinity, minHeight: 48)
571573
.background {
572574
RoundedRectangle(cornerRadius: OpenClawRadius.sm, style: .continuous)
573575
.fill(
574-
configuration.isPressed
576+
!self.isEnabled
577+
? Color(uiColor: .tertiarySystemFill)
578+
: configuration.isPressed
575579
? OpenClawBrand.accentPressed
576580
: OpenClawBrand.accent)
577581
}
578582
.animation(.easeOut(duration: 0.15), value: configuration.isPressed)
583+
.animation(.easeOut(duration: 0.15), value: self.isEnabled)
579584
}
580585
}
581586

582587
struct OpenClawSecondaryButtonStyle: ButtonStyle {
588+
@Environment(\.isEnabled) private var isEnabled
589+
583590
func makeBody(configuration: Configuration) -> some View {
584591
configuration.label
585592
.font(OpenClawType.headline)
586-
.foregroundStyle(OpenClawBrand.textPrimary)
593+
.foregroundStyle(self.isEnabled ? OpenClawBrand.textPrimary : OpenClawBrand.textSecondary.opacity(0.68))
587594
.frame(maxWidth: .infinity, minHeight: 48)
588595
.background {
589596
RoundedRectangle(cornerRadius: OpenClawRadius.sm, style: .continuous)
590-
.fill(Color(uiColor: .secondarySystemBackground))
597+
.fill(Color(uiColor: self.isEnabled ? .secondarySystemBackground : .tertiarySystemFill))
591598
.overlay {
592599
RoundedRectangle(cornerRadius: OpenClawRadius.sm, style: .continuous)
593-
.strokeBorder(Color(uiColor: .separator).opacity(0.35), lineWidth: 1)
600+
.strokeBorder(
601+
Color(uiColor: .separator).opacity(self.isEnabled ? 0.35 : 0.20),
602+
lineWidth: 1)
594603
}
595604
}
596-
.opacity(configuration.isPressed ? 0.82 : 1)
605+
.opacity(!self.isEnabled ? 0.74 : configuration.isPressed ? 0.82 : 1)
606+
.animation(.easeOut(duration: 0.15), value: configuration.isPressed)
607+
.animation(.easeOut(duration: 0.15), value: self.isEnabled)
597608
}
598609
}
599610

‎apps/ios/Tests/OpenClawTypographyTests.swift‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ struct OpenClawTypographyTests {
169169
#expect(proComponents.contains(".font(OpenClawType.subheadSemiBold)"))
170170
#expect(proComponents.contains("Text(primaryActionTitle)"))
171171
#expect(proComponents.contains("Text(secondaryActionTitle)"))
172+
#expect(proComponents.contains("@Environment(\\.isEnabled)"))
173+
#expect(proComponents.contains(".animation(.easeOut(duration: 0.15), value: self.isEnabled)"))
172174

173175
#expect(!quickSetup.contains("Button(\"Close\")"))
174176
#expect(quickSetup.contains("Text(\"Quick Setup\")"))

0 commit comments

Comments
 (0)