Skip to content

Commit

Permalink
Avatar type for Feed check (#2661)
Browse files Browse the repository at this point in the history
* Changed type from algo to list

* Fixed to check if it's a feed or a list
  • Loading branch information
dollproxy authored Jan 30, 2024
1 parent 640ce5e commit f81bacc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/state/queries/feed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ export function getFeedTypeFromUri(uri: string) {
return pathname.includes(feedSourceNSIDs.feed) ? 'feed' : 'list'
}

export function getAvatarTypeFromUri(uri: string) {
return getFeedTypeFromUri(uri) === 'feed' ? 'algo' : 'list'
}

export function useFeedSourceInfoQuery({uri}: {uri: string}) {
const type = getFeedTypeFromUri(uri)

Expand Down
4 changes: 3 additions & 1 deletion src/view/screens/Feeds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
useFeedSourceInfoQuery,
useGetPopularFeedsQuery,
useSearchPopularFeedsMutation,
getAvatarTypeFromUri,
} from '#/state/queries/feed'
import {cleanError} from 'lib/strings/errors'
import {useComposerControls} from '#/state/shell/composer'
Expand Down Expand Up @@ -555,6 +556,7 @@ function SavedFeed({feedUri}: {feedUri: string}) {
const pal = usePalette('default')
const {isMobile} = useWebMediaQueries()
const {data: info, error} = useFeedSourceInfoQuery({uri: feedUri})
const typeAvatar = getAvatarTypeFromUri(feedUri)

if (!info)
return (
Expand Down Expand Up @@ -582,7 +584,7 @@ function SavedFeed({feedUri}: {feedUri: string}) {
/>
</View>
) : (
<UserAvatar type="algo" size={28} avatar={info.avatar} />
<UserAvatar type={typeAvatar} size={28} avatar={info.avatar} />
)}
<View
style={{flex: 1, flexDirection: 'row', gap: 8, alignItems: 'center'}}>
Expand Down

0 comments on commit f81bacc

Please sign in to comment.