diff options
Diffstat (limited to 'src/view/screens/stacks')
-rw-r--r-- | src/view/screens/stacks/Composer.tsx | 50 | ||||
-rw-r--r-- | src/view/screens/stacks/PostLikedBy.tsx | 38 | ||||
-rw-r--r-- | src/view/screens/stacks/PostRepostedBy.tsx | 41 | ||||
-rw-r--r-- | src/view/screens/stacks/PostThread.tsx | 38 | ||||
-rw-r--r-- | src/view/screens/stacks/Profile.tsx | 71 | ||||
-rw-r--r-- | src/view/screens/stacks/ProfileFollowers.tsx | 39 | ||||
-rw-r--r-- | src/view/screens/stacks/ProfileFollows.tsx | 39 |
7 files changed, 0 insertions, 316 deletions
diff --git a/src/view/screens/stacks/Composer.tsx b/src/view/screens/stacks/Composer.tsx deleted file mode 100644 index e1b36567a..000000000 --- a/src/view/screens/stacks/Composer.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import React, {useLayoutEffect, useRef} from 'react' -import {Text, TouchableOpacity} from 'react-native' -import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' -import {Shell} from '../../shell' -import type {RootTabsScreenProps} from '../../routes/types' -import {Composer as ComposerComponent} from '../../com/composer/Composer' - -export const Composer = ({ - navigation, - route, -}: RootTabsScreenProps<'Composer'>) => { - const {replyTo} = route.params - const ref = useRef<{publish: () => Promise<boolean>}>() - - useLayoutEffect(() => { - navigation.setOptions({ - headerShown: true, - headerTitle: replyTo ? 'Reply' : 'New Post', - headerLeft: () => ( - <TouchableOpacity onPress={() => navigation.goBack()}> - <FontAwesomeIcon icon="x" /> - </TouchableOpacity> - ), - headerRight: () => ( - <TouchableOpacity - onPress={() => { - if (!ref.current) { - return - } - ref.current.publish().then( - posted => { - if (posted) { - navigation.goBack() - } - }, - err => console.error('Failed to create post', err), - ) - }}> - <Text>Post</Text> - </TouchableOpacity> - ), - }) - }, [navigation, replyTo, ref]) - - return ( - <Shell> - <ComposerComponent ref={ref} replyTo={replyTo} /> - </Shell> - ) -} diff --git a/src/view/screens/stacks/PostLikedBy.tsx b/src/view/screens/stacks/PostLikedBy.tsx deleted file mode 100644 index f12990141..000000000 --- a/src/view/screens/stacks/PostLikedBy.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import React, {useLayoutEffect} from 'react' -import {TouchableOpacity} from 'react-native' -import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' -import {makeRecordUri} from '../../lib/strings' -import {Shell} from '../../shell' -import type {RootTabsScreenProps} from '../../routes/types' -import {PostLikedBy as PostLikedByComponent} from '../../com/post-thread/PostLikedBy' - -export const PostLikedBy = ({ - navigation, - route, -}: RootTabsScreenProps<'PostLikedBy'>) => { - const {name, recordKey} = route.params - const uri = makeRecordUri(name, 'blueskyweb.xyz:Posts', recordKey) - - useLayoutEffect(() => { - navigation.setOptions({ - headerShown: true, - headerTitle: 'Liked By', - headerLeft: () => ( - <TouchableOpacity onPress={() => navigation.goBack()}> - <FontAwesomeIcon icon="arrow-left" /> - </TouchableOpacity> - ), - }) - }, [navigation]) - - const onNavigateContent = (screen: string, props: Record<string, string>) => { - // @ts-ignore it's up to the callers to supply correct params -prf - navigation.push(screen, props) - } - - return ( - <Shell> - <PostLikedByComponent uri={uri} onNavigateContent={onNavigateContent} /> - </Shell> - ) -} diff --git a/src/view/screens/stacks/PostRepostedBy.tsx b/src/view/screens/stacks/PostRepostedBy.tsx deleted file mode 100644 index 000c1a7fc..000000000 --- a/src/view/screens/stacks/PostRepostedBy.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import React, {useLayoutEffect} from 'react' -import {TouchableOpacity} from 'react-native' -import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' -import {makeRecordUri} from '../../lib/strings' -import {Shell} from '../../shell' -import type {RootTabsScreenProps} from '../../routes/types' -import {PostRepostedBy as PostRepostedByComponent} from '../../com/post-thread/PostRepostedBy' - -export const PostRepostedBy = ({ - navigation, - route, -}: RootTabsScreenProps<'PostRepostedBy'>) => { - const {name, recordKey} = route.params - const uri = makeRecordUri(name, 'blueskyweb.xyz:Posts', recordKey) - - useLayoutEffect(() => { - navigation.setOptions({ - headerShown: true, - headerTitle: 'Reposted By', - headerLeft: () => ( - <TouchableOpacity onPress={() => navigation.goBack()}> - <FontAwesomeIcon icon="arrow-left" /> - </TouchableOpacity> - ), - }) - }, [navigation]) - - const onNavigateContent = (screen: string, props: Record<string, string>) => { - // @ts-ignore it's up to the callers to supply correct params -prf - navigation.push(screen, props) - } - - return ( - <Shell> - <PostRepostedByComponent - uri={uri} - onNavigateContent={onNavigateContent} - /> - </Shell> - ) -} diff --git a/src/view/screens/stacks/PostThread.tsx b/src/view/screens/stacks/PostThread.tsx deleted file mode 100644 index 485a2e49a..000000000 --- a/src/view/screens/stacks/PostThread.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import React, {useLayoutEffect} from 'react' -import {TouchableOpacity} from 'react-native' -import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' -import {makeRecordUri} from '../../lib/strings' -import {Shell} from '../../shell' -import type {RootTabsScreenProps} from '../../routes/types' -import {PostThread as PostThreadComponent} from '../../com/post-thread/PostThread' - -export const PostThread = ({ - navigation, - route, -}: RootTabsScreenProps<'PostThread'>) => { - const {name, recordKey} = route.params - const uri = makeRecordUri(name, 'blueskyweb.xyz:Posts', recordKey) - - useLayoutEffect(() => { - navigation.setOptions({ - headerShown: true, - headerTitle: 'Thread', - headerLeft: () => ( - <TouchableOpacity onPress={() => navigation.goBack()}> - <FontAwesomeIcon icon="arrow-left" /> - </TouchableOpacity> - ), - }) - }, [navigation]) - - const onNavigateContent = (screen: string, props: Record<string, string>) => { - // @ts-ignore it's up to the callers to supply correct params -prf - navigation.push(screen, props) - } - - return ( - <Shell> - <PostThreadComponent uri={uri} onNavigateContent={onNavigateContent} /> - </Shell> - ) -} diff --git a/src/view/screens/stacks/Profile.tsx b/src/view/screens/stacks/Profile.tsx deleted file mode 100644 index d8de12436..000000000 --- a/src/view/screens/stacks/Profile.tsx +++ /dev/null @@ -1,71 +0,0 @@ -import React, {useState, useEffect} from 'react' -import {View, StyleSheet} from 'react-native' -import {Shell} from '../../shell' -import type {RootTabsScreenProps} from '../../routes/types' -import {FeedViewModel} from '../../../state/models/feed-view' -import {useStores} from '../../../state' -import {ProfileHeader} from '../../com/profile/ProfileHeader' -import {Feed} from '../../com/feed/Feed' - -export const Profile = ({ - navigation, - route, -}: RootTabsScreenProps<'Profile'>) => { - const store = useStores() - const [hasSetup, setHasSetup] = useState<string>('') - const [feedView, setFeedView] = useState<FeedViewModel | undefined>() - - useEffect(() => { - const author = route.params.name - if (feedView?.params.author === author) { - return // no change needed? or trigger refresh? - } - console.log('Fetching profile feed', author) - const newFeedView = new FeedViewModel(store, {author}) - setFeedView(newFeedView) - newFeedView - .setup() - .catch(err => console.error('Failed to fetch feed', err)) - .then(() => setHasSetup(author)) - }, [route.params.name, feedView?.params.author, store]) - - useEffect(() => { - return navigation.addListener('focus', () => { - if (hasSetup === feedView?.params.author) { - console.log('Updating profile feed', hasSetup) - feedView?.update() - } - }) - }, [navigation, feedView, hasSetup]) - - const onNavigateContent = (screen: string, props: Record<string, string>) => { - // @ts-ignore it's up to the callers to supply correct params -prf - navigation.push(screen, props) - } - - return ( - <Shell> - <View style={styles.container}> - <ProfileHeader - user={route.params.name} - onNavigateContent={onNavigateContent} - /> - <View style={styles.feed}> - {feedView && ( - <Feed feed={feedView} onNavigateContent={onNavigateContent} /> - )} - </View> - </View> - </Shell> - ) -} - -const styles = StyleSheet.create({ - container: { - flexDirection: 'column', - height: '100%', - }, - feed: { - flex: 1, - }, -}) diff --git a/src/view/screens/stacks/ProfileFollowers.tsx b/src/view/screens/stacks/ProfileFollowers.tsx deleted file mode 100644 index 48fbb4e13..000000000 --- a/src/view/screens/stacks/ProfileFollowers.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import React, {useLayoutEffect} from 'react' -import {TouchableOpacity} from 'react-native' -import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' -import {Shell} from '../../shell' -import type {RootTabsScreenProps} from '../../routes/types' -import {ProfileFollowers as ProfileFollowersComponent} from '../../com/profile/ProfileFollowers' - -export const ProfileFollowers = ({ - navigation, - route, -}: RootTabsScreenProps<'ProfileFollowers'>) => { - const {name} = route.params - - useLayoutEffect(() => { - navigation.setOptions({ - headerShown: true, - headerTitle: 'Followers', - headerLeft: () => ( - <TouchableOpacity onPress={() => navigation.goBack()}> - <FontAwesomeIcon icon="arrow-left" /> - </TouchableOpacity> - ), - }) - }, [navigation]) - - const onNavigateContent = (screen: string, props: Record<string, string>) => { - // @ts-ignore it's up to the callers to supply correct params -prf - navigation.push(screen, props) - } - - return ( - <Shell> - <ProfileFollowersComponent - name={name} - onNavigateContent={onNavigateContent} - /> - </Shell> - ) -} diff --git a/src/view/screens/stacks/ProfileFollows.tsx b/src/view/screens/stacks/ProfileFollows.tsx deleted file mode 100644 index 6fce3d798..000000000 --- a/src/view/screens/stacks/ProfileFollows.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import React, {useLayoutEffect} from 'react' -import {TouchableOpacity} from 'react-native' -import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' -import {Shell} from '../../shell' -import type {RootTabsScreenProps} from '../../routes/types' -import {ProfileFollows as ProfileFollowsComponent} from '../../com/profile/ProfileFollows' - -export const ProfileFollows = ({ - navigation, - route, -}: RootTabsScreenProps<'ProfileFollows'>) => { - const {name} = route.params - - useLayoutEffect(() => { - navigation.setOptions({ - headerShown: true, - headerTitle: 'Following', - headerLeft: () => ( - <TouchableOpacity onPress={() => navigation.goBack()}> - <FontAwesomeIcon icon="arrow-left" /> - </TouchableOpacity> - ), - }) - }, [navigation]) - - const onNavigateContent = (screen: string, props: Record<string, string>) => { - // @ts-ignore it's up to the callers to supply correct params -prf - navigation.push(screen, props) - } - - return ( - <Shell> - <ProfileFollowsComponent - name={name} - onNavigateContent={onNavigateContent} - /> - </Shell> - ) -} |