Reorganize custom feeds in the view layer

zio/stable
Paul Frazee 2023-05-17 14:03:08 -05:00
parent b672006f7e
commit 3d09008bfd
9 changed files with 11 additions and 15 deletions

View File

@ -1,5 +1,4 @@
import {makeAutoObservable} from 'mobx'
import {AppBskyFeedDefs} from '@atproto/api'
import {RootStoreModel} from '../root-store'
import {ProfileModel} from '../content/profile'
import {PostsFeedModel} from '../feeds/posts'
@ -90,9 +89,6 @@ export class ProfileUiModel {
get selectedView() {
return this.selectorItems[this.selectedViewIndex]
}
isGeneratorView(v: any) {
return AppBskyFeedDefs.isGeneratorView(v)
}
get uiItems() {
let arr: any[] = []

View File

@ -21,7 +21,7 @@ import {pluralize} from 'lib/strings/helpers'
import {AtUri} from '@atproto/api'
import {isWeb} from 'platform/detection'
const AlgoItem = observer(
const CustomFeed = observer(
({
item,
style,
@ -112,7 +112,7 @@ const AlgoItem = observer(
)
},
)
export default AlgoItem
export default CustomFeed
const styles = StyleSheet.create({
container: {

View File

@ -5,7 +5,7 @@ import {colors} from 'lib/styles'
import {observer} from 'mobx-react-lite'
import {CustomFeedModel} from 'state/models/feeds/custom-feed'
import {SavedFeedsModel} from 'state/models/ui/saved-feeds'
import AlgoItem from './AlgoItem'
import CustomFeed from './CustomFeed'
export const SavedFeedItem = observer(
({
@ -19,7 +19,7 @@ export const SavedFeedItem = observer(
return (
<View style={styles.itemContainer}>
<AlgoItem
<CustomFeed
key={item.data.uri}
item={item}
showBottom={false}

View File

@ -25,7 +25,7 @@ import {ExternalLinkEmbed} from './ExternalLinkEmbed'
import {getYoutubeVideoId} from 'lib/strings/url-helpers'
import QuoteEmbed from './QuoteEmbed'
import {AutoSizedImage} from '../images/AutoSizedImage'
import AlgoItem from 'view/com/algos/AlgoItem'
import CustomFeed from 'view/com/feeds/CustomFeed'
import {CustomFeedModel} from 'state/models/feeds/custom-feed'
type Embed =
@ -171,7 +171,7 @@ export function PostEmbeds({
AppBskyFeedDefs.isGeneratorView(embed.record)
) {
return (
<AlgoItem
<CustomFeed
item={new CustomFeedModel(store, embed.record)}
style={[pal.view, pal.border, styles.extOuter]}
reloadOnFocus={true}

View File

@ -9,7 +9,7 @@ import React, {useMemo, useRef} from 'react'
import {FlatList, StyleSheet, TouchableOpacity, View} from 'react-native'
import {useStores} from 'state/index'
import {PostsFeedModel} from 'state/models/feeds/posts'
import {useCustomFeed} from 'view/com/algos/useCustomFeed'
import {useCustomFeed} from 'lib/hooks/useCustomFeed'
import {withAuthRequired} from 'view/com/auth/withAuthRequired'
import {Feed} from 'view/com/posts/Feed'
import {Link} from 'view/com/util/Link'

View File

@ -24,7 +24,7 @@ import DraggableFlatList, {
ShadowDecorator,
ScaleDecorator,
} from 'react-native-draggable-flatlist'
import {SavedFeedItem} from 'view/com/algos/SavedFeedItem'
import {SavedFeedItem} from 'view/com/feeds/SavedFeedItem'
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
import {CustomFeedModel} from 'state/models/feeds/custom-feed'

View File

@ -25,7 +25,7 @@ import {FAB} from '../com/util/fab/FAB'
import {s, colors} from 'lib/styles'
import {useAnalytics} from 'lib/analytics'
import {ComposeIcon2} from 'lib/icons'
import AlgoItem from 'view/com/algos/AlgoItem'
import CustomFeed from 'view/com/feeds/CustomFeed'
import {CustomFeedModel} from 'state/models/feeds/custom-feed'
import {useSetTitle} from 'lib/hooks/useSetTitle'
import {combinedDisplayName} from 'lib/strings/display-names'
@ -189,7 +189,7 @@ export const ProfileScreen = withAuthRequired(
<FeedSlice slice={item} ignoreMuteFor={uiState.profile.did} />
)
} else if (item instanceof CustomFeedModel) {
return <AlgoItem item={item} />
return <CustomFeed item={item} />
}
}
return <View />

View File

@ -24,7 +24,7 @@ import {s} from 'lib/styles'
import {SavedFeedsModel} from 'state/models/ui/saved-feeds'
import {Link} from 'view/com/util/Link'
import {UserAvatar} from 'view/com/util/UserAvatar'
import {SavedFeedItem} from 'view/com/algos/SavedFeedItem'
import {SavedFeedItem} from 'view/com/feeds/SavedFeedItem'
import {AtUri} from '@atproto/api'
type Props = NativeStackScreenProps<CommonNavigatorParams, 'SavedFeeds'>