filter out discover
This commit is contained in:
@@ -4,6 +4,7 @@ import {KeyboardAwareScrollView} from 'react-native-keyboard-controller'
|
|||||||
import {GeneratorView} from '@atproto/api/dist/client/types/app/bsky/feed/defs'
|
import {GeneratorView} from '@atproto/api/dist/client/types/app/bsky/feed/defs'
|
||||||
import debounce from 'lodash.debounce'
|
import debounce from 'lodash.debounce'
|
||||||
|
|
||||||
|
import {DISCOVER_FEED_URI} from 'lib/constants'
|
||||||
import {
|
import {
|
||||||
useGetPopularFeedsQuery,
|
useGetPopularFeedsQuery,
|
||||||
useSearchPopularFeedsMutation,
|
useSearchPopularFeedsMutation,
|
||||||
@@ -29,36 +30,6 @@ export function StepFeeds() {
|
|||||||
const popularFeeds =
|
const popularFeeds =
|
||||||
popularFeedsPages?.pages.flatMap(page => page.feeds) || []
|
popularFeedsPages?.pages.flatMap(page => page.feeds) || []
|
||||||
|
|
||||||
// const popularFeeds = [
|
|
||||||
// {
|
|
||||||
// uri: 'at://did:plc:i2g4cq5neuol2n5kadpffqok/app.bsky.feed.generator/alice-favs',
|
|
||||||
// cid: 'bafyreidgvy4vlvvhx3lhpyej2qido3m5sk2l5643bhbmqtgfuxwz53xqlm',
|
|
||||||
// did: 'did:plc:epfqsozl6rso6ebd6mkfyzpl',
|
|
||||||
// creator: {
|
|
||||||
// did: 'did:plc:vyhhvdf4xw5nziakfxxsynwk',
|
|
||||||
// handle: 'alice.test',
|
|
||||||
// displayName: 'Alice',
|
|
||||||
// viewer: {
|
|
||||||
// muted: false,
|
|
||||||
// blockedBy: false,
|
|
||||||
// },
|
|
||||||
// labels: [],
|
|
||||||
// description: 'Test user 1',
|
|
||||||
// indexedAt: '2024-06-10T17:37:36.662Z',
|
|
||||||
// },
|
|
||||||
// displayName: 'alices feed',
|
|
||||||
// description: 'all my fav stuff',
|
|
||||||
// avatar:
|
|
||||||
// 'http://localhost:2584/img/avatar/plain/did:plc:vyhhvdf4xw5nziakfxxsynwk/bafkreihem6nzbu462kcx5cqnrkonpq75fe5dlbhgnzcmuvvhqk7s5vcq3u@jpeg',
|
|
||||||
// likeCount: 3,
|
|
||||||
// labels: [],
|
|
||||||
// viewer: {
|
|
||||||
// like: 'at://did:plc:vyhhvdf4xw5nziakfxxsynwk/app.bsky.feed.like/3kulmhjxuoc2g',
|
|
||||||
// },
|
|
||||||
// indexedAt: '2022-07-15T00:51:16.914Z',
|
|
||||||
// },
|
|
||||||
// ]
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data: searchedFeeds,
|
data: searchedFeeds,
|
||||||
mutate: search,
|
mutate: search,
|
||||||
@@ -79,6 +50,10 @@ export function StepFeeds() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const filterFeeds = (feeds?: GeneratorView[]) => {
|
||||||
|
return feeds?.filter(feed => feed.uri !== DISCOVER_FEED_URI)
|
||||||
|
}
|
||||||
|
|
||||||
const renderItem = ({item}: ListRenderItemInfo<GeneratorView>) => {
|
const renderItem = ({item}: ListRenderItemInfo<GeneratorView>) => {
|
||||||
return <WizardFeedCard generator={item} state={state} dispatch={dispatch} />
|
return <WizardFeedCard generator={item} state={state} dispatch={dispatch} />
|
||||||
}
|
}
|
||||||
@@ -96,7 +71,7 @@ export function StepFeeds() {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<List
|
<List
|
||||||
data={query ? searchedFeeds : popularFeeds}
|
data={filterFeeds(query ? searchedFeeds : popularFeeds)}
|
||||||
renderItem={renderItem}
|
renderItem={renderItem}
|
||||||
keyExtractor={keyExtractor}
|
keyExtractor={keyExtractor}
|
||||||
onEndReached={!query ? () => fetchNextPage() : undefined}
|
onEndReached={!query ? () => fetchNextPage() : undefined}
|
||||||
|
|||||||
@@ -481,6 +481,10 @@ function Footer({
|
|||||||
|
|
||||||
const items = state.currentStep === 'Profiles' ? state.profiles : state.feeds
|
const items = state.currentStep === 'Profiles' ? state.profiles : state.feeds
|
||||||
|
|
||||||
|
const isEditEnabled =
|
||||||
|
(state.currentStep === 'Profiles' && items.length > 1) ||
|
||||||
|
(state.currentStep === 'Feeds' && items.length > 0)
|
||||||
|
|
||||||
const textStyles = [isWeb && a.text_md]
|
const textStyles = [isWeb && a.text_md]
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -573,30 +577,36 @@ function Footer({
|
|||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<View
|
{isEditEnabled && (
|
||||||
style={[a.flex_row, a.w_full, a.justify_between, {marginTop: 'auto'}]}>
|
<View
|
||||||
<Button
|
style={[
|
||||||
label={_(msg`Edit`)}
|
a.flex_row,
|
||||||
variant="ghost"
|
a.w_full,
|
||||||
color="primary"
|
a.justify_between,
|
||||||
size="small"
|
{marginTop: 'auto'},
|
||||||
disabled={items.length === 0}
|
]}>
|
||||||
onPress={editDialogControl.open}>
|
<Button
|
||||||
<ButtonText>
|
label={_(msg`Edit`)}
|
||||||
<Trans>Edit</Trans>
|
variant="ghost"
|
||||||
</ButtonText>
|
color="primary"
|
||||||
</Button>
|
size="small"
|
||||||
<Button
|
onPress={editDialogControl.open}>
|
||||||
label={nextBtnText}
|
<ButtonText>
|
||||||
variant="solid"
|
<Trans>Edit</Trans>
|
||||||
color="primary"
|
</ButtonText>
|
||||||
size="small"
|
</Button>
|
||||||
onPress={onNext}
|
<Button
|
||||||
disabled={!state.canNext || state.processing}>
|
label={nextBtnText}
|
||||||
<ButtonText>{nextBtnText}</ButtonText>
|
variant="solid"
|
||||||
{state.processing && <Loader size="xs" style={{color: 'white'}} />}
|
color="primary"
|
||||||
</Button>
|
size="small"
|
||||||
</View>
|
onPress={onNext}
|
||||||
|
disabled={!state.canNext || state.processing}>
|
||||||
|
<ButtonText>{nextBtnText}</ButtonText>
|
||||||
|
{state.processing && <Loader size="xs" style={{color: 'white'}} />}
|
||||||
|
</Button>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
|
||||||
<WizardEditListDialog
|
<WizardEditListDialog
|
||||||
control={editDialogControl}
|
control={editDialogControl}
|
||||||
|
|||||||
Reference in New Issue
Block a user