import SwiftUI struct MenuPanelView: View { let content: MenuPanelContent let height: CGFloat @Environment(\.accessibilityReduceTransparency) private var reduceTransparency var body: some View { VStack(spacing: 0) { ScrollView { VStack(alignment: .leading, spacing: 16) { VStack(alignment: .leading, spacing: 8) { HStack { Text(UIStrings.text("Parcel")).font(.title3).fontWeight(.semibold) Spacer() if let automatic = content.command(.toggleAutomaticTiling) { MenuPanelToggle(item: automatic, content: content) .font(.subheadline) .fixedSize(horizontal: false, vertical: true) } } Text(content.status) .font(.caption) .foregroundStyle(.secondary) .fixedSize(horizontal: false, vertical: true) } if let problem = content.item("menu.problem") { MenuPanelNotice(item: problem, content: content) } if content.canArrange { MenuPanelArrangement(content: content) } else { HStack { Menu(UIStrings.text("Layout")) { MenuPanelCommands(items: content.layoutItems, content: content) } Menu(MenuText.text("Tile count")) { MenuPanelCommands(items: content.countItems, content: content) } } } MenuPanelModes(content: content) } .padding(16) } .scrollBounceBehavior(.basedOnSize) Divider().padding(.horizontal, 16) footer.padding(16).fixedSize(horizontal: false, vertical: true) } .frame(width: 380, height: height) .background(reduceTransparency ? Color(nsColor: .windowBackgroundColor) : .clear) .onExitCommand(perform: content.dismiss) } private var footer: some View { HStack { if let settings = content.command(.openSettings) { Button { content.perform(settings) } label: { Label(settings.title, systemImage: "gearshape") } .buttonStyle(.borderless) } Spacer() if let shortcuts = content.item("menu.shortcuts") { Button { content.perform(shortcuts) } label: { Image(systemName: "keyboard") } .buttonStyle(.borderless) .help(shortcuts.title) .accessibilityLabel(shortcuts.title) } Menu(MenuText.text("More")) { MenuPanelCommands( items: [content.item("menu.tour")].compactMap { $0 } + (content.item("menu.more")?.submenu?.items ?? []) + [content.command(.quit)].compactMap { $0 }, content: content) } .fixedSize() .menuStyle(.borderlessButton) } .font(.subheadline) } }