remove proile media panel from right sidebar on medium screens
This commit is contained in:
parent
368baf818e
commit
dd0b0c911f
|
@ -18,10 +18,6 @@ class ProfileMediaPanel extends ImmutablePureComponent {
|
|||
dispatch: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
state = {
|
||||
width: 255,
|
||||
};
|
||||
|
||||
handleOpenMedia = attachment => {
|
||||
if (attachment.get('type') === 'video') {
|
||||
this.props.dispatch(openModal('VIDEO', { media: attachment, status: attachment.get('status') }));
|
||||
|
@ -41,7 +37,6 @@ class ProfileMediaPanel extends ImmutablePureComponent {
|
|||
|
||||
render() {
|
||||
const { attachments } = this.props;
|
||||
const { width } = this.state;
|
||||
const nineAttachments = attachments.slice(0, 9);
|
||||
|
||||
if (attachments.isEmpty()) {
|
||||
|
@ -62,7 +57,7 @@ class ProfileMediaPanel extends ImmutablePureComponent {
|
|||
<MediaItem
|
||||
key={`${attachment.getIn(['status', 'id'])}+${attachment.get('id')}`}
|
||||
attachment={attachment}
|
||||
displayWidth={width}
|
||||
displayWidth={255}
|
||||
onOpenMedia={this.handleOpenMedia}
|
||||
/>
|
||||
))}
|
||||
|
|
|
@ -13,7 +13,6 @@ import ProfileMediaPanel from '../features/ui/components/profile_media_panel';
|
|||
import { acctFull } from 'soapbox/utils/accounts';
|
||||
import { getFeatures } from 'soapbox/utils/features';
|
||||
import { makeGetAccount } from '../selectors';
|
||||
import { debounce } from 'lodash';
|
||||
|
||||
const mapStateToProps = (state, { params: { username }, withReplies = false }) => {
|
||||
const accounts = state.getIn(['accounts']);
|
||||
|
@ -50,28 +49,9 @@ class ProfilePage extends ImmutablePureComponent {
|
|||
features: PropTypes.object,
|
||||
};
|
||||
|
||||
state = {
|
||||
isSmallScreen: (window.innerWidth <= 1200),
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
window.addEventListener('resize', this.handleResize, { passive: true });
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
window.removeEventListener('resize', this.handleResize);
|
||||
}
|
||||
|
||||
handleResize = debounce(() => {
|
||||
this.setState({ isSmallScreen: (window.innerWidth <= 1200) });
|
||||
}, 5, {
|
||||
trailing: true,
|
||||
});
|
||||
|
||||
render() {
|
||||
const { children, accountId, account, accountUsername, features } = this.props;
|
||||
const bg = account ? account.getIn(['customizations', 'background']) : undefined;
|
||||
const { isSmallScreen } = this.state;
|
||||
|
||||
return (
|
||||
<div className={bg && `page page--customization page--${bg}` || 'page'}>
|
||||
|
@ -89,7 +69,6 @@ class ProfilePage extends ImmutablePureComponent {
|
|||
<div className='columns-area__panels__pane columns-area__panels__pane--left'>
|
||||
<div className='columns-area__panels__pane__inner'>
|
||||
<ProfileInfoPanel username={accountUsername} account={account} />
|
||||
{isSmallScreen && account && <ProfileMediaPanel account={account} />}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue