mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-19 16:07:08 +00:00
Change responsive break points on navigation panel in web UI (#32034)
This commit is contained in:
parent
28966fa0a6
commit
28c4eca0af
|
@ -4,22 +4,22 @@ import AccountNavigation from 'mastodon/features/account/navigation';
|
||||||
import Trends from 'mastodon/features/getting_started/containers/trends_container';
|
import Trends from 'mastodon/features/getting_started/containers/trends_container';
|
||||||
import { showTrends } from 'mastodon/initial_state';
|
import { showTrends } from 'mastodon/initial_state';
|
||||||
|
|
||||||
const DefaultNavigation: React.FC = () =>
|
const DefaultNavigation: React.FC = () => (showTrends ? <Trends /> : null);
|
||||||
showTrends ? (
|
|
||||||
<>
|
|
||||||
<div className='flex-spacer' />
|
|
||||||
<Trends />
|
|
||||||
</>
|
|
||||||
) : null;
|
|
||||||
|
|
||||||
export const NavigationPortal: React.FC = () => (
|
export const NavigationPortal: React.FC = () => (
|
||||||
<Switch>
|
<div className='navigation-panel__portal'>
|
||||||
<Route path='/@:acct' exact component={AccountNavigation} />
|
<Switch>
|
||||||
<Route path='/@:acct/tagged/:tagged?' exact component={AccountNavigation} />
|
<Route path='/@:acct' exact component={AccountNavigation} />
|
||||||
<Route path='/@:acct/with_replies' exact component={AccountNavigation} />
|
<Route
|
||||||
<Route path='/@:acct/followers' exact component={AccountNavigation} />
|
path='/@:acct/tagged/:tagged?'
|
||||||
<Route path='/@:acct/following' exact component={AccountNavigation} />
|
exact
|
||||||
<Route path='/@:acct/media' exact component={AccountNavigation} />
|
component={AccountNavigation}
|
||||||
<Route component={DefaultNavigation} />
|
/>
|
||||||
</Switch>
|
<Route path='/@:acct/with_replies' exact component={AccountNavigation} />
|
||||||
|
<Route path='/@:acct/followers' exact component={AccountNavigation} />
|
||||||
|
<Route path='/@:acct/following' exact component={AccountNavigation} />
|
||||||
|
<Route path='/@:acct/media' exact component={AccountNavigation} />
|
||||||
|
<Route component={DefaultNavigation} />
|
||||||
|
</Switch>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -43,10 +43,7 @@ class AccountNavigation extends PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<FeaturedTags accountId={accountId} tagged={tagged} />
|
||||||
<div className='flex-spacer' />
|
|
||||||
<FeaturedTags accountId={accountId} tagged={tagged} />
|
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,11 @@ import PropTypes from 'prop-types';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { useRouteMatch, NavLink } from 'react-router-dom';
|
import { useRouteMatch, NavLink } from 'react-router-dom';
|
||||||
|
|
||||||
import { Icon } from 'mastodon/components/icon';
|
import { Icon } from 'mastodon/components/icon';
|
||||||
|
|
||||||
const ColumnLink = ({ icon, activeIcon, iconComponent, activeIconComponent, text, to, href, method, badge, transparent, ...other }) => {
|
const ColumnLink = ({ icon, activeIcon, iconComponent, activeIconComponent, text, to, href, method, badge, transparent, optional, ...other }) => {
|
||||||
const match = useRouteMatch(to);
|
const match = useRouteMatch(to);
|
||||||
const className = classNames('column-link', { 'column-link--transparent': transparent });
|
const className = classNames('column-link', { 'column-link--transparent': transparent, 'column-link--optional': optional });
|
||||||
const badgeElement = typeof badge !== 'undefined' ? <span className='column-link__badge'>{badge}</span> : null;
|
const badgeElement = typeof badge !== 'undefined' ? <span className='column-link__badge'>{badge}</span> : null;
|
||||||
const iconElement = (typeof icon === 'string' || iconComponent) ? <Icon id={icon} icon={iconComponent} className='column-link__icon' /> : icon;
|
const iconElement = (typeof icon === 'string' || iconComponent) ? <Icon id={icon} icon={iconComponent} className='column-link__icon' /> : icon;
|
||||||
const activeIconElement = activeIcon ?? (activeIconComponent ? <Icon id={icon} icon={activeIconComponent} className='column-link__icon' /> : iconElement);
|
const activeIconElement = activeIcon ?? (activeIconComponent ? <Icon id={icon} icon={activeIconComponent} className='column-link__icon' /> : iconElement);
|
||||||
|
@ -43,6 +43,7 @@ ColumnLink.propTypes = {
|
||||||
method: PropTypes.string,
|
method: PropTypes.string,
|
||||||
badge: PropTypes.node,
|
badge: PropTypes.node,
|
||||||
transparent: PropTypes.bool,
|
transparent: PropTypes.bool,
|
||||||
|
optional: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ColumnLink;
|
export default ColumnLink;
|
||||||
|
|
|
@ -120,14 +120,17 @@ class NavigationPanel extends Component {
|
||||||
|
|
||||||
let banner = undefined;
|
let banner = undefined;
|
||||||
|
|
||||||
if(transientSingleColumn)
|
if (transientSingleColumn) {
|
||||||
banner = (<div className='switch-to-advanced'>
|
banner = (
|
||||||
{intl.formatMessage(messages.openedInClassicInterface)}
|
<div className='switch-to-advanced'>
|
||||||
{" "}
|
{intl.formatMessage(messages.openedInClassicInterface)}
|
||||||
<a href={`/deck${location.pathname}`} className='switch-to-advanced__toggle'>
|
{" "}
|
||||||
{intl.formatMessage(messages.advancedInterface)}
|
<a href={`/deck${location.pathname}`} className='switch-to-advanced__toggle'>
|
||||||
</a>
|
{intl.formatMessage(messages.advancedInterface)}
|
||||||
</div>);
|
</a>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='navigation-panel'>
|
<div className='navigation-panel'>
|
||||||
|
@ -141,54 +144,58 @@ class NavigationPanel extends Component {
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
{signedIn && (
|
<div className='navigation-panel__menu'>
|
||||||
<>
|
{signedIn && (
|
||||||
<ColumnLink transparent to='/home' icon='home' iconComponent={HomeIcon} activeIconComponent={HomeActiveIcon} text={intl.formatMessage(messages.home)} />
|
<>
|
||||||
<NotificationsLink />
|
<ColumnLink transparent to='/home' icon='home' iconComponent={HomeIcon} activeIconComponent={HomeActiveIcon} text={intl.formatMessage(messages.home)} />
|
||||||
<FollowRequestsLink />
|
<NotificationsLink />
|
||||||
</>
|
<FollowRequestsLink />
|
||||||
)}
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
{trendsEnabled ? (
|
{trendsEnabled ? (
|
||||||
<ColumnLink transparent to='/explore' icon='explore' iconComponent={ExploreIcon} activeIconComponent={ExploreActiveIcon} text={intl.formatMessage(messages.explore)} />
|
<ColumnLink transparent to='/explore' icon='explore' iconComponent={ExploreIcon} activeIconComponent={ExploreActiveIcon} text={intl.formatMessage(messages.explore)} />
|
||||||
) : (
|
) : (
|
||||||
<ColumnLink transparent to='/search' icon='search' iconComponent={SearchIcon} text={intl.formatMessage(messages.search)} />
|
<ColumnLink transparent to='/search' icon='search' iconComponent={SearchIcon} text={intl.formatMessage(messages.search)} />
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{(signedIn || timelinePreview) && (
|
{(signedIn || timelinePreview) && (
|
||||||
<ColumnLink transparent to='/public/local' isActive={this.isFirehoseActive} icon='globe' iconComponent={PublicIcon} text={intl.formatMessage(messages.firehose)} />
|
<ColumnLink transparent to='/public/local' isActive={this.isFirehoseActive} icon='globe' iconComponent={PublicIcon} text={intl.formatMessage(messages.firehose)} />
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{!signedIn && (
|
{!signedIn && (
|
||||||
<div className='navigation-panel__sign-in-banner'>
|
<div className='navigation-panel__sign-in-banner'>
|
||||||
|
<hr />
|
||||||
|
{ disabledAccountId ? <DisabledAccountBanner /> : <SignInBanner /> }
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{signedIn && (
|
||||||
|
<>
|
||||||
|
<ColumnLink transparent to='/conversations' icon='at' iconComponent={AlternateEmailIcon} text={intl.formatMessage(messages.direct)} />
|
||||||
|
<ColumnLink transparent to='/bookmarks' icon='bookmarks' iconComponent={BookmarksIcon} activeIconComponent={BookmarksActiveIcon} text={intl.formatMessage(messages.bookmarks)} />
|
||||||
|
<ColumnLink transparent to='/favourites' icon='star' iconComponent={StarIcon} activeIconComponent={StarActiveIcon} text={intl.formatMessage(messages.favourites)} />
|
||||||
|
<ColumnLink transparent to='/lists' icon='list-ul' iconComponent={ListAltIcon} activeIconComponent={ListAltActiveIcon} text={intl.formatMessage(messages.lists)} />
|
||||||
|
|
||||||
|
<ListPanel />
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<ColumnLink transparent href='/settings/preferences' icon='cog' iconComponent={SettingsIcon} text={intl.formatMessage(messages.preferences)} />
|
||||||
|
|
||||||
|
{canManageReports(permissions) && <ColumnLink optional transparent href='/admin/reports' icon='flag' iconComponent={ModerationIcon} text={intl.formatMessage(messages.moderation)} />}
|
||||||
|
{canViewAdminDashboard(permissions) && <ColumnLink optional transparent href='/admin/dashboard' icon='tachometer' iconComponent={AdministrationIcon} text={intl.formatMessage(messages.administration)} />}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div className='navigation-panel__legal'>
|
||||||
<hr />
|
<hr />
|
||||||
{ disabledAccountId ? <DisabledAccountBanner /> : <SignInBanner /> }
|
<ColumnLink transparent to='/about' icon='ellipsis-h' iconComponent={MoreHorizIcon} text={intl.formatMessage(messages.about)} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
|
||||||
|
|
||||||
{signedIn && (
|
|
||||||
<>
|
|
||||||
<ColumnLink transparent to='/conversations' icon='at' iconComponent={AlternateEmailIcon} text={intl.formatMessage(messages.direct)} />
|
|
||||||
<ColumnLink transparent to='/bookmarks' icon='bookmarks' iconComponent={BookmarksIcon} activeIconComponent={BookmarksActiveIcon} text={intl.formatMessage(messages.bookmarks)} />
|
|
||||||
<ColumnLink transparent to='/favourites' icon='star' iconComponent={StarIcon} activeIconComponent={StarActiveIcon} text={intl.formatMessage(messages.favourites)} />
|
|
||||||
<ColumnLink transparent to='/lists' icon='list-ul' iconComponent={ListAltIcon} activeIconComponent={ListAltActiveIcon} text={intl.formatMessage(messages.lists)} />
|
|
||||||
|
|
||||||
<ListPanel />
|
|
||||||
|
|
||||||
<hr />
|
|
||||||
|
|
||||||
<ColumnLink transparent href='/settings/preferences' icon='cog' iconComponent={SettingsIcon} text={intl.formatMessage(messages.preferences)} />
|
|
||||||
|
|
||||||
{canManageReports(permissions) && <ColumnLink transparent href='/admin/reports' icon='flag' iconComponent={ModerationIcon} text={intl.formatMessage(messages.moderation)} />}
|
|
||||||
{canViewAdminDashboard(permissions) && <ColumnLink transparent href='/admin/dashboard' icon='tachometer' iconComponent={AdministrationIcon} text={intl.formatMessage(messages.administration)} />}
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<div className='navigation-panel__legal'>
|
|
||||||
<hr />
|
|
||||||
<ColumnLink transparent to='/about' icon='ellipsis-h' iconComponent={MoreHorizIcon} text={intl.formatMessage(messages.about)} />
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className='flex-spacer' />
|
||||||
|
|
||||||
<NavigationPortal />
|
<NavigationPortal />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -3490,12 +3490,14 @@ $ui-header-logo-wordmark-width: 99px;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
height: calc(100% - 20px);
|
height: calc(100% - 20px);
|
||||||
overflow-y: auto;
|
overflow: hidden;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
||||||
& > a {
|
&__menu {
|
||||||
flex: 0 0 auto;
|
flex: 1 1 auto;
|
||||||
|
min-height: 0;
|
||||||
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo {
|
.logo {
|
||||||
|
@ -3506,6 +3508,36 @@ $ui-header-logo-wordmark-width: 99px;
|
||||||
&__logo {
|
&__logo {
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media screen and (height <= 710px) {
|
||||||
|
&__portal {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (height <= 765px) {
|
||||||
|
&__portal .trends__item:nth-child(n + 3) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (height <= 820px) {
|
||||||
|
&__portal .trends__item:nth-child(n + 4) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (height <= 920px) {
|
||||||
|
.column-link.column-link--optional {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (height <= 1040px) {
|
||||||
|
.list-panel {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.navigation-panel,
|
.navigation-panel,
|
||||||
|
@ -3869,22 +3901,6 @@ $ui-header-logo-wordmark-width: 99px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (height <= 810px) {
|
|
||||||
.trends__item:nth-of-type(3) {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (height <= 720px) {
|
|
||||||
.trends__item:nth-of-type(2) {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (height <= 670px) {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.trends__item {
|
.trends__item {
|
||||||
border-bottom: 0;
|
border-bottom: 0;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
|
Loading…
Reference in a new issue