Update UI around Empty Message

This commit is contained in:
Justin 2022-06-22 11:20:29 -04:00
parent 1f3785c920
commit 14a9a2f4eb
13 changed files with 48 additions and 17 deletions

View File

@ -159,7 +159,7 @@
"empty_column.follow_requests": "You don\"t have any follow requests yet. When you receive one, it will show up here.", "empty_column.follow_requests": "You don\"t have any follow requests yet. When you receive one, it will show up here.",
"empty_column.group": "There is nothing in this group yet. When members of this group make new posts, they will appear here.", "empty_column.group": "There is nothing in this group yet. When members of this group make new posts, they will appear here.",
"empty_column.hashtag": "There is nothing in this hashtag yet.", "empty_column.hashtag": "There is nothing in this hashtag yet.",
"empty_column.home": "Your home timeline is empty! Visit {public} to get started and meet other users.", "empty_column.home": "Or you can visit {public} to get started and meet other users.",
"empty_column.home.local_tab": "the {site_title} tab", "empty_column.home.local_tab": "the {site_title} tab",
"empty_column.list": "There is nothing in this list yet. When members of this list create new posts, they will appear here.", "empty_column.list": "There is nothing in this list yet. When members of this list create new posts, they will appear here.",
"empty_column.lists": "You don\"t have any lists yet. When you create one, it will show up here.", "empty_column.lists": "You don\"t have any lists yet. When you create one, it will show up here.",
@ -637,7 +637,7 @@
"empty_column.follow_requests": "You don\"t have any follow requests yet. When you receive one, it will show up here.", "empty_column.follow_requests": "You don\"t have any follow requests yet. When you receive one, it will show up here.",
"empty_column.group": "There is nothing in this group yet. When members of this group make new posts, they will appear here.", "empty_column.group": "There is nothing in this group yet. When members of this group make new posts, they will appear here.",
"empty_column.hashtag": "There is nothing in this hashtag yet.", "empty_column.hashtag": "There is nothing in this hashtag yet.",
"empty_column.home": "Your home timeline is empty! Visit {public} to get started and meet other users.", "empty_column.home": "Or you can visit {public} to get started and meet other users.",
"empty_column.home.local_tab": "the {site_title} tab", "empty_column.home.local_tab": "the {site_title} tab",
"empty_column.list": "There is nothing in this list yet. When members of this list create new posts, they will appear here.", "empty_column.list": "There is nothing in this list yet. When members of this list create new posts, they will appear here.",
"empty_column.lists": "You don\"t have any lists yet. When you create one, it will show up here.", "empty_column.lists": "You don\"t have any lists yet. When you create one, it will show up here.",

View File

@ -7,7 +7,7 @@ import PullToRefresh from 'soapbox/components/pull-to-refresh';
import { useSettings } from 'soapbox/hooks'; import { useSettings } from 'soapbox/hooks';
import LoadMore from './load_more'; import LoadMore from './load_more';
import { Spinner, Text } from './ui'; import { Card, Spinner, Text } from './ui';
/** Custom Viruoso component context. */ /** Custom Viruoso component context. */
type Context = { type Context = {
@ -157,13 +157,13 @@ const ScrollableList = React.forwardRef<VirtuosoHandle, IScrollableList>(({
<div className='mt-2'> <div className='mt-2'>
{alwaysPrepend && prepend} {alwaysPrepend && prepend}
<div className='bg-primary-50 dark:bg-slate-700 mt-2 rounded-lg text-center p-8'> <Card variant='rounded' size='lg'>
{isLoading ? ( {isLoading ? (
<Spinner /> <Spinner />
) : ( ) : (
<Text>{emptyMessage}</Text> <Text>{emptyMessage}</Text>
)} )}
</div> </Card>
</div> </div>
); );
}; };

View File

@ -5,7 +5,7 @@ import { Link } from 'react-router-dom';
import { expandHomeTimeline } from 'soapbox/actions/timelines'; import { expandHomeTimeline } from 'soapbox/actions/timelines';
import { Column, Stack, Text } from 'soapbox/components/ui'; import { Column, Stack, Text } from 'soapbox/components/ui';
import Timeline from 'soapbox/features/ui/components/timeline'; import Timeline from 'soapbox/features/ui/components/timeline';
import { useAppSelector, useAppDispatch } from 'soapbox/hooks'; import { useAppSelector, useAppDispatch, useFeatures } from 'soapbox/hooks';
const messages = defineMessages({ const messages = defineMessages({
title: { id: 'column.home', defaultMessage: 'Home' }, title: { id: 'column.home', defaultMessage: 'Home' },
@ -14,6 +14,8 @@ const messages = defineMessages({
const HomeTimeline: React.FC = () => { const HomeTimeline: React.FC = () => {
const intl = useIntl(); const intl = useIntl();
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const features = useFeatures();
const polling = useRef<NodeJS.Timer | null>(null); const polling = useRef<NodeJS.Timer | null>(null);
const isPartial = useAppSelector(state => state.timelines.get('home')?.isPartial === true); const isPartial = useAppSelector(state => state.timelines.get('home')?.isPartial === true);
@ -66,12 +68,35 @@ const HomeTimeline: React.FC = () => {
emptyMessage={ emptyMessage={
<Stack space={1}> <Stack space={1}>
<Text size='xl' weight='medium' align='center'> <Text size='xl' weight='medium' align='center'>
Youre not following anyone yet <FormattedMessage
id='empty_column.home.title'
defaultMessage="You're not following anyone yet"
/>
</Text> </Text>
<Text theme='muted' align='center'> <Text theme='muted' align='center'>
{siteTitle} gets more interesting once you follow other users. <FormattedMessage
id='empty_column.home.subtitle'
defaultMessage='{siteTitle} gets more interesting once you follow other users.'
values={{ siteTitle }}
/>
</Text> </Text>
{features.federating && (
<Text theme='muted' align='center'>
<FormattedMessage
id='empty_column.home'
defaultMessage='Or you can visit {public} to get started and meet other users.'
values={{
public: (
<Link to='/timeline/local' className='text-primary-600 dark:text-primary-400 hover:underline'>
<FormattedMessage id='empty_column.home.local_tab' defaultMessage='the {site_title} tab' values={{ site_title: siteTitle }} />
</Link>
),
}}
/>
</Text>
)}
</Stack> </Stack>
} }
/> />

View File

@ -5,12 +5,14 @@ import { useDimensions } from '../useDimensions';
let listener: ((rect: any) => void) | undefined = undefined; let listener: ((rect: any) => void) | undefined = undefined;
(window as any).ResizeObserver = class ResizeObserver { (window as any).ResizeObserver = class ResizeObserver {
constructor(ls) { constructor(ls) {
listener = ls; listener = ls;
} }
observe() {} observe() {}
disconnect() {} disconnect() {}
}; };
describe('useDimensions()', () => { describe('useDimensions()', () => {
@ -56,10 +58,12 @@ describe('useDimensions()', () => {
it('disconnects on unmount', () => { it('disconnects on unmount', () => {
const disconnect = jest.fn(); const disconnect = jest.fn();
(window as any).ResizeObserver = class ResizeObserver { (window as any).ResizeObserver = class ResizeObserver {
observe() {} observe() {}
disconnect() { disconnect() {
disconnect(); disconnect();
} }
}; };
const { result, unmount } = renderHook(() => useDimensions()); const { result, unmount } = renderHook(() => useDimensions());

View File

@ -450,7 +450,7 @@
"empty_column.follow_requests": "You don't have any follow requests yet. When you receive one, it will show up here.", "empty_column.follow_requests": "You don't have any follow requests yet. When you receive one, it will show up here.",
"empty_column.group": "There is nothing in this group yet. When members of this group make new posts, they will appear here.", "empty_column.group": "There is nothing in this group yet. When members of this group make new posts, they will appear here.",
"empty_column.hashtag": "There is nothing in this hashtag yet.", "empty_column.hashtag": "There is nothing in this hashtag yet.",
"empty_column.home": "Your home timeline is empty! Visit {public} to get started and meet other users.", "empty_column.home": "Or you can visit {public} to get started and meet other users.",
"empty_column.home.local_tab": "the {site_title} tab", "empty_column.home.local_tab": "the {site_title} tab",
"empty_column.list": "There is nothing in this list yet.", "empty_column.list": "There is nothing in this list yet.",
"empty_column.lists": "You don't have any lists yet. When you create one, it will show up here.", "empty_column.lists": "You don't have any lists yet. When you create one, it will show up here.",

View File

@ -450,7 +450,7 @@
"empty_column.follow_requests": "You don't have any follow requests yet. When you receive one, it will show up here.", "empty_column.follow_requests": "You don't have any follow requests yet. When you receive one, it will show up here.",
"empty_column.group": "There is nothing in this group yet. When members of this group make new posts, they will appear here.", "empty_column.group": "There is nothing in this group yet. When members of this group make new posts, they will appear here.",
"empty_column.hashtag": "There is nothing in this hashtag yet.", "empty_column.hashtag": "There is nothing in this hashtag yet.",
"empty_column.home": "Your home timeline is empty! Visit {public} to get started and meet other users.", "empty_column.home": "Or you can visit {public} to get started and meet other users.",
"empty_column.home.local_tab": "the {site_title} tab", "empty_column.home.local_tab": "the {site_title} tab",
"empty_column.list": "There is nothing in this list yet. When members of this list create new posts, they will appear here.", "empty_column.list": "There is nothing in this list yet. When members of this list create new posts, they will appear here.",
"empty_column.lists": "You don't have any lists yet. When you create one, it will show up here.", "empty_column.lists": "You don't have any lists yet. When you create one, it will show up here.",

View File

@ -3793,7 +3793,7 @@
"id": "column.home" "id": "column.home"
}, },
{ {
"defaultMessage": "Your home timeline is empty! Visit {public} to get started and meet other users.", "defaultMessage": "Or you can visit {public} to get started and meet other users.",
"id": "empty_column.home" "id": "empty_column.home"
}, },
{ {

View File

@ -453,7 +453,9 @@
"empty_column.follow_requests": "You don't have any follow requests yet. When you receive one, it will show up here.", "empty_column.follow_requests": "You don't have any follow requests yet. When you receive one, it will show up here.",
"empty_column.group": "There is nothing in this group yet. When members of this group make new posts, they will appear here.", "empty_column.group": "There is nothing in this group yet. When members of this group make new posts, they will appear here.",
"empty_column.hashtag": "There is nothing in this hashtag yet.", "empty_column.hashtag": "There is nothing in this hashtag yet.",
"empty_column.home": "Your home timeline is empty! Visit {public} to get started and meet other users.", "empty_column.home": "Or you can visit {public} to get started and meet other users.",
"empty_column.home.title": "You're not following anyone yet",
"empty_column.home.subtitle": "{siteTitle} gets more interesting once you follow other users.",
"empty_column.home.local_tab": "the {site_title} tab", "empty_column.home.local_tab": "the {site_title} tab",
"empty_column.list": "There is nothing in this list yet. When members of this list create new posts, they will appear here.", "empty_column.list": "There is nothing in this list yet. When members of this list create new posts, they will appear here.",
"empty_column.lists": "You don't have any lists yet. When you create one, it will show up here.", "empty_column.lists": "You don't have any lists yet. When you create one, it will show up here.",

View File

@ -450,7 +450,7 @@
"empty_column.follow_requests": "You don't have any follow requests yet. When you receive one, it will show up here.", "empty_column.follow_requests": "You don't have any follow requests yet. When you receive one, it will show up here.",
"empty_column.group": "There is nothing in this group yet. When members of this group make new posts, they will appear here.", "empty_column.group": "There is nothing in this group yet. When members of this group make new posts, they will appear here.",
"empty_column.hashtag": "There is nothing in this hashtag yet.", "empty_column.hashtag": "There is nothing in this hashtag yet.",
"empty_column.home": "Your home timeline is empty! Visit {public} to get started and meet other users.", "empty_column.home": "Or you can visit {public} to get started and meet other users.",
"empty_column.home.local_tab": "the {site_title} tab", "empty_column.home.local_tab": "the {site_title} tab",
"empty_column.list": "There is nothing in this list yet. When members of this list create new posts, they will appear here.", "empty_column.list": "There is nothing in this list yet. When members of this list create new posts, they will appear here.",
"empty_column.lists": "You don't have any lists yet. When you create one, it will show up here.", "empty_column.lists": "You don't have any lists yet. When you create one, it will show up here.",

View File

@ -450,7 +450,7 @@
"empty_column.follow_requests": "You don't have any follow requests yet. When you receive one, it will show up here.", "empty_column.follow_requests": "You don't have any follow requests yet. When you receive one, it will show up here.",
"empty_column.group": "There is nothing in this group yet. When members of this group make new posts, they will appear here.", "empty_column.group": "There is nothing in this group yet. When members of this group make new posts, they will appear here.",
"empty_column.hashtag": "There is nothing in this hashtag yet.", "empty_column.hashtag": "There is nothing in this hashtag yet.",
"empty_column.home": "Your home timeline is empty! Visit {public} to get started and meet other users.", "empty_column.home": "Or you can visit {public} to get started and meet other users.",
"empty_column.home.local_tab": "the {site_title} tab", "empty_column.home.local_tab": "the {site_title} tab",
"empty_column.list": "There is nothing in this list yet. When members of this list create new posts, they will appear here.", "empty_column.list": "There is nothing in this list yet. When members of this list create new posts, they will appear here.",
"empty_column.lists": "You don't have any lists yet. When you create one, it will show up here.", "empty_column.lists": "You don't have any lists yet. When you create one, it will show up here.",

View File

@ -450,7 +450,7 @@
"empty_column.follow_requests": "You don't have any follow requests yet. When you receive one, it will show up here.", "empty_column.follow_requests": "You don't have any follow requests yet. When you receive one, it will show up here.",
"empty_column.group": "There is nothing in this group yet. When members of this group make new posts, they will appear here.", "empty_column.group": "There is nothing in this group yet. When members of this group make new posts, they will appear here.",
"empty_column.hashtag": "There is nothing in this hashtag yet.", "empty_column.hashtag": "There is nothing in this hashtag yet.",
"empty_column.home": "Your home timeline is empty! Visit {public} to get started and meet other users.", "empty_column.home": "Or you can visit {public} to get started and meet other users.",
"empty_column.home.local_tab": "the {site_title} tab", "empty_column.home.local_tab": "the {site_title} tab",
"empty_column.list": "There is nothing in this list yet. When members of this list create new posts, they will appear here.", "empty_column.list": "There is nothing in this list yet. When members of this list create new posts, they will appear here.",
"empty_column.lists": "You don't have any lists yet. When you create one, it will show up here.", "empty_column.lists": "You don't have any lists yet. When you create one, it will show up here.",

View File

@ -450,7 +450,7 @@
"empty_column.follow_requests": "You don't have any follow requests yet. When you receive one, it will show up here.", "empty_column.follow_requests": "You don't have any follow requests yet. When you receive one, it will show up here.",
"empty_column.group": "There is nothing in this group yet. When members of this group make new posts, they will appear here.", "empty_column.group": "There is nothing in this group yet. When members of this group make new posts, they will appear here.",
"empty_column.hashtag": "There is nothing in this hashtag yet.", "empty_column.hashtag": "There is nothing in this hashtag yet.",
"empty_column.home": "Your home timeline is empty! Visit {public} to get started and meet other users.", "empty_column.home": "Or you can visit {public} to get started and meet other users.",
"empty_column.home.local_tab": "the {site_title} tab", "empty_column.home.local_tab": "the {site_title} tab",
"empty_column.list": "There is nothing in this list yet. When members of this list create new posts, they will appear here.", "empty_column.list": "There is nothing in this list yet. When members of this list create new posts, they will appear here.",
"empty_column.lists": "You don't have any lists yet. When you create one, it will show up here.", "empty_column.lists": "You don't have any lists yet. When you create one, it will show up here.",

View File

@ -450,7 +450,7 @@
"empty_column.follow_requests": "You don't have any follow requests yet. When you receive one, it will show up here.", "empty_column.follow_requests": "You don't have any follow requests yet. When you receive one, it will show up here.",
"empty_column.group": "There is nothing in this group yet. When members of this group make new posts, they will appear here.", "empty_column.group": "There is nothing in this group yet. When members of this group make new posts, they will appear here.",
"empty_column.hashtag": "There is nothing in this hashtag yet.", "empty_column.hashtag": "There is nothing in this hashtag yet.",
"empty_column.home": "Your home timeline is empty! Visit {public} to get started and meet other users.", "empty_column.home": "Or you can visit {public} to get started and meet other users.",
"empty_column.home.local_tab": "the {site_title} tab", "empty_column.home.local_tab": "the {site_title} tab",
"empty_column.list": "There is nothing in this list yet. When members of this list create new posts, they will appear here.", "empty_column.list": "There is nothing in this list yet. When members of this list create new posts, they will appear here.",
"empty_column.lists": "You don't have any lists yet. When you create one, it will show up here.", "empty_column.lists": "You don't have any lists yet. When you create one, it will show up here.",