import { useEffect } from 'react'; import { defineMessages, useIntl, FormattedMessage } from 'react-intl'; import { Helmet } from 'react-helmet'; import { Link } from 'react-router-dom'; import AddIcon from '@/material-icons/400-24px/add.svg?react'; import CollectionsFilledIcon from '@/material-icons/400-24px/category-fill.svg?react'; import SquigglyArrow from '@/svg-icons/squiggly_arrow.svg?react'; import { Column } from 'flavours/glitch/components/column'; import { ColumnHeader } from 'flavours/glitch/components/column_header'; import { Icon } from 'flavours/glitch/components/icon'; import { ItemList, Scrollable, } from 'flavours/glitch/components/scrollable_list/components'; import { fetchAccountCollections, selectAccountCollections, } from 'flavours/glitch/reducers/slices/collections'; import { useAppSelector, useAppDispatch } from 'flavours/glitch/store'; import { CollectionListItem } from './detail/collection_list_item'; import { messages as editorMessages } from './editor'; const messages = defineMessages({ heading: { id: 'column.collections', defaultMessage: 'My collections' }, }); export const Collections: React.FC<{ multiColumn?: boolean; }> = ({ multiColumn }) => { const dispatch = useAppDispatch(); const intl = useIntl(); const me = useAppSelector((state) => state.meta.get('me') as string); const { collections, status } = useAppSelector((state) => selectAccountCollections(state, me), ); useEffect(() => { void dispatch(fetchAccountCollections({ accountId: me })); }, [dispatch, me]); const emptyMessage = status === 'error' ? ( ) : ( <>
); return ( } /> {collections.map((item, index) => ( ))} {intl.formatMessage(messages.heading)} ); };