pl-fe: Remove unused code(?)
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
2f8ab065a1
commit
d21241165f
1 changed files with 4 additions and 21 deletions
|
@ -14,21 +14,6 @@ import { useModalsStore } from 'pl-fe/stores';
|
||||||
|
|
||||||
import MediaItem from './components/media-item';
|
import MediaItem from './components/media-item';
|
||||||
|
|
||||||
interface ILoadMoreMedia {
|
|
||||||
maxId: string | null;
|
|
||||||
onLoadMore: (value: string | null) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
const LoadMoreMedia: React.FC<ILoadMoreMedia> = ({ maxId, onLoadMore }) => {
|
|
||||||
const handleLoadMore = () => {
|
|
||||||
onLoadMore(maxId);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<LoadMore onClick={handleLoadMore} />
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const AccountGallery = () => {
|
const AccountGallery = () => {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const { username } = useParams<{ username: string }>();
|
const { username } = useParams<{ username: string }>();
|
||||||
|
@ -97,7 +82,7 @@ const AccountGallery = () => {
|
||||||
let loadOlder = null;
|
let loadOlder = null;
|
||||||
|
|
||||||
if (hasMore && !(isLoading && attachments.size === 0)) {
|
if (hasMore && !(isLoading && attachments.size === 0)) {
|
||||||
loadOlder = <LoadMore className='my-auto' visible={!isLoading} onClick={handleLoadOlder} />;
|
loadOlder = <LoadMore className='my-auto mt-4' visible={!isLoading} onClick={handleLoadOlder} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isUnavailable) {
|
if (isUnavailable) {
|
||||||
|
@ -113,9 +98,7 @@ const AccountGallery = () => {
|
||||||
return (
|
return (
|
||||||
<Column label={`@${account.acct}`} transparent withHeader={false}>
|
<Column label={`@${account.acct}`} transparent withHeader={false}>
|
||||||
<div role='feed' className='grid grid-cols-2 gap-2 sm:grid-cols-3' ref={node}>
|
<div role='feed' className='grid grid-cols-2 gap-2 sm:grid-cols-3' ref={node}>
|
||||||
{attachments.map((attachment, index) => attachment === null ? (
|
{attachments.map((attachment, index) => (
|
||||||
<LoadMoreMedia key={'more:' + attachments.get(index + 1)?.id} maxId={index > 0 ? (attachments.get(index - 1)?.id || null) : null} onLoadMore={handleLoadMore} />
|
|
||||||
) : (
|
|
||||||
<MediaItem
|
<MediaItem
|
||||||
key={`${attachment.status.id}+${attachment.id}`}
|
key={`${attachment.status.id}+${attachment.id}`}
|
||||||
attachment={attachment}
|
attachment={attachment}
|
||||||
|
@ -128,10 +111,10 @@ const AccountGallery = () => {
|
||||||
<FormattedMessage id='account_gallery.none' defaultMessage='No media to show.' />
|
<FormattedMessage id='account_gallery.none' defaultMessage='No media to show.' />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{loadOlder}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{loadOlder}
|
||||||
|
|
||||||
{isLoading && attachments.size === 0 && (
|
{isLoading && attachments.size === 0 && (
|
||||||
<div className='relative flex-auto px-8 py-4'>
|
<div className='relative flex-auto px-8 py-4'>
|
||||||
<Spinner />
|
<Spinner />
|
||||||
|
|
Loading…
Reference in a new issue