From be4171c168fc19c85d6a60f8628bae9397f0409d Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Fri, 5 May 2023 13:52:53 -0500 Subject: [PATCH] Tune the empty state code --- src/view/com/lists/MyListsEmptyState.tsx | 86 ------------- .../EmptyStateWithButton.tsx} | 24 ++-- src/view/screens/Moderation.tsx | 2 +- src/view/screens/ModerationMuteLists.tsx | 119 ++++++++++-------- 4 files changed, 83 insertions(+), 148 deletions(-) delete mode 100644 src/view/com/lists/MyListsEmptyState.tsx rename src/view/com/{lists/SubscribedMutelistsEmptyState.tsx => util/EmptyStateWithButton.tsx} (78%) diff --git a/src/view/com/lists/MyListsEmptyState.tsx b/src/view/com/lists/MyListsEmptyState.tsx deleted file mode 100644 index 641404b229..0000000000 --- a/src/view/com/lists/MyListsEmptyState.tsx +++ /dev/null @@ -1,86 +0,0 @@ -import React from 'react' -import {StyleSheet, View} from 'react-native' -import { - FontAwesomeIcon, - FontAwesomeIconStyle, -} from '@fortawesome/react-native-fontawesome' -import {Text} from '../util/text/Text' -import {Button} from '../util/forms/Button' -import {usePalette} from 'lib/hooks/usePalette' -import {s} from 'lib/styles' - -export function MyListsEmptyState() { - const pal = usePalette('default') - const palInverted = usePalette('inverted') - - const onPressCreateList = React.useCallback(() => { - // TODO - }, []) - - return ( - - - - - - Lists are public collections of users. You can create a list or find - other users' lists on their profiles. - - - - - - - Currently only "mutelists" are available. Feed lists will be - implemented soon! - - - - ) -} -const styles = StyleSheet.create({ - container: { - height: '100%', - paddingVertical: 40, - paddingHorizontal: 30, - }, - iconContainer: { - marginBottom: 16, - }, - icon: { - marginLeft: 'auto', - marginRight: 'auto', - }, - btns: { - flexDirection: 'row', - justifyContent: 'center', - }, - btn: { - gap: 10, - marginVertical: 20, - flexDirection: 'row', - alignItems: 'center', - paddingVertical: 14, - paddingHorizontal: 24, - borderRadius: 30, - }, - notice: { - borderRadius: 12, - paddingHorizontal: 12, - paddingVertical: 10, - marginHorizontal: 30, - }, -}) diff --git a/src/view/com/lists/SubscribedMutelistsEmptyState.tsx b/src/view/com/util/EmptyStateWithButton.tsx similarity index 78% rename from src/view/com/lists/SubscribedMutelistsEmptyState.tsx rename to src/view/com/util/EmptyStateWithButton.tsx index 81faaafa12..d868d138d8 100644 --- a/src/view/com/lists/SubscribedMutelistsEmptyState.tsx +++ b/src/view/com/util/EmptyStateWithButton.tsx @@ -4,12 +4,20 @@ import { FontAwesomeIcon, FontAwesomeIconStyle, } from '@fortawesome/react-native-fontawesome' -import {Text} from '../util/text/Text' -import {Button} from '../util/forms/Button' +import {IconProp} from '@fortawesome/fontawesome-svg-core' +import {Text} from './text/Text' +import {Button} from './forms/Button' import {usePalette} from 'lib/hooks/usePalette' import {s} from 'lib/styles' -export function SubscribedMutelistsEmptyState() { +interface Props { + icon: IconProp + message: string + buttonLabel: string + onPress: () => void +} + +export function EmptyStateWithButton(props: Props) { const pal = usePalette('default') const palInverted = usePalette('inverted') @@ -21,25 +29,23 @@ export function SubscribedMutelistsEmptyState() { - You can subscribe to mutelists to automatically mute all of the users - they include. Mutelists are public but your subscription to a mutelist - is private. + {props.message} - diff --git a/src/view/screens/Moderation.tsx b/src/view/screens/Moderation.tsx index d54624585b..a5933ad3c6 100644 --- a/src/view/screens/Moderation.tsx +++ b/src/view/screens/Moderation.tsx @@ -74,7 +74,7 @@ export const ModerationScreen = withAuthRequired( /> - Mutelist subscriptions + Mute-list subscriptions { const pal = usePalette('default') const store = useStores() - const [selectedPage, setSelectedPage] = React.useState(0) - - const mine: ListsListModel = React.useMemo(() => { - const list = new ListsListModel(store, store.me.did) - list.loadMore() - return list - }, [store]) const mutelists: ListsListModel = React.useMemo(() => { const list = new ListsListModel(store, 'mutelists') @@ -35,54 +30,74 @@ export const ModerationMuteListsScreen = withAuthRequired(({route}: Props) => { useFocusEffect( React.useCallback(() => { store.shell.setMinimalShellMode(false) - }, [store, selectedPage]), + }, [store]), ) - const onPageSelected = React.useCallback( - (index: number) => { - setSelectedPage(index) - }, - [store, setSelectedPage], - ) - - const renderTabBar = React.useCallback((props: RenderTabBarFnProps) => { + const renderEmptyState = React.useCallback(() => { return ( - undefined} /> ) }, []) - const renderMineEmptyState = React.useCallback(() => { - return - }, []) - - const renderMutelistsEmptyState = React.useCallback(() => { - return - }, []) - return ( - - - - + + + + ) }) + +const styles = StyleSheet.create({ + container: { + flex: 1, + paddingBottom: isDesktopWeb ? 0 : 100, + }, + containerDesktop: { + borderLeftWidth: 1, + borderRightWidth: 1, + }, + title: { + textAlign: 'center', + marginTop: 12, + marginBottom: 12, + }, + description: { + textAlign: 'center', + paddingHorizontal: 30, + marginBottom: 14, + }, + descriptionDesktop: { + marginTop: 14, + }, + + flex1: { + flex: 1, + }, + empty: { + paddingHorizontal: 20, + paddingVertical: 20, + borderRadius: 16, + marginHorizontal: 24, + marginTop: 10, + }, + emptyText: { + textAlign: 'center', + }, + + footer: { + height: 200, + paddingTop: 20, + }, +})