Fix errors
This commit is contained in:
parent
531da7b172
commit
0b6c9bccc1
@ -14,7 +14,10 @@ class HistoryWindowController: NSObject, NSWindowDelegate {
|
||||
}
|
||||
|
||||
func showHistoryWindow(modelContainer: ModelContainer, whisperState: WhisperState) {
|
||||
if let existingWindow = historyWindow, existingWindow.isVisible {
|
||||
if let existingWindow = historyWindow {
|
||||
if existingWindow.isMiniaturized {
|
||||
existingWindow.deminiaturize(nil)
|
||||
}
|
||||
existingWindow.makeKeyAndOrderFront(nil)
|
||||
NSApplication.shared.activate(ignoringOtherApps: true)
|
||||
return
|
||||
|
||||
@ -113,36 +113,14 @@ struct ContentView: View {
|
||||
whisperState: whisperState
|
||||
)
|
||||
}) {
|
||||
HStack(spacing: 12) {
|
||||
Image(systemName: viewType.icon)
|
||||
.font(.system(size: 18, weight: .medium))
|
||||
.frame(width: 24, height: 24)
|
||||
|
||||
Text(viewType.rawValue)
|
||||
.font(.system(size: 14, weight: .medium))
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.vertical, 8)
|
||||
.padding(.horizontal, 2)
|
||||
SidebarItemView(viewType: viewType)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.listRowInsets(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0))
|
||||
.listRowSeparator(.hidden)
|
||||
} else {
|
||||
NavigationLink(value: viewType) {
|
||||
HStack(spacing: 12) {
|
||||
Image(systemName: viewType.icon)
|
||||
.font(.system(size: 18, weight: .medium))
|
||||
.frame(width: 24, height: 24)
|
||||
|
||||
Text(viewType.rawValue)
|
||||
.font(.system(size: 14, weight: .medium))
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.vertical, 8)
|
||||
.padding(.horizontal, 2)
|
||||
SidebarItemView(viewType: viewType)
|
||||
}
|
||||
.listRowInsets(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0))
|
||||
.listRowSeparator(.hidden)
|
||||
@ -225,4 +203,22 @@ struct ContentView: View {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private struct SidebarItemView: View {
|
||||
let viewType: ViewType
|
||||
|
||||
var body: some View {
|
||||
HStack(spacing: 12) {
|
||||
Image(systemName: viewType.icon)
|
||||
.font(.system(size: 18, weight: .medium))
|
||||
.frame(width: 24, height: 24)
|
||||
|
||||
Text(viewType.rawValue)
|
||||
.font(.system(size: 14, weight: .medium))
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.vertical, 8)
|
||||
.padding(.horizontal, 2)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -357,8 +357,13 @@ struct TranscriptionHistoryView: View {
|
||||
selectedTranscriptions.remove(transcription)
|
||||
|
||||
Task {
|
||||
try? modelContext.save()
|
||||
await loadInitialContent()
|
||||
do {
|
||||
try modelContext.save()
|
||||
await loadInitialContent()
|
||||
} catch {
|
||||
print("Error saving deletion: \(error.localizedDescription)")
|
||||
await loadInitialContent()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -377,8 +382,13 @@ struct TranscriptionHistoryView: View {
|
||||
selectedTranscriptions.removeAll()
|
||||
|
||||
Task {
|
||||
try? modelContext.save()
|
||||
await loadInitialContent()
|
||||
do {
|
||||
try modelContext.save()
|
||||
await loadInitialContent()
|
||||
} catch {
|
||||
print("Error saving deletion: \(error.localizedDescription)")
|
||||
await loadInitialContent()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user