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