mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 13:26:16 +00:00
added applySelectedTheme to sshhandler which will run applyselectedtheme on the terminalview if it exists added applyselectedtheme to apply the chosen theme in hostsmanager applying of the chosen theme on appear of any shell view made the tap target for sessions actually the whole list item fix undefined behaivour from modifying published values from background threads
50 lines
1.0 KiB
Swift
50 lines
1.0 KiB
Swift
//
|
|
// SessionView.swift
|
|
// ShhShell
|
|
//
|
|
// Created by neon443 on 29/06/2025.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct SessionView: View {
|
|
@ObservedObject var hostsManager: HostsManager
|
|
@ObservedObject var container = TerminalViewContainer.shared
|
|
|
|
@State var key: UUID
|
|
@State var shellPresented: Bool = false
|
|
|
|
var host: Host {
|
|
container.sessions[key]?.handler.host ?? Host.blank
|
|
}
|
|
|
|
var body: some View {
|
|
Button() {
|
|
shellPresented.toggle()
|
|
} label: {
|
|
HStack {
|
|
Image(systemName: "apple.terminal")
|
|
.resizable().scaledToFit()
|
|
.frame(width: 40, height: 40)
|
|
.foregroundStyle(.terminalGreen)
|
|
SymbolPreview(symbol: host.symbol, label: host.label)
|
|
.frame(width: 40, height: 40)
|
|
Text(hostsManager.makeLabel(forHost: host))
|
|
}
|
|
}
|
|
.fullScreenCover(isPresented: $shellPresented) {
|
|
ShellView(
|
|
handler: container.sessions[key]?.handler ?? SSHHandler(host: Host.blank),
|
|
hostsManager: hostsManager
|
|
)
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
SessionView(
|
|
hostsManager: HostsManager(),
|
|
key: UUID()
|
|
)
|
|
}
|