mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 13:26:16 +00:00
made the session list view more pretty terminalviewcontaner has a static shared property which is an instance of itself then it has sessions inside with a dict of uuid:terminalcontainer inside hostsview is in the section "hosts"
49 lines
1018 B
Swift
49 lines
1018 B
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 {
|
|
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))
|
|
}
|
|
.onTapGesture {
|
|
shellPresented.toggle()
|
|
}
|
|
.fullScreenCover(isPresented: $shellPresented) {
|
|
ShellView(
|
|
handler: container.sessions[key]?.handler ?? SSHHandler(host: Host.blank),
|
|
hostsManager: hostsManager
|
|
)
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
SessionView(
|
|
hostsManager: HostsManager(),
|
|
key: UUID()
|
|
)
|
|
}
|