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) {
|
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)
|
existingWindow.makeKeyAndOrderFront(nil)
|
||||||
NSApplication.shared.activate(ignoringOtherApps: true)
|
NSApplication.shared.activate(ignoringOtherApps: true)
|
||||||
return
|
return
|
||||||
|
|||||||
@ -113,36 +113,14 @@ struct ContentView: View {
|
|||||||
whisperState: whisperState
|
whisperState: whisperState
|
||||||
)
|
)
|
||||||
}) {
|
}) {
|
||||||
HStack(spacing: 12) {
|
SidebarItemView(viewType: viewType)
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
.buttonStyle(.plain)
|
.buttonStyle(.plain)
|
||||||
.listRowInsets(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0))
|
.listRowInsets(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0))
|
||||||
.listRowSeparator(.hidden)
|
.listRowSeparator(.hidden)
|
||||||
} else {
|
} else {
|
||||||
NavigationLink(value: viewType) {
|
NavigationLink(value: viewType) {
|
||||||
HStack(spacing: 12) {
|
SidebarItemView(viewType: viewType)
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
.listRowInsets(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0))
|
.listRowInsets(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0))
|
||||||
.listRowSeparator(.hidden)
|
.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)
|
selectedTranscriptions.remove(transcription)
|
||||||
|
|
||||||
Task {
|
Task {
|
||||||
try? modelContext.save()
|
do {
|
||||||
await loadInitialContent()
|
try modelContext.save()
|
||||||
|
await loadInitialContent()
|
||||||
|
} catch {
|
||||||
|
print("Error saving deletion: \(error.localizedDescription)")
|
||||||
|
await loadInitialContent()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,8 +382,13 @@ struct TranscriptionHistoryView: View {
|
|||||||
selectedTranscriptions.removeAll()
|
selectedTranscriptions.removeAll()
|
||||||
|
|
||||||
Task {
|
Task {
|
||||||
try? modelContext.save()
|
do {
|
||||||
await loadInitialContent()
|
try modelContext.save()
|
||||||
|
await loadInitialContent()
|
||||||
|
} catch {
|
||||||
|
print("Error saving deletion: \(error.localizedDescription)")
|
||||||
|
await loadInitialContent()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user