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,
|
dispatch: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
state = {
|
|
||||||
width: 255,
|
|
||||||
};
|
|
||||||
|
|
||||||
handleOpenMedia = attachment => {
|
handleOpenMedia = attachment => {
|
||||||
if (attachment.get('type') === 'video') {
|
if (attachment.get('type') === 'video') {
|
||||||
this.props.dispatch(openModal('VIDEO', { media: attachment, status: attachment.get('status') }));
|
this.props.dispatch(openModal('VIDEO', { media: attachment, status: attachment.get('status') }));
|
||||||
|
@ -41,7 +37,6 @@ class ProfileMediaPanel extends ImmutablePureComponent {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { attachments } = this.props;
|
const { attachments } = this.props;
|
||||||
const { width } = this.state;
|
|
||||||
const nineAttachments = attachments.slice(0, 9);
|
const nineAttachments = attachments.slice(0, 9);
|
||||||
|
|
||||||
if (attachments.isEmpty()) {
|
if (attachments.isEmpty()) {
|
||||||
|
@ -62,7 +57,7 @@ class ProfileMediaPanel extends ImmutablePureComponent {
|
||||||
<MediaItem
|
<MediaItem
|
||||||
key={`${attachment.getIn(['status', 'id'])}+${attachment.get('id')}`}
|
key={`${attachment.getIn(['status', 'id'])}+${attachment.get('id')}`}
|
||||||
attachment={attachment}
|
attachment={attachment}
|
||||||
displayWidth={width}
|
displayWidth={255}
|
||||||
onOpenMedia={this.handleOpenMedia}
|
onOpenMedia={this.handleOpenMedia}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
|
|
@ -13,7 +13,6 @@ import ProfileMediaPanel from '../features/ui/components/profile_media_panel';
|
||||||
import { acctFull } from 'soapbox/utils/accounts';
|
import { acctFull } from 'soapbox/utils/accounts';
|
||||||
import { getFeatures } from 'soapbox/utils/features';
|
import { getFeatures } from 'soapbox/utils/features';
|
||||||
import { makeGetAccount } from '../selectors';
|
import { makeGetAccount } from '../selectors';
|
||||||
import { debounce } from 'lodash';
|
|
||||||
|
|
||||||
const mapStateToProps = (state, { params: { username }, withReplies = false }) => {
|
const mapStateToProps = (state, { params: { username }, withReplies = false }) => {
|
||||||
const accounts = state.getIn(['accounts']);
|
const accounts = state.getIn(['accounts']);
|
||||||
|
@ -50,28 +49,9 @@ class ProfilePage extends ImmutablePureComponent {
|
||||||
features: PropTypes.object,
|
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() {
|
render() {
|
||||||
const { children, accountId, account, accountUsername, features } = this.props;
|
const { children, accountId, account, accountUsername, features } = this.props;
|
||||||
const bg = account ? account.getIn(['customizations', 'background']) : undefined;
|
const bg = account ? account.getIn(['customizations', 'background']) : undefined;
|
||||||
const { isSmallScreen } = this.state;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={bg && `page page--customization page--${bg}` || 'page'}>
|
<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 columns-area__panels__pane--left'>
|
||||||
<div className='columns-area__panels__pane__inner'>
|
<div className='columns-area__panels__pane__inner'>
|
||||||
<ProfileInfoPanel username={accountUsername} account={account} />
|
<ProfileInfoPanel username={accountUsername} account={account} />
|
||||||
{isSmallScreen && account && <ProfileMediaPanel account={account} />}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue