mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-04-27 15:17:38 +00:00
iOS: Update theme colors for FilePreviewView and XtermWebView
This commit is contained in:
parent
a94883c891
commit
c63da02a98
3 changed files with 24 additions and 11 deletions
|
|
@ -14,17 +14,27 @@ struct FilePreviewView: View {
|
||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
ZStack {
|
ZStack {
|
||||||
Theme.Colors.background
|
Theme.Colors.terminalBackground
|
||||||
.ignoresSafeArea()
|
.ignoresSafeArea()
|
||||||
|
|
||||||
if isLoading {
|
if isLoading {
|
||||||
ProgressView("Loading...")
|
ProgressView("Loading...")
|
||||||
.progressViewStyle(CircularProgressViewStyle(tint: Theme.Colors.primaryAccent))
|
.progressViewStyle(CircularProgressViewStyle(tint: Theme.Colors.primaryAccent))
|
||||||
} else if let error = error {
|
} else if let error = error {
|
||||||
ErrorView(message: error) {
|
VStack {
|
||||||
Task {
|
Text("Error loading file")
|
||||||
await loadPreview()
|
.font(.headline)
|
||||||
|
.foregroundColor(Theme.Colors.errorAccent)
|
||||||
|
Text(error)
|
||||||
|
.font(.subheadline)
|
||||||
|
.foregroundColor(Theme.Colors.terminalForeground)
|
||||||
|
.multilineTextAlignment(.center)
|
||||||
|
Button("Retry") {
|
||||||
|
Task {
|
||||||
|
await loadPreview()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
.terminalButton()
|
||||||
}
|
}
|
||||||
} else if let preview = preview {
|
} else if let preview = preview {
|
||||||
previewContent(for: preview)
|
previewContent(for: preview)
|
||||||
|
|
@ -213,7 +223,7 @@ struct GitDiffView: View {
|
||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
ZStack {
|
ZStack {
|
||||||
Theme.Colors.background
|
Theme.Colors.terminalBackground
|
||||||
.ignoresSafeArea()
|
.ignoresSafeArea()
|
||||||
|
|
||||||
DiffWebView(content: diff.diff)
|
DiffWebView(content: diff.diff)
|
||||||
|
|
|
||||||
|
|
@ -597,7 +597,8 @@ struct TerminalHostingView: UIViewRepresentable {
|
||||||
if let line = terminalInstance.getLine(row: row) {
|
if let line = terminalInstance.getLine(row: row) {
|
||||||
var lineText = ""
|
var lineText = ""
|
||||||
for col in 0..<terminalInstance.cols {
|
for col in 0..<terminalInstance.cols {
|
||||||
if let char = line.getChar(at: col) {
|
if col < line.count {
|
||||||
|
let char = line[col]
|
||||||
lineText += String(char.getCharacter())
|
lineText += String(char.getCharacter())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -295,7 +295,7 @@ struct XtermWebView: UIViewRepresentable {
|
||||||
case .output(_, let data):
|
case .output(_, let data):
|
||||||
writeToTerminal(data)
|
writeToTerminal(data)
|
||||||
|
|
||||||
case .resize(_, let dimensions):
|
case .resize(_, _):
|
||||||
// Handle resize if needed
|
// Handle resize if needed
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
@ -343,9 +343,9 @@ struct XtermWebView: UIViewRepresentable {
|
||||||
// Convert theme to xterm.js format
|
// Convert theme to xterm.js format
|
||||||
let themeJS = """
|
let themeJS = """
|
||||||
{
|
{
|
||||||
background: '\(theme.backgroundColor.hex)',
|
background: '\(theme.background.hex)',
|
||||||
foreground: '\(theme.textColor.hex)',
|
foreground: '\(theme.foreground.hex)',
|
||||||
cursor: '\(theme.cursorColor.hex)',
|
cursor: '\(theme.cursor.hex)',
|
||||||
selection: 'rgba(255, 255, 255, 0.3)'
|
selection: 'rgba(255, 255, 255, 0.3)'
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
|
@ -365,7 +365,8 @@ struct XtermWebView: UIViewRepresentable {
|
||||||
// MARK: - SSEClientDelegate
|
// MARK: - SSEClientDelegate
|
||||||
@MainActor
|
@MainActor
|
||||||
extension XtermWebView.Coordinator: SSEClientDelegate {
|
extension XtermWebView.Coordinator: SSEClientDelegate {
|
||||||
func sseClient(_ client: SSEClient, didReceiveEvent event: SSEClient.SSEEvent) {
|
nonisolated func sseClient(_ client: SSEClient, didReceiveEvent event: SSEClient.SSEEvent) {
|
||||||
|
Task { @MainActor in
|
||||||
switch event {
|
switch event {
|
||||||
case .terminalOutput(_, let type, let data):
|
case .terminalOutput(_, let type, let data):
|
||||||
if type == "o" { // output
|
if type == "o" { // output
|
||||||
|
|
@ -376,6 +377,7 @@ extension XtermWebView.Coordinator: SSEClientDelegate {
|
||||||
case .error(let error):
|
case .error(let error):
|
||||||
print("[XtermWebView] SSE error: \(error)")
|
print("[XtermWebView] SSE error: \(error)")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue