From 3d09008bfde3352212ab69105063150a175b8d5d Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Wed, 17 May 2023 14:03:08 -0500 Subject: [PATCH] Reorganize custom feeds in the view layer --- src/{view/com/algos => lib/hooks}/useCustomFeed.ts | 0 src/state/models/ui/profile.ts | 4 ---- src/view/com/{algos/AlgoItem.tsx => feeds/CustomFeed.tsx} | 4 ++-- src/view/com/{algos => feeds}/SavedFeedItem.tsx | 4 ++-- src/view/com/util/post-embeds/index.tsx | 4 ++-- src/view/screens/CustomFeed.tsx | 2 +- src/view/screens/PinnedFeeds.tsx | 2 +- src/view/screens/Profile.tsx | 4 ++-- src/view/screens/SavedFeeds.tsx | 2 +- 9 files changed, 11 insertions(+), 15 deletions(-) rename src/{view/com/algos => lib/hooks}/useCustomFeed.ts (100%) rename src/view/com/{algos/AlgoItem.tsx => feeds/CustomFeed.tsx} (98%) rename src/view/com/{algos => feeds}/SavedFeedItem.tsx (95%) diff --git a/src/view/com/algos/useCustomFeed.ts b/src/lib/hooks/useCustomFeed.ts similarity index 100% rename from src/view/com/algos/useCustomFeed.ts rename to src/lib/hooks/useCustomFeed.ts diff --git a/src/state/models/ui/profile.ts b/src/state/models/ui/profile.ts index 2189e8e9..54ee461b 100644 --- a/src/state/models/ui/profile.ts +++ b/src/state/models/ui/profile.ts @@ -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[] = [] diff --git a/src/view/com/algos/AlgoItem.tsx b/src/view/com/feeds/CustomFeed.tsx similarity index 98% rename from src/view/com/algos/AlgoItem.tsx rename to src/view/com/feeds/CustomFeed.tsx index ea45005d..2137081f 100644 --- a/src/view/com/algos/AlgoItem.tsx +++ b/src/view/com/feeds/CustomFeed.tsx @@ -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: { diff --git a/src/view/com/algos/SavedFeedItem.tsx b/src/view/com/feeds/SavedFeedItem.tsx similarity index 95% rename from src/view/com/algos/SavedFeedItem.tsx rename to src/view/com/feeds/SavedFeedItem.tsx index e8aeae72..b93cebe1 100644 --- a/src/view/com/algos/SavedFeedItem.tsx +++ b/src/view/com/feeds/SavedFeedItem.tsx @@ -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 ( - ) } else if (item instanceof CustomFeedModel) { - return + return } } return diff --git a/src/view/screens/SavedFeeds.tsx b/src/view/screens/SavedFeeds.tsx index c02d8ce3..6d55649f 100644 --- a/src/view/screens/SavedFeeds.tsx +++ b/src/view/screens/SavedFeeds.tsx @@ -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