mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 21:36:17 +00:00
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:
@@ -57,6 +57,7 @@ struct HostSymbolPicker: View {
|
|||||||
}
|
}
|
||||||
.padding(10)
|
.padding(10)
|
||||||
}
|
}
|
||||||
|
.preferredColorScheme(.dark)
|
||||||
.scrollDisabled(true)
|
.scrollDisabled(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
||||||
|
.frame(height: 40)
|
||||||
|
|
||||||
if container.sessionIDs.count > 1 {
|
if container.sessionIDs.count > 1 {
|
||||||
ScrollView(.horizontal, showsIndicators: false) {
|
ScrollView(.horizontal, showsIndicators: false) {
|
||||||
HStack(spacing: 0) {
|
HStack(spacing: 0) {
|
||||||
ForEach(container.sessionIDs, id: \.self) { id in
|
ForEach(container.sessionIDs, id: \.self) { id in
|
||||||
let selected: Bool = selectedID == id
|
let selected: Bool = selectedID == id
|
||||||
ZStack {
|
ZStack {
|
||||||
Rectangle()
|
Rectangle()
|
||||||
.fill(selected ? hostsManager.tint : background)
|
.fill(selected ? hostsManager.tint : background)
|
||||||
HStack {
|
HStack {
|
||||||
Spacer()
|
Spacer()
|
||||||
VStack {
|
VStack {
|
||||||
if !selected {
|
if !selected {
|
||||||
Text(container.sessions[id]!.handler.title)
|
Text(container.sessions[id]!.handler.title)
|
||||||
.monospaced()
|
|
||||||
.foregroundStyle(selected ? foreground : hostsManager.tint)
|
|
||||||
.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)
|
||||||
|
.onAppear {
|
||||||
|
if selectedID == nil {
|
||||||
|
if let handler {
|
||||||
|
selectedID = handler.sessionID
|
||||||
|
} else {
|
||||||
|
dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//the acc terminal lol
|
//the acc terminal lol
|
||||||
if let selectedID,
|
if let selectedID,
|
||||||
let session = container.sessions[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