diff options
Diffstat (limited to 'src/view/com/post-thread')
-rw-r--r-- | src/view/com/post-thread/PostLikedBy.tsx | 7 | ||||
-rw-r--r-- | src/view/com/post-thread/PostRepostedBy.tsx | 7 | ||||
-rw-r--r-- | src/view/com/post-thread/PostThread.tsx | 18 | ||||
-rw-r--r-- | src/view/com/post-thread/PostThreadItem.tsx | 4 |
4 files changed, 15 insertions, 21 deletions
diff --git a/src/view/com/post-thread/PostLikedBy.tsx b/src/view/com/post-thread/PostLikedBy.tsx index 3ca147b8d..1b65c04fc 100644 --- a/src/view/com/post-thread/PostLikedBy.tsx +++ b/src/view/com/post-thread/PostLikedBy.tsx @@ -2,7 +2,7 @@ import React, {useEffect} from 'react' import {observer} from 'mobx-react-lite' import {ActivityIndicator, RefreshControl, StyleSheet, View} from 'react-native' import {CenteredView, FlatList} from '../util/Views' -import {LikesViewModel, LikeItem} from 'state/models/likes-view' +import {LikesModel, LikeItem} from 'state/models/lists/likes' import {ErrorMessage} from '../util/error/ErrorMessage' import {ProfileCardWithFollowBtn} from '../profile/ProfileCard' import {useStores} from 'state/index' @@ -11,10 +11,7 @@ import {usePalette} from 'lib/hooks/usePalette' export const PostLikedBy = observer(function ({uri}: {uri: string}) { const pal = usePalette('default') const store = useStores() - const view = React.useMemo( - () => new LikesViewModel(store, {uri}), - [store, uri], - ) + const view = React.useMemo(() => new LikesModel(store, {uri}), [store, uri]) useEffect(() => { view.loadMore().catch(err => store.log.error('Failed to fetch likes', err)) diff --git a/src/view/com/post-thread/PostRepostedBy.tsx b/src/view/com/post-thread/PostRepostedBy.tsx index 147d0271f..30f8fd445 100644 --- a/src/view/com/post-thread/PostRepostedBy.tsx +++ b/src/view/com/post-thread/PostRepostedBy.tsx @@ -2,10 +2,7 @@ import React, {useEffect} from 'react' import {observer} from 'mobx-react-lite' import {ActivityIndicator, RefreshControl, StyleSheet, View} from 'react-native' import {CenteredView, FlatList} from '../util/Views' -import { - RepostedByViewModel, - RepostedByItem, -} from 'state/models/reposted-by-view' +import {RepostedByModel, RepostedByItem} from 'state/models/lists/reposted-by' import {ProfileCardWithFollowBtn} from '../profile/ProfileCard' import {ErrorMessage} from '../util/error/ErrorMessage' import {useStores} from 'state/index' @@ -19,7 +16,7 @@ export const PostRepostedBy = observer(function PostRepostedBy({ const pal = usePalette('default') const store = useStores() const view = React.useMemo( - () => new RepostedByViewModel(store, {uri}), + () => new RepostedByModel(store, {uri}), [store, uri], ) diff --git a/src/view/com/post-thread/PostThread.tsx b/src/view/com/post-thread/PostThread.tsx index 569c6e392..40a6f48c8 100644 --- a/src/view/com/post-thread/PostThread.tsx +++ b/src/view/com/post-thread/PostThread.tsx @@ -9,9 +9,9 @@ import { } from 'react-native' import {CenteredView, FlatList} from '../util/Views' import { - PostThreadViewModel, - PostThreadViewPostModel, -} from 'state/models/post-thread-view' + PostThreadModel, + PostThreadItemModel, +} from 'state/models/content/post-thread' import { FontAwesomeIcon, FontAwesomeIconStyle, @@ -31,7 +31,7 @@ const BOTTOM_BORDER = { _reactKey: '__bottom_border__', _isHighlightedPost: false, } -type YieldedItem = PostThreadViewPostModel | typeof REPLY_PROMPT +type YieldedItem = PostThreadItemModel | typeof REPLY_PROMPT export const PostThread = observer(function PostThread({ uri, @@ -39,7 +39,7 @@ export const PostThread = observer(function PostThread({ onPressReply, }: { uri: string - view: PostThreadViewModel + view: PostThreadModel onPressReply: () => void }) { const pal = usePalette('default') @@ -109,7 +109,7 @@ export const PostThread = observer(function PostThread({ // I could find to get a border positioned directly under the last item // -prf return <View style={[styles.bottomBorder, pal.border]} /> - } else if (item instanceof PostThreadViewPostModel) { + } else if (item instanceof PostThreadItemModel) { return <PostThreadItem item={item} onPostReply={onRefresh} /> } return <></> @@ -187,14 +187,14 @@ export const PostThread = observer(function PostThread({ }) function* flattenThread( - post: PostThreadViewPostModel, + post: PostThreadItemModel, isAscending = false, ): Generator<YieldedItem, void> { if (post.parent) { if ('notFound' in post.parent && post.parent.notFound) { // TODO render not found } else { - yield* flattenThread(post.parent as PostThreadViewPostModel, true) + yield* flattenThread(post.parent as PostThreadItemModel, true) } } yield post @@ -206,7 +206,7 @@ function* flattenThread( if ('notFound' in reply && reply.notFound) { // TODO render not found } else { - yield* flattenThread(reply as PostThreadViewPostModel) + yield* flattenThread(reply as PostThreadItemModel) } } } else if (!isAscending && !post.parent && post.post.replyCount) { diff --git a/src/view/com/post-thread/PostThreadItem.tsx b/src/view/com/post-thread/PostThreadItem.tsx index cf2148060..5a983698c 100644 --- a/src/view/com/post-thread/PostThreadItem.tsx +++ b/src/view/com/post-thread/PostThreadItem.tsx @@ -7,7 +7,7 @@ import { FontAwesomeIcon, FontAwesomeIconStyle, } from '@fortawesome/react-native-fontawesome' -import {PostThreadViewPostModel} from 'state/models/post-thread-view' +import {PostThreadItemModel} from 'state/models/content/post-thread' import {Link} from '../util/Link' import {RichText} from '../util/text/RichText' import {Text} from '../util/text/Text' @@ -31,7 +31,7 @@ export const PostThreadItem = observer(function PostThreadItem({ item, onPostReply, }: { - item: PostThreadViewPostModel + item: PostThreadItemModel onPostReply: () => void }) { const pal = usePalette('default') |