update shelltabview - remove geometryreader and make the smallest tab size larger

update keyimporterview to make the button not look odd
fix the textbox having illegible text
fix hostsymbol picker looking shit in light mode
This commit is contained in:
neon443 committed 2025-08-16 11:25:18 +01:00
1 parent 700c169e55
commit 587c85842f
3 files changed
+140 -138

No files matched your search

@@ -57,6 +57,7 @@ struct HostSymbolPicker: View {
} }
.padding(10) .padding(10)
} }
.preferredColorScheme(.dark)
.scrollDisabled(true) .scrollDisabled(true)
} }
} }
+18 -15
View File
@@ -45,8 +45,10 @@ struct KeyImporterView: View {
.listRowSeparator(.hidden) .listRowSeparator(.hidden)
TextEditor(text: $privkeyStr) TextEditor(text: $privkeyStr)
.background(.black) .background(.gray.opacity(0.5))
.clipShape(RoundedRectangle(cornerRadius: 10)) .clipShape(RoundedRectangle(cornerRadius: 8))
.padding(.bottom, 5)
.padding(.horizontal, -8)
} }
if !keypair.openSshPubkey.isEmpty { if !keypair.openSshPubkey.isEmpty {
@@ -55,20 +57,21 @@ struct KeyImporterView: View {
} }
} }
.overlay(alignment: .bottom) {
Button() { Button() {
keyManager.importKey(type: keyType, priv: privkeyStr, name: keyName) keyManager.importKey(type: keyType, priv: privkeyStr, name: keyName)
dismiss() dismiss()
} label: { } label: {
Text("Import") Text("Import")
.font(.title) .font(.title)
.bold() .bold()
}
.onTapGesture {
UINotificationFeedbackGenerator().notificationOccurred(.success)
}
.buttonStyle(.borderedProminent)
.padding(.bottom, 15)
} }
.onTapGesture {
UINotificationFeedbackGenerator().notificationOccurred(.success)
}
.buttonStyle(.borderedProminent)
.padding()
} }
} }
+121 -123
View File
@@ -46,153 +46,151 @@ struct ShellTabView: View {
ZStack { ZStack {
background background
.ignoresSafeArea(.all) .ignoresSafeArea(.all)
GeometryReader { geo in VStack(spacing: 0) {
VStack(spacing: 0) { let oneTabWidth = max(100, (UIScreen.main.bounds.width)/CGFloat(container.sessionIDs.count))
let oneTabWidth = max(60, (geo.size.width)/CGFloat(container.sessionIDs.count))
HStack(alignment: .center, spacing: 10) {
HStack(alignment: .center, spacing: 10) { Button() {
Button() { for session in container.sessions.values {
for session in container.sessions.values { session.handler.disconnect()
session.handler.disconnect()
}
dismiss()
} label: {
TrafficLightRed()
} }
Button() { dismiss()
dismiss() } label: {
} label: { TrafficLightRed()
TrafficLightYellow() }
} Button() {
Spacer() dismiss()
VStack { } label: {
Text(selectedHandler.title) TrafficLightYellow()
}
Spacer()
VStack {
Text(selectedHandler.title)
.bold()
.foregroundStyle(foreground)
.monospaced()
.contentTransition(.numericText())
if container.sessionIDs.count == 1 {
Text(selectedHandler.host.description)
.bold() .bold()
.foregroundStyle(foreground) .foregroundStyle(foreground)
.monospaced() .monospaced()
.contentTransition(.numericText()) .font(.caption2)
if container.sessionIDs.count == 1 {
Text(selectedHandler.host.description)
.bold()
.foregroundStyle(foreground)
.monospaced()
.font(.caption2)
}
} }
Spacer() }
Spacer()
Button() {
showSnippetPicker.toggle()
} label: {
Image(systemName: "paperclip")
.resizable().scaledToFit()
.frame(width: 20, height: 20)
}
.foregroundStyle(foreground)
.popover(isPresented: $showSnippetPicker) {
SnippetPicker(hostsManager: hostsManager) {
selectedHandler.writeToChannel($0.content)
}
.frame(minWidth: 200, minHeight: 300)
.modifier(presentationCompactPopover())
}
Menu {
Button() { Button() {
showSnippetPicker.toggle() UIPasteboard.general.string = selectedHandler.scrollback.joined()
Haptic.success.trigger()
} label: { } label: {
Image(systemName: "paperclip") Label("Copy Scrollback", systemImage: "document.on.document")
.resizable().scaledToFit()
.frame(width: 20, height: 20)
} }
.foregroundStyle(foreground) } label: {
.popover(isPresented: $showSnippetPicker) { Image(systemName: "ellipsis")
SnippetPicker(hostsManager: hostsManager) { .resizable().scaledToFit()
selectedHandler.writeToChannel($0.content) .frame(width: 20, height: 20)
}
.frame(minWidth: 200, minHeight: 300)
.modifier(presentationCompactPopover())
}
Menu {
Button() {
UIPasteboard.general.string = selectedHandler.scrollback.joined()
Haptic.success.trigger()
} label: {
Label("Copy Scrollback", systemImage: "document.on.document")
}
} label: {
Image(systemName: "ellipsis")
.resizable().scaledToFit()
.frame(width: 20, height: 20)
}
.foregroundStyle(foreground)
} }
.padding(.horizontal, 10) .foregroundStyle(foreground)
.padding(.vertical, 10) }
.background(hostsManager.tint, ignoresSafeAreaEdges: .all) .padding(.horizontal, 10)
.frame(height: 40) .padding(.vertical, 10)
.background(hostsManager.tint, ignoresSafeAreaEdges: .all)
if container.sessionIDs.count > 1 { .frame(height: 40)
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 0) { if container.sessionIDs.count > 1 {
ForEach(container.sessionIDs, id: \.self) { id in ScrollView(.horizontal, showsIndicators: false) {
let selected: Bool = selectedID == id HStack(spacing: 0) {
ZStack { ForEach(container.sessionIDs, id: \.self) { id in
Rectangle() let selected: Bool = selectedID == id
.fill(selected ? hostsManager.tint : background) ZStack {
HStack { Rectangle()
Spacer() .fill(selected ? hostsManager.tint : background)
VStack { HStack {
if !selected { Spacer()
Text(container.sessions[id]!.handler.title) VStack {
.monospaced() if !selected {
.foregroundStyle(selected ? foreground : hostsManager.tint) Text(container.sessions[id]!.handler.title)
.opacity(0.7)
.font(.callout)
}
Text(container.sessions[id]!.handler.host.description)
.foregroundStyle(selected ? foreground : hostsManager.tint)
.opacity(selected ? 1 : 0.7)
.monospaced() .monospaced()
.bold(selected) .foregroundStyle(selected ? foreground : hostsManager.tint)
.font(.caption2) .opacity(0.7)
.font(.callout)
} }
Spacer() Text(container.sessions[id]!.handler.host.description)
.foregroundStyle(selected ? foreground : hostsManager.tint)
.opacity(selected ? 1 : 0.7)
.monospaced()
.bold(selected)
.font(.caption2)
} }
} Spacer()
.frame(width: oneTabWidth)
.onTapGesture {
withAnimation { selectedID = id }
} }
} }
} .frame(width: oneTabWidth)
} .onTapGesture {
.frame(height: 30) withAnimation { selectedID = id }
.onAppear {
if selectedID == nil {
if let handler {
selectedID = handler.sessionID
} else {
dismiss()
} }
} }
} }
} }
.frame(height: 30)
//the acc terminal lol .onAppear {
if let selectedID, if selectedID == nil {
let session = container.sessions[selectedID] { if let handler {
selectedID = handler.sessionID
} else {
dismiss()
}
}
}
}
//the acc terminal lol
if let selectedID,
let session = container.sessions[selectedID] {
ShellView(
handler: session.handler,
hostsManager: hostsManager
)
.onDisappear {
if !checkShell(session.handler.state) {
if let lastSession = container.sessionIDs.last {
withAnimation { self.selectedID = lastSession }
} else {
dismiss()
}
}
}
.id(selectedID)
.transition(.opacity)
} else {
if let handler {
ShellView( ShellView(
handler: session.handler, handler: handler,
hostsManager: hostsManager hostsManager: hostsManager
) )
.onDisappear { .onAppear {
if !checkShell(session.handler.state) { if selectedID == nil {
if let lastSession = container.sessionIDs.last { selectedID = handler.sessionID
withAnimation { self.selectedID = lastSession }
} else {
dismiss()
}
} }
} }
.id(selectedID)
.transition(.opacity)
} else { } else {
if let handler { Text("No Session")
ShellView(
handler: handler,
hostsManager: hostsManager
)
.onAppear {
if selectedID == nil {
selectedID = handler.sessionID
}
}
} else {
Text("No Session")
}
} }
} }
} }
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.