Skip to content
Merged
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
28 changes: 17 additions & 11 deletions Piperly/App/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,29 @@ struct ContentView: View {

Spacer()

Picker("Reader Profile", selection: activeProfileSelection) {
Menu {
ForEach(bookStore.profiles) { profile in
Label(profile.name, systemImage: profile.avatarSymbol)
.tag(profile.id)
Button {
bookStore.selectProfile(profile.id)
} label: {
Label(
profile.name,
systemImage: profile.id == bookStore.activeProfile.id ? "checkmark" : profile.avatarSymbol
)
}
}
} label: {
HStack(spacing: 6) {
Label(bookStore.activeProfile.name, systemImage: bookStore.activeProfile.avatarSymbol)
Image(systemName: "chevron.up.chevron.down")
.font(.caption)
}
}
.pickerStyle(.menu)
.foregroundStyle(Piperly.Colors.accent)
.buttonStyle(.bordered)
.tint(Piperly.Colors.accent)
.accessibilityLabel("Reader Profile")
.accessibilityValue(bookStore.activeProfile.name)

HStack(spacing: 12) {
Button {
Expand Down Expand Up @@ -108,11 +121,4 @@ struct ContentView: View {
}
}
}

private var activeProfileSelection: Binding<UUID> {
Binding(
get: { bookStore.activeProfile.id },
set: { bookStore.selectProfile($0) }
)
}
}
Loading