From da6bcc54cfff198e629a34987746028414867ec9 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 13 Dec 2024 21:38:43 +0000 Subject: [PATCH] Tweak ProfileList design (#7100) * Remove "No description" * Move Lists about into header * Remove pager with one tab * Layout tweaks --- src/screens/StarterPack/StarterPackScreen.tsx | 1 + src/view/com/pager/PagerWithHeader.tsx | 4 +- src/view/com/profile/ProfileSubpageHeader.tsx | 65 +++- src/view/screens/ProfileList.tsx | 321 +++++++----------- 4 files changed, 181 insertions(+), 210 deletions(-) diff --git a/src/screens/StarterPack/StarterPackScreen.tsx b/src/screens/StarterPack/StarterPackScreen.tsx index 1b2f61bd5e..3a3e4234f1 100644 --- a/src/screens/StarterPack/StarterPackScreen.tsx +++ b/src/screens/StarterPack/StarterPackScreen.tsx @@ -407,6 +407,7 @@ function Header({ isOwner={isOwn} avatar={undefined} creator={creator} + purpose="app.bsky.graph.defs#referencelist" avatarType="starter-pack"> {hasSession ? ( diff --git a/src/view/com/pager/PagerWithHeader.tsx b/src/view/com/pager/PagerWithHeader.tsx index dcf141f84d..1746d2ca13 100644 --- a/src/view/com/pager/PagerWithHeader.tsx +++ b/src/view/com/pager/PagerWithHeader.tsx @@ -21,6 +21,7 @@ import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback' import {ScrollProvider} from '#/lib/ScrollContext' import {isIOS} from '#/platform/detection' import {Pager, PagerRef, RenderTabBarFnProps} from '#/view/com/pager/Pager' +import {useTheme} from '#/alf' import {ListMethods} from '../util/List' import {PagerHeaderProvider} from './PagerHeaderContext' import {TabBar} from './TabBar' @@ -256,6 +257,7 @@ let PagerTabBar = ({ dragProgress: SharedValue dragState: SharedValue<'idle' | 'dragging' | 'settling'> }): React.ReactNode => { + const t = useTheme() const [minimumHeaderHeight, setMinimumHeaderHeight] = React.useState(0) const headerTransform = useAnimatedStyle(() => { const translateY = @@ -277,7 +279,7 @@ let PagerTabBar = ({ return ( + style={[styles.tabBarMobile, headerTransform, t.atoms.bg]}> @@ -123,7 +126,7 @@ export function ProfileSubpageHeader({ )} - + {isLoading ? ( )} - {isLoading ? ( + {isLoading || !creator ? ( ) : ( - - {!creator ? ( - by — - ) : isOwner ? ( - by you - ) : ( - - by{' '} - - - )} + + {purpose === 'app.bsky.graph.defs#curatelist' ? ( + isOwner ? ( + List by you + ) : ( + + List by{' '} + + + ) + ) : purpose === 'app.bsky.graph.defs#modlist' ? ( + isOwner ? ( + Moderation list by you + ) : ( + + Moderation list by{' '} + + + ) + ) : purpose === 'app.bsky.graph.defs#referencelist' ? ( + isOwner ? ( + Starter pack by you + ) : ( + + Starter pack by{' '} + + + ) + ) : null} )} diff --git a/src/view/screens/ProfileList.tsx b/src/view/screens/ProfileList.tsx index 27ede80a35..2e661ff462 100644 --- a/src/view/screens/ProfileList.tsx +++ b/src/view/screens/ProfileList.tsx @@ -1,5 +1,6 @@ import React, {useCallback, useMemo} from 'react' import {Pressable, StyleSheet, View} from 'react-native' +import {useAnimatedRef} from 'react-native-reanimated' import { AppBskyGraphDefs, AtUri, @@ -19,12 +20,11 @@ import {usePalette} from '#/lib/hooks/usePalette' import {useSetTitle} from '#/lib/hooks/useSetTitle' import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries' import {ComposeIcon2} from '#/lib/icons' -import {makeListLink, makeProfileLink} from '#/lib/routes/links' +import {makeListLink} from '#/lib/routes/links' import {CommonNavigatorParams, NativeStackScreenProps} from '#/lib/routes/types' import {NavigationProp} from '#/lib/routes/types' import {shareUrl} from '#/lib/sharing' import {cleanError} from '#/lib/strings/errors' -import {sanitizeHandle} from '#/lib/strings/handles' import {toShareUrl} from '#/lib/strings/url-helpers' import {s} from '#/lib/styles' import {logger} from '#/logger' @@ -63,14 +63,13 @@ import { DropdownItem, NativeDropdown, } from '#/view/com/util/forms/NativeDropdown' -import {TextLink} from '#/view/com/util/Link' import {ListRef} from '#/view/com/util/List' import {LoadLatestBtn} from '#/view/com/util/load-latest/LoadLatestBtn' import {LoadingScreen} from '#/view/com/util/LoadingScreen' import {Text} from '#/view/com/util/text/Text' import * as Toast from '#/view/com/util/Toast' import {ListHiddenScreen} from '#/screens/List/ListHiddenScreen' -import {atoms as a, useTheme} from '#/alf' +import {atoms as a} from '#/alf' import {useDialogControl} from '#/components/Dialog' import * as Layout from '#/components/Layout' import * as Hider from '#/components/moderation/Hider' @@ -78,8 +77,7 @@ import * as Prompt from '#/components/Prompt' import {ReportDialog, useReportDialogControl} from '#/components/ReportDialog' import {RichText} from '#/components/RichText' -const SECTION_TITLES_CURATE = ['Posts', 'About'] -const SECTION_TITLES_MOD = ['About'] +const SECTION_TITLES_CURATE = ['Posts', 'People'] interface SectionRef { scrollToTop: () => void @@ -161,6 +159,7 @@ function ProfileListScreenLoaded({ const isScreenFocused = useIsFocused() const isHidden = list.labels?.findIndex(l => l.val === '!hide') !== -1 const isOwner = currentAccount?.did === list.creator.did + const scrollElRef = useAnimatedRef() const moderation = React.useMemo(() => { return moderateUserList(list, moderationOpts) @@ -259,19 +258,13 @@ function ProfileListScreenLoaded({ - - {({headerHeight, scrollElRef}) => ( - - )} - + {renderHeader()} + openComposer({})} @@ -652,101 +645,124 @@ function Header({ ] }, [_, subscribeMutePromptControl.open, subscribeBlockPromptControl.open]) + const descriptionRT = useMemo( + () => + list.description + ? new RichTextAPI({ + text: list.description, + facets: list.descriptionFacets, + }) + : undefined, + [list], + ) + return ( - - - {isCurateList ? ( -