about summary refs log tree commit diff
path: root/src/view/com/modals
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2024-06-18 12:07:56 -0700
committerGitHub <noreply@github.com>2024-06-18 12:07:56 -0700
commitd6ce16d15ae79c4fef943cd48dfa0cdb072e9596 (patch)
treeb0c1ec509e6d0ba5d4d516d71721e054752a67e1 /src/view/com/modals
parent4165a02b2d712ba20b9fdbf435d4cb00c03e5e52 (diff)
downloadvoidsky-d6ce16d15ae79c4fef943cd48dfa0cdb072e9596.tar.zst
Implement thread locking (#4545)
* Add the ability to edit threadgates

* Fix bottom border on mobile

* Refresh thread after threadgate edit
Diffstat (limited to 'src/view/com/modals')
-rw-r--r--src/view/com/modals/Threadgate.tsx11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/view/com/modals/Threadgate.tsx b/src/view/com/modals/Threadgate.tsx
index a2e9f391c..4a9a9e2ab 100644
--- a/src/view/com/modals/Threadgate.tsx
+++ b/src/view/com/modals/Threadgate.tsx
@@ -26,9 +26,11 @@ export const snapPoints = ['60%']
 export function Component({
   settings,
   onChange,
+  onConfirm,
 }: {
   settings: ThreadgateSetting[]
-  onChange: (settings: ThreadgateSetting[]) => void
+  onChange?: (settings: ThreadgateSetting[]) => void
+  onConfirm?: (settings: ThreadgateSetting[]) => void
 }) {
   const pal = usePalette('default')
   const {closeModal} = useModalControls()
@@ -38,12 +40,12 @@ export function Component({
 
   const onPressEverybody = () => {
     setSelected([])
-    onChange([])
+    onChange?.([])
   }
 
   const onPressNobody = () => {
     setSelected([{type: 'nobody'}])
-    onChange([{type: 'nobody'}])
+    onChange?.([{type: 'nobody'}])
   }
 
   const onPressAudience = (setting: ThreadgateSetting) => {
@@ -57,7 +59,7 @@ export function Component({
       newSelected.splice(i, 1)
     }
     setSelected(newSelected)
-    onChange(newSelected)
+    onChange?.(newSelected)
   }
 
   return (
@@ -124,6 +126,7 @@ export function Component({
           testID="confirmBtn"
           onPress={() => {
             closeModal()
+            onConfirm?.(selected)
           }}
           style={styles.btn}
           accessibilityRole="button"