Profile Editor

Changelog-Added: Added profile edit view
Changelog-Changed: Don't fetch followers right away
This commit is contained in:
William Casarin
2022-12-23 13:13:30 -08:00
parent db763d07fe
commit 79f4223977
5 changed files with 114 additions and 69 deletions

View File

@@ -13,14 +13,9 @@ struct FollowButtonView: View {
let target: FollowTarget
@State var follow_state: FollowState
let perform: (() -> Void)?
var body: some View {
Button {
if perform != nil {
perform!()
}
follow_state = perform_follow_btn_action(follow_state, target: target)
} label: {
Text(follow_btn_txt(follow_state))
@@ -71,19 +66,16 @@ struct FollowButtonPreviews: View {
var body: some View {
VStack {
Text("Unfollows")
FollowButtonView(target: target, follow_state: .unfollows, perform: nil)
FollowButtonView(target: target, follow_state: .unfollows)
Text("Following")
FollowButtonView(target: target, follow_state: .following, perform: nil)
FollowButtonView(target: target, follow_state: .following)
Text("Follows")
FollowButtonView(target: target, follow_state: .follows, perform: nil)
FollowButtonView(target: target, follow_state: .follows)
Text("Unfollowing")
FollowButtonView(target: target, follow_state: .unfollowing, perform: nil)
Text("Edit")
FollowButtonView(target: target, follow_state: .edit, perform: nil)
FollowButtonView(target: target, follow_state: .unfollowing)
}
}
}
@@ -106,8 +98,6 @@ func perform_follow_btn_action(_ fs: FollowState, target: FollowTarget) -> Follo
case .unfollows:
notify(.follow, target)
return .unfollowing
case .edit:
return .edit
}
}