From a2b089d3155afcdd9c7a43474692ab8c82fdf276 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Wed, 17 May 2023 13:42:29 -0500 Subject: [PATCH] Add 'algo' variant of avatars --- src/view/com/algos/AlgoItem.tsx | 2 +- src/view/com/util/UserAvatar.tsx | 60 ++++++++++++++++++++++---------- src/view/screens/CustomFeed.tsx | 6 +++- src/view/screens/SavedFeeds.tsx | 6 +++- 4 files changed, 53 insertions(+), 21 deletions(-) diff --git a/src/view/com/algos/AlgoItem.tsx b/src/view/com/algos/AlgoItem.tsx index 56ee6d1d..45526309 100644 --- a/src/view/com/algos/AlgoItem.tsx +++ b/src/view/com/algos/AlgoItem.tsx @@ -61,7 +61,7 @@ const AlgoItem = observer( key={item.data.uri}> - + diff --git a/src/view/com/util/UserAvatar.tsx b/src/view/com/util/UserAvatar.tsx index f3679326..10a605b2 100644 --- a/src/view/com/util/UserAvatar.tsx +++ b/src/view/com/util/UserAvatar.tsx @@ -1,6 +1,6 @@ import React, {useMemo} from 'react' import {StyleSheet, View} from 'react-native' -import Svg, {Circle, Path} from 'react-native-svg' +import Svg, {Circle, Rect, Path} from 'react-native-svg' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {IconProp} from '@fortawesome/fontawesome-svg-core' import {HighPriorityImage} from 'view/com/util/images/Image' @@ -17,9 +17,29 @@ import {isWeb, isAndroid} from 'platform/detection' import {Image as RNImage} from 'react-native-image-crop-picker' import {AvatarModeration} from 'lib/labeling/types' +type Type = 'user' | 'algo' + const BLUR_AMOUNT = isWeb ? 5 : 100 -function DefaultAvatar({size}: {size: number}) { +function DefaultAvatar({type, size}: {type: Type; size: number}) { + if (type === 'algo') { + // Font Awesome Pro 6.4.0 by @fontawesome -https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. + return ( + + + + + ) + } return ( { + if (type === 'algo') { + return { + width: size, + height: size, + borderRadius: 8, + } + } + return { + width: size, + height: size, + borderRadius: Math.floor(size / 2), + } + }, [type, size]) + const dropdownItems = useMemo( () => [ !isWeb && { @@ -146,11 +183,7 @@ export function UserAvatar({ {avatar ? ( @@ -170,11 +203,7 @@ export function UserAvatar({ ) : ( - + {warning} ) @@ -201,11 +230,6 @@ const styles = StyleSheet.create({ justifyContent: 'center', backgroundColor: colors.gray5, }, - avatarImage: { - width: 80, - height: 80, - borderRadius: 40, - }, warningIconContainer: { position: 'absolute', right: 0, diff --git a/src/view/screens/CustomFeed.tsx b/src/view/screens/CustomFeed.tsx index 5c19556e..a50916a9 100644 --- a/src/view/screens/CustomFeed.tsx +++ b/src/view/screens/CustomFeed.tsx @@ -67,7 +67,11 @@ const ListHeaderComponent = observer(({uri}: {uri: string}) => { - + @{currentFeed?.data.creator.handle} diff --git a/src/view/screens/SavedFeeds.tsx b/src/view/screens/SavedFeeds.tsx index c3a4542c..4f028703 100644 --- a/src/view/screens/SavedFeeds.tsx +++ b/src/view/screens/SavedFeeds.tsx @@ -146,7 +146,11 @@ const ListHeaderComponent = observer( }) }} style={styles.pinnedItem}> - +