Skip to content

Commit

Permalink
Merge pull request #275 from AvdLee/feature/macos-session-view-improv…
Browse files Browse the repository at this point in the history
…ements

macOS Session View improvements
  • Loading branch information
kean authored Jul 1, 2024
2 parents bb0a835 + b636cf5 commit 9c5f3fc
Showing 1 changed file with 27 additions and 15 deletions.
42 changes: 27 additions & 15 deletions Sources/PulseUI/Features/Sessions/SessionListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,34 +27,42 @@ struct SessionListView: View {
@Environment(\.store) private var store

var body: some View {
if sessions.isEmpty {
Text("No Recorded Sessions")
.frame(maxWidth: .infinity, maxHeight: .infinity)
.foregroundColor(.secondary)
} else {
content
.onAppear { refreshGroups() }
.onChange(of: sessions.count) { _ in refreshGroups() }
VStack(spacing: 0) {
#if os(macOS)
Text("Recorded sessions")
.padding(.vertical, 10)
Divider()
#endif
if sessions.isEmpty {
Text("No Recorded Sessions")
.frame(maxWidth: .infinity, maxHeight: .infinity)
.foregroundColor(.secondary)
} else {
content
.onAppear { refreshGroups() }
.onChange(of: sessions.count) { _ in refreshGroups() }
}
}
}

@ViewBuilder
private var content: some View {
#if os(macOS)
VStack {
VStack(spacing: 0) {
list
HStack {

#if PULSE_STANDALONE_APP
HStack {
NavigatorFilterBar(text: $filterTerm)
.frame(maxWidth: 200)
.help("Show sessions with matching name")
}
#else
SearchBar(title: "Filter", imageName: "line.3.horizontal.decrease.circle", text: $filterTerm)
.frame(maxWidth: 200)
.help("Show sessions with matching name")
Divider()
SearchBar(title: "Filter", imageName: "line.3.horizontal.decrease.circle", text: $filterTerm)
.help("Show sessions with matching name")
.padding(8)
#endif
Spacer()
}.padding(8)
}
#else
list
Expand Down Expand Up @@ -92,10 +100,14 @@ struct SessionListView: View {

private func makeHeader(for startDate: Date, sessions: [LoggerSessionEntity]) -> some View {
HStack {
#if os(macOS)
PlainListSectionHeaderSeparator(title: sectionTitleFormatter.string(from: startDate) + " (\(sessions.count))")
#else
(Text(sectionTitleFormatter.string(from: startDate)) +
Text(" (\(sessions.count))").foregroundColor(.secondary.opacity(0.5)))
.font(.headline)
.padding(.vertical, 6)
#endif

#if os(iOS) || os(visionOS)
if editMode?.wrappedValue.isEditing ?? false {
Expand Down

0 comments on commit 9c5f3fc

Please sign in to comment.