[🏁 #10] Searching for feeds (#4368)

* refactor name

* refactor to support feeds search

* more refactor

* cleanup

* allow searching for feeds

* better empty states

* move some stuff around

* one more move

* rename buttons

* another move

* clarify variable names
This commit is contained in:
Hailey
2024-06-04 17:12:41 -07:00
committed by GitHub
parent 6cc82a41fc
commit 1c28bf47f2
8 changed files with 271 additions and 131 deletions
+7 -6
View File
@@ -1,5 +1,6 @@
import React from 'react'
import {AppBskyActorDefs} from '@atproto/api'
import {GeneratorView} from '@atproto/api/dist/client/types/app/bsky/feed/defs'
const steps = ['Landing', 'Details', 'Profiles', 'Feeds'] as const
type Step = (typeof steps)[number]
@@ -12,8 +13,8 @@ type Action =
| {type: 'SetDescription'; description: string}
| {type: 'AddProfile'; profile: AppBskyActorDefs.ProfileViewBasic}
| {type: 'RemoveProfile'; profileDid: string}
| {type: 'AddFeed'; uri: string}
| {type: 'RemoveFeed'; uri: string}
| {type: 'AddFeed'; feed: GeneratorView}
| {type: 'RemoveFeed'; feedUri: string}
| {type: 'SetProcessing'; processing: boolean}
interface State {
@@ -23,7 +24,7 @@ interface State {
description?: string
avatar?: string
profiles: AppBskyActorDefs.ProfileViewBasic[]
feedUris: string[]
feeds: GeneratorView[]
processing: boolean
}
@@ -66,12 +67,12 @@ function reducer(state: State, action: Action): State {
}
break
case 'AddFeed':
updatedState = {...state, feedUris: [...state.feedUris, action.uri]}
updatedState = {...state, feeds: [...state.feeds, action.feed]}
break
case 'RemoveFeed':
updatedState = {
...state,
feedUris: state.feedUris.filter(uri => uri !== action.uri),
feeds: state.feeds.filter(f => f.uri !== action.feedUri),
}
break
case 'SetProcessing':
@@ -118,7 +119,7 @@ export function Provider({
canNext: true,
currentStep: initialStep,
profiles: [],
feedUris: [],
feeds: [],
processing: false,
},
)