Added new sorting for "Hot" in GroupCollection, GroupTimeline

• Added:
- new sorting for "Hot" in GroupCollection, GroupTimeline
This commit is contained in:
mgabdev
2020-08-10 22:16:08 -05:00
parent 5f6a2e9cab
commit b2c69afdbd
6 changed files with 39 additions and 14 deletions

View File

@@ -3,6 +3,7 @@ import { openPopover } from '../actions/popover'
import {
POPOVER_GROUP_TIMELINE_SORT_OPTIONS,
POPOVER_GROUP_TIMELINE_SORT_TOP_OPTIONS,
GROUP_TIMELINE_SORTING_TYPE_HOT,
GROUP_TIMELINE_SORTING_TYPE_NEWEST,
GROUP_TIMELINE_SORTING_TYPE_RECENT_ACTIVITY,
GROUP_TIMELINE_SORTING_TYPE_TOP,
@@ -15,7 +16,8 @@ import {
import SortBlock from '../components/sort_block'
const messages = defineMessages({
sortBy: { id: 'comment_sort.title', defaultMessage: 'Sort by' },
sortBy: { id: 'comment_sort.title', defaultMessage: 'Sort by' },
hotTitle: { id: 'group_timeline_sorting.hot_title', defaultMessage: 'Hot Posts' },
topTitle: { id: 'group_timeline_sorting.top_title', defaultMessage: 'Top Posts' },
topTodayTitle: { id: 'group_timeline_sorting.top_today_title', defaultMessage: 'Today' },
topWeekTitle: { id: 'group_timeline_sorting.top_week_title', defaultMessage: 'This Week' },
@@ -85,6 +87,9 @@ class GroupSortBlock extends PureComponent {
let sortValueTopTitle = ''
switch (sortByValue) {
case GROUP_TIMELINE_SORTING_TYPE_HOT:
sortValueTitle = intl.formatMessage(messages.hotTitle)
break
case GROUP_TIMELINE_SORTING_TYPE_NEWEST:
sortValueTitle = intl.formatMessage(messages.newTitle)
break

View File

@@ -3,6 +3,7 @@ import isObject from 'lodash.isobject'
import { closePopover } from '../../actions/popover'
import { setGroupTimelineSort } from '../../actions/groups'
import {
GROUP_TIMELINE_SORTING_TYPE_HOT,
GROUP_TIMELINE_SORTING_TYPE_NEWEST,
GROUP_TIMELINE_SORTING_TYPE_RECENT_ACTIVITY,
GROUP_TIMELINE_SORTING_TYPE_TOP,
@@ -17,6 +18,8 @@ const messages = defineMessages({
recentSubtitle: { id: 'group_timeline_sorting.recent_subtitle', defaultMessage: 'See gabs with most recent comments first' },
newTitle: { id: 'group_timeline_sorting.new_title', defaultMessage: 'New Posts' },
newSubtitle: { id: 'group_timeline_sorting.new_subtitle', defaultMessage: 'See most recent gabs first' },
hotTitle: { id: 'group_timeline_sorting.hot_title', defaultMessage: 'Hot Posts' },
hotSubtitle: { id: 'group_timeline_sorting.hot_subtitle', defaultMessage: 'See the most popular and recent gabs' },
})
const mapStateToProps = (state) => ({
@@ -64,6 +67,13 @@ class GroupTimelineSortOptionsPopover extends PureComponent {
const isFeaturedTimeline = isObject(options) && options.collectionType === 'featured'
const items = [
{
hideArrow: true,
isActive: sorting === GROUP_TIMELINE_SORTING_TYPE_HOT,
title: intl.formatMessage(messages.hotTitle),
subtitle: intl.formatMessage(messages.hotSubtitle),
onClick: () => this.handleOnClick(GROUP_TIMELINE_SORTING_TYPE_HOT),
},
{
hideArrow: true,
isActive: sorting === GROUP_TIMELINE_SORTING_TYPE_TOP,