kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
AccountTimeline: add SubNavigation
rodzic
9871c4dff1
commit
ec22cc8afa
|
@ -73,9 +73,9 @@ class SubNavigation extends React.PureComponent {
|
||||||
|
|
||||||
handleScroll = throttle(() => {
|
handleScroll = throttle(() => {
|
||||||
if (this.node) {
|
if (this.node) {
|
||||||
const { top } = this.node.getBoundingClientRect();
|
const { offsetTop } = this.node;
|
||||||
|
|
||||||
if (top <= 50) {
|
if (offsetTop > 0) {
|
||||||
this.setState({ scrolled: true });
|
this.setState({ scrolled: true });
|
||||||
} else {
|
} else {
|
||||||
this.setState({ scrolled: false });
|
this.setState({ scrolled: false });
|
||||||
|
|
|
@ -1,38 +1,59 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import { injectIntl, FormattedMessage } from 'react-intl';
|
import { injectIntl, defineMessages, FormattedMessage } from 'react-intl';
|
||||||
|
import IconButton from 'soapbox/components/icon_button';
|
||||||
import SettingToggle from '../../notifications/components/setting_toggle';
|
import SettingToggle from '../../notifications/components/setting_toggle';
|
||||||
|
|
||||||
|
const messages = defineMessages({
|
||||||
|
close: { id: 'lightbox.close', defaultMessage: 'Close' },
|
||||||
|
});
|
||||||
|
|
||||||
export default @injectIntl
|
export default @injectIntl
|
||||||
class ColumnSettings extends React.PureComponent {
|
class ColumnSettings extends React.PureComponent {
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
intl: PropTypes.object.isRequired,
|
||||||
settings: ImmutablePropTypes.map.isRequired,
|
settings: ImmutablePropTypes.map.isRequired,
|
||||||
onChange: PropTypes.func.isRequired,
|
onChange: PropTypes.func.isRequired,
|
||||||
intl: PropTypes.object.isRequired,
|
onClose: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { settings, onChange } = this.props;
|
const { intl, settings, onChange, onClose } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div className='column-settings'>
|
||||||
<div className='column-settings__row'>
|
<div className='column-settings__header'>
|
||||||
<SettingToggle
|
<h1 className='column-settings__title'>
|
||||||
prefix='account_timeline'
|
<FormattedMessage id='account.column_settings.title' defaultMessage='Account timeline settings' />
|
||||||
settings={settings}
|
</h1>
|
||||||
settingPath={['shows', 'pinned']}
|
<div className='column-settings__close'>
|
||||||
onChange={onChange}
|
<IconButton title={intl.formatMessage(messages.close)} src={require('@tabler/icons/icons/x.svg')} onClick={onClose} />
|
||||||
label={<FormattedMessage id='account_timeline.column_settings.show_pinned' defaultMessage='Show pinned posts' />}
|
</div>
|
||||||
/>
|
</div>
|
||||||
<SettingToggle
|
|
||||||
prefix='account_timeline'
|
<div className='column-settings__content'>
|
||||||
settings={settings}
|
<div className='column-settings__description'>
|
||||||
settingPath={['shows', 'reblog']}
|
<FormattedMessage id='account.column_settings.description' defaultMessage='These settings apply to all account timelines.' />
|
||||||
onChange={onChange}
|
</div>
|
||||||
label={<FormattedMessage id='home.column_settings.show_reblogs' defaultMessage='Show reposts' />}
|
|
||||||
/>
|
<div className='column-settings__row'>
|
||||||
|
<SettingToggle
|
||||||
|
prefix='account_timeline'
|
||||||
|
settings={settings}
|
||||||
|
settingPath={['shows', 'pinned']}
|
||||||
|
onChange={onChange}
|
||||||
|
label={<FormattedMessage id='account_timeline.column_settings.show_pinned' defaultMessage='Show pinned posts' />}
|
||||||
|
/>
|
||||||
|
<SettingToggle
|
||||||
|
prefix='account_timeline'
|
||||||
|
settings={settings}
|
||||||
|
settingPath={['shows', 'reblog']}
|
||||||
|
onChange={onChange}
|
||||||
|
label={<FormattedMessage id='home.column_settings.show_reblogs' defaultMessage='Show reposts' />}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -9,6 +9,7 @@ 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 ColumnSettingsContainer from './containers/column_settings_container';
|
||||||
|
import SubNavigation from 'soapbox/components/sub_navigation';
|
||||||
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';
|
||||||
|
@ -19,7 +20,6 @@ import { fetchPatronAccount } from '../../actions/patron';
|
||||||
import { getSoapboxConfig } from 'soapbox/actions/soapbox';
|
import { getSoapboxConfig } from 'soapbox/actions/soapbox';
|
||||||
import { getSettings } from 'soapbox/actions/settings';
|
import { getSettings } from 'soapbox/actions/settings';
|
||||||
import { makeGetStatusIds, findAccountByUsername } from 'soapbox/selectors';
|
import { makeGetStatusIds, findAccountByUsername } from 'soapbox/selectors';
|
||||||
import classNames from 'classnames';
|
|
||||||
|
|
||||||
const makeMapStateToProps = () => {
|
const makeMapStateToProps = () => {
|
||||||
const getStatusIds = makeGetStatusIds();
|
const getStatusIds = makeGetStatusIds();
|
||||||
|
@ -146,7 +146,6 @@ class AccountTimeline extends ImmutablePureComponent {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { statusIds, featuredStatusIds, isLoading, hasMore, isBlocked, isAccount, accountId, unavailable, accountUsername } = this.props;
|
const { statusIds, featuredStatusIds, isLoading, hasMore, isBlocked, isAccount, accountId, unavailable, accountUsername } = this.props;
|
||||||
const { collapsed, animating } = this.state;
|
|
||||||
|
|
||||||
if (!isAccount && accountId !== -1) {
|
if (!isAccount && accountId !== -1) {
|
||||||
return (
|
return (
|
||||||
|
@ -176,7 +175,8 @@ class AccountTimeline extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Column transparent>
|
<Column className='account-timeline' transparent>
|
||||||
|
<SubNavigation message={`@${accountUsername}`} settings={ColumnSettingsContainer} />
|
||||||
<div className='account__section-headline'>
|
<div className='account__section-headline'>
|
||||||
<NavLink exact to={`/@${accountUsername}`}>
|
<NavLink exact to={`/@${accountUsername}`}>
|
||||||
<FormattedMessage id='account.posts' defaultMessage='Posts' />
|
<FormattedMessage id='account.posts' defaultMessage='Posts' />
|
||||||
|
@ -193,11 +193,6 @@ class AccountTimeline extends ImmutablePureComponent {
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className={classNames('column-header__collapsible', { collapsed, animating })} onTransitionEnd={this.handleTransitionEnd}>
|
|
||||||
<div className='column-header__collapsible-inner'>
|
|
||||||
{(!collapsed || animating) && <ColumnSettingsContainer />}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<StatusList
|
<StatusList
|
||||||
scrollKey='account_timeline'
|
scrollKey='account_timeline'
|
||||||
statusIds={statusIds}
|
statusIds={statusIds}
|
||||||
|
|
|
@ -335,3 +335,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (min-width: 896px) {
|
||||||
|
.account-timeline .sub-navigation {
|
||||||
|
top: 134px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -625,6 +625,12 @@
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&__description {
|
||||||
|
font-size: 14px;
|
||||||
|
margin: 5px 0 15px;
|
||||||
|
color: var(--primary-text-color--faint);
|
||||||
|
}
|
||||||
|
|
||||||
&__close {
|
&__close {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -949,3 +955,7 @@
|
||||||
.column .explanation-box {
|
.column .explanation-box {
|
||||||
background: var(--foreground-color);
|
background: var(--foreground-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sub-navigation + .account__section-headline {
|
||||||
|
background: var(--foreground-color);
|
||||||
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 1000;
|
z-index: 1100;
|
||||||
transition: transform 0.2s ease;
|
transition: transform 0.2s ease;
|
||||||
|
|
||||||
&--collapsed {
|
&--collapsed {
|
||||||
|
|
|
@ -346,10 +346,11 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
&__top {
|
&__top {
|
||||||
|
@include standard-panel-shadow;
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: auto;
|
height: auto;
|
||||||
z-index: 105;
|
z-index: 1000;
|
||||||
background: var(--foreground-color);
|
background: var(--foreground-color);
|
||||||
|
|
||||||
@media (min-width: 896px) {
|
@media (min-width: 896px) {
|
||||||
|
|
Ładowanie…
Reference in New Issue