diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-04-12 18:26:38 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-12 18:26:38 -0700 |
commit | 2fed6c402159c6084dd481ab87c5e8b034e910ac (patch) | |
tree | 5907b2b67c900ef78de89e12ad9ae4c0d5ef6715 /src/view/com/util/UserAvatar.tsx | |
parent | a20d034ba5b18c4512f3a36f733bb5cd2199424e (diff) | |
download | voidsky-2fed6c402159c6084dd481ab87c5e8b034e910ac.tar.zst |
Add first round of labeling tools (#467)
* Rework notifications to sync locally in full and give users better control * Fix positioning of load more btn on web * Improve behavior of load more notifications btn * Fix to post rendering * Fix notification fetch abort condition * Add start of post-hiding by labels * Create a standard postcontainer and improve show/hide UI on posts * Add content hiding to expanded post form * Improve label rendering to give more context to users when appropriate * Fix rendering bug * Add user/profile labeling * Implement content filtering preferences * Filter notifications by content prefs * Update test-pds config * Bump deps
Diffstat (limited to 'src/view/com/util/UserAvatar.tsx')
-rw-r--r-- | src/view/com/util/UserAvatar.tsx | 47 |
1 files changed, 40 insertions, 7 deletions
diff --git a/src/view/com/util/UserAvatar.tsx b/src/view/com/util/UserAvatar.tsx index ff741cd34..d18c2d697 100644 --- a/src/view/com/util/UserAvatar.tsx +++ b/src/view/com/util/UserAvatar.tsx @@ -44,10 +44,12 @@ function DefaultAvatar({size}: {size: number}) { export function UserAvatar({ size, avatar, + hasWarning, onSelectNewAvatar, }: { size: number avatar?: string | null + hasWarning?: boolean onSelectNewAvatar?: (img: PickedMedia | null) => void }) { const store = useStores() @@ -105,6 +107,22 @@ export function UserAvatar({ }, }, ] + + const warning = React.useMemo(() => { + if (!hasWarning) { + return <></> + } + return ( + <View style={[styles.warningIconContainer, pal.view]}> + <FontAwesomeIcon + icon="exclamation-circle" + style={styles.warningIcon} + size={Math.floor(size / 3)} + /> + </View> + ) + }, [hasWarning, size, pal]) + // onSelectNewAvatar is only passed as prop on the EditProfile component return onSelectNewAvatar ? ( <DropdownButton @@ -137,14 +155,20 @@ export function UserAvatar({ </View> </DropdownButton> ) : avatar ? ( - <HighPriorityImage - testID="userAvatarImage" - style={{width: size, height: size, borderRadius: Math.floor(size / 2)}} - resizeMode="stretch" - source={{uri: avatar}} - /> + <View style={{width: size, height: size}}> + <HighPriorityImage + testID="userAvatarImage" + style={{width: size, height: size, borderRadius: Math.floor(size / 2)}} + resizeMode="stretch" + source={{uri: avatar}} + /> + {warning} + </View> ) : ( - <DefaultAvatar size={size} /> + <View style={{width: size, height: size}}> + <DefaultAvatar size={size} /> + {warning} + </View> ) } @@ -165,4 +189,13 @@ const styles = StyleSheet.create({ height: 80, borderRadius: 40, }, + warningIconContainer: { + position: 'absolute', + right: 0, + bottom: 0, + borderRadius: 100, + }, + warningIcon: { + color: colors.red3, + }, }) |