Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 20 additions & 11 deletions Paicord/Baseplates/LargeBaseplate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
import DiscordModels
@_spi(Advanced) import SwiftUIIntrospect
import SwiftUIX

// makes a fallback to .automatic on iOS because topBarLeading is not available on macOS
@available(iOS, unavailable)
extension ToolbarItemPlacement {
@_disfavoredOverload
static var topBarLeading: Self { .automatic }
}

// if on macos or ipad
struct LargeBaseplate: View {
Expand All @@ -33,20 +40,22 @@ struct LargeBaseplate: View {
}
.toolbar(removing: .sidebarToggle)
.toolbar {
Group {
if columnVisibility != .detailOnly {
if let currentGuildStore {
Text(currentGuildStore.guild?.name ?? "Direct Messages")
.font(.title2)
.bold()
} else {
Text("Direct Messages")
.font(.title2)
.bold()
ToolbarItem(placement: .topBarLeading) {
Group {
if columnVisibility != .detailOnly {
if let currentGuildStore {
Text(currentGuildStore.guild?.name ?? "Direct Messages")
.font(.title2)
.bold()
} else {
Text("Direct Messages")
.font(.title2)
.bold()
}
}
}
.minimumScaleFactor(0.5)
}
.minimumScaleFactor(0.5)
}
.navigationSplitViewColumnWidth(min: 280, ideal: 310, max: 360)

Expand Down
39 changes: 23 additions & 16 deletions Paicord/macOS/Sidebar/ProfileBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ struct ProfileBar: View {
@State var showingUsername = false
@State var showingPopover = false
@State var barHovered = false
#if os(iOS)
@State var settingsSheetPresented = false
#endif

var body: some View {
HStack {
Expand Down Expand Up @@ -80,22 +83,26 @@ struct ProfileBar: View {
}

Spacer()

#if os(macOS)
Button {
openWindow(id: "settings")
} label: {
Image(systemName: "gearshape.fill")
.font(.title2)
.padding(5)
.background(.ultraThinMaterial)
.clipShape(.circle)
}
.buttonStyle(.borderless)
#elseif os(iOS)
/// targetting ipad here, ios wouldnt have this at all
// do something
#endif

Button {
#if os(macOS)
openWindow(id: "settings")
#elseif os(iOS)
settingsSheetPresented = true
#endif
} label: {
Image(systemName: "gearshape.fill")
.font(.title2)
.padding(5)
.background(.ultraThinMaterial)
.clipShape(.circle)
}
.buttonStyle(.borderless)
#if os(iOS)
.sheet(isPresented: $settingsSheetPresented) {
SettingsView()
}
#endif
}
.padding(8)
.background {
Expand Down
Loading