mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-06-09 08:49:36 +00:00
4189a59cf6
* Initial iOS 17 + Observable migration * More Observation * More observation * Checkpoint * Checkpoint * Bump version to 1.8.0 * SwiftFormat * Fix home timeline switch on login * Fix sidebar routerPath * Fixes on detail view * Remove print changes * Simply detail view * More opt * Migrate DisplaySettingsLocalValues * Better post detail transition * Status detail animation finally right * Cleanup
42 lines
1 KiB
Swift
42 lines
1 KiB
Swift
import Env
|
|
import Models
|
|
import SwiftUI
|
|
|
|
public struct FollowRequestButtons: View {
|
|
@Environment(CurrentAccount.self) private var currentAccount
|
|
|
|
let account: Account
|
|
let requestUpdated: (() -> Void)?
|
|
|
|
public init(account: Account, requestUpdated: (() -> Void)? = nil) {
|
|
self.account = account
|
|
self.requestUpdated = requestUpdated
|
|
}
|
|
|
|
public var body: some View {
|
|
HStack {
|
|
Button {
|
|
Task {
|
|
await currentAccount.acceptFollowerRequest(id: account.id)
|
|
requestUpdated?()
|
|
}
|
|
} label: {
|
|
Text("account.follow-request.accept")
|
|
.frame(maxWidth: .infinity)
|
|
}
|
|
Button {
|
|
Task {
|
|
await currentAccount.rejectFollowerRequest(id: account.id)
|
|
requestUpdated?()
|
|
}
|
|
} label: {
|
|
Text("account.follow-request.reject")
|
|
.frame(maxWidth: .infinity)
|
|
}
|
|
}
|
|
.buttonStyle(.bordered)
|
|
.disabled(currentAccount.updatingFollowRequestAccountIds.contains(account.id))
|
|
.padding(.top, 4)
|
|
}
|
|
}
|