Fixed Toolbar Visibility Issue
This commit is contained in:
parent
d889e3a6c2
commit
c6fbb1d6be
@ -52,59 +52,66 @@ struct TranscriptionHistoryView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack(spacing: 0) {
|
ZStack(alignment: .bottom) {
|
||||||
searchBar
|
VStack(spacing: 0) {
|
||||||
|
searchBar
|
||||||
|
|
||||||
if displayedTranscriptions.isEmpty && !isLoading {
|
if displayedTranscriptions.isEmpty && !isLoading {
|
||||||
emptyStateView
|
emptyStateView
|
||||||
} else {
|
} else {
|
||||||
ScrollView {
|
ScrollView {
|
||||||
LazyVStack(spacing: 10) {
|
LazyVStack(spacing: 10) {
|
||||||
ForEach(displayedTranscriptions) { transcription in
|
ForEach(displayedTranscriptions) { transcription in
|
||||||
TranscriptionCard(
|
TranscriptionCard(
|
||||||
transcription: transcription,
|
transcription: transcription,
|
||||||
isExpanded: expandedTranscription == transcription,
|
isExpanded: expandedTranscription == transcription,
|
||||||
isSelected: selectedTranscriptions.contains(transcription),
|
isSelected: selectedTranscriptions.contains(transcription),
|
||||||
onDelete: { deleteTranscription(transcription) },
|
onDelete: { deleteTranscription(transcription) },
|
||||||
onToggleSelection: { toggleSelection(transcription) }
|
onToggleSelection: { toggleSelection(transcription) }
|
||||||
)
|
)
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
expandedTranscription = expandedTranscription == transcription ? nil : transcription
|
expandedTranscription = expandedTranscription == transcription ? nil : transcription
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if hasMoreContent {
|
|
||||||
Button(action: {
|
|
||||||
loadMoreContent()
|
|
||||||
}) {
|
|
||||||
HStack(spacing: 8) {
|
|
||||||
if isLoading {
|
|
||||||
ProgressView()
|
|
||||||
.controlSize(.small)
|
|
||||||
}
|
|
||||||
Text(isLoading ? "Loading..." : "Load More")
|
|
||||||
.font(.system(size: 14, weight: .medium))
|
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity)
|
|
||||||
.padding(.vertical, 12)
|
|
||||||
.background(Color(.windowBackgroundColor).opacity(0.4))
|
|
||||||
.cornerRadius(8)
|
|
||||||
}
|
}
|
||||||
.buttonStyle(.plain)
|
|
||||||
.disabled(isLoading)
|
|
||||||
.padding(.top, 12)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.padding(24)
|
|
||||||
}
|
|
||||||
.padding(.vertical, 16)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if hasMoreContent {
|
||||||
|
Button(action: {
|
||||||
|
loadMoreContent()
|
||||||
|
}) {
|
||||||
|
HStack(spacing: 8) {
|
||||||
|
if isLoading {
|
||||||
|
ProgressView()
|
||||||
|
.controlSize(.small)
|
||||||
|
}
|
||||||
|
Text(isLoading ? "Loading..." : "Load More")
|
||||||
|
.font(.system(size: 14, weight: .medium))
|
||||||
|
}
|
||||||
|
.frame(maxWidth: .infinity)
|
||||||
|
.padding(.vertical, 12)
|
||||||
|
.background(Color(.windowBackgroundColor).opacity(0.4))
|
||||||
|
.cornerRadius(8)
|
||||||
|
}
|
||||||
|
.buttonStyle(.plain)
|
||||||
|
.disabled(isLoading)
|
||||||
|
.padding(.top, 12)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding(24)
|
||||||
|
// Add bottom padding to ensure content is not hidden by the toolbar when visible
|
||||||
|
.padding(.bottom, !selectedTranscriptions.isEmpty ? 60 : 0)
|
||||||
|
}
|
||||||
|
.padding(.vertical, 16)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.background(Color(NSColor.controlBackgroundColor))
|
||||||
|
|
||||||
|
// Selection toolbar as an overlay
|
||||||
if !selectedTranscriptions.isEmpty {
|
if !selectedTranscriptions.isEmpty {
|
||||||
selectionToolbar
|
selectionToolbar
|
||||||
|
.transition(.move(edge: .bottom).combined(with: .opacity))
|
||||||
|
.animation(.easeInOut(duration: 0.3), value: !selectedTranscriptions.isEmpty)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.background(Color(NSColor.controlBackgroundColor))
|
|
||||||
.alert("Delete Selected Items?", isPresented: $showDeleteConfirmation) {
|
.alert("Delete Selected Items?", isPresented: $showDeleteConfirmation) {
|
||||||
Button("Delete", role: .destructive) {
|
Button("Delete", role: .destructive) {
|
||||||
deleteSelectedTranscriptions()
|
deleteSelectedTranscriptions()
|
||||||
@ -208,7 +215,11 @@ struct TranscriptionHistoryView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding(16)
|
.padding(16)
|
||||||
.background(Color(.windowBackgroundColor))
|
.frame(maxWidth: .infinity)
|
||||||
|
.background(
|
||||||
|
Color(.windowBackgroundColor)
|
||||||
|
.shadow(color: Color.black.opacity(0.1), radius: 3, y: -2)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func loadInitialContent() async {
|
private func loadInitialContent() async {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user