AccountTimeline: column settings UI
This commit is contained in:
parent
dcf7dd216f
commit
1d18db3439
|
@ -4,9 +4,11 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { fetchAccount, fetchAccountByUsername } from '../../actions/accounts';
|
import { fetchAccount, fetchAccountByUsername } from '../../actions/accounts';
|
||||||
import { expandAccountFeaturedTimeline, expandAccountTimeline } from '../../actions/timelines';
|
import { expandAccountFeaturedTimeline, expandAccountTimeline } from '../../actions/timelines';
|
||||||
|
import Icon from 'soapbox/components/icon';
|
||||||
import StatusList from '../../components/status_list';
|
import StatusList from '../../components/status_list';
|
||||||
import LoadingIndicator from '../../components/loading_indicator';
|
import LoadingIndicator from '../../components/loading_indicator';
|
||||||
import Column from '../ui/components/column';
|
import Column from '../ui/components/column';
|
||||||
|
import ColumnSettingsContainer from './containers/column_settings_container';
|
||||||
import { OrderedSet as ImmutableOrderedSet } from 'immutable';
|
import { OrderedSet as ImmutableOrderedSet } from 'immutable';
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
@ -16,6 +18,7 @@ import { NavLink } from 'react-router-dom';
|
||||||
import { fetchPatronAccount } from '../../actions/patron';
|
import { fetchPatronAccount } from '../../actions/patron';
|
||||||
import { getSoapboxConfig } from 'soapbox/actions/soapbox';
|
import { getSoapboxConfig } from 'soapbox/actions/soapbox';
|
||||||
import { makeGetStatusIds } from 'soapbox/selectors';
|
import { makeGetStatusIds } from 'soapbox/selectors';
|
||||||
|
import classNames from 'classnames';
|
||||||
|
|
||||||
const makeMapStateToProps = () => {
|
const makeMapStateToProps = () => {
|
||||||
const getStatusIds = makeGetStatusIds();
|
const getStatusIds = makeGetStatusIds();
|
||||||
|
@ -77,6 +80,11 @@ class AccountTimeline extends ImmutablePureComponent {
|
||||||
unavailable: PropTypes.bool,
|
unavailable: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
state = {
|
||||||
|
collapsed: true,
|
||||||
|
animating: false,
|
||||||
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { params: { username }, accountId, accountApId, withReplies, me, patronEnabled } = this.props;
|
const { params: { username }, accountId, accountApId, withReplies, me, patronEnabled } = this.props;
|
||||||
|
|
||||||
|
@ -122,8 +130,18 @@ class AccountTimeline extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleToggleClick = (e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
this.setState({ collapsed: !this.state.collapsed, animating: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
handleTransitionEnd = () => {
|
||||||
|
this.setState({ animating: false });
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { statusIds, featuredStatusIds, isLoading, hasMore, isAccount, accountId, unavailable, accountUsername } = this.props;
|
const { statusIds, featuredStatusIds, isLoading, hasMore, isAccount, accountId, unavailable, accountUsername } = this.props;
|
||||||
|
const { collapsed, animating } = this.state;
|
||||||
|
|
||||||
if (!isAccount && accountId !== -1) {
|
if (!isAccount && accountId !== -1) {
|
||||||
return (
|
return (
|
||||||
|
@ -163,6 +181,16 @@ class AccountTimeline extends ImmutablePureComponent {
|
||||||
<NavLink exact to={`/@${accountUsername}/media`}>
|
<NavLink exact to={`/@${accountUsername}/media`}>
|
||||||
<FormattedMessage id='account.media' defaultMessage='Media' />
|
<FormattedMessage id='account.media' defaultMessage='Media' />
|
||||||
</NavLink>
|
</NavLink>
|
||||||
|
<div className='column-header__buttons'>
|
||||||
|
<button onClick={this.handleToggleClick}>
|
||||||
|
<Icon id='sliders' />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className={classNames('column-header__collapsible', { collapsed, animating })} onTransitionEnd={this.handleTransitionEnd}>
|
||||||
|
<div className='column-header__collapsible-inner'>
|
||||||
|
<ColumnSettingsContainer />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<StatusList
|
<StatusList
|
||||||
scrollKey='account_timeline'
|
scrollKey='account_timeline'
|
||||||
|
|
Loading…
Reference in New Issue