Merge branch 'fix-media-spacing' into 'develop'
Fix media spacing See merge request soapbox-pub/soapbox!2450
This commit is contained in:
commit
b1859ebfbb
1 changed files with 18 additions and 16 deletions
|
@ -1,6 +1,5 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import { useParams } from 'react-router-dom';
|
|
||||||
|
|
||||||
import { openModal } from 'soapbox/actions/modals';
|
import { openModal } from 'soapbox/actions/modals';
|
||||||
import LoadMore from 'soapbox/components/load-more';
|
import LoadMore from 'soapbox/components/load-more';
|
||||||
|
@ -13,10 +12,14 @@ import MediaItem from '../account-gallery/components/media-item';
|
||||||
|
|
||||||
import type { Attachment, Status } from 'soapbox/types/entities';
|
import type { Attachment, Status } from 'soapbox/types/entities';
|
||||||
|
|
||||||
const GroupGallery = () => {
|
interface IGroupGallery {
|
||||||
const dispatch = useAppDispatch();
|
params: { groupId: string }
|
||||||
|
}
|
||||||
|
|
||||||
const { groupId } = useParams<{ groupId: string }>();
|
const GroupGallery: React.FC<IGroupGallery> = (props) => {
|
||||||
|
const { groupId } = props.params;
|
||||||
|
|
||||||
|
const dispatch = useAppDispatch();
|
||||||
|
|
||||||
const { group, isLoading: groupIsLoading } = useGroup(groupId);
|
const { group, isLoading: groupIsLoading } = useGroup(groupId);
|
||||||
|
|
||||||
|
@ -24,6 +27,7 @@ const GroupGallery = () => {
|
||||||
entities: statuses,
|
entities: statuses,
|
||||||
fetchNextPage,
|
fetchNextPage,
|
||||||
isLoading,
|
isLoading,
|
||||||
|
isFetching,
|
||||||
hasNextPage,
|
hasNextPage,
|
||||||
} = useGroupMedia(groupId);
|
} = useGroupMedia(groupId);
|
||||||
|
|
||||||
|
@ -45,21 +49,25 @@ const GroupGallery = () => {
|
||||||
|
|
||||||
if (isLoading || groupIsLoading) {
|
if (isLoading || groupIsLoading) {
|
||||||
return (
|
return (
|
||||||
<Column>
|
<Column transparent withHeader={false}>
|
||||||
<Spinner />
|
<div className='pt-6'>
|
||||||
|
<Spinner />
|
||||||
|
</div>
|
||||||
</Column>
|
</Column>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!group) {
|
if (!group) {
|
||||||
return (
|
return (
|
||||||
<MissingIndicator />
|
<div className='pt-6'>
|
||||||
|
<MissingIndicator nested />
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Column label={group.display_name} transparent withHeader={false}>
|
<Column label={group.display_name} transparent withHeader={false}>
|
||||||
<div role='feed' className='grid grid-cols-2 gap-2 sm:grid-cols-3'>
|
<div role='feed' className='mt-4 grid grid-cols-2 gap-2 sm:grid-cols-3'>
|
||||||
{attachments.map((attachment) => (
|
{attachments.map((attachment) => (
|
||||||
<MediaItem
|
<MediaItem
|
||||||
key={`${attachment.status.id}+${attachment.id}`}
|
key={`${attachment.status.id}+${attachment.id}`}
|
||||||
|
@ -73,16 +81,10 @@ const GroupGallery = () => {
|
||||||
<FormattedMessage id='account_gallery.none' defaultMessage='No media to show.' />
|
<FormattedMessage id='account_gallery.none' defaultMessage='No media to show.' />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{(hasNextPage && !isLoading) && (
|
|
||||||
<LoadMore className='my-auto' visible={!isLoading} onClick={fetchNextPage} />
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{isLoading && (
|
{hasNextPage && (
|
||||||
<div className='slist__append'>
|
<LoadMore className='mt-4' disabled={isFetching} onClick={fetchNextPage} />
|
||||||
<Spinner />
|
|
||||||
</div>
|
|
||||||
)}
|
)}
|
||||||
</Column>
|
</Column>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue