small improvements and allowing user to delete

This commit is contained in:
talksik
2021-12-25 04:12:25 -08:00
parent 6ad872d793
commit 781547a35b
4 changed files with 18 additions and 9 deletions
@@ -11,6 +11,7 @@ import NavigationStack
struct CircleFooterView: View {
@EnvironmentObject var navigationStack: NavigationStack
@EnvironmentObject var authSessionStore: AuthSessionStore
@EnvironmentObject var innerCircleVM: InnerCircleViewModel
@Binding var selectedFriendIndex: String?
@@ -34,6 +35,20 @@ struct CircleFooterView: View {
.frame(width: 40, height: 40)
.clipShape(Circle())
.padding(5)
.contextMenu {
Button(role: .destructive) {
print("deactivating friend...removing from circle")
if self.authSessionStore.user?.id != nil && self.selectedFriendIndex != nil {
self.innerCircleVM.activateOrDeactiveInboxUser(activate: false, userId: self.authSessionStore.user!.id!, friendId: self.selectedFriendIndex!) {res in
print(res)
self.selectedFriendIndex = nil // making this footer disappear although a view change should do this
}
}
} label: {
Label("Remove from Circle", systemImage: "person.crop.circle.fill.badge.minus")
}
}
}
@@ -80,13 +80,9 @@ struct CircleGridView: View {
// check if the last message in the conversation between me and my friend was me talking or him
if self.haveNewMessageFromFriend(friendDbId: friendId) { // him talking
Image(systemName: "wave.3.right.circle.fill")
Image(systemName: "arrow.down.left.circle.fill")
.foregroundColor(Color.orange)
.font(.title2)
} else {
Image(systemName: "wave.3.right.circle.fill")
.foregroundColor(NirvanaColor.dimTeal)
.font(.title2)
}
//
Image(self.authSessionStore.relevantUsersDict[friendId]?.avatar ?? Avatars.avatarSystemNames[0])
@@ -164,8 +160,6 @@ struct CircleGridView: View {
.foregroundColor(Color.orange)
.font(.title)
Text("\(activeFriends.count)")
Circle()
.foregroundColor(Color.orange.opacity(0.4))
.blur(radius: 5)
@@ -111,7 +111,7 @@ struct CircleNavigationView: View {
Button {
self.alertActive.toggle()
self.alertText = "👯‍♂ Coming Soon!"
self.alertText = " Coming Soon!"
self.alertSubtext = "Stay posted for buttery smooth convos with groups! We will be limiting you to 3 circles!"
} label: {
@@ -98,7 +98,7 @@ struct InnerCircleView: View {
Spacer()
}
CircleFooterView(selectedFriendIndex: self.$selectedFriendIndex)
CircleFooterView(selectedFriendIndex: self.$selectedFriendIndex).environmentObject(innerCircleVM)
// helper for new users
// TODO: make it back to 1 instead of 10...testing