ios: unify iPad chat toolbar

This commit is contained in:
2026-05-02 17:03:02 -07:00
parent ba6fc9c660
commit cafe4bb9ae
2 changed files with 28 additions and 90 deletions

View File

@@ -25,7 +25,6 @@ public struct SplitView: View {
} else {
NavigationSplitView {
SybilSidebarView(viewModel: viewModel)
.navigationTitle("Sybil")
} detail: {
SybilWorkspaceView(viewModel: viewModel)
}

View File

@@ -3,13 +3,8 @@ import SwiftUI
struct SybilWorkspaceView: View {
@Bindable var viewModel: SybilViewModel
@Environment(\.horizontalSizeClass) private var horizontalSizeClass
@FocusState private var composerFocused: Bool
private var isCompact: Bool {
horizontalSizeClass == .compact
}
private var isSettingsSelected: Bool {
if case .settings = viewModel.selectedItem {
return true
@@ -18,7 +13,7 @@ struct SybilWorkspaceView: View {
}
private var showsHeader: Bool {
!isCompact || viewModel.errorMessage != nil
viewModel.errorMessage != nil
}
var body: some View {
@@ -55,20 +50,23 @@ struct SybilWorkspaceView: View {
composerBar
}
}
.navigationTitle(isCompact ? "" : viewModel.selectedTitle)
.navigationTitle("")
.navigationBarTitleDisplayMode(.inline)
.toolbar {
if isCompact {
ToolbarItem(placement: .principal) {
Text(viewModel.selectedTitle)
.font(.sybil(.headline, weight: .semibold))
.foregroundStyle(SybilTheme.text)
.lineLimit(1)
}
}
if isCompact && !viewModel.isSearchMode && !isSettingsSelected {
if !isSettingsSelected {
ToolbarItem(placement: .topBarTrailing) {
compactProviderModelMenu
if viewModel.isSearchMode {
searchModeChip
} else {
providerModelMenu
}
}
}
}
@@ -83,30 +81,6 @@ struct SybilWorkspaceView: View {
private var header: some View {
VStack(alignment: .leading, spacing: 12) {
if !isCompact {
HStack(alignment: .top, spacing: 12) {
Spacer()
if !viewModel.isSearchMode && !isSettingsSelected {
providerControls
} else if viewModel.isSearchMode {
Label("Search mode", systemImage: "globe")
.font(.sybil(.caption, weight: .medium))
.foregroundStyle(SybilTheme.accent)
.padding(.horizontal, 10)
.padding(.vertical, 7)
.background(
RoundedRectangle(cornerRadius: 10)
.fill(SybilTheme.accent.opacity(0.10))
.overlay(
RoundedRectangle(cornerRadius: 10)
.stroke(SybilTheme.accent.opacity(0.24), lineWidth: 1)
)
)
}
}
}
if let error = viewModel.errorMessage {
Text(error)
.font(.sybil(.footnote))
@@ -119,7 +93,7 @@ struct SybilWorkspaceView: View {
.background(SybilTheme.panelGradient.opacity(0.58))
}
private var compactProviderModelMenu: some View {
private var providerModelMenu: some View {
Menu {
Text("\(viewModel.provider.displayName)\(viewModel.model)")
.font(.sybil(.caption))
@@ -163,57 +137,22 @@ struct SybilWorkspaceView: View {
.accessibilityLabel("Provider and model")
}
private var providerControls: some View {
HStack(spacing: 8) {
Menu {
ForEach(Provider.allCases, id: \.self) { candidate in
Button(candidate.displayName) {
viewModel.setProvider(candidate)
}
}
} label: {
Label(viewModel.provider.displayName, systemImage: "chevron.down")
.labelStyle(.titleAndIcon)
private var searchModeChip: some View {
Label("Search", systemImage: "globe")
.font(.sybil(.caption, weight: .medium))
.foregroundStyle(SybilTheme.text)
.foregroundStyle(SybilTheme.accent)
.padding(.horizontal, 10)
.padding(.vertical, 7)
.background(
RoundedRectangle(cornerRadius: 10)
.fill(SybilTheme.surface.opacity(0.78))
Capsule()
.fill(SybilTheme.accent.opacity(0.10))
.overlay(
RoundedRectangle(cornerRadius: 10)
.stroke(SybilTheme.border.opacity(0.88), lineWidth: 1)
Capsule()
.stroke(SybilTheme.accent.opacity(0.24), lineWidth: 1)
)
)
}
Menu {
ForEach(viewModel.providerModelOptions, id: \.self) { model in
Button(model) {
viewModel.setModel(model)
}
}
} label: {
Label(viewModel.model, systemImage: "chevron.down")
.labelStyle(.titleAndIcon)
.font(.sybil(.caption, weight: .medium))
.foregroundStyle(SybilTheme.text)
.lineLimit(1)
.padding(.horizontal, 10)
.padding(.vertical, 7)
.background(
RoundedRectangle(cornerRadius: 10)
.fill(SybilTheme.surface.opacity(0.78))
.overlay(
RoundedRectangle(cornerRadius: 10)
.stroke(SybilTheme.border.opacity(0.88), lineWidth: 1)
)
)
}
}
}
private var composerBar: some View {
HStack(alignment: .bottom, spacing: 10) {
TextField(