diff --git a/damus.xcodeproj/project.pbxproj b/damus.xcodeproj/project.pbxproj index 9da6aeca..4578b62a 100644 --- a/damus.xcodeproj/project.pbxproj +++ b/damus.xcodeproj/project.pbxproj @@ -223,7 +223,7 @@ F7908E92298B0F0700AB113A /* RelayDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7908E91298B0F0700AB113A /* RelayDetailView.swift */; }; F7908E97298B1FDF00AB113A /* NIPURLBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7908E96298B1FDF00AB113A /* NIPURLBuilder.swift */; }; F7F0BA25297892BD009531F3 /* SwipeToDismiss.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7F0BA24297892BD009531F3 /* SwipeToDismiss.swift */; }; - F7F0BA272978E54D009531F3 /* ParicipantsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7F0BA262978E54D009531F3 /* ParicipantsView.swift */; }; + F7F0BA272978E54D009531F3 /* ParticipantsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7F0BA262978E54D009531F3 /* ParticipantsView.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -540,7 +540,7 @@ F7908E91298B0F0700AB113A /* RelayDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RelayDetailView.swift; sourceTree = ""; }; F7908E96298B1FDF00AB113A /* NIPURLBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NIPURLBuilder.swift; sourceTree = ""; }; F7F0BA24297892BD009531F3 /* SwipeToDismiss.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwipeToDismiss.swift; sourceTree = ""; }; - F7F0BA262978E54D009531F3 /* ParicipantsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParicipantsView.swift; sourceTree = ""; }; + F7F0BA262978E54D009531F3 /* ParticipantsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParticipantsView.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -729,7 +729,7 @@ 4C3AC7A42836987600E1F516 /* MainTabView.swift */, 4C363A8B28236B92006E126D /* PubkeyView.swift */, 4CACA9D4280C31E100D9BBE8 /* ReplyView.swift */, - F7F0BA262978E54D009531F3 /* ParicipantsView.swift */, + F7F0BA262978E54D009531F3 /* ParticipantsView.swift */, 4C285C8D28399BFD008A31F1 /* SaveKeysView.swift */, 4C3AC7A628369BA200E1F516 /* SearchHomeView.swift */, 4C5C7E69284EDE2E00A22DF5 /* SearchResultsView.swift */, @@ -1245,7 +1245,7 @@ 4C477C9E282C3A4800033AA3 /* TipCounter.swift in Sources */, 4C3D52B6298DB4E6001C5831 /* ZapEvent.swift in Sources */, 647D9A8D2968520300A295DE /* SideMenuView.swift in Sources */, - F7F0BA272978E54D009531F3 /* ParicipantsView.swift in Sources */, + F7F0BA272978E54D009531F3 /* ParticipantsView.swift in Sources */, 4C0A3F91280F6528000448DE /* ChatView.swift in Sources */, 4CF0ABE32981BC7D00D66079 /* UserView.swift in Sources */, 4CE0E2AF29A2E82100DB4CA2 /* EventHolder.swift in Sources */, diff --git a/damus/Views/ParicipantsView.swift b/damus/Views/ParicipantsView.swift deleted file mode 100644 index 720a3e84..00000000 --- a/damus/Views/ParicipantsView.swift +++ /dev/null @@ -1,79 +0,0 @@ -// -// ParicipantsView.swift -// damus -// -// Created by Joel Klabo on 1/18/23. -// - -import SwiftUI - -struct ParticipantsView: View { - - let damus_state: DamusState - - @Binding var references: [ReferencedId] - @Binding var originalReferences: [ReferencedId] - - var body: some View { - VStack { - Text("Edit participants", comment: "Text indicating that the view is used for editing which participants are replied to in a note.") - HStack { - Spacer() - Button { - // Remove all "p" refs, keep "e" refs - references = originalReferences.eRefs - } label: { - Text("Remove all", comment: "Button label to remove all participants from a note reply.") - } - .buttonStyle(.borderedProminent) - Spacer() - Button { - references = originalReferences - } label: { - Text("Add all", comment: "Button label to re-add all original participants as profiles to reply to in a note") - } - .buttonStyle(.borderedProminent) - Spacer() - } - VStack { - ForEach(originalReferences.pRefs) { participant in - let pubkey = participant.id - HStack { - ProfilePicView(pubkey: pubkey, size: PFP_SIZE, highlight: .none, profiles: damus_state.profiles) - - VStack(alignment: .leading) { - let profile = damus_state.profiles.lookup(id: pubkey) - ProfileName(pubkey: pubkey, profile: profile, damus: damus_state, show_friend_confirmed: false, show_nip5_domain: false) - if let about = profile?.about { - Text(FollowUserView.markdown.process(about)) - .lineLimit(3) - .font(.footnote) - } - } - - Spacer() - - Image(systemName: "checkmark.circle.fill") - .font(.system(size: 30)) - .foregroundColor(references.contains(participant) ? .purple : .gray) - } - .onTapGesture { - if references.contains(participant) { - references = references.filter { - $0 != participant - } - } else { - if references.contains(participant) { - // Don't add it twice - } else { - references.append(participant) - } - } - } - } - } - Spacer() - } - .padding() - } -} diff --git a/damus/Views/ParticipantsView.swift b/damus/Views/ParticipantsView.swift new file mode 100644 index 00000000..b232a331 --- /dev/null +++ b/damus/Views/ParticipantsView.swift @@ -0,0 +1,81 @@ +// +// ParicipantsView.swift +// damus +// +// Created by Joel Klabo on 1/18/23. +// + +import SwiftUI + +struct ParticipantsView: View { + + let damus_state: DamusState + + @Binding var references: [ReferencedId] + @Binding var originalReferences: [ReferencedId] + + var body: some View { + VStack { + Text("Edit participants", comment: "Text indicating that the view is used for editing which participants are replied to in a note.") + HStack { + Spacer() + Button { + // Remove all "p" refs, keep "e" refs + references = originalReferences.eRefs + } label: { + Text("Remove all", comment: "Button label to remove all participants from a note reply.") + } + .buttonStyle(.borderedProminent) + Spacer() + Button { + references = originalReferences + } label: { + Text("Add all", comment: "Button label to re-add all original participants as profiles to reply to in a note") + } + .buttonStyle(.borderedProminent) + Spacer() + } + VStack { + ScrollView { + ForEach(originalReferences.pRefs) { participant in + let pubkey = participant.id + HStack { + ProfilePicView(pubkey: pubkey, size: PFP_SIZE, highlight: .none, profiles: damus_state.profiles) + + VStack(alignment: .leading) { + let profile = damus_state.profiles.lookup(id: pubkey) + ProfileName(pubkey: pubkey, profile: profile, damus: damus_state, show_friend_confirmed: false, show_nip5_domain: false) + if let about = profile?.about { + Text(FollowUserView.markdown.process(about)) + .lineLimit(3) + .font(.footnote) + } + } + + Spacer() + + Image(systemName: "checkmark.circle.fill") + .font(.system(size: 30)) + .foregroundColor(references.contains(participant) ? .purple : .gray) + } + .onTapGesture { + if references.contains(participant) { + references = references.filter { + $0 != participant + } + } else { + if references.contains(participant) { + // Don't add it twice + } else { + references.append(participant) + } + } + } + } + } + } + Spacer() + } + .padding() + } +}