Skip to content

Commit 2a79a25

Browse files
committed
style(menubar): improve the style ef menubar items
1 parent 0692f2d commit 2a79a25

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

Reframed/UI/MenuBarView.swift

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ struct MenuBarView: View {
2222
@State private var totalProjectCount: Int = 0
2323
@Environment(\.colorScheme) private var colorScheme
2424

25+
private var isBusy: Bool {
26+
if case .idle = session.state { return false }
27+
if case .editing = session.state { return false }
28+
return true
29+
}
30+
2531
var body: some View {
2632
let _ = colorScheme
2733
HoverEffectScope {
@@ -37,6 +43,7 @@ struct MenuBarView: View {
3743
}
3844
}
3945
.hoverEffect(id: "menu.newRecording")
46+
.disabled(isBusy)
4047
.padding(.horizontal, 12)
4148

4249
MenuBarActionRow(
@@ -50,6 +57,7 @@ struct MenuBarView: View {
5057
session.selectMode(.entireScreen)
5158
}
5259
.hoverEffect(id: "menu.displayMode")
60+
.disabled(isBusy)
5361
.padding(.horizontal, 12)
5462

5563
MenuBarActionRow(
@@ -63,6 +71,7 @@ struct MenuBarView: View {
6371
session.selectMode(.selectedWindow)
6472
}
6573
.hoverEffect(id: "menu.windowMode")
74+
.disabled(isBusy)
6675
.padding(.horizontal, 12)
6776

6877
MenuBarActionRow(
@@ -76,6 +85,7 @@ struct MenuBarView: View {
7685
session.selectMode(.selectedArea)
7786
}
7887
.hoverEffect(id: "menu.areaMode")
88+
.disabled(isBusy)
7989
.padding(.horizontal, 12)
8090

8191
MenuBarDivider()
@@ -95,9 +105,12 @@ struct MenuBarView: View {
95105
session.openProject(at: project.url)
96106
}
97107
.hoverEffect(id: "menu.project.\(project.id)")
108+
.disabled(isBusy)
98109
.padding(.horizontal, 12)
99110
}
100111

112+
MenuBarDivider()
113+
101114
MenuBarActionRow(
102115
icon: "folder",
103116
title: "Open Projects Folder",
@@ -108,6 +121,7 @@ struct MenuBarView: View {
108121
NSWorkspace.shared.open(URL(fileURLWithPath: path))
109122
}
110123
.hoverEffect(id: "menu.openProjects")
124+
.disabled(isBusy)
111125
.padding(.horizontal, 12)
112126
}
113127

@@ -270,7 +284,7 @@ private struct ProjectRow: View {
270284
Spacer()
271285
}
272286
.padding(.horizontal, 10)
273-
.padding(.vertical, 10)
287+
.padding(.vertical, 4)
274288
.contentShape(Rectangle())
275289
}
276290
.buttonStyle(.plain)
@@ -328,7 +342,7 @@ private struct MenuBarActionRow: View {
328342
}
329343
}
330344
.padding(.horizontal, 10)
331-
.padding(.vertical, 10)
345+
.padding(.vertical, 6)
332346
.contentShape(Rectangle())
333347
}
334348
.buttonStyle(.plain)

0 commit comments

Comments
 (0)