diff options
author | Eric Bailey <git@esb.lol> | 2023-11-29 18:17:27 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-29 16:17:27 -0800 |
commit | a59d235e8b319f6c33e0a0221c99c915128826a6 (patch) | |
tree | 5565590c364a0a922436e9a34af9a8a70725c9ed /src/view/com/feeds/FeedSourceCard.tsx | |
parent | 3ca4bd805a0efa35a9b1d3c4b0a8cebb6cbdeef9 (diff) | |
download | voidsky-a59d235e8b319f6c33e0a0221c99c915128826a6.tar.zst |
Improve feed reordering with optimistic updates (#2032)
* Optimisticaly update order of saved feeds * Better show disabled state for pin button * Improve loading/disabled states * Improve placeholder * Simplify loading components
Diffstat (limited to 'src/view/com/feeds/FeedSourceCard.tsx')
-rw-r--r-- | src/view/com/feeds/FeedSourceCard.tsx | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/view/com/feeds/FeedSourceCard.tsx b/src/view/com/feeds/FeedSourceCard.tsx index d8b67767b..9acbf3611 100644 --- a/src/view/com/feeds/FeedSourceCard.tsx +++ b/src/view/com/feeds/FeedSourceCard.tsx @@ -23,6 +23,7 @@ import { useRemoveFeedMutation, } from '#/state/queries/preferences' import {useFeedSourceInfoQuery, FeedSourceInfo} from '#/state/queries/feed' +import {FeedLoadingPlaceholder} from '#/view/com/util/LoadingPlaceholder' export function FeedSourceCard({ feedUri, @@ -30,17 +31,25 @@ export function FeedSourceCard({ showSaveBtn = false, showDescription = false, showLikes = false, + LoadingComponent, }: { feedUri: string style?: StyleProp<ViewStyle> showSaveBtn?: boolean showDescription?: boolean showLikes?: boolean + LoadingComponent?: JSX.Element }) { const {data: preferences} = usePreferencesQuery() const {data: feed} = useFeedSourceInfoQuery({uri: feedUri}) - if (!feed || !preferences) return null + if (!feed || !preferences) { + return LoadingComponent ? ( + LoadingComponent + ) : ( + <FeedLoadingPlaceholder style={{flex: 1}} /> + ) + } return ( <FeedSourceCardLoaded |