Files
ShhShell/ShhShell/Views/Sessions/SessionView.swift
neon443 80ddde3a62 applying themes on the fly!! (to sessions already active)
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
2025-06-29 16:39:03 +01:00

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()
)
}