mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-26 10:11:00 +00:00
Accounts selector: Add correct initial height
This commit is contained in:
parent
8b4f6dbd05
commit
5c9122a72c
1 changed files with 8 additions and 2 deletions
|
@ -16,7 +16,7 @@ public struct AppAccountsSelectorView: View {
|
||||||
private let accountCreationEnabled: Bool
|
private let accountCreationEnabled: Bool
|
||||||
private let avatarSize: AvatarView.Size
|
private let avatarSize: AvatarView.Size
|
||||||
|
|
||||||
var showNotificationBadge: Bool {
|
private var showNotificationBadge: Bool {
|
||||||
accountsViewModel
|
accountsViewModel
|
||||||
.filter { $0.account?.id != currentAccount.account?.id }
|
.filter { $0.account?.id != currentAccount.account?.id }
|
||||||
.compactMap { $0.appAccount.oauthToken }
|
.compactMap { $0.appAccount.oauthToken }
|
||||||
|
@ -24,6 +24,12 @@ public struct AppAccountsSelectorView: View {
|
||||||
.reduce(0, +) > 0
|
.reduce(0, +) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var preferredHeight: CGFloat {
|
||||||
|
var baseHeight: CGFloat = 220
|
||||||
|
baseHeight += CGFloat(60 * accountsViewModel.count)
|
||||||
|
return baseHeight
|
||||||
|
}
|
||||||
|
|
||||||
public init(routerPath: RouterPath,
|
public init(routerPath: RouterPath,
|
||||||
accountCreationEnabled: Bool = true,
|
accountCreationEnabled: Bool = true,
|
||||||
avatarSize: AvatarView.Size = .badge)
|
avatarSize: AvatarView.Size = .badge)
|
||||||
|
@ -41,7 +47,7 @@ public struct AppAccountsSelectorView: View {
|
||||||
labelView
|
labelView
|
||||||
}
|
}
|
||||||
.sheet(isPresented: $isPresented, content: {
|
.sheet(isPresented: $isPresented, content: {
|
||||||
accountsView.presentationDetents([.medium, .large])
|
accountsView.presentationDetents([.height(preferredHeight), .large])
|
||||||
.onAppear {
|
.onAppear {
|
||||||
refreshAccounts()
|
refreshAccounts()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue