kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
refactor: dispatch openModal() 'MEDIA' with raw objects
rodzic
10ff18e76f
commit
60489cb123
|
@ -151,7 +151,7 @@ const Status: React.FC<IStatus> = (props) => {
|
||||||
if (firstAttachment.type === 'video') {
|
if (firstAttachment.type === 'video') {
|
||||||
dispatch(openModal('VIDEO', { status, media: firstAttachment, time: 0 }));
|
dispatch(openModal('VIDEO', { status, media: firstAttachment, time: 0 }));
|
||||||
} else {
|
} else {
|
||||||
dispatch(openModal('MEDIA', { status, media: status.media_attachments, index: 0 }));
|
dispatch(openModal('MEDIA', { status: status.toJS(), media: status.media_attachments.toJS(), index: 0 }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -140,7 +140,7 @@ const Upload: React.FC<IUpload> = ({
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleOpenModal = () => {
|
const handleOpenModal = () => {
|
||||||
dispatch(openModal('MEDIA', { media: ImmutableList.of(media), index: 0 }));
|
dispatch(openModal('MEDIA', { media: ImmutableList.of(media).toJS(), index: 0 }));
|
||||||
};
|
};
|
||||||
|
|
||||||
const active = hovered || focused;
|
const active = hovered || focused;
|
||||||
|
|
|
@ -74,7 +74,7 @@ const AccountGallery = () => {
|
||||||
const media = (attachment.status as Status).media_attachments;
|
const media = (attachment.status as Status).media_attachments;
|
||||||
const index = media.findIndex((x) => x.id === attachment.id);
|
const index = media.findIndex((x) => x.id === attachment.id);
|
||||||
|
|
||||||
dispatch(openModal('MEDIA', { media, index, status: attachment.status }));
|
dispatch(openModal('MEDIA', { media: media.toJS(), index, status: attachment?.status?.toJS() ?? attachment.status }));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -266,7 +266,7 @@ const Header: React.FC<IHeader> = ({ account }) => {
|
||||||
type: 'image',
|
type: 'image',
|
||||||
url: account.avatar,
|
url: account.avatar,
|
||||||
});
|
});
|
||||||
dispatch(openModal('MEDIA', { media: ImmutableList.of(avatar), index: 0 }));
|
dispatch(openModal('MEDIA', { media: ImmutableList.of(avatar).toJS(), index: 0 }));
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleAvatarClick: React.MouseEventHandler = (e) => {
|
const handleAvatarClick: React.MouseEventHandler = (e) => {
|
||||||
|
@ -281,7 +281,7 @@ const Header: React.FC<IHeader> = ({ account }) => {
|
||||||
type: 'image',
|
type: 'image',
|
||||||
url: account.header,
|
url: account.header,
|
||||||
});
|
});
|
||||||
dispatch(openModal('MEDIA', { media: ImmutableList.of(header), index: 0 }));
|
dispatch(openModal('MEDIA', { media: ImmutableList.of(header).toJS(), index: 0 }));
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleHeaderClick: React.MouseEventHandler = (e) => {
|
const handleHeaderClick: React.MouseEventHandler = (e) => {
|
||||||
|
|
|
@ -22,7 +22,7 @@ const ChatUpload: React.FC<IChatUpload> = ({ attachment, onDelete }) => {
|
||||||
const clickable = attachment.type !== 'unknown';
|
const clickable = attachment.type !== 'unknown';
|
||||||
|
|
||||||
const handleOpenModal = () => {
|
const handleOpenModal = () => {
|
||||||
dispatch(openModal('MEDIA', { media: ImmutableList.of(attachment), index: 0 }));
|
dispatch(openModal('MEDIA', { media: ImmutableList.of(attachment).toJS(), index: 0 }));
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -128,7 +128,7 @@ const EventHeader: React.FC<IEventHeader> = ({ status }) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
dispatch(openModal('MEDIA', { media: ImmutableList([event.banner]) }));
|
dispatch(openModal('MEDIA', { media: ImmutableList([event.banner]).toJS() }));
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleExportClick = () => {
|
const handleExportClick = () => {
|
||||||
|
|
|
@ -63,7 +63,7 @@ const GroupHeader: React.FC<IGroupHeader> = ({ group }) => {
|
||||||
type: 'image',
|
type: 'image',
|
||||||
url: group.avatar,
|
url: group.avatar,
|
||||||
});
|
});
|
||||||
dispatch(openModal('MEDIA', { media: ImmutableList.of(avatar), index: 0 }));
|
dispatch(openModal('MEDIA', { media: ImmutableList.of(avatar).toJS(), index: 0 }));
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleAvatarClick: React.MouseEventHandler = (e) => {
|
const handleAvatarClick: React.MouseEventHandler = (e) => {
|
||||||
|
@ -78,7 +78,7 @@ const GroupHeader: React.FC<IGroupHeader> = ({ group }) => {
|
||||||
type: 'image',
|
type: 'image',
|
||||||
url: group.header,
|
url: group.header,
|
||||||
});
|
});
|
||||||
dispatch(openModal('MEDIA', { media: ImmutableList.of(header), index: 0 }));
|
dispatch(openModal('MEDIA', { media: ImmutableList.of(header).toJS(), index: 0 }));
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleHeaderClick: React.MouseEventHandler = (e) => {
|
const handleHeaderClick: React.MouseEventHandler = (e) => {
|
||||||
|
|
|
@ -43,7 +43,7 @@ const GroupGallery: React.FC<IGroupGallery> = (props) => {
|
||||||
const media = (attachment.status as Status).media_attachments;
|
const media = (attachment.status as Status).media_attachments;
|
||||||
const index = media.findIndex((x) => x.id === attachment.id);
|
const index = media.findIndex((x) => x.id === attachment.id);
|
||||||
|
|
||||||
dispatch(openModal('MEDIA', { media, index, status: attachment.status }));
|
dispatch(openModal('MEDIA', { media: media.toJS(), index, status: attachment?.status?.toJS() ?? attachment.status }));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -179,7 +179,7 @@ const Thread = (props: IThread) => {
|
||||||
if (media.size === 1 && firstAttachment.type === 'video') {
|
if (media.size === 1 && firstAttachment.type === 'video') {
|
||||||
dispatch(openModal('VIDEO', { media: firstAttachment, status: status }));
|
dispatch(openModal('VIDEO', { media: firstAttachment, status: status }));
|
||||||
} else {
|
} else {
|
||||||
dispatch(openModal('MEDIA', { media, index: 0, status: status }));
|
dispatch(openModal('MEDIA', { media: media.toJS(), index: 0, status: status.toJS() }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -36,7 +36,7 @@ const GroupMediaPanel: React.FC<IGroupMediaPanel> = ({ group }) => {
|
||||||
const media = attachment.getIn(['status', 'media_attachments']) as ImmutableList<Attachment>;
|
const media = attachment.getIn(['status', 'media_attachments']) as ImmutableList<Attachment>;
|
||||||
const index = media.findIndex(x => x.id === attachment.id);
|
const index = media.findIndex(x => x.id === attachment.id);
|
||||||
|
|
||||||
dispatch(openModal('MEDIA', { media, index, status: attachment.status, account: attachment.account }));
|
dispatch(openModal('MEDIA', { media: media.toJS(), index, status: attachment?.status?.toJS() ?? attachment.status, account: attachment.account })); // NOTE: why 'account' field is here? it doesn't exist in MediaModal component
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ const ProfileMediaPanel: React.FC<IProfileMediaPanel> = ({ account }) => {
|
||||||
const media = attachment.getIn(['status', 'media_attachments']) as ImmutableList<Attachment>;
|
const media = attachment.getIn(['status', 'media_attachments']) as ImmutableList<Attachment>;
|
||||||
const index = media.findIndex(x => x.id === attachment.id);
|
const index = media.findIndex(x => x.id === attachment.id);
|
||||||
|
|
||||||
dispatch(openModal('MEDIA', { media, index, status: attachment.status }));
|
dispatch(openModal('MEDIA', { media: media.toJS(), index, status: attachment?.status?.toJS() ?? attachment.status }));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue