diff --git a/app/javascript/mastodon/features/account_featured/index.tsx b/app/javascript/mastodon/features/account_featured/index.tsx index b743a7302e..cddfb96c22 100644 --- a/app/javascript/mastodon/features/account_featured/index.tsx +++ b/app/javascript/mastodon/features/account_featured/index.tsx @@ -29,7 +29,7 @@ import { useAppDispatch, useAppSelector } from '@/mastodon/store'; import AddIcon from '@/material-icons/400-24px/add.svg?react'; import { CollectionListItem } from '../collections/components/collection_list_item'; -import { useCollectionsCreatedBy } from '../collections/overview/created_by_you'; +import { useCollectionsCreatedBy } from '../collections/overview/created_by_account'; import { EmptyMessage } from './components/empty_message'; import { Subheading, SubheadingLink } from './components/subheading'; diff --git a/app/javascript/mastodon/features/collection_adder/index.tsx b/app/javascript/mastodon/features/collection_adder/index.tsx index 48a0e68f48..75aae8f3f8 100644 --- a/app/javascript/mastodon/features/collection_adder/index.tsx +++ b/app/javascript/mastodon/features/collection_adder/index.tsx @@ -15,7 +15,7 @@ import { IconButton } from 'mastodon/components/icon_button'; import { useAppDispatch, useAppSelector } from 'mastodon/store'; import { MAX_COLLECTION_ACCOUNT_COUNT } from '../collections/editor/accounts'; -import { useCollectionsCreatedBy } from '../collections/overview/created_by_you'; +import { useCollectionsCreatedBy } from '../collections/overview/created_by_account'; import { CollectionToggle } from './collection_toggle'; diff --git a/app/javascript/mastodon/features/collections/editor/index.tsx b/app/javascript/mastodon/features/collections/editor/index.tsx index 935e230e4a..06109916a3 100644 --- a/app/javascript/mastodon/features/collections/editor/index.tsx +++ b/app/javascript/mastodon/features/collections/editor/index.tsx @@ -13,20 +13,21 @@ import { import { Helmet } from '@unhead/react/helmet'; -import { Callout } from '@/mastodon/components/callout'; -import { useCurrentAccountId } from '@/mastodon/hooks/useAccountId'; -import { initialState } from '@/mastodon/initial_state'; import ListAltIcon from '@/material-icons/400-24px/list_alt.svg?react'; +import { Callout } from 'mastodon/components/callout'; import { Column } from 'mastodon/components/column'; import { ColumnHeader } from 'mastodon/components/column_header'; import { LoadingIndicator } from 'mastodon/components/loading_indicator'; +import { NotSignedInIndicator } from 'mastodon/components/not_signed_in_indicator'; +import { useIdentity } from 'mastodon/identity_context'; +import { initialState } from 'mastodon/initial_state'; import { collectionEditorActions, fetchCollection, } from 'mastodon/reducers/slices/collections'; import { useAppDispatch, useAppSelector } from 'mastodon/store'; -import { useCollectionsCreatedBy } from '../overview/created_by_you'; +import { useCollectionsCreatedBy } from '../overview/created_by_account'; import { CollectionAccounts } from './accounts'; import { CollectionDetails } from './details'; @@ -75,7 +76,7 @@ export const CollectionEditorPage: React.FC<{ }> = ({ multiColumn }) => { const intl = useIntl(); const dispatch = useAppDispatch(); - const accountId = useCurrentAccountId(); + const { accountId, signedIn } = useIdentity(); const { id = null } = useParams<{ id?: string }>(); const { path } = useRouteMatch(); const collection = useAppSelector((state) => @@ -94,13 +95,13 @@ export const CollectionEditorPage: React.FC<{ (!isEditMode && collectionListStatus === 'loading'); const canCreateMoreCollections = - isEditMode || collectionList.length < userCollectionLimit; + signedIn && (isEditMode || collectionList.length < userCollectionLimit); useEffect(() => { - if (id) { + if (id && signedIn) { void dispatch(fetchCollection({ collectionId: id })); } - }, [dispatch, id]); + }, [dispatch, id, signedIn]); useEffect(() => { if (id !== editorStateId) { @@ -129,6 +130,8 @@ export const CollectionEditorPage: React.FC<{
{isLoading ? ( + ) : !signedIn ? ( + ) : canCreateMoreCollections ? ( - + { +export const CollectionsCreatedByAccount: React.FC = () => { const me = useCurrentAccountId(); const accountId = useAccountId(); + const account = useAccount(accountId); const { collections, status } = useCollectionsCreatedBy(accountId); @@ -78,24 +81,40 @@ export const CollectionsCreatedByYou: React.FC = () => { } if (collections.length === 0) { - return ( - - } - message={ - - } - > - - - ); + if (isOwnCollectionPage) { + return ( + + } + message={ + + } + > + + + ); + } else { + return ( + , + }} + /> + } + /> + ); + } } return ( @@ -113,7 +132,7 @@ export const CollectionsCreatedByYou: React.FC = () => { {showCreateButton && }
- {!canCreateMoreCollections && ( + {isOwnCollectionPage && !canCreateMoreCollections && ( )} {collections.map((item, index) => ( diff --git a/app/javascript/mastodon/features/collections/overview/featuring_you.tsx b/app/javascript/mastodon/features/collections/overview/featuring_you.tsx index 4d6cd30b9f..2f5c7628d2 100644 --- a/app/javascript/mastodon/features/collections/overview/featuring_you.tsx +++ b/app/javascript/mastodon/features/collections/overview/featuring_you.tsx @@ -16,7 +16,7 @@ import { useAppSelector, useAppDispatch } from 'mastodon/store'; import { CollectionListItem } from '../components/collection_list_item'; import classes from '../styles.module.scss'; -import { CollectionListError } from './created_by_you'; +import { CollectionListError } from './created_by_account'; function useCollectionsFeaturing(accountId: string | null | undefined) { const dispatch = useAppDispatch(); diff --git a/app/javascript/mastodon/features/lists/index.tsx b/app/javascript/mastodon/features/lists/index.tsx index 6aa27d5c57..12b96ea336 100644 --- a/app/javascript/mastodon/features/lists/index.tsx +++ b/app/javascript/mastodon/features/lists/index.tsx @@ -6,6 +6,8 @@ import { Link } from 'react-router-dom'; import { Helmet } from '@unhead/react/helmet'; +import { NotSignedInIndicator } from '@/mastodon/components/not_signed_in_indicator'; +import { useIdentity } from '@/mastodon/identity_context'; import AddIcon from '@/material-icons/400-24px/add.svg?react'; import ListAltIcon from '@/material-icons/400-24px/list_alt.svg?react'; import MoreHorizIcon from '@/material-icons/400-24px/more_horiz.svg?react'; @@ -78,10 +80,13 @@ const Lists: React.FC<{ const dispatch = useAppDispatch(); const intl = useIntl(); const lists = useAppSelector((state) => getOrderedLists(state)); + const { signedIn } = useIdentity(); useEffect(() => { - void dispatch(fetchLists()); - }, [dispatch]); + if (signedIn) { + void dispatch(fetchLists()); + } + }, [signedIn, dispatch]); const emptyMessage = ( <> @@ -112,14 +117,16 @@ const Lists: React.FC<{ iconComponent={ListAltIcon} multiColumn={multiColumn} extraButton={ - - - + signedIn && ( + + + + ) } /> @@ -128,9 +135,13 @@ const Lists: React.FC<{ emptyMessage={emptyMessage} bindToDocument={!multiColumn} > - {lists.map((list) => ( - - ))} + {signedIn ? ( + lists.map((list) => ( + + )) + ) : ( + + )} diff --git a/app/javascript/mastodon/features/lists/new.tsx b/app/javascript/mastodon/features/lists/new.tsx index e8f6343278..c95eb333f1 100644 --- a/app/javascript/mastodon/features/lists/new.tsx +++ b/app/javascript/mastodon/features/lists/new.tsx @@ -8,6 +8,8 @@ import { isFulfilled } from '@reduxjs/toolkit'; import { Helmet } from '@unhead/react/helmet'; +import { NotSignedInIndicator } from '@/mastodon/components/not_signed_in_indicator'; +import { useIdentity } from '@/mastodon/identity_context'; import ChevronRightIcon from '@/material-icons/400-24px/chevron_right.svg?react'; import ListAltIcon from '@/material-icons/400-24px/list_alt.svg?react'; import { fetchList } from 'mastodon/actions/lists'; @@ -250,16 +252,17 @@ const NewListWrapper: React.FC<{ }> = ({ multiColumn }) => { const intl = useIntl(); const dispatch = useAppDispatch(); + const { signedIn } = useIdentity(); const { id } = useParams<{ id?: string }>(); const list = useAppSelector((state) => id ? state.lists.get(id) : undefined, ); useEffect(() => { - if (id) { + if (signedIn && id) { dispatch(fetchList(id)); } - }, [dispatch, id]); + }, [dispatch, signedIn, id]); const isLoading = id && !list; @@ -277,7 +280,13 @@ const NewListWrapper: React.FC<{ />
- {isLoading ? : } + {!signedIn ? ( + + ) : isLoading ? ( + + ) : ( + + )}
diff --git a/app/javascript/mastodon/locales/en.json b/app/javascript/mastodon/locales/en.json index 44e2c9aa17..d051fecf8a 100644 --- a/app/javascript/mastodon/locales/en.json +++ b/app/javascript/mastodon/locales/en.json @@ -646,6 +646,7 @@ "empty_column.account_unavailable": "Profile unavailable", "empty_column.blocks": "You haven't blocked any users yet.", "empty_column.bookmarked_statuses": "You don't have any bookmarked posts yet. When you bookmark one, it will show up here.", + "empty_column.collections": "{acct} has not created any collections yet.", "empty_column.collections.featured_in": "You have not been added to any collections yet.", "empty_column.collections.featured_in_undiscoverable": "In order for people to add you to collections, you need to allow featuring in discovery experiences from Preferences > Privacy and reach", "empty_column.community": "The local timeline is empty. Write something publicly to get the ball rolling!",