Skip to content

Commit 9c5f3fc

Browse files
authored
Merge pull request #275 from AvdLee/feature/macos-session-view-improvements
macOS Session View improvements
2 parents bb0a835 + b636cf5 commit 9c5f3fc

File tree

1 file changed

+27
-15
lines changed

1 file changed

+27
-15
lines changed

Sources/PulseUI/Features/Sessions/SessionListView.swift

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,34 +27,42 @@ struct SessionListView: View {
2727
@Environment(\.store) private var store
2828

2929
var body: some View {
30-
if sessions.isEmpty {
31-
Text("No Recorded Sessions")
32-
.frame(maxWidth: .infinity, maxHeight: .infinity)
33-
.foregroundColor(.secondary)
34-
} else {
35-
content
36-
.onAppear { refreshGroups() }
37-
.onChange(of: sessions.count) { _ in refreshGroups() }
30+
VStack(spacing: 0) {
31+
#if os(macOS)
32+
Text("Recorded sessions")
33+
.padding(.vertical, 10)
34+
Divider()
35+
#endif
36+
if sessions.isEmpty {
37+
Text("No Recorded Sessions")
38+
.frame(maxWidth: .infinity, maxHeight: .infinity)
39+
.foregroundColor(.secondary)
40+
} else {
41+
content
42+
.onAppear { refreshGroups() }
43+
.onChange(of: sessions.count) { _ in refreshGroups() }
44+
}
3845
}
3946
}
4047

4148
@ViewBuilder
4249
private var content: some View {
4350
#if os(macOS)
44-
VStack {
51+
VStack(spacing: 0) {
4552
list
46-
HStack {
53+
4754
#if PULSE_STANDALONE_APP
55+
HStack {
4856
NavigatorFilterBar(text: $filterTerm)
4957
.frame(maxWidth: 200)
5058
.help("Show sessions with matching name")
59+
}
5160
#else
52-
SearchBar(title: "Filter", imageName: "line.3.horizontal.decrease.circle", text: $filterTerm)
53-
.frame(maxWidth: 200)
54-
.help("Show sessions with matching name")
61+
Divider()
62+
SearchBar(title: "Filter", imageName: "line.3.horizontal.decrease.circle", text: $filterTerm)
63+
.help("Show sessions with matching name")
64+
.padding(8)
5565
#endif
56-
Spacer()
57-
}.padding(8)
5866
}
5967
#else
6068
list
@@ -92,10 +100,14 @@ struct SessionListView: View {
92100

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

100112
#if os(iOS) || os(visionOS)
101113
if editMode?.wrappedValue.isEditing ?? false {

0 commit comments

Comments
 (0)