Re: [PATCH damus] Fix missing Mute button in profile view menu

0 views
Skip to first unread message

William Casarin

unread,
Jun 24, 2024, 6:15:20 PM (11 days ago) Jun 24
to Terry Yiu, pat...@damus.io
Looks good to me

Reviewed-by: William Casarin <jb...@jb55.com>

> damus/Views/Profile/ProfileView.swift | 22 ++++++++++++++++------
> 1 file changed, 16 insertions(+), 6 deletions(-)
>
>diff --git a/damus/Views/Profile/ProfileView.swift b/damus/Views/Profile/ProfileView.swift
>index c8e713131..dfeba33c4 100644
>--- a/damus/Views/Profile/ProfileView.swift
>+++ b/damus/Views/Profile/ProfileView.swift
>@@ -70,6 +70,7 @@ struct ProfileView: View {
> @State var show_share_sheet: Bool = false
> @State var show_qr_code: Bool = false
> @State var action_sheet_presented: Bool = false
>+ @State var mute_dialog_presented: Bool = false
> @State var filter_state : FilterState = .posts
> @State var yOffset: CGFloat = 0
>
>@@ -162,7 +163,10 @@ struct ProfileView: View {
> Button(action: {
> action_sheet_presented = true
> }) {
>- navImage(img: "share3")
>+ Image(systemName: "ellipsis")
>+ .frame(width: 33, height: 33)
>+ .background(Color.black.opacity(0.6))
>+ .clipShape(Circle())
> }
> .confirmationDialog(NSLocalizedString("Actions", comment: "Title for confirmation dialog to either share, report, or mute a profile."), isPresented: $action_sheet_presented) {
> Button(NSLocalizedString("Share", comment: "Button to share the link to a profile.")) {
>@@ -196,15 +200,21 @@ struct ProfileView: View {
> damus_state.postbox.send(new_ev)
> }
> } else {
>- MuteDurationMenu { duration in
>- notify(.mute(.user(profile.pubkey, duration?.date_from_now)))
>- } label: {
>- Text("Mute", comment: "Button to mute a profile.")
>- .foregroundStyle(.red)
>+ Button(NSLocalizedString("Mute", comment: "Button to mute a profile"), role: .destructive) {
>+ mute_dialog_presented = true
> }
> }
> }
> }
>+ .confirmationDialog(NSLocalizedString("Mute", comment: "Title for confirmation dialog to mute a profile."), isPresented: $mute_dialog_presented) {
>+ ForEach(DamusDuration.allCases, id: \.self) { duration in
>+ Button {
>+ notify(.mute(.user(profile.pubkey, duration.date_from_now)))
>+ } label: {
>+ Text(duration.title)
>+ }
>+ }
>+ }
> }
>
> var customNavbar: some View {
Reply all
Reply to author
Forward
0 new messages