Come back local timeline menu in navigation

This commit is contained in:
KMY 2023-07-07 08:49:04 +09:00
parent 398985f8a2
commit 0273a61fb2
6 changed files with 32 additions and 17 deletions

View file

@ -21,6 +21,7 @@ import StatusListContainer from '../ui/containers/status_list_container';
const messages = defineMessages({ const messages = defineMessages({
title: { id: 'column.firehose', defaultMessage: 'Live feeds' }, title: { id: 'column.firehose', defaultMessage: 'Live feeds' },
titleDefault: { id: 'column.community', defaultMessage: 'Local timeline' },
}); });
// TODO: use a proper React context later on // TODO: use a proper React context later on
@ -54,7 +55,7 @@ const ColumnSettings = () => {
); );
}; };
const Firehose = ({ feedType, multiColumn }) => { const Firehose = ({ feedType, defaultColumn, multiColumn }) => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const intl = useIntl(); const intl = useIntl();
const { signedIn } = useIdentity(); const { signedIn } = useIdentity();
@ -156,12 +157,31 @@ const Firehose = ({ feedType, multiColumn }) => {
/> />
); );
const headerIcon = defaultColumn ? 'users' : 'globe';
const headerTitle = defaultColumn ? messages.titleDefault : messages.title;
const sectionHeadline = defaultColumn || (
<div className='account__section-headline'>
<NavLink exact to='/public/local'>
<FormattedMessage tagName='div' id='firehose.local' defaultMessage='This server' />
</NavLink>
<NavLink exact to='/public/remote'>
<FormattedMessage tagName='div' id='firehose.remote' defaultMessage='Other servers' />
</NavLink>
<NavLink exact to='/public'>
<FormattedMessage tagName='div' id='firehose.all' defaultMessage='All' />
</NavLink>
</div>
);
return ( return (
<Column bindToDocument={!multiColumn} ref={columnRef} label={intl.formatMessage(messages.title)}> <Column bindToDocument={!multiColumn} ref={columnRef} label={intl.formatMessage(messages.title)}>
<ColumnHeader <ColumnHeader
icon='globe' icon={headerIcon}
active={hasUnread} active={hasUnread}
title={intl.formatMessage(messages.title)} title={intl.formatMessage(headerTitle)}
onPin={handlePin} onPin={handlePin}
onClick={handleHeaderClick} onClick={handleHeaderClick}
multiColumn={multiColumn} multiColumn={multiColumn}
@ -170,19 +190,7 @@ const Firehose = ({ feedType, multiColumn }) => {
</ColumnHeader> </ColumnHeader>
<div className='scrollable scrollable--flex'> <div className='scrollable scrollable--flex'>
<div className='account__section-headline'> {sectionHeadline}
<NavLink exact to='/public/local'>
<FormattedMessage tagName='div' id='firehose.local' defaultMessage='This server' />
</NavLink>
<NavLink exact to='/public/remote'>
<FormattedMessage tagName='div' id='firehose.remote' defaultMessage='Other servers' />
</NavLink>
<NavLink exact to='/public'>
<FormattedMessage tagName='div' id='firehose.all' defaultMessage='All' />
</NavLink>
</div>
<StatusListContainer <StatusListContainer
prepend={prependBanner} prepend={prependBanner}
@ -204,6 +212,7 @@ const Firehose = ({ feedType, multiColumn }) => {
} }
Firehose.propTypes = { Firehose.propTypes = {
defaultColumn: PropTypes.bool,
multiColumn: PropTypes.bool, multiColumn: PropTypes.bool,
feedType: PropTypes.string, feedType: PropTypes.string,
}; };

View file

@ -20,6 +20,7 @@ const messages = defineMessages({
home: { id: 'tabs_bar.home', defaultMessage: 'Home' }, home: { id: 'tabs_bar.home', defaultMessage: 'Home' },
notifications: { id: 'tabs_bar.notifications', defaultMessage: 'Notifications' }, notifications: { id: 'tabs_bar.notifications', defaultMessage: 'Notifications' },
explore: { id: 'explore.title', defaultMessage: 'Explore' }, explore: { id: 'explore.title', defaultMessage: 'Explore' },
local: { id: 'column.local', defaultMessage: 'Local' },
firehose: { id: 'column.firehose', defaultMessage: 'Live feeds' }, firehose: { id: 'column.firehose', defaultMessage: 'Live feeds' },
direct: { id: 'navigation_bar.direct', defaultMessage: 'Private mentions' }, direct: { id: 'navigation_bar.direct', defaultMessage: 'Private mentions' },
favourites: { id: 'navigation_bar.favourites', defaultMessage: 'Favourites' }, favourites: { id: 'navigation_bar.favourites', defaultMessage: 'Favourites' },
@ -43,7 +44,7 @@ class NavigationPanel extends Component {
}; };
isFirehoseActive = (match, location) => { isFirehoseActive = (match, location) => {
return match || location.pathname.startsWith('/public'); return (match || location.pathname.startsWith('/public')) && !location.pathname.endsWith('/fixed');
}; };
render () { render () {
@ -67,6 +68,7 @@ class NavigationPanel extends Component {
<> <>
<ColumnLink transparent to='/notifications' icon={<NotificationsCounterIcon className='column-link__icon' />} text={intl.formatMessage(messages.notifications)} /> <ColumnLink transparent to='/notifications' icon={<NotificationsCounterIcon className='column-link__icon' />} text={intl.formatMessage(messages.notifications)} />
<ColumnLink transparent to='/home' icon='home' text={intl.formatMessage(messages.home)} /> <ColumnLink transparent to='/home' icon='home' text={intl.formatMessage(messages.home)} />
<ColumnLink transparent to='/public/local/fixed' icon='users' text={intl.formatMessage(messages.local)} />
</> </>
)} )}

View file

@ -197,6 +197,7 @@ class SwitchingColumnsArea extends PureComponent {
<WrappedRoute path='/public' exact component={Firehose} componentParams={{ feedType: 'public' }} content={children} /> <WrappedRoute path='/public' exact component={Firehose} componentParams={{ feedType: 'public' }} content={children} />
<WrappedRoute path='/public/local' exact component={Firehose} componentParams={{ feedType: 'community' }} content={children} /> <WrappedRoute path='/public/local' exact component={Firehose} componentParams={{ feedType: 'community' }} content={children} />
<WrappedRoute path='/public/remote' exact component={Firehose} componentParams={{ feedType: 'public:remote' }} content={children} /> <WrappedRoute path='/public/remote' exact component={Firehose} componentParams={{ feedType: 'public:remote' }} content={children} />
<WrappedRoute path='/public/local/fixed' exact component={Firehose} componentParams={{ feedType: 'community', defaultColumn: true }} content={children} />
<WrappedRoute path={['/conversations', '/timelines/direct']} component={DirectTimeline} content={children} /> <WrappedRoute path={['/conversations', '/timelines/direct']} component={DirectTimeline} content={children} />
<WrappedRoute path='/tags/:id' component={HashtagTimeline} content={children} /> <WrappedRoute path='/tags/:id' component={HashtagTimeline} content={children} />
<WrappedRoute path='/lists/:id' component={ListTimeline} content={children} /> <WrappedRoute path='/lists/:id' component={ListTimeline} content={children} />

View file

@ -120,6 +120,7 @@
"column.follow_requests": "Follow requests", "column.follow_requests": "Follow requests",
"column.home": "Home", "column.home": "Home",
"column.lists": "Lists", "column.lists": "Lists",
"column.local": "Local",
"column.mutes": "Muted users", "column.mutes": "Muted users",
"column.notifications": "Notifications", "column.notifications": "Notifications",
"column.pins": "Pinned posts", "column.pins": "Pinned posts",

View file

@ -113,6 +113,7 @@
"column.follow_requests": "フォローリクエスト", "column.follow_requests": "フォローリクエスト",
"column.home": "ホーム", "column.home": "ホーム",
"column.lists": "リスト", "column.lists": "リスト",
"column.local": "ローカル",
"column.mutes": "ミュートしたユーザー", "column.mutes": "ミュートしたユーザー",
"column.notifications": "通知", "column.notifications": "通知",
"column.pins": "固定された投稿", "column.pins": "固定された投稿",

View file

@ -12,6 +12,7 @@ Rails.application.routes.draw do
/home /home
/public /public
/public/local /public/local
/public/local/fixed
/public/remote /public/remote
/conversations /conversations
/lists/(*any) /lists/(*any)