From cdae685ee12a0d7807c911a3116eeafd0a8307f5 Mon Sep 17 00:00:00 2001
From: Paul Frazee <pfrazee@gmail.com>
Date: Fri, 2 Sep 2022 12:17:33 -0500
Subject: Move SharePost modal to new system

---
 src/view/com/post-thread/PostThread.tsx | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

(limited to 'src/view/com/post-thread/PostThread.tsx')

diff --git a/src/view/com/post-thread/PostThread.tsx b/src/view/com/post-thread/PostThread.tsx
index c12d99edb..7a70aea75 100644
--- a/src/view/com/post-thread/PostThread.tsx
+++ b/src/view/com/post-thread/PostThread.tsx
@@ -6,9 +6,8 @@ import {
   PostThreadViewPostModel,
 } from '../../../state/models/post-thread-view'
 import {useStores} from '../../../state'
+import {SharePostModel} from '../../../state/models/shell'
 import {PostThreadItem} from './PostThreadItem'
-import {ShareModal} from '../modals/SharePost'
-import {s} from '../../lib/styles'
 
 const UPDATE_DELAY = 2e3 // wait 2s before refetching the thread for updates
 
@@ -16,7 +15,6 @@ export const PostThread = observer(function PostThread({uri}: {uri: string}) {
   const store = useStores()
   const [view, setView] = useState<PostThreadViewModel | undefined>()
   const [lastUpdate, setLastUpdate] = useState<number>(Date.now())
-  const shareSheetRef = useRef<{open: (_uri: string) => void}>()
 
   useEffect(() => {
     if (view?.params.uri === uri) {
@@ -38,7 +36,7 @@ export const PostThread = observer(function PostThread({uri}: {uri: string}) {
   // })
 
   const onPressShare = (uri: string) => {
-    shareSheetRef.current?.open(uri)
+    store.shell.openModal(new SharePostModel(uri))
   }
   const onRefresh = () => {
     view?.refresh().catch(err => console.error('Failed to refresh', err))
@@ -83,7 +81,6 @@ export const PostThread = observer(function PostThread({uri}: {uri: string}) {
         refreshing={view.isRefreshing}
         onRefresh={onRefresh}
       />
-      <ShareModal ref={shareSheetRef} />
     </View>
   )
 })
-- 
cgit 1.4.1

