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