diff --git a/app/soapbox/features/ui/components/video_modal.js b/app/soapbox/features/ui/components/video_modal.js deleted file mode 100644 index 066aa9d79..000000000 --- a/app/soapbox/features/ui/components/video_modal.js +++ /dev/null @@ -1,53 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import { FormattedMessage } from 'react-intl'; -import { withRouter } from 'react-router-dom'; - -import Video from 'soapbox/features/video'; - -export default @withRouter -class VideoModal extends ImmutablePureComponent { - - static propTypes = { - media: ImmutablePropTypes.map.isRequired, - status: ImmutablePropTypes.record, - account: ImmutablePropTypes.record, - time: PropTypes.number, - onClose: PropTypes.func.isRequired, - history: PropTypes.object, - }; - - handleStatusClick = e => { - const { status, account } = this.props; - if (e.button === 0 && !(e.ctrlKey || e.metaKey)) { - e.preventDefault(); - this.props.history.push(`/@${account.get('acct')}/posts/${status.get('id')}`); - } - } - - render() { - const { media, status, account, time, onClose } = this.props; - - const link = status && account && ; - - return ( -
-
-
-
- ); - } - -} diff --git a/app/soapbox/features/ui/components/video_modal.tsx b/app/soapbox/features/ui/components/video_modal.tsx new file mode 100644 index 000000000..c703e51db --- /dev/null +++ b/app/soapbox/features/ui/components/video_modal.tsx @@ -0,0 +1,51 @@ +import React from 'react'; +import { FormattedMessage } from 'react-intl'; +import { useHistory } from 'react-router-dom'; + +import Video from 'soapbox/features/video'; + +import type { Status, Account, Attachment } from 'soapbox/types/entities'; + +interface IVideoModal { + media: Attachment, + status: Status, + account: Account, + time: number, + onClose: () => void, +} + +const VideoModal: React.FC = ({ status, account, media, time, onClose }) => { + const history = useHistory(); + + const handleStatusClick: React.MouseEventHandler = e => { + if (e.button === 0 && !(e.ctrlKey || e.metaKey)) { + e.preventDefault(); + history.push(`/@${account.acct}/posts/${status.id}`); + } + }; + + const link = status && account && ( + + + + ); + + return ( +
+
+
+
+ ); +}; + +export default VideoModal;