Merge branch 'custom-algos' of github.com:bluesky-social/social-app into custom-algos

zio/stable
Paul Frazee 2023-05-25 20:49:16 -05:00
commit 11262ffc83
2 changed files with 14 additions and 0 deletions

View File

@ -8,13 +8,19 @@ export class CustomFeedModel {
// data // data
_reactKey: string _reactKey: string
data: AppBskyFeedDefs.GeneratorView data: AppBskyFeedDefs.GeneratorView
isOnline: boolean
isValid: boolean
constructor( constructor(
public rootStore: RootStoreModel, public rootStore: RootStoreModel,
view: AppBskyFeedDefs.GeneratorView, view: AppBskyFeedDefs.GeneratorView,
isOnline?: boolean,
isValid?: boolean,
) { ) {
this._reactKey = view.uri this._reactKey = view.uri
this.data = view this.data = view
this.isOnline = isOnline ?? true
this.isValid = isValid ?? true
makeAutoObservable( makeAutoObservable(
this, this,
{ {
@ -103,6 +109,8 @@ export class CustomFeedModel {
}) })
runInAction(() => { runInAction(() => {
this.data = res.data.view this.data = res.data.view
this.isOnline = res.data.isOnline
this.isValid = res.data.isValid
}) })
} }

View File

@ -30,6 +30,7 @@ import {FAB} from '../com/util/fab/FAB'
import {LoadLatestBtn} from 'view/com/util/load-latest/LoadLatestBtn' import {LoadLatestBtn} from 'view/com/util/load-latest/LoadLatestBtn'
import {DropdownButton, DropdownItem} from 'view/com/util/forms/DropdownButton' import {DropdownButton, DropdownItem} from 'view/com/util/forms/DropdownButton'
import {useOnMainScroll} from 'lib/hooks/useOnMainScroll' import {useOnMainScroll} from 'lib/hooks/useOnMainScroll'
import {EmptyState} from 'view/com/util/EmptyState'
type Props = NativeStackScreenProps<CommonNavigatorParams, 'CustomFeed'> type Props = NativeStackScreenProps<CommonNavigatorParams, 'CustomFeed'>
export const CustomFeedScreen = withAuthRequired( export const CustomFeedScreen = withAuthRequired(
@ -326,6 +327,10 @@ export const CustomFeedScreen = withAuthRequired(
onTogglePinned, onTogglePinned,
]) ])
const renderEmptyState = React.useCallback(() => {
return <EmptyState icon="feed" message="This list is empty!" />
}, [])
return ( return (
<View style={s.hContentRegion}> <View style={s.hContentRegion}>
<ViewHeader title="" renderButton={currentFeed && renderHeaderBtns} /> <ViewHeader title="" renderButton={currentFeed && renderHeaderBtns} />
@ -335,6 +340,7 @@ export const CustomFeedScreen = withAuthRequired(
onScroll={onMainScroll} onScroll={onMainScroll}
scrollEventThrottle={100} scrollEventThrottle={100}
ListHeaderComponent={renderListHeaderComponent} ListHeaderComponent={renderListHeaderComponent}
renderEmptyState={renderEmptyState}
extraData={[uri, isPinned]} extraData={[uri, isPinned]}
/> />
{isScrolledDown ? ( {isScrolledDown ? (