Minor layout fixes

This commit is contained in:
Arkadiusz Fal 2022-12-16 00:13:36 +01:00
parent f1551141e3
commit d19446d37d
3 changed files with 14 additions and 42 deletions

View File

@ -15,12 +15,16 @@ struct AccountViewButton: View {
Button { Button {
navigation.presentingAccounts = true navigation.presentingAccounts = true
} label: { } label: {
HStack { HStack(spacing: 6) {
if !accountPickerDisplaysUsername || !(model.current?.isPublic ?? true) { if !accountPickerDisplaysUsername || !(model.current?.isPublic ?? true) {
if let name = model.current?.app?.rawValue.capitalized { if #available(iOS 15, macOS 12, *) {
Image(name) if let name = model.current?.app?.rawValue.capitalized {
.resizable() Image(name)
.frame(width: accountImageSize, height: accountImageSize) .resizable()
.frame(width: accountImageSize, height: accountImageSize)
} else {
Image(systemName: "globe")
}
} else { } else {
Image(systemName: "globe") Image(systemName: "globe")
} }

View File

@ -32,6 +32,7 @@ struct SearchTextField: View {
.frame(maxWidth: 190) .frame(maxWidth: 190)
.textFieldStyle(.plain) .textFieldStyle(.plain)
#else #else
.frame(minWidth: 200)
.textFieldStyle(.roundedBorder) .textFieldStyle(.roundedBorder)
.padding(.horizontal, 5) .padding(.horizontal, 5)
.padding(.trailing, state.queryText.isEmpty ? 0 : 10) .padding(.trailing, state.queryText.isEmpty ? 0 : 10)
@ -47,6 +48,7 @@ struct SearchTextField: View {
} }
} }
} }
.transaction { t in t.animation = nil }
} }
private var fieldBorder: some View { private var fieldBorder: some View {

View File

@ -169,18 +169,11 @@ struct SearchView: View {
#endif #endif
#if os(iOS) #if os(iOS)
.toolbar { .toolbar {
ToolbarItemGroup(placement: .navigationBarLeading) { ToolbarItem(placement: .navigationBarLeading) {
if !navigationBarHidden { searchMenu
Button(action: { NavigationModel.shared.presentingSettings = true }) {
Image(systemName: "gearshape.2")
}
}
} }
ToolbarItem(placement: .principal) { ToolbarItem(placement: .principal) {
HStack(spacing: 0) { SearchTextField()
searchMenu
SearchTextField()
}
} }
} }
.navigationBarTitleDisplayMode(.inline) .navigationBarTitleDisplayMode(.inline)
@ -231,33 +224,6 @@ struct SearchView: View {
} }
#endif #endif
private var navigationBarHidden: Bool {
if navigationStyle == .sidebar {
return true
}
let preferred = Defaults[.visibleSections]
var visibleSections = [VisibleSection]()
if accounts.app.supportsPopular && preferred.contains(.popular) {
visibleSections.append(.popular)
}
if accounts.app.supportsSubscriptions && accounts.signedIn && preferred.contains(.subscriptions) {
visibleSections.append(.subscriptions)
}
if accounts.app.supportsUserPlaylists && accounts.signedIn && preferred.contains(.playlists) {
visibleSections.append(.playlists)
}
if preferred.contains(.trending) {
visibleSections.append(.trending)
}
return !visibleSections.isEmpty || showHome
}
private var results: some View { private var results: some View {
VStack { VStack {
if showRecentQueries { if showRecentQueries {