Yep. AI rewrote the whole thing.
This commit is contained in:
@@ -5,13 +5,13 @@ import SwiftUI
|
||||
/// the single `.opacity()` on ContentView handles transparency.
|
||||
struct TabBar: View {
|
||||
|
||||
@ObservedObject var terminalManager: TerminalManager
|
||||
@ObservedObject var workspace: WorkspaceController
|
||||
|
||||
var body: some View {
|
||||
HStack(spacing: 0) {
|
||||
ScrollView(.horizontal, showsIndicators: false) {
|
||||
HStack(spacing: 2) {
|
||||
ForEach(Array(terminalManager.tabs.enumerated()), id: \.element.id) { index, tab in
|
||||
ForEach(Array(workspace.tabs.enumerated()), id: \.element.id) { index, tab in
|
||||
tabButton(for: tab, at: index)
|
||||
}
|
||||
}
|
||||
@@ -21,12 +21,14 @@ struct TabBar: View {
|
||||
Spacer()
|
||||
|
||||
Button {
|
||||
terminalManager.newTab()
|
||||
workspace.newTab()
|
||||
} label: {
|
||||
Image(systemName: "plus")
|
||||
.font(.system(size: 11, weight: .medium))
|
||||
.foregroundStyle(.white.opacity(0.6))
|
||||
}
|
||||
.accessibilityLabel("New Tab")
|
||||
.accessibilityIdentifier("notch.new-tab")
|
||||
.buttonStyle(.plain)
|
||||
.padding(.horizontal, 8)
|
||||
}
|
||||
@@ -36,7 +38,7 @@ struct TabBar: View {
|
||||
|
||||
@ViewBuilder
|
||||
private func tabButton(for tab: TerminalSession, at index: Int) -> some View {
|
||||
let isActive = index == terminalManager.activeTabIndex
|
||||
let isActive = index == workspace.activeTabIndex
|
||||
|
||||
HStack(spacing: 4) {
|
||||
Text(abbreviateTitle(tab.title))
|
||||
@@ -44,9 +46,9 @@ struct TabBar: View {
|
||||
.lineLimit(1)
|
||||
.foregroundStyle(isActive ? .white : .white.opacity(0.5))
|
||||
|
||||
if isActive && terminalManager.tabs.count > 1 {
|
||||
if isActive && workspace.tabs.count > 1 {
|
||||
Button {
|
||||
terminalManager.closeTab(at: index)
|
||||
workspace.closeTab(at: index)
|
||||
} label: {
|
||||
Image(systemName: "xmark")
|
||||
.font(.system(size: 8, weight: .bold))
|
||||
@@ -63,7 +65,7 @@ struct TabBar: View {
|
||||
)
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture {
|
||||
terminalManager.switchToTab(at: index)
|
||||
workspace.switchToTab(at: index)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user