mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-06 06:23:35 +00:00
* feat(ios): modernize navigation and settings * fix(ios): remove obsolete settings helpers * test(ios): update i18n collector fixture * test(ios): update i18n collector fixture * test(ios): update i18n collector fixture
91 lines
3.2 KiB
Swift
91 lines
3.2 KiB
Swift
import SwiftUI
|
|
|
|
struct IPadSidebarScreenChrome<Content: View>: View {
|
|
@Environment(\.verticalSizeClass) private var verticalSizeClass
|
|
let title: String
|
|
let subtitle: String
|
|
let headerLeadingAction: OpenClawSidebarHeaderAction?
|
|
let usesNativeNavigationChrome: Bool
|
|
let gatewayAction: (() -> Void)?
|
|
@ViewBuilder var content: Content
|
|
|
|
init(
|
|
title: String,
|
|
subtitle: String,
|
|
headerLeadingAction: OpenClawSidebarHeaderAction? = nil,
|
|
usesNativeNavigationChrome: Bool = false,
|
|
gatewayAction: (() -> Void)? = nil,
|
|
@ViewBuilder content: () -> Content)
|
|
{
|
|
self.title = title
|
|
self.subtitle = subtitle
|
|
self.headerLeadingAction = headerLeadingAction
|
|
self.usesNativeNavigationChrome = usesNativeNavigationChrome
|
|
self.gatewayAction = gatewayAction
|
|
self.content = content()
|
|
}
|
|
|
|
var body: some View {
|
|
ZStack {
|
|
OpenClawProBackground()
|
|
ScrollView {
|
|
VStack(alignment: .leading, spacing: self.isCompactHeight ? 10 : 16) {
|
|
if !self.usesNativeNavigationChrome {
|
|
OpenClawAdaptiveHeaderRow(
|
|
title: self.title,
|
|
subtitle: self.subtitle,
|
|
titleFont: self.isCompactHeight ? .headline.weight(.semibold) : .title2.weight(.semibold),
|
|
subtitleLineLimit: self.isCompactHeight ? 1 : 2)
|
|
{
|
|
if let headerLeadingAction {
|
|
OpenClawSidebarHeaderLeadingSlot(action: headerLeadingAction)
|
|
}
|
|
} accessory: {
|
|
self.gatewayPill
|
|
}
|
|
.padding(.horizontal, OpenClawProMetric.pagePadding)
|
|
}
|
|
self.content
|
|
}
|
|
.padding(.vertical, self.isCompactHeight ? 10 : 18)
|
|
}
|
|
.safeAreaPadding(.bottom, self.bottomScrollInset)
|
|
}
|
|
.navigationTitle(self.title)
|
|
.navigationBarTitleDisplayMode(.inline)
|
|
.toolbar(self.usesNativeNavigationChrome ? .visible : .hidden, for: .navigationBar)
|
|
.toolbar {
|
|
if self.usesNativeNavigationChrome, let gatewayAction {
|
|
ToolbarItem(placement: .topBarTrailing) {
|
|
Button(action: gatewayAction) {
|
|
Image(systemName: "antenna.radiowaves.left.and.right")
|
|
}
|
|
.accessibilityLabel("Gateway settings")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private var isCompactHeight: Bool {
|
|
self.verticalSizeClass == .compact
|
|
}
|
|
|
|
@ViewBuilder
|
|
private var gatewayPill: some View {
|
|
if let gatewayAction {
|
|
Button(action: gatewayAction) {
|
|
OpenClawGatewayCompactPill()
|
|
}
|
|
.buttonBorderShape(.capsule)
|
|
.openClawGlassButton()
|
|
.accessibilityHint("Opens Settings / Gateway")
|
|
} else {
|
|
OpenClawGatewayCompactPill()
|
|
}
|
|
}
|
|
|
|
private var bottomScrollInset: CGFloat {
|
|
self.isCompactHeight ? 150 : OpenClawProMetric.bottomScrollInset
|
|
}
|
|
}
|