From ec22cc8afaef9381ba0452c1b3a92680e877c882 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 19 Oct 2021 15:13:04 -0500 Subject: [PATCH] AccountTimeline: add SubNavigation --- app/soapbox/components/sub_navigation.js | 4 +- .../components/column_settings.js | 59 +++++++++++++------ .../features/account_timeline/index.js | 11 +--- app/styles/components/account-header.scss | 6 ++ app/styles/components/columns.scss | 10 ++++ app/styles/components/tabs-bar.scss | 2 +- app/styles/ui.scss | 3 +- 7 files changed, 64 insertions(+), 31 deletions(-) diff --git a/app/soapbox/components/sub_navigation.js b/app/soapbox/components/sub_navigation.js index abaceedfa..063448b5c 100644 --- a/app/soapbox/components/sub_navigation.js +++ b/app/soapbox/components/sub_navigation.js @@ -73,9 +73,9 @@ class SubNavigation extends React.PureComponent { handleScroll = throttle(() => { if (this.node) { - const { top } = this.node.getBoundingClientRect(); + const { offsetTop } = this.node; - if (top <= 50) { + if (offsetTop > 0) { this.setState({ scrolled: true }); } else { this.setState({ scrolled: false }); diff --git a/app/soapbox/features/account_timeline/components/column_settings.js b/app/soapbox/features/account_timeline/components/column_settings.js index 7836c01f0..130cb47db 100644 --- a/app/soapbox/features/account_timeline/components/column_settings.js +++ b/app/soapbox/features/account_timeline/components/column_settings.js @@ -1,38 +1,59 @@ import React from 'react'; import PropTypes from 'prop-types'; 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'; +const messages = defineMessages({ + close: { id: 'lightbox.close', defaultMessage: 'Close' }, +}); + export default @injectIntl class ColumnSettings extends React.PureComponent { static propTypes = { + intl: PropTypes.object.isRequired, settings: ImmutablePropTypes.map.isRequired, onChange: PropTypes.func.isRequired, - intl: PropTypes.object.isRequired, + onClose: PropTypes.func.isRequired, }; render() { - const { settings, onChange } = this.props; + const { intl, settings, onChange, onClose } = this.props; return ( -
-
- } - /> - } - /> +
+
+

+ +

+
+ +
+
+ +
+
+ +
+ +
+ } + /> + } + /> +
); diff --git a/app/soapbox/features/account_timeline/index.js b/app/soapbox/features/account_timeline/index.js index 003ab8dda..b55decbba 100644 --- a/app/soapbox/features/account_timeline/index.js +++ b/app/soapbox/features/account_timeline/index.js @@ -9,6 +9,7 @@ import StatusList from '../../components/status_list'; import LoadingIndicator from '../../components/loading_indicator'; import Column from '../ui/components/column'; import ColumnSettingsContainer from './containers/column_settings_container'; +import SubNavigation from 'soapbox/components/sub_navigation'; import { OrderedSet as ImmutableOrderedSet } from 'immutable'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { FormattedMessage } from 'react-intl'; @@ -19,7 +20,6 @@ import { fetchPatronAccount } from '../../actions/patron'; import { getSoapboxConfig } from 'soapbox/actions/soapbox'; import { getSettings } from 'soapbox/actions/settings'; import { makeGetStatusIds, findAccountByUsername } from 'soapbox/selectors'; -import classNames from 'classnames'; const makeMapStateToProps = () => { const getStatusIds = makeGetStatusIds(); @@ -146,7 +146,6 @@ class AccountTimeline extends ImmutablePureComponent { render() { const { statusIds, featuredStatusIds, isLoading, hasMore, isBlocked, isAccount, accountId, unavailable, accountUsername } = this.props; - const { collapsed, animating } = this.state; if (!isAccount && accountId !== -1) { return ( @@ -176,7 +175,8 @@ class AccountTimeline extends ImmutablePureComponent { } return ( - + +
@@ -193,11 +193,6 @@ class AccountTimeline extends ImmutablePureComponent {
-
-
- {(!collapsed || animating) && } -
-