fix: remove settings sidebar toggle
This commit is contained in:
@@ -8,6 +8,7 @@ extension ConnectionsSettings {
|
|||||||
self.detail
|
self.detail
|
||||||
}
|
}
|
||||||
.navigationSplitViewStyle(.balanced)
|
.navigationSplitViewStyle(.balanced)
|
||||||
|
.toolbar(removing: .sidebarToggle)
|
||||||
.onAppear {
|
.onAppear {
|
||||||
self.store.start()
|
self.store.start()
|
||||||
self.ensureSelection()
|
self.ensureSelection()
|
||||||
|
|||||||
@@ -18,32 +18,64 @@ struct SettingsRootView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationSplitView {
|
VStack(alignment: .leading, spacing: 12) {
|
||||||
List(selection: self.$selectedTab) {
|
if self.isNixMode {
|
||||||
Section("Settings") {
|
self.nixManagedBanner
|
||||||
ForEach(self.sidebarTabs, id: \.self) { tab in
|
|
||||||
Label(tab.title, systemImage: tab.systemImage)
|
|
||||||
.tag(tab)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.listStyle(.sidebar)
|
TabView(selection: self.$selectedTab) {
|
||||||
.toolbar(removing: .sidebarToggle)
|
GeneralSettings(state: self.state)
|
||||||
.frame(minWidth: 200, idealWidth: 220, maxWidth: 260)
|
.tabItem { Label("General", systemImage: "gearshape") }
|
||||||
} detail: {
|
.tag(SettingsTab.general)
|
||||||
VStack(alignment: .leading, spacing: 12) {
|
|
||||||
if self.isNixMode {
|
ConnectionsSettings()
|
||||||
self.nixManagedBanner
|
.tabItem { Label("Connections", systemImage: "link") }
|
||||||
|
.tag(SettingsTab.connections)
|
||||||
|
|
||||||
|
VoiceWakeSettings(state: self.state)
|
||||||
|
.tabItem { Label("Voice Wake", systemImage: "waveform.circle") }
|
||||||
|
.tag(SettingsTab.voiceWake)
|
||||||
|
|
||||||
|
ConfigSettings()
|
||||||
|
.tabItem { Label("Config", systemImage: "slider.horizontal.3") }
|
||||||
|
.tag(SettingsTab.config)
|
||||||
|
|
||||||
|
InstancesSettings()
|
||||||
|
.tabItem { Label("Instances", systemImage: "network") }
|
||||||
|
.tag(SettingsTab.instances)
|
||||||
|
|
||||||
|
SessionsSettings()
|
||||||
|
.tabItem { Label("Sessions", systemImage: "clock.arrow.circlepath") }
|
||||||
|
.tag(SettingsTab.sessions)
|
||||||
|
|
||||||
|
CronSettings()
|
||||||
|
.tabItem { Label("Cron", systemImage: "calendar") }
|
||||||
|
.tag(SettingsTab.cron)
|
||||||
|
|
||||||
|
SkillsSettings(state: self.state)
|
||||||
|
.tabItem { Label("Skills", systemImage: "sparkles") }
|
||||||
|
.tag(SettingsTab.skills)
|
||||||
|
|
||||||
|
PermissionsSettings(
|
||||||
|
status: self.permissionMonitor.status,
|
||||||
|
refresh: self.refreshPerms,
|
||||||
|
showOnboarding: { OnboardingController.shared.show() })
|
||||||
|
.tabItem { Label("Permissions", systemImage: "lock.shield") }
|
||||||
|
.tag(SettingsTab.permissions)
|
||||||
|
|
||||||
|
if self.state.debugPaneEnabled {
|
||||||
|
DebugSettings(state: self.state)
|
||||||
|
.tabItem { Label("Debug", systemImage: "ant") }
|
||||||
|
.tag(SettingsTab.debug)
|
||||||
}
|
}
|
||||||
self.detailView(for: self.selectedTab)
|
|
||||||
|
AboutSettings(updater: self.updater)
|
||||||
|
.tabItem { Label("About", systemImage: "info.circle") }
|
||||||
|
.tag(SettingsTab.about)
|
||||||
}
|
}
|
||||||
.padding(.horizontal, 28)
|
|
||||||
.padding(.vertical, 22)
|
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
|
|
||||||
}
|
}
|
||||||
.navigationSplitViewStyle(.balanced)
|
.padding(.horizontal, 28)
|
||||||
.navigationTitle("Settings")
|
.padding(.vertical, 22)
|
||||||
.background(SettingsWindowChrome(title: "Clawdbot Settings"))
|
.background(SettingsToolbarCleaner())
|
||||||
.frame(width: SettingsTab.windowWidth, height: SettingsTab.windowHeight, alignment: .topLeading)
|
.frame(width: SettingsTab.windowWidth, height: SettingsTab.windowHeight, alignment: .topLeading)
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
|
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
|
||||||
.onReceive(NotificationCenter.default.publisher(for: .clawdbotSelectSettingsTab)) { note in
|
.onReceive(NotificationCenter.default.publisher(for: .clawdbotSelectSettingsTab)) { note in
|
||||||
@@ -113,56 +145,6 @@ struct SettingsRootView: View {
|
|||||||
return requested
|
return requested
|
||||||
}
|
}
|
||||||
|
|
||||||
private var sidebarTabs: [SettingsTab] {
|
|
||||||
var tabs: [SettingsTab] = [
|
|
||||||
.general,
|
|
||||||
.connections,
|
|
||||||
.voiceWake,
|
|
||||||
.config,
|
|
||||||
.instances,
|
|
||||||
.sessions,
|
|
||||||
.cron,
|
|
||||||
.skills,
|
|
||||||
.permissions,
|
|
||||||
]
|
|
||||||
if self.state.debugPaneEnabled {
|
|
||||||
tabs.append(.debug)
|
|
||||||
}
|
|
||||||
tabs.append(.about)
|
|
||||||
return tabs
|
|
||||||
}
|
|
||||||
|
|
||||||
@ViewBuilder
|
|
||||||
private func detailView(for tab: SettingsTab) -> some View {
|
|
||||||
switch tab {
|
|
||||||
case .general:
|
|
||||||
GeneralSettings(state: self.state)
|
|
||||||
case .connections:
|
|
||||||
ConnectionsSettings()
|
|
||||||
case .voiceWake:
|
|
||||||
VoiceWakeSettings(state: self.state)
|
|
||||||
case .config:
|
|
||||||
ConfigSettings()
|
|
||||||
case .instances:
|
|
||||||
InstancesSettings()
|
|
||||||
case .sessions:
|
|
||||||
SessionsSettings()
|
|
||||||
case .cron:
|
|
||||||
CronSettings()
|
|
||||||
case .skills:
|
|
||||||
SkillsSettings(state: self.state)
|
|
||||||
case .permissions:
|
|
||||||
PermissionsSettings(
|
|
||||||
status: self.permissionMonitor.status,
|
|
||||||
refresh: self.refreshPerms,
|
|
||||||
showOnboarding: { OnboardingController.shared.show() })
|
|
||||||
case .debug:
|
|
||||||
DebugSettings(state: self.state)
|
|
||||||
case .about:
|
|
||||||
AboutSettings(updater: self.updater)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
private func refreshSnapshotPaths() async {
|
private func refreshSnapshotPaths() async {
|
||||||
let paths = await GatewayConnection.shared.snapshotPaths()
|
let paths = await GatewayConnection.shared.snapshotPaths()
|
||||||
|
|||||||
18
apps/macos/Sources/Clawdbot/SettingsToolbarCleaner.swift
Normal file
18
apps/macos/Sources/Clawdbot/SettingsToolbarCleaner.swift
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import AppKit
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct SettingsToolbarCleaner: NSViewRepresentable {
|
||||||
|
func makeNSView(context: Context) -> NSView {
|
||||||
|
NSView()
|
||||||
|
}
|
||||||
|
|
||||||
|
func updateNSView(_ nsView: NSView, context: Context) {
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
guard let toolbar = nsView.window?.toolbar else { return }
|
||||||
|
toolbar.items.removeAll {
|
||||||
|
$0.itemIdentifier == .toggleSidebar
|
||||||
|
|| $0.itemIdentifier.rawValue == "com.apple.NSToolbarShowSidebarItem"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
import AppKit
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
struct SettingsWindowChrome: NSViewRepresentable {
|
|
||||||
let title: String
|
|
||||||
|
|
||||||
func makeNSView(context: Context) -> NSView {
|
|
||||||
NSView()
|
|
||||||
}
|
|
||||||
|
|
||||||
func updateNSView(_ nsView: NSView, context: Context) {
|
|
||||||
DispatchQueue.main.async {
|
|
||||||
guard let window = nsView.window else { return }
|
|
||||||
window.title = title
|
|
||||||
window.titleVisibility = .visible
|
|
||||||
window.toolbar?.isVisible = false
|
|
||||||
window.toolbarStyle = .unified
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user