From ff9161d8e70fc2e6d066fd045bd2a380c63cb46c Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Sat, 5 Nov 2022 16:12:06 -0500 Subject: [PATCH] Sizing and spacing fixes based on on-device testing --- src/view/com/notifications/FeedItem.tsx | 10 ++-- src/view/com/post-thread/PostThread.tsx | 14 +---- src/view/com/post-thread/PostThreadItem.tsx | 58 ++++++++++----------- src/view/com/post/Post.tsx | 8 +-- src/view/com/posts/FeedItem.tsx | 15 +++--- src/view/com/profile/ProfileHeader.tsx | 37 ++++++++----- src/view/com/util/DropdownBtn.tsx | 8 +-- src/view/com/util/UserBanner.tsx | 2 +- src/view/lib/icons.tsx | 26 ++++++--- src/view/lib/styles.ts | 3 ++ src/view/screens/PostThread.tsx | 6 ++- src/view/shell/mobile/Composer.tsx | 2 +- src/view/shell/mobile/MainMenu.tsx | 24 ++++++--- 13 files changed, 120 insertions(+), 93 deletions(-) diff --git a/src/view/com/notifications/FeedItem.tsx b/src/view/com/notifications/FeedItem.tsx index 8ac661a2..45bad95f 100644 --- a/src/view/com/notifications/FeedItem.tsx +++ b/src/view/com/notifications/FeedItem.tsx @@ -133,20 +133,20 @@ export const FeedItem = observer(function FeedItem({ style={styles.metaItem} href={authors[0].href} title={`@${authors[0].handle}`}> - + {authors[0].displayName || authors[0].handle} {authors.length > 1 ? ( <> - and - + and + {authors.length - 1} {pluralize(authors.length - 1, 'other')} ) : undefined} - {action} - + {action} + {ago(item.indexedAt)} diff --git a/src/view/com/post-thread/PostThread.tsx b/src/view/com/post-thread/PostThread.tsx index 8a0ddab5..5d0a5ba4 100644 --- a/src/view/com/post-thread/PostThread.tsx +++ b/src/view/com/post-thread/PostThread.tsx @@ -1,4 +1,4 @@ -import React, {useState, useEffect, useRef} from 'react' +import React, {useState, useEffect} from 'react' import {observer} from 'mobx-react-lite' import {ActivityIndicator, FlatList, Text, View} from 'react-native' import { @@ -9,12 +9,9 @@ import {useStores} from '../../../state' import {SharePostModel} from '../../../state/models/shell' import {PostThreadItem} from './PostThreadItem' -const UPDATE_DELAY = 2e3 // wait 2s before refetching the thread for updates - export const PostThread = observer(function PostThread({uri}: {uri: string}) { const store = useStores() const [view, setView] = useState() - const [lastUpdate, setLastUpdate] = useState(Date.now()) useEffect(() => { if (view?.params.uri === uri) { @@ -27,14 +24,6 @@ export const PostThread = observer(function PostThread({uri}: {uri: string}) { newView.setup().catch(err => console.error('Failed to fetch thread', err)) }, [uri, view?.params.uri, store]) - // TODO - // useFocusEffect(() => { - // if (Date.now() - lastUpdate > UPDATE_DELAY) { - // view?.update() - // setLastUpdate(Date.now()) - // } - // }) - const onPressShare = (uri: string) => { store.shell.openModal(new SharePostModel(uri)) } @@ -83,6 +72,7 @@ export const PostThread = observer(function PostThread({uri}: {uri: string}) { renderItem={renderItem} refreshing={view.isRefreshing} onRefresh={onRefresh} + style={{flex: 1}} /> ) }) diff --git a/src/view/com/post-thread/PostThreadItem.tsx b/src/view/com/post-thread/PostThreadItem.tsx index 7add9236..17f37cb2 100644 --- a/src/view/com/post-thread/PostThreadItem.tsx +++ b/src/view/com/post-thread/PostThreadItem.tsx @@ -77,14 +77,14 @@ export const PostThreadItem = observer(function PostThreadItem({ /> - + - {item.author.displayName} + {item.author.displayName} - + · {ago(item.indexedAt)} @@ -104,7 +104,7 @@ export const PostThreadItem = observer(function PostThreadItem({ style={styles.metaItem} href={authorHref} title={authorTitle}> - @{item.author.handle} + @{item.author.handle} @@ -125,8 +125,10 @@ export const PostThreadItem = observer(function PostThreadItem({ style={styles.expandedInfoItem} href={repostsHref} title={repostsTitle}> - - {item.repostCount}{' '} + + + {item.repostCount} + {' '} {pluralize(item.repostCount, 'repost')} @@ -138,8 +140,10 @@ export const PostThreadItem = observer(function PostThreadItem({ style={styles.expandedInfoItem} href={likesHref} title={likesTitle}> - - {item.likeCount}{' '} + + + {item.likeCount} + {' '} {pluralize(item.likeCount, 'like')} @@ -205,37 +209,20 @@ export const PostThreadItem = observer(function PostThreadItem({ /> - {item.replyingToAuthor && - item.replyingToAuthor !== item.author.handle && ( - - - - - @{item.replyingToAuthor} - - - - )} - {item.author.displayName} + {item.author.displayName} - @{item.author.handle} + @{item.author.handle} - + · {ago(item.indexedAt)} @@ -250,11 +237,24 @@ export const PostThreadItem = observer(function PostThreadItem({ /> + {item.replyingToAuthor && + item.replyingToAuthor !== item.author.handle && ( + + Replying to + + + @{item.replyingToAuthor} + + + + )} - {item.author.displayName} + {item.author.displayName} - @{item.author.handle} + @{item.author.handle} - + · {ago(item.indexedAt)} @@ -123,7 +123,7 @@ export const Post = observer(function Post({uri}: {uri: string}) { - {item.author.displayName} + {item.author.displayName} - @{item.author.handle} + @{item.author.handle} - + · {ago(item.indexedAt)} @@ -108,13 +108,12 @@ export const FeedItem = observer(function FeedItem({ {replyHref !== '' && ( - - - Reply to + + Replying to @@ -124,7 +123,7 @@ export const FeedItem = observer(function FeedItem({ - {view.followersCount} - + + {view.followersCount} + + {pluralize(view.followersCount, 'follower')} @@ -163,27 +165,35 @@ export const ProfileHeader = observer(function ProfileHeader({ - {view.followsCount} - following + + {view.followsCount} + + following ) : undefined} {view.isScene ? ( - {view.followsCount} - + + {view.followsCount} + + {pluralize(view.followsCount, 'member')} ) : undefined} - {view.postsCount} - {pluralize(view.postsCount, 'post')} + + {view.postsCount} + + + {pluralize(view.postsCount, 'post')} + {view.description && ( - {view.description} + {view.description} )} { undefined /* @@ -268,7 +278,7 @@ const styles = StyleSheet.create({ // marginBottom: 14, }, displayName: { - fontSize: 24, + fontSize: 28, fontWeight: 'bold', }, @@ -277,7 +287,7 @@ const styles = StyleSheet.create({ marginBottom: 8, }, handle: { - fontSize: 14, + fontSize: 15, fontWeight: 'bold', color: colors.gray5, }, @@ -288,7 +298,7 @@ const styles = StyleSheet.create({ marginRight: 5, }, typeLabel: { - fontSize: 14, + fontSize: 15, fontWeight: 'bold', color: colors.gray5, }, @@ -297,6 +307,9 @@ const styles = StyleSheet.create({ flexDirection: 'row', marginBottom: 8, }, + metricsText: { + fontSize: 15, + }, badgesLine: { flexDirection: 'row', diff --git a/src/view/com/util/DropdownBtn.tsx b/src/view/com/util/DropdownBtn.tsx index 825a5395..2e9ca0c1 100644 --- a/src/view/com/util/DropdownBtn.tsx +++ b/src/view/com/util/DropdownBtn.tsx @@ -157,9 +157,9 @@ const styles = StyleSheet.create({ menuItem: { flexDirection: 'row', alignItems: 'center', - paddingVertical: 6, - paddingLeft: 10, - paddingRight: 30, + paddingVertical: 10, + paddingLeft: 15, + paddingRight: 40, }, menuItemBorder: { borderTopWidth: 1, @@ -172,6 +172,6 @@ const styles = StyleSheet.create({ marginRight: 8, }, label: { - fontSize: 15, + fontSize: 18, }, }) diff --git a/src/view/com/util/UserBanner.tsx b/src/view/com/util/UserBanner.tsx index 6c886897..16e18c84 100644 --- a/src/view/com/util/UserBanner.tsx +++ b/src/view/com/util/UserBanner.tsx @@ -5,7 +5,7 @@ import {getGradient} from '../../lib/asset-gen' export function UserBanner({handle}: {handle: string}) { const gradient = getGradient(handle) return ( - + diff --git a/src/view/lib/icons.tsx b/src/view/lib/icons.tsx index 8cc40a73..bf4d242f 100644 --- a/src/view/lib/icons.tsx +++ b/src/view/lib/icons.tsx @@ -31,12 +31,18 @@ export function GridIcon({style}: {style?: StyleProp}) { ) } -export function HomeIcon({style}: {style?: StyleProp}) { +export function HomeIcon({ + style, + size, +}: { + style?: StyleProp + size?: string | number +}) { return ( }) { +export function UserGroupIcon({ + style, + size, +}: { + style?: StyleProp + size?: string | number +}) { return ( { }, [visible, store.nav, name]) return ( - + - + + + ) } diff --git a/src/view/shell/mobile/Composer.tsx b/src/view/shell/mobile/Composer.tsx index 62bc7304..96fd5044 100644 --- a/src/view/shell/mobile/Composer.tsx +++ b/src/view/shell/mobile/Composer.tsx @@ -78,6 +78,6 @@ const styles = StyleSheet.create({ bottom: 0, width: '100%', backgroundColor: '#fff', - paddingTop: 20, + paddingTop: 24, }, }) diff --git a/src/view/shell/mobile/MainMenu.tsx b/src/view/shell/mobile/MainMenu.tsx index 89c7857f..fbd31ff2 100644 --- a/src/view/shell/mobile/MainMenu.tsx +++ b/src/view/shell/mobile/MainMenu.tsx @@ -51,6 +51,10 @@ export const MainMenu = observer( // rendering // = + const MenuItemBlank = () => ( + + ) + const MenuItem = ({ icon, label, @@ -67,16 +71,16 @@ export const MainMenu = observer( onPress={() => onNavigate(url)}> {icon === 'home' ? ( - + ) : icon === 'user-group' ? ( - + ) : icon === 'bell' ? ( - + ) : ( )} @@ -133,7 +137,7 @@ export const MainMenu = observer( onPress={() => onNavigate(`/profile/${store.me.handle || ''}`)}> @@ -167,6 +171,8 @@ export const MainMenu = observer( url="/notifications" count={store.me.notificationCount} /> + + Scenes @@ -183,6 +189,8 @@ export const MainMenu = observer( + + @@ -215,7 +223,7 @@ const styles = StyleSheet.create({ alignItems: 'center', height: 40, paddingHorizontal: 10, - marginBottom: 10, + marginBottom: 16, }, section: { paddingHorizontal: 10, @@ -238,7 +246,7 @@ const styles = StyleSheet.create({ marginRight: 8, }, profileText: { - fontSize: 15, + fontSize: 17, fontWeight: 'bold', }, @@ -256,7 +264,7 @@ const styles = StyleSheet.create({ marginBottom: 20, }, menuItem: { - width: 82, + flex: 1, alignItems: 'center', }, menuItemMargin: {