From 63fbdede42fe28846e552dd64ff7f0fce829a3f8 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 25 Jan 2024 01:38:23 +0000 Subject: [PATCH] Clean up the post controls UI (#2614) * Hide zeros on post ctrls * Align buttons between posts * Update loading placeholders * Remove unused --- src/view/com/util/LoadingPlaceholder.tsx | 50 ++++++++++++------- src/view/com/util/post-ctrls/PostCtrls.tsx | 21 ++++---- src/view/com/util/post-ctrls/RepostButton.tsx | 9 ++-- .../com/util/post-ctrls/RepostButton.web.tsx | 13 ++--- 4 files changed, 52 insertions(+), 41 deletions(-) diff --git a/src/view/com/util/LoadingPlaceholder.tsx b/src/view/com/util/LoadingPlaceholder.tsx index b7f13377..8941bfb9 100644 --- a/src/view/com/util/LoadingPlaceholder.tsx +++ b/src/view/com/util/LoadingPlaceholder.tsx @@ -6,8 +6,12 @@ import { ViewStyle, DimensionValue, } from 'react-native' -import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' -import {HeartIcon, HeartIconSolid} from 'lib/icons' +import { + HeartIcon, + HeartIconSolid, + CommentBottomArrow, + RepostIcon, +} from 'lib/icons' import {s} from 'lib/styles' import {useTheme} from 'lib/ThemeContext' import {usePalette} from 'lib/hooks/usePalette' @@ -61,30 +65,30 @@ export function PostLoadingPlaceholder({ - - - - + + + - - + - + - + @@ -267,6 +271,18 @@ const styles = StyleSheet.create({ paddingHorizontal: 10, paddingTop: 20, paddingBottom: 5, + paddingRight: 15, + }, + postCtrls: { + opacity: 0.5, + flexDirection: 'row', + justifyContent: 'space-between', + }, + postCtrl: { + padding: 5, + flex: 1, + flexDirection: 'row', + alignItems: 'center', }, avatar: { borderRadius: 26, diff --git a/src/view/com/util/post-ctrls/PostCtrls.tsx b/src/view/com/util/post-ctrls/PostCtrls.tsx index 50ef8a87..9ef83b26 100644 --- a/src/view/com/util/post-ctrls/PostCtrls.tsx +++ b/src/view/com/util/post-ctrls/PostCtrls.tsx @@ -165,19 +165,21 @@ let PostCtrls = ({ strokeWidth={3} size={big ? 20 : 15} /> - {typeof post.replyCount !== 'undefined' ? ( + {typeof post.replyCount !== 'undefined' && post.replyCount > 0 ? ( {post.replyCount} ) : undefined} - + + + )} - {typeof post.likeCount !== 'undefined' ? ( + {typeof post.likeCount !== 'undefined' && post.likeCount > 0 ? ( { requireAuth(() => onPressToggleRepostWrapper()) }} - style={[styles.control, !big && styles.controlPad]} + style={[styles.container]} accessibilityRole="button" accessibilityLabel={`${ isReposted @@ -71,7 +71,7 @@ let RepostButton = ({ strokeWidth={2.4} size={big ? 24 : 20} /> - {typeof repostCount !== 'undefined' ? ( + {typeof repostCount !== 'undefined' && repostCount > 0 ? ( , ]}> - {typeof repostCount !== 'undefined' ? ( + {typeof repostCount !== 'undefined' && repostCount > 0 ? ( - {repostCount ?? 0} + {repostCount} ) : undefined} @@ -110,15 +109,11 @@ export const RepostButton = ({ } const styles = StyleSheet.create({ - control: { - display: 'flex', + container: { flexDirection: 'row', alignItems: 'center', gap: 4, }, - controlPad: { - padding: 5, - }, reposted: { color: colors.green3, },