2020-09-28 20:29:43 +09:00
|
|
|
import PropTypes from 'prop-types';
|
2023-05-24 00:15:17 +09:00
|
|
|
import { PureComponent } from 'react';
|
|
|
|
|
2020-09-28 20:29:43 +09:00
|
|
|
import { FormattedMessage } from 'react-intl';
|
|
|
|
|
2023-05-24 00:15:17 +09:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
2024-01-13 05:16:48 +09:00
|
|
|
import CancelPresentationIcon from 'mastodon/../material-icons/400-24px/cancel_presentation.svg?react';
|
2023-05-24 00:15:17 +09:00
|
|
|
import { removePictureInPicture } from 'mastodon/actions/picture_in_picture';
|
|
|
|
import { Icon } from 'mastodon/components/icon';
|
|
|
|
|
2023-05-23 17:52:27 +09:00
|
|
|
class PictureInPicturePlaceholder extends PureComponent {
|
2020-09-28 20:29:43 +09:00
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
dispatch: PropTypes.func.isRequired,
|
2023-07-24 20:46:55 +09:00
|
|
|
aspectRatio: PropTypes.string,
|
2020-09-28 20:29:43 +09:00
|
|
|
};
|
|
|
|
|
|
|
|
handleClick = () => {
|
|
|
|
const { dispatch } = this.props;
|
|
|
|
dispatch(removePictureInPicture());
|
2023-01-30 09:45:35 +09:00
|
|
|
};
|
2020-09-28 20:29:43 +09:00
|
|
|
|
|
|
|
render () {
|
2023-07-24 20:46:55 +09:00
|
|
|
const { aspectRatio } = this.props;
|
|
|
|
|
2020-09-28 20:29:43 +09:00
|
|
|
return (
|
2023-07-24 20:46:55 +09:00
|
|
|
<div className='picture-in-picture-placeholder' style={{ aspectRatio }} role='button' tabIndex={0} onClick={this.handleClick}>
|
2023-10-25 02:45:08 +09:00
|
|
|
<Icon id='window-restore' icon={CancelPresentationIcon} />
|
2020-09-28 20:29:43 +09:00
|
|
|
<FormattedMessage id='picture_in_picture.restore' defaultMessage='Put it back' />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2023-03-24 11:17:53 +09:00
|
|
|
|
|
|
|
export default connect()(PictureInPicturePlaceholder);
|