TESTING Adding statuses to search
TESTING • Adding: - statuses to search
This commit is contained in:
parent
f2b9889e49
commit
84f779b070
@ -12,6 +12,7 @@ import Text from '../components/text'
|
|||||||
import Account from '../components/account'
|
import Account from '../components/account'
|
||||||
import PanelLayout from '../components/panel/panel_layout'
|
import PanelLayout from '../components/panel/panel_layout'
|
||||||
import ColumnIndicator from '../components/column_indicator'
|
import ColumnIndicator from '../components/column_indicator'
|
||||||
|
import StatusContainer from '../containers/status_container'
|
||||||
import Block from '../components/block'
|
import Block from '../components/block'
|
||||||
|
|
||||||
class Search extends ImmutablePureComponent {
|
class Search extends ImmutablePureComponent {
|
||||||
@ -60,7 +61,8 @@ class Search extends ImmutablePureComponent {
|
|||||||
const showPeople = pathname === '/search/people'
|
const showPeople = pathname === '/search/people'
|
||||||
const showHashtags = pathname === '/search/hashtags'
|
const showHashtags = pathname === '/search/hashtags'
|
||||||
const showGroups = pathname === '/search/groups'
|
const showGroups = pathname === '/search/groups'
|
||||||
const isTop = !showPeople && !showHashtags && !showGroups
|
const showStatuses = pathname === '/search/statuses'
|
||||||
|
const isTop = !showPeople && !showHashtags && !showGroups && !showStatuses
|
||||||
const theLimit = 4
|
const theLimit = 4
|
||||||
|
|
||||||
let accounts, statuses, hashtags, groups
|
let accounts, statuses, hashtags, groups
|
||||||
@ -131,6 +133,38 @@ class Search extends ImmutablePureComponent {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (results.get('statuses') && results.get('statuses').size > 0 && me && (isTop || showStatuses)) {
|
||||||
|
const size = isTop ? Math.min(results.get('statuses').size, theLimit) : results.get('statuses').size;
|
||||||
|
const isMax = size === results.get('statuses').size
|
||||||
|
|
||||||
|
statuses = (
|
||||||
|
<PanelLayout
|
||||||
|
title='Statuses'
|
||||||
|
headerButtonTo={isMax ? undefined : '/search/statuses'}
|
||||||
|
headerButtonTitle={isMax ? undefined : 'See more'}
|
||||||
|
footerButtonTo={isMax ? undefined : '/search/hashtags'}
|
||||||
|
footerButtonTitle={isMax ? undefined : 'See more'}
|
||||||
|
noPadding
|
||||||
|
>
|
||||||
|
<div className={[_s.d, _s.pb10, _s.px15, _s.borderBottom1PX, _s.borderColorSecondary].join(' ')}>
|
||||||
|
<Text color='tertiary' size='small'>
|
||||||
|
Showing {size} of {results.get('statuses').size} results
|
||||||
|
</Text>
|
||||||
|
</div>
|
||||||
|
{
|
||||||
|
results.get('statuses').slice(0, size).map((status) => (
|
||||||
|
<StatusContainer
|
||||||
|
key={`status-${status.id}`}
|
||||||
|
id={status.id}
|
||||||
|
contextType='search'
|
||||||
|
commentsLimited
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</PanelLayout>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
if (results.get('hashtags') && results.get('hashtags').size > 0 && me && (isTop || showHashtags)) {
|
if (results.get('hashtags') && results.get('hashtags').size > 0 && me && (isTop || showHashtags)) {
|
||||||
const size = isTop ? Math.min(results.get('hashtags').size, theLimit) : results.get('hashtags').size;
|
const size = isTop ? Math.min(results.get('hashtags').size, theLimit) : results.get('hashtags').size;
|
||||||
const isMax = size === results.get('hashtags').size
|
const isMax = size === results.get('hashtags').size
|
||||||
|
@ -32,6 +32,10 @@ class SearchPage extends React.PureComponent {
|
|||||||
title: intl.formatMessage(messages.groups),
|
title: intl.formatMessage(messages.groups),
|
||||||
to: '/search/groups'
|
to: '/search/groups'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: intl.formatMessage(messages.statuses),
|
||||||
|
to: '/search/statuses'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: intl.formatMessage(messages.hashtags),
|
title: intl.formatMessage(messages.hashtags),
|
||||||
to: '/search/hashtags'
|
to: '/search/hashtags'
|
||||||
@ -83,6 +87,7 @@ const messages = defineMessages({
|
|||||||
top: { id: 'top', defaultMessage: 'Top' },
|
top: { id: 'top', defaultMessage: 'Top' },
|
||||||
people: { id: 'people', defaultMessage: 'People' },
|
people: { id: 'people', defaultMessage: 'People' },
|
||||||
groups: { id: 'groups', defaultMessage: 'Groups' },
|
groups: { id: 'groups', defaultMessage: 'Groups' },
|
||||||
|
statuses: { id: 'statuses', defaultMessage: 'Statuses' },
|
||||||
hashtags: { id: 'hashtags', defaultMessage: 'Hashtags' },
|
hashtags: { id: 'hashtags', defaultMessage: 'Hashtags' },
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user