From 1b5989ac51328b47779dffb7672e9d04885e43b0 Mon Sep 17 00:00:00 2001
From: Eric Bailey <git@esb.lol>
Date: Thu, 7 Dec 2023 16:00:09 -0600
Subject: Allow blocking/muting to curational lists, unpinning to modlists
 (#2121)

* Add un-pinning of modlist

* Allow muting/blocking of curational lists

* Tweak icon

---------

Co-authored-by: Paul Frazee <pfrazee@gmail.com>
---
 src/view/screens/ProfileList.tsx | 69 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 68 insertions(+), 1 deletion(-)

(limited to 'src/view/screens/ProfileList.tsx')

diff --git a/src/view/screens/ProfileList.tsx b/src/view/screens/ProfileList.tsx
index 923560efd..3dcc7121f 100644
--- a/src/view/screens/ProfileList.tsx
+++ b/src/view/screens/ProfileList.tsx
@@ -456,8 +456,75 @@ function Header({rkey, list}: {rkey: string; list: AppBskyGraphDefs.ListView}) {
         },
       })
     }
+    if (isModList && isPinned) {
+      items.push({label: 'separator'})
+      items.push({
+        testID: 'listHeaderDropdownUnpinBtn',
+        label: _(msg`Unpin moderation list`),
+        onPress: isPending ? undefined : () => unpinFeed({uri: list.uri}),
+        icon: {
+          ios: {
+            name: 'pin',
+          },
+          android: '',
+          web: 'thumbtack',
+        },
+      })
+    }
+    if (isCurateList) {
+      items.push({label: 'separator'})
+
+      if (!isBlocking) {
+        items.push({
+          testID: 'listHeaderDropdownMuteBtn',
+          label: isMuting ? _(msg`Un-mute list`) : _(msg`Mute list`),
+          onPress: isMuting ? onUnsubscribeMute : onSubscribeMute,
+          icon: {
+            ios: {
+              name: isMuting ? 'eye' : 'eye.slash',
+            },
+            android: '',
+            web: isMuting ? 'eye' : ['far', 'eye-slash'],
+          },
+        })
+      }
+
+      if (!isMuting) {
+        items.push({
+          testID: 'listHeaderDropdownBlockBtn',
+          label: isBlocking ? _(msg`Un-block list`) : _(msg`Block list`),
+          onPress: isBlocking ? onUnsubscribeBlock : onSubscribeBlock,
+          icon: {
+            ios: {
+              name: 'person.fill.xmark',
+            },
+            android: '',
+            web: 'user-slash',
+          },
+        })
+      }
+    }
     return items
-  }, [isOwner, onPressShare, onPressEdit, onPressDelete, onPressReport, _])
+  }, [
+    isOwner,
+    onPressShare,
+    onPressEdit,
+    onPressDelete,
+    onPressReport,
+    _,
+    isModList,
+    isPinned,
+    unpinFeed,
+    isPending,
+    list.uri,
+    isCurateList,
+    isMuting,
+    isBlocking,
+    onUnsubscribeMute,
+    onSubscribeMute,
+    onUnsubscribeBlock,
+    onSubscribeBlock,
+  ])
 
   const subscribeDropdownItems: DropdownItem[] = useMemo(() => {
     return [
-- 
cgit 1.4.1

