FollowButton: show "Follows You" if they follow you

Changelog-Changed: Show "Follow Back" button on profile page
This commit is contained in:
William Casarin
2023-02-07 10:21:21 -08:00
parent b882a96206
commit 09f12845c0
3 changed files with 16 additions and 8 deletions

View File

@@ -12,13 +12,14 @@ struct FollowButtonView: View {
@Environment(\.colorScheme) var colorScheme
let target: FollowTarget
let follows_you: Bool
@State var follow_state: FollowState
var body: some View {
Button {
follow_state = perform_follow_btn_action(follow_state, target: target)
} label: {
Text(follow_btn_txt(follow_state))
Text(follow_btn_txt(follow_state, follows_you: follows_you))
.frame(width: 105, height: 30)
//.padding(.vertical, 10)
.font(.caption.weight(.bold))
@@ -70,16 +71,19 @@ struct FollowButtonPreviews: View {
var body: some View {
VStack {
Text("Unfollows", comment: "Text to indicate that the button next to it is in a state that will unfollow a profile when tapped.")
FollowButtonView(target: target, follow_state: .unfollows)
FollowButtonView(target: target, follows_you: false, follow_state: .unfollows)
Text("Following", comment: "Text to indicate that the button next to it is in a state that indicates that it is in the process of following a profile.")
FollowButtonView(target: target, follow_state: .following)
FollowButtonView(target: target, follows_you: false, follow_state: .following)
Text("Follows", comment: "Text to indicate that button next to it is in a state that will follow a profile when tapped.")
FollowButtonView(target: target, follows_you: false, follow_state: .follows)
Text("Follows", comment: "Text to indicate that button next to it is in a state that will follow a profile when tapped.")
FollowButtonView(target: target, follow_state: .follows)
FollowButtonView(target: target, follows_you: true, follow_state: .follows)
Text("Unfollowing", comment: "Text to indicate that the button next to it is in a state that indicates that it is in the process of unfollowing a profile.")
FollowButtonView(target: target, follow_state: .unfollowing)
FollowButtonView(target: target, follows_you: false, follow_state: .unfollowing)
}
}
}