Finished updating the reformatting of propTypes and set redux, intl functions to end of component

• Finished:
- updating the reformatting of propTypes and set redux, intl functions to end of component

• Removed:
- Gif implementation
This commit is contained in:
mgabdev
2020-08-18 19:22:15 -05:00
parent e21a6ff897
commit 99982c0391
102 changed files with 2540 additions and 3285 deletions

View File

@@ -12,44 +12,8 @@ import LoadMore from '../components/load_more'
import Block from '../components/block'
import MediaGalleryPlaceholder from '../components/placeholder/media_gallery_placeholder'
const messages = defineMessages({
none: { id: 'account_gallery.none', defaultMessage: 'No media to show.' },
})
const mapStateToProps = (state, { account, mediaType }) => {
const accountId = !!account ? account.get('id') : -1
return {
accountId,
attachments: getAccountGallery(state, accountId, mediaType),
isLoading: state.getIn(['timelines', `account:${accountId}:media`, 'isLoading']),
hasMore: state.getIn(['timelines', `account:${accountId}:media`, 'hasMore']),
}
}
export default
@connect(mapStateToProps)
@injectIntl
class AccountGallery extends ImmutablePureComponent {
static propTypes = {
dispatch: PropTypes.func.isRequired,
account: ImmutablePropTypes.map,
accountId: PropTypes.string,
attachments: ImmutablePropTypes.list.isRequired,
isLoading: PropTypes.bool,
hasMore: PropTypes.bool,
intl: PropTypes.object.isRequired,
mediaType: PropTypes.oneOf([
'photo',
'video',
]),
}
static defaultProps = {
mediaType: 'both'
}
componentDidMount() {
const { accountId, mediaType } = this.props
@@ -149,3 +113,38 @@ class AccountGallery extends ImmutablePureComponent {
}
}
const messages = defineMessages({
none: { id: 'account_gallery.none', defaultMessage: 'No media to show.' },
})
const mapStateToProps = (state, { account, mediaType }) => {
const accountId = !!account ? account.get('id') : -1
return {
accountId,
attachments: getAccountGallery(state, accountId, mediaType),
isLoading: state.getIn(['timelines', `account:${accountId}:media`, 'isLoading']),
hasMore: state.getIn(['timelines', `account:${accountId}:media`, 'hasMore']),
}
}
AccountGallery.propTypes = {
dispatch: PropTypes.func.isRequired,
account: ImmutablePropTypes.map,
accountId: PropTypes.string,
attachments: ImmutablePropTypes.list.isRequired,
isLoading: PropTypes.bool,
hasMore: PropTypes.bool,
intl: PropTypes.object.isRequired,
mediaType: PropTypes.oneOf([
'photo',
'video',
]),
}
AccountGallery.defaultProps = {
mediaType: 'both'
}
export default injectIntl(connect(mapStateToProps)(AccountGallery))

View File

@@ -8,42 +8,8 @@ import { injectIntl, defineMessages } from 'react-intl'
import { expandAccountFeaturedTimeline, expandAccountTimeline } from '../actions/timelines'
import StatusList from '../components/status_list'
const messages = defineMessages({
empty: { id: 'empty_column.account_timeline', defaultMessage: 'No gabs here!' },
})
const emptyList = ImmutableList()
const mapStateToProps = (state, { account, commentsOnly = false }) => {
const accountId = !!account ? account.getIn(['id'], null) : -1
const path = commentsOnly ? `${accountId}:comments_only` : accountId
return {
accountId,
statusIds: state.getIn(['timelines', `account:${path}`, 'items'], emptyList),
featuredStatusIds: commentsOnly ? ImmutableList() : state.getIn(['timelines', `account:${accountId}:pinned`, 'items'], emptyList),
isLoading: state.getIn(['timelines', `account:${path}`, 'isLoading'], true),
hasMore: state.getIn(['timelines', `account:${path}`, 'hasMore']),
}
}
export default
@connect(mapStateToProps)
@injectIntl
class AccountTimeline extends ImmutablePureComponent {
static propTypes = {
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
statusIds: ImmutablePropTypes.list,
featuredStatusIds: ImmutablePropTypes.list,
isLoading: PropTypes.bool,
hasMore: PropTypes.bool,
commentsOnly: PropTypes.bool,
intl: PropTypes.object.isRequired,
}
componentWillMount() {
const { accountId, commentsOnly } = this.props
@@ -98,3 +64,36 @@ class AccountTimeline extends ImmutablePureComponent {
}
}
const messages = defineMessages({
empty: { id: 'empty_column.account_timeline', defaultMessage: 'No gabs here!' },
})
const emptyList = ImmutableList()
const mapStateToProps = (state, { account, commentsOnly = false }) => {
const accountId = !!account ? account.getIn(['id'], null) : -1
const path = commentsOnly ? `${accountId}:comments_only` : accountId
return {
accountId,
statusIds: state.getIn(['timelines', `account:${path}`, 'items'], emptyList),
featuredStatusIds: commentsOnly ? ImmutableList() : state.getIn(['timelines', `account:${accountId}:pinned`, 'items'], emptyList),
isLoading: state.getIn(['timelines', `account:${path}`, 'isLoading'], true),
hasMore: state.getIn(['timelines', `account:${path}`, 'hasMore']),
}
}
AccountTimeline.propTypes = {
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
statusIds: ImmutablePropTypes.list,
featuredStatusIds: ImmutablePropTypes.list,
isLoading: PropTypes.bool,
hasMore: PropTypes.bool,
commentsOnly: PropTypes.bool,
intl: PropTypes.object.isRequired,
}
export default injectIntl(connect(mapStateToProps)(AccountTimeline))

View File

@@ -12,36 +12,8 @@ import Block from '../components/block'
import BlockHeading from '../components/block_heading'
import ScrollableList from '../components/scrollable_list'
const messages = defineMessages({
empty: { id: 'empty_column.blocks', defaultMessage: 'You haven\'t blocked any users yet.' },
blocks: { id: 'navigation_bar.blocks', defaultMessage: 'Blocked users' },
})
const mapStateToProps = (state) => ({
accountIds: state.getIn(['user_lists', 'blocks', me, 'items']),
hasMore: !!state.getIn(['user_lists', 'blocks', me, 'next']),
isLoading: state.getIn(['user_lists', 'blocks', me, 'isLoading']),
})
const mapDispatchToProps = (dispatch) => ({
onFetchBlocks: () => dispatch(fetchBlocks()),
onExpandBlocks: () => dispatch(expandBlocks()),
})
export default
@connect(mapStateToProps, mapDispatchToProps)
@injectIntl
class Blocks extends ImmutablePureComponent {
static propTypes = {
accountIds: ImmutablePropTypes.list,
hasMore: PropTypes.bool,
intl: PropTypes.object.isRequired,
isLoading: PropTypes.bool,
onExpandBlocks: PropTypes.func.isRequired,
onFetchBlocks: PropTypes.func.isRequired,
}
componentDidMount() {
this.props.onFetchBlocks()
}
@@ -85,3 +57,30 @@ class Blocks extends ImmutablePureComponent {
}
}
const messages = defineMessages({
empty: { id: 'empty_column.blocks', defaultMessage: 'You haven\'t blocked any users yet.' },
blocks: { id: 'navigation_bar.blocks', defaultMessage: 'Blocked users' },
})
const mapStateToProps = (state) => ({
accountIds: state.getIn(['user_lists', 'blocks', me, 'items']),
hasMore: !!state.getIn(['user_lists', 'blocks', me, 'next']),
isLoading: state.getIn(['user_lists', 'blocks', me, 'isLoading']),
})
const mapDispatchToProps = (dispatch) => ({
onFetchBlocks: () => dispatch(fetchBlocks()),
onExpandBlocks: () => dispatch(expandBlocks()),
})
Blocks.propTypes = {
accountIds: ImmutablePropTypes.list,
hasMore: PropTypes.bool,
intl: PropTypes.object.isRequired,
isLoading: PropTypes.bool,
onExpandBlocks: PropTypes.func.isRequired,
onFetchBlocks: PropTypes.func.isRequired,
}
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(Blocks))

View File

@@ -10,27 +10,8 @@ import { meUsername } from '../initial_state'
import StatusList from '../components/status_list'
import ColumnIndicator from '../components/column_indicator'
const mapStateToProps = (state, { params: { username } }) => {
return {
isMyAccount: (username.toLowerCase() === meUsername.toLowerCase()),
statusIds: state.getIn(['status_lists', 'bookmarks', 'items']),
isLoading: state.getIn(['status_lists', 'bookmarks', 'isLoading'], true),
hasMore: !!state.getIn(['status_lists', 'bookmarks', 'next']),
}
}
export default
@connect(mapStateToProps)
class BookmarkedStatuses extends ImmutablePureComponent {
static propTypes = {
dispatch: PropTypes.func.isRequired,
statusIds: ImmutablePropTypes.list.isRequired,
hasMore: PropTypes.bool,
isLoading: PropTypes.bool,
isMyAccount: PropTypes.bool.isRequired,
}
componentWillMount() {
this.props.dispatch(fetchBookmarkedStatuses())
}
@@ -65,3 +46,21 @@ class BookmarkedStatuses extends ImmutablePureComponent {
}
const mapStateToProps = (state, { params: { username } }) => {
return {
isMyAccount: (username.toLowerCase() === meUsername.toLowerCase()),
statusIds: state.getIn(['status_lists', 'bookmarks', 'items']),
isLoading: state.getIn(['status_lists', 'bookmarks', 'isLoading'], true),
hasMore: !!state.getIn(['status_lists', 'bookmarks', 'next']),
}
}
BookmarkedStatuses.propTypes = {
dispatch: PropTypes.func.isRequired,
statusIds: ImmutablePropTypes.list.isRequired,
hasMore: PropTypes.bool,
isLoading: PropTypes.bool,
isMyAccount: PropTypes.bool.isRequired,
}
export default connect(mapStateToProps)(BookmarkedStatuses)

View File

@@ -5,29 +5,12 @@ import { defineMessages, injectIntl } from 'react-intl'
import { expandCommunityTimeline } from '../actions/timelines'
import StatusList from '../components/status_list'
const messages = defineMessages({
empty: { id: 'empty_column.community', defaultMessage: 'The community timeline is empty. Write something publicly to get the ball rolling!' },
})
const mapStateToProps = (state) => ({
onlyMedia: state.getIn(['settings', 'community', 'other', 'onlyMedia'])
})
export default
@connect(mapStateToProps)
@injectIntl
class CommunityTimeline extends React.PureComponent {
static contextTypes = {
router: PropTypes.object,
}
static propTypes = {
dispatch: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
onlyMedia: PropTypes.bool,
}
componentDidMount () {
const { dispatch, onlyMedia } = this.props
@@ -64,3 +47,19 @@ class CommunityTimeline extends React.PureComponent {
}
}
const messages = defineMessages({
empty: { id: 'empty_column.community', defaultMessage: 'The community timeline is empty. Write something publicly to get the ball rolling!' },
})
const mapStateToProps = (state) => ({
onlyMedia: state.getIn(['settings', 'community', 'other', 'onlyMedia'])
})
CommunityTimeline.propTypes = {
dispatch: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
onlyMedia: PropTypes.bool,
}
export default injectIntl(connect(mapStateToProps)(CommunityTimeline))

View File

@@ -200,7 +200,6 @@ class ComposeForm extends ImmutablePureComponent {
isMatch,
isChangingUpload,
isSubmitting,
selectedGifSrc,
isPro,
hidePro,
} = this.props
@@ -390,19 +389,6 @@ class ComposeForm extends ImmutablePureComponent {
</div>
}
{
/* : todo :
!!selectedGifSrc && !anyMedia &&
<div className={[_s.d, _s.px15].join(' ')}>
<GifForm
replyToId={replyToId}
small={shouldCondense}
selectedGifSrc={selectedGifSrc}
/>
</div>
*/
}
{
!edit && hasPoll &&
<div className={[_s.d, _s.px15, _s.mt5].join(' ')}>
@@ -518,7 +504,6 @@ ComposeForm.propTypes = {
replyToId: PropTypes.string,
reduxReplyToId: PropTypes.string,
hasPoll: PropTypes.bool,
selectedGifSrc: PropTypes.string,
isPro: PropTypes.bool,
hidePro: PropTypes.bool,
autoJoinGroup: PropTypes.bool,

View File

@@ -1,45 +0,0 @@
import React from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import { clearSelectedGif } from '../../../actions/tenor'
import Image from '../../../components/image'
class GifForm extends React.PureComponent {
render () {
const {
selectedGifSrc,
small,
} = this.props
if (!selectedGifSrc) return null
return (
<div className={_s.d}>
<div className={[_s.d, _s.flexRow, _s.flexWrap].join(' ')}>
<Image
width='auto'
src={selectedGifSrc}
className={[_s.maxW100PC, _s.radiusSmall, _s.h260PX].join(' ')}
/>
</div>
</div>
)
}
}
const mapDispatchToProps = (dispatch) => ({
onClearSelectedGif() {
dispatch(clearSelectedGif())
},
})
GifForm.propTypes = {
onClearSelectedGif: PropTypes.func.isRequired,
replyToId: PropTypes.string,
small: PropTypes.bool,
selectedGifSrc: PropTypes.string.isRequired,
}
export default connect(null, mapDispatchToProps)(GifForm)

View File

@@ -119,16 +119,6 @@ class PollForm extends ImmutablePureComponent {
class PollFormOption extends ImmutablePureComponent {
static propTypes = {
title: PropTypes.string.isRequired,
index: PropTypes.number.isRequired,
isPollMultiple: PropTypes.bool,
onChange: PropTypes.func.isRequired,
onRemove: PropTypes.func.isRequired,
onToggleMultiple: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
}
handleOptionTitleChange = (value) => {
this.props.onChange(this.props.index, value)
}
@@ -195,6 +185,16 @@ class PollFormOption extends ImmutablePureComponent {
}
PollFormOption.propTypes = {
title: PropTypes.string.isRequired,
index: PropTypes.number.isRequired,
isPollMultiple: PropTypes.bool,
onChange: PropTypes.func.isRequired,
onRemove: PropTypes.func.isRequired,
onToggleMultiple: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
}
const messages = defineMessages({
option_placeholder: { id: 'compose_form.poll.option_placeholder', defaultMessage: 'Choice {number}' },
add_option: { id: 'compose_form.poll.add_option', defaultMessage: 'Add a choice' },

View File

@@ -67,7 +67,6 @@ const mapStateToProps = (state, props) => {
scheduledAt: null,
account: state.getIn(['accounts', me]),
hasPoll: false,
selectedGifSrc: null,
}
}
@@ -95,7 +94,6 @@ const mapStateToProps = (state, props) => {
account: state.getIn(['accounts', me]),
isPro: state.getIn(['accounts', me, 'is_pro']),
hasPoll: state.getIn(['compose', 'poll']),
selectedGifSrc: state.getIn(['tenor', 'selectedGif', 'src']),
}
}

View File

@@ -12,35 +12,8 @@ import Block from '../components/block'
import ScrollableList from '../components/scrollable_list'
import Text from '../components/text'
const mapStateToProps = (state) => ({
accountIds: state.getIn(['user_lists', 'follow_requests', me, 'items']),
isLoading: state.getIn(['user_lists', 'follow_requests', me, 'isLoading']),
hasMore: !!state.getIn(['user_lists', 'follow_requests', me, 'next']),
locked: !!state.getIn(['accounts', me, 'locked']),
})
const mapDispatchToProps = (dispatch) => ({
onFetchFollowRequests() {
dispatch(fetchFollowRequests())
},
onExpandFollowRequests() {
dispatch(expandFollowRequests())
},
})
export default
@connect(mapStateToProps, mapDispatchToProps)
class FollowRequests extends ImmutablePureComponent {
static propTypes = {
accountIds: ImmutablePropTypes.list,
hasMore: PropTypes.bool,
isLoading: PropTypes.bool,
locked: PropTypes.bool,
onFetchFollowRequests: PropTypes.func.isRequired,
onExpandFollowRequests: PropTypes.func.isRequired,
}
componentWillMount () {
this.props.onFetchFollowRequests()
}
@@ -91,3 +64,30 @@ class FollowRequests extends ImmutablePureComponent {
}
}
const mapStateToProps = (state) => ({
accountIds: state.getIn(['user_lists', 'follow_requests', me, 'items']),
isLoading: state.getIn(['user_lists', 'follow_requests', me, 'isLoading']),
hasMore: !!state.getIn(['user_lists', 'follow_requests', me, 'next']),
locked: !!state.getIn(['accounts', me, 'locked']),
})
const mapDispatchToProps = (dispatch) => ({
onFetchFollowRequests() {
dispatch(fetchFollowRequests())
},
onExpandFollowRequests() {
dispatch(expandFollowRequests())
},
})
FollowRequests.propTypes = {
accountIds: ImmutablePropTypes.list,
hasMore: PropTypes.bool,
isLoading: PropTypes.bool,
locked: PropTypes.bool,
onFetchFollowRequests: PropTypes.func.isRequired,
onExpandFollowRequests: PropTypes.func.isRequired,
}
export default connect(mapStateToProps, mapDispatchToProps)(FollowRequests)

View File

@@ -15,38 +15,8 @@ import Block from '../components/block'
import BlockHeading from '../components/block_heading'
import AccountPlaceholder from '../components/placeholder/account_placeholder'
const mapStateToProps = (state, { account }) => {
const accountId = !!account ? account.get('id') : -1
return {
accountId,
accountIds: state.getIn(['user_lists', 'followers', accountId, 'items']),
hasMore: !!state.getIn(['user_lists', 'followers', accountId, 'next']),
isLoading: state.getIn(['user_lists', 'followers', accountId, 'isLoading'], true),
}
}
const messages = defineMessages({
followers: { id: 'account.followers', defaultMessage: 'Followers' },
empty: { id: 'account.followers.empty', defaultMessage: 'No one follows this user yet.' },
})
export default
@connect(mapStateToProps)
@injectIntl
class Followers extends ImmutablePureComponent {
static propTypes = {
account: ImmutablePropTypes.map,
accountId: PropTypes.string,
intl: PropTypes.object.isRequired,
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
accountIds: ImmutablePropTypes.list,
hasMore: PropTypes.bool,
isLoading: PropTypes.bool,
}
componentWillMount() {
const { accountId } = this.props
@@ -101,3 +71,32 @@ class Followers extends ImmutablePureComponent {
}
}
const mapStateToProps = (state, { account }) => {
const accountId = !!account ? account.get('id') : -1
return {
accountId,
accountIds: state.getIn(['user_lists', 'followers', accountId, 'items']),
hasMore: !!state.getIn(['user_lists', 'followers', accountId, 'next']),
isLoading: state.getIn(['user_lists', 'followers', accountId, 'isLoading'], true),
}
}
const messages = defineMessages({
followers: { id: 'account.followers', defaultMessage: 'Followers' },
empty: { id: 'account.followers.empty', defaultMessage: 'No one follows this user yet.' },
})
Followers.propTypes = {
account: ImmutablePropTypes.map,
accountId: PropTypes.string,
intl: PropTypes.object.isRequired,
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
accountIds: ImmutablePropTypes.list,
hasMore: PropTypes.bool,
isLoading: PropTypes.bool,
}
export default injectIntl(connect(mapStateToProps)(Followers))

View File

@@ -15,38 +15,8 @@ import Block from '../components/block'
import BlockHeading from '../components/block_heading'
import AccountPlaceholder from '../components/placeholder/account_placeholder'
const mapStateToProps = (state, { account }) => {
const accountId = !!account ? account.get('id') : -1
return {
accountId,
accountIds: state.getIn(['user_lists', 'following', accountId, 'items']),
hasMore: !!state.getIn(['user_lists', 'following', accountId, 'next']),
isLoading: state.getIn(['user_lists', 'following', accountId, 'isLoading'], true),
}
}
const messages = defineMessages({
follows: { id: 'account.follows', defaultMessage: 'Following' },
empty: { id: 'account.follows.empty', defaultMessage: 'This user doesn\'t follow anyone yet.' },
})
export default
@connect(mapStateToProps)
@injectIntl
class Following extends ImmutablePureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
accountIds: ImmutablePropTypes.list,
account: ImmutablePropTypes.map,
accountId: PropTypes.string,
hasMore: PropTypes.bool,
isLoading: PropTypes.bool,
}
componentDidMount() {
const { accountId } = this.props
@@ -100,4 +70,33 @@ class Following extends ImmutablePureComponent {
)
}
}
}
const mapStateToProps = (state, { account }) => {
const accountId = !!account ? account.get('id') : -1
return {
accountId,
accountIds: state.getIn(['user_lists', 'following', accountId, 'items']),
hasMore: !!state.getIn(['user_lists', 'following', accountId, 'next']),
isLoading: state.getIn(['user_lists', 'following', accountId, 'isLoading'], true),
}
}
const messages = defineMessages({
follows: { id: 'account.follows', defaultMessage: 'Following' },
empty: { id: 'account.follows.empty', defaultMessage: 'This user doesn\'t follow anyone yet.' },
})
Following.propTypes = {
intl: PropTypes.object.isRequired,
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
accountIds: ImmutablePropTypes.list,
account: ImmutablePropTypes.map,
accountId: PropTypes.string,
hasMore: PropTypes.bool,
isLoading: PropTypes.bool,
}
export default injectIntl(connect(mapStateToProps)(Following))

View File

@@ -12,25 +12,8 @@ import {
GroupInfoPanel
} from '../features/ui/util/async_components'
const mapStateToProps = (state, { params }) => {
const groupId = isObject(params) ? params['id'] : null
const group = state.getIn(['groups', groupId])
return { group }
}
export default
@connect(mapStateToProps)
class GroupAbout extends ImmutablePureComponent {
static contextTypes = {
router: PropTypes.object
}
static propTypes = {
group: ImmutablePropTypes.map,
}
render() {
const { group } = this.props
@@ -56,3 +39,16 @@ class GroupAbout extends ImmutablePureComponent {
}
}
const mapStateToProps = (state, { params }) => {
const groupId = isObject(params) ? params['id'] : null
const group = state.getIn(['groups', groupId])
return { group }
}
GroupAbout.propTypes = {
group: ImmutablePropTypes.map,
}
export default connect(mapStateToProps)(GroupAbout)

View File

@@ -22,63 +22,8 @@ import StatusList from '../components/status_list'
import GroupSortBlock from '../components/group_sort_block'
import GroupsCollection from './groups_collection'
const messages = defineMessages({
empty: { id: 'empty_column.group_collection_timeline', defaultMessage: 'There are no gabs to display.' },
})
const mapStateToProps = (state) => {
let hasNoGroupMembers = true
try {
hasNoGroupMembers = state.getIn(['group_lists', 'member', 'items'], ImmutableList()).count() === 0
} catch (error) {
//
}
return {
hasNoGroupMembers,
sortByValue: state.getIn(['group_lists', 'sortByValue']),
sortByTopValue: state.getIn(['group_lists', 'sortByTopValue']),
}
}
const mapDispatchToProps = (dispatch) => ({
onConnectGroupCollectionStream(collectionType, sortBy) {
dispatch(connectGroupCollectionStream(collectionType, sortBy))
},
onClearTimeline(timeline) {
dispatch(clearTimeline(timeline))
},
onExpandGroupCollectionTimeline(collectionType, options) {
dispatch(expandGroupCollectionTimeline(collectionType, options))
},
setFeaturedTop() {
dispatch(setGroupTimelineSort(GROUP_TIMELINE_SORTING_TYPE_HOT))
},
setMemberNewest() {
dispatch(setGroupTimelineSort(GROUP_TIMELINE_SORTING_TYPE_NEWEST))
},
})
export default
@injectIntl
@connect(mapStateToProps, mapDispatchToProps)
class GroupCollectionTimeline extends React.PureComponent {
static propTypes = {
params: PropTypes.object.isRequired,
onConnectGroupCollectionStream: PropTypes.func.isRequired,
onClearTimeline: PropTypes.func.isRequired,
onExpandGroupCollectionTimeline: PropTypes.func.isRequired,
setFeaturedTop: PropTypes.func.isRequired,
setMemberNewest: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
collectionType: PropTypes.string.isRequired,
sortByValue: PropTypes.string.isRequired,
sortByTopValue: PropTypes.string,
hasStatuses: PropTypes.bool.isRequired,
}
state = {
//keep track of loads for if no user,
//only allow 2 loads before showing sign up msg
@@ -184,3 +129,57 @@ class GroupCollectionTimeline extends React.PureComponent {
}
}
const messages = defineMessages({
empty: { id: 'empty_column.group_collection_timeline', defaultMessage: 'There are no gabs to display.' },
})
const mapStateToProps = (state) => {
let hasNoGroupMembers = true
try {
hasNoGroupMembers = state.getIn(['group_lists', 'member', 'items'], ImmutableList()).count() === 0
} catch (error) {
//
}
return {
hasNoGroupMembers,
sortByValue: state.getIn(['group_lists', 'sortByValue']),
sortByTopValue: state.getIn(['group_lists', 'sortByTopValue']),
}
}
const mapDispatchToProps = (dispatch) => ({
onConnectGroupCollectionStream(collectionType, sortBy) {
dispatch(connectGroupCollectionStream(collectionType, sortBy))
},
onClearTimeline(timeline) {
dispatch(clearTimeline(timeline))
},
onExpandGroupCollectionTimeline(collectionType, options) {
dispatch(expandGroupCollectionTimeline(collectionType, options))
},
setFeaturedTop() {
dispatch(setGroupTimelineSort(GROUP_TIMELINE_SORTING_TYPE_HOT))
},
setMemberNewest() {
dispatch(setGroupTimelineSort(GROUP_TIMELINE_SORTING_TYPE_NEWEST))
},
})
GroupCollectionTimeline.propTypes = {
params: PropTypes.object.isRequired,
onConnectGroupCollectionStream: PropTypes.func.isRequired,
onClearTimeline: PropTypes.func.isRequired,
onExpandGroupCollectionTimeline: PropTypes.func.isRequired,
setFeaturedTop: PropTypes.func.isRequired,
setMemberNewest: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
collectionType: PropTypes.string.isRequired,
sortByValue: PropTypes.string.isRequired,
sortByTopValue: PropTypes.string,
hasStatuses: PropTypes.bool.isRequired,
}
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(GroupCollectionTimeline))

View File

@@ -32,137 +32,12 @@ import Select from '../components/select'
import Textarea from '../components/textarea'
import FileInput from '../components/file_input'
const messages = defineMessages({
title: { id: 'groups.form.title', defaultMessage: 'Title' },
idTitle: { id: 'groups.form.id_title', defaultMessage: 'Unique id' },
idDescription: { id: 'groups.form.id_description', defaultMessage: 'A unique id that links to this group. (Cannot be changed)' },
tagsTitle: { id: 'groups.form.tags_title', defaultMessage: 'Tags' },
tagsDescription: { id: 'groups.form.tags_description', defaultMessage: 'Add tags seperated by commas to increase group visibility' },
categoryTitle: { id: 'groups.form.category_title', defaultMessage: 'Category' },
categoryDescription: { id: 'groups.form.category_description', defaultMessage: 'Add a general category for your group' },
description: { id: 'groups.form.description', defaultMessage: 'Enter the group description' },
coverImage: { id: 'groups.form.coverImage', defaultMessage: 'Upload a banner image' },
coverImageDescription: { id: 'groups.form.coverImage_description', defaultMessage: 'Accepted image types: .jpg, .png' },
coverImageChange: { id: 'groups.form.coverImageChange', defaultMessage: 'Banner image selected' },
create: { id: 'groups.form.create', defaultMessage: 'Create group' },
update: { id: 'groups.form.update', defaultMessage: 'Update group' },
titlePlaceholder: { id: 'groups.form.title_placeholder', defaultMessage: 'New group title...' },
descriptionPlaceholder: { id: 'groups.form.description_placeholder', defaultMessage: 'This group is about...' },
isPrivateDescription: { id: 'groups.form.is_private_description', defaultMessage: 'Only members can see group posts.' },
isVisibleDescription: { id: 'groups.form.is_visible_description', defaultMessage: 'Anyone can find a visible group in search and other places on Gab.' },
})
const mapStateToProps = (state, { params }) => {
const groupId = isObject(params) ? params['id'] : null
const group = state.getIn(['groups', groupId])
let isAdmin = false
if (groupId) {
const relationships = state.getIn(['group_relationships', groupId])
if (relationships) {
isAdmin = relationships.get('admin')
}
}
return {
group,
groupId,
isAdmin,
error: (groupId && !group) || (group && !isAdmin),
titleValue: state.getIn(['group_editor', 'title']),
descriptionValue: state.getIn(['group_editor', 'description']),
coverImage: state.getIn(['group_editor', 'coverImage']),
isSubmitting: state.getIn(['group_editor', 'isSubmitting']),
idValue: state.getIn(['group_editor', 'id']),
tags: state.getIn(['group_editor', 'tags']),
category: state.getIn(['group_editor', 'category']),
isPrivate: state.getIn(['group_editor', 'isPrivate']),
isVisible: state.getIn(['group_editor', 'isVisible']),
categories: state.getIn(['group_categories', 'items']),
}
}
const mapDispatchToProps = (dispatch) => ({
onTitleChange(value) {
dispatch(changeGroupTitle(value))
},
onDescriptionChange(value) {
dispatch(changeGroupDescription(value))
},
onCoverImageChange(imageData) {
dispatch(changeGroupCoverImage(imageData))
},
onChangeGroupId(value) {
dispatch(changeGroupId(value))
},
onChangeGroupTags(value) {
dispatch(changeGroupTags(value))
},
onChangeGroupCategory(e) {
dispatch(changeGroupCategory(e.target.value))
},
onChangeGroupIsPrivate(value) {
dispatch(changeGroupIsPrivate(value))
},
onChangeGroupIsVisible(value) {
dispatch(changeGroupIsVisible(value))
},
onResetEditor() {
dispatch(resetEditor())
},
onSetGroup(group) {
dispatch(setGroup(group))
},
onSubmit(routerHistory) {
dispatch(submit(routerHistory))
dispatch(closeModal())
},
onFetchGroup(groupId) {
dispatch(fetchGroup(groupId))
},
onFetchGroupCategories() {
dispatch(fetchGroupCategories())
}
})
export default
@injectIntl
@connect(mapStateToProps, mapDispatchToProps)
class GroupCreate extends ImmutablePureComponent {
static contextTypes = {
router: PropTypes.object
}
static propTypes = {
group: ImmutablePropTypes.map,
titleValue: PropTypes.string.isRequired,
descriptionValue: PropTypes.string.isRequired,
coverImage: PropTypes.object,
intl: PropTypes.object.isRequired,
onTitleChange: PropTypes.func.isRequired,
onDescriptionChange: PropTypes.func.isRequired,
onChangeGroupId: PropTypes.func.isRequired,
onChangeGroupTags: PropTypes.func.isRequired,
onChangeGroupCategory: PropTypes.func.isRequired,
onChangeGroupIsPrivate: PropTypes.func.isRequired,
onChangeGroupIsVisible: PropTypes.func.isRequired,
onFetchGroup: PropTypes.func.isRequired,
onFetchGroupCategories: PropTypes.func.isRequired,
onResetEditor: PropTypes.func.isRequired,
onSetGroup: PropTypes.func.isRequired,
onSubmit: PropTypes.func.isRequired,
isSubmitting: PropTypes.bool,
isAdmin: PropTypes.bool,
onClose: PropTypes.func,
idValue: PropTypes.string.isRequired,
tags: PropTypes.string.isRequired,
category: PropTypes.string.isRequired,
isPrivate: PropTypes.bool.isRequired,
isVisible: PropTypes.bool.isRequired,
categories: ImmutablePropTypes.list.isRequired,
}
componentDidMount() {
const { groupId, group } = this.props
@@ -374,3 +249,128 @@ class GroupCreate extends ImmutablePureComponent {
}
}
const messages = defineMessages({
title: { id: 'groups.form.title', defaultMessage: 'Title' },
idTitle: { id: 'groups.form.id_title', defaultMessage: 'Unique id' },
idDescription: { id: 'groups.form.id_description', defaultMessage: 'A unique id that links to this group. (Cannot be changed)' },
tagsTitle: { id: 'groups.form.tags_title', defaultMessage: 'Tags' },
tagsDescription: { id: 'groups.form.tags_description', defaultMessage: 'Add tags seperated by commas to increase group visibility' },
categoryTitle: { id: 'groups.form.category_title', defaultMessage: 'Category' },
categoryDescription: { id: 'groups.form.category_description', defaultMessage: 'Add a general category for your group' },
description: { id: 'groups.form.description', defaultMessage: 'Enter the group description' },
coverImage: { id: 'groups.form.coverImage', defaultMessage: 'Upload a banner image' },
coverImageDescription: { id: 'groups.form.coverImage_description', defaultMessage: 'Accepted image types: .jpg, .png' },
coverImageChange: { id: 'groups.form.coverImageChange', defaultMessage: 'Banner image selected' },
create: { id: 'groups.form.create', defaultMessage: 'Create group' },
update: { id: 'groups.form.update', defaultMessage: 'Update group' },
titlePlaceholder: { id: 'groups.form.title_placeholder', defaultMessage: 'New group title...' },
descriptionPlaceholder: { id: 'groups.form.description_placeholder', defaultMessage: 'This group is about...' },
isPrivateDescription: { id: 'groups.form.is_private_description', defaultMessage: 'Only members can see group posts.' },
isVisibleDescription: { id: 'groups.form.is_visible_description', defaultMessage: 'Anyone can find a visible group in search and other places on Gab.' },
})
const mapStateToProps = (state, { params }) => {
const groupId = isObject(params) ? params['id'] : null
const group = state.getIn(['groups', groupId])
let isAdmin = false
if (groupId) {
const relationships = state.getIn(['group_relationships', groupId])
if (relationships) {
isAdmin = relationships.get('admin')
}
}
return {
group,
groupId,
isAdmin,
error: (groupId && !group) || (group && !isAdmin),
titleValue: state.getIn(['group_editor', 'title']),
descriptionValue: state.getIn(['group_editor', 'description']),
coverImage: state.getIn(['group_editor', 'coverImage']),
isSubmitting: state.getIn(['group_editor', 'isSubmitting']),
idValue: state.getIn(['group_editor', 'id']),
tags: state.getIn(['group_editor', 'tags']),
category: state.getIn(['group_editor', 'category']),
isPrivate: state.getIn(['group_editor', 'isPrivate']),
isVisible: state.getIn(['group_editor', 'isVisible']),
categories: state.getIn(['group_categories', 'items']),
}
}
const mapDispatchToProps = (dispatch) => ({
onTitleChange(value) {
dispatch(changeGroupTitle(value))
},
onDescriptionChange(value) {
dispatch(changeGroupDescription(value))
},
onCoverImageChange(imageData) {
dispatch(changeGroupCoverImage(imageData))
},
onChangeGroupId(value) {
dispatch(changeGroupId(value))
},
onChangeGroupTags(value) {
dispatch(changeGroupTags(value))
},
onChangeGroupCategory(e) {
dispatch(changeGroupCategory(e.target.value))
},
onChangeGroupIsPrivate(value) {
dispatch(changeGroupIsPrivate(value))
},
onChangeGroupIsVisible(value) {
dispatch(changeGroupIsVisible(value))
},
onResetEditor() {
dispatch(resetEditor())
},
onSetGroup(group) {
dispatch(setGroup(group))
},
onSubmit(routerHistory) {
dispatch(submit(routerHistory))
dispatch(closeModal())
},
onFetchGroup(groupId) {
dispatch(fetchGroup(groupId))
},
onFetchGroupCategories() {
dispatch(fetchGroupCategories())
}
})
GroupCreate.propTypes = {
group: ImmutablePropTypes.map,
titleValue: PropTypes.string.isRequired,
descriptionValue: PropTypes.string.isRequired,
coverImage: PropTypes.object,
intl: PropTypes.object.isRequired,
onTitleChange: PropTypes.func.isRequired,
onDescriptionChange: PropTypes.func.isRequired,
onChangeGroupId: PropTypes.func.isRequired,
onChangeGroupTags: PropTypes.func.isRequired,
onChangeGroupCategory: PropTypes.func.isRequired,
onChangeGroupIsPrivate: PropTypes.func.isRequired,
onChangeGroupIsVisible: PropTypes.func.isRequired,
onFetchGroup: PropTypes.func.isRequired,
onFetchGroupCategories: PropTypes.func.isRequired,
onResetEditor: PropTypes.func.isRequired,
onSetGroup: PropTypes.func.isRequired,
onSubmit: PropTypes.func.isRequired,
isSubmitting: PropTypes.bool,
isAdmin: PropTypes.bool,
onClose: PropTypes.func,
idValue: PropTypes.string.isRequired,
tags: PropTypes.string.isRequired,
category: PropTypes.string.isRequired,
isPrivate: PropTypes.bool.isRequired,
isVisible: PropTypes.bool.isRequired,
categories: ImmutablePropTypes.list.isRequired,
}
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(GroupCreate))

View File

@@ -19,50 +19,8 @@ import BlockHeading from '../components/block_heading'
import Input from '../components/input'
import ScrollableList from '../components/scrollable_list'
const mapStateToProps = (state, { params }) => {
const groupId = isObject(params) ? params['id'] : -1
const group = groupId === -1 ? null : state.getIn(['groups', groupId])
return {
group,
groupId,
relationships: state.getIn(['group_relationships', groupId]),
accountIds: state.getIn(['user_lists', 'groups', groupId, 'items']),
hasMore: !!state.getIn(['user_lists', 'groups', groupId, 'next']),
}
}
const mapDispatchToProps = (dispatch) => ({
onFetchMembers(groupId) {
dispatch(fetchMembers(groupId))
},
onExpandMembers(groupId) {
dispatch(expandMembers(groupId))
},
onOpenGroupMemberOptions(targetRef, accountId, groupId) {
dispatch(openPopover('GROUP_MEMBER_OPTIONS', {
targetRef,
accountId,
groupId,
position: 'top',
}))
},
})
export default
@connect(mapStateToProps, mapDispatchToProps)
class GroupMembers extends ImmutablePureComponent {
static propTypes = {
group: ImmutablePropTypes.map,
groupId: PropTypes.string.isRequired,
accountIds: ImmutablePropTypes.list,
hasMore: PropTypes.bool,
onExpandMembers: PropTypes.func.isRequired,
onFetchMembers: PropTypes.func.isRequired,
onOpenGroupMemberOptions: PropTypes.func.isRequired,
}
componentWillMount() {
const { groupId } = this.props
@@ -146,3 +104,45 @@ class GroupMembers extends ImmutablePureComponent {
}
}
const mapStateToProps = (state, { params }) => {
const groupId = isObject(params) ? params['id'] : -1
const group = groupId === -1 ? null : state.getIn(['groups', groupId])
return {
group,
groupId,
relationships: state.getIn(['group_relationships', groupId]),
accountIds: state.getIn(['user_lists', 'groups', groupId, 'items']),
hasMore: !!state.getIn(['user_lists', 'groups', groupId, 'next']),
}
}
const mapDispatchToProps = (dispatch) => ({
onFetchMembers(groupId) {
dispatch(fetchMembers(groupId))
},
onExpandMembers(groupId) {
dispatch(expandMembers(groupId))
},
onOpenGroupMemberOptions(targetRef, accountId, groupId) {
dispatch(openPopover('GROUP_MEMBER_OPTIONS', {
targetRef,
accountId,
groupId,
position: 'top',
}))
},
})
GroupMembers.propTypes = {
group: ImmutablePropTypes.map,
groupId: PropTypes.string.isRequired,
accountIds: ImmutablePropTypes.list,
hasMore: PropTypes.bool,
onExpandMembers: PropTypes.func.isRequired,
onFetchMembers: PropTypes.func.isRequired,
onOpenGroupMemberOptions: PropTypes.func.isRequired,
}
export default connect(mapStateToProps, mapDispatchToProps)(GroupMembers)

View File

@@ -18,48 +18,8 @@ import BlockHeading from '../components/block_heading'
import ColumnIndicator from '../components/column_indicator'
import ScrollableList from '../components/scrollable_list'
const messages = defineMessages({
remove: { id: 'groups.removed_accounts', defaultMessage: 'Allow joining' },
})
const mapStateToProps = (state, { params }) => {
const groupId = isObject(params) ? params['id'] : -1
const group = groupId === -1 ? null : state.getIn(['groups', groupId])
return {
group,
groupId,
accountIds: state.getIn(['user_lists', 'groups_removed_accounts', groupId, 'items']),
hasMore: !!state.getIn(['user_lists', 'groups_removed_accounts', groupId, 'next']),
}
}
const mapDispatchToProps = (dispatch) => ({
onFetchRemovedAccounts(groupId) {
dispatch(fetchRemovedAccounts(groupId))
},
onExpandRemovedAccounts(groupId) {
dispatch(expandRemovedAccounts(groupId))
},
onRemoveRemovedAccount(groupId, accountId) {
dispatch(removeRemovedAccount(groupId, accountId))
},
})
export default
@injectIntl
@connect(mapStateToProps, mapDispatchToProps)
class GroupRemovedAccounts extends ImmutablePureComponent {
static propTypes = {
groupId: PropTypes.string.isRequired,
accountIds: ImmutablePropTypes.list,
hasMore: PropTypes.bool,
onFetchRemovedAccounts: PropTypes.func.isRequired,
onExpandRemovedAccounts: PropTypes.func.isRequired,
onRemoveRemovedAccount: PropTypes.func.isRequired,
}
componentWillMount() {
const { groupId } = this.props
@@ -113,3 +73,42 @@ class GroupRemovedAccounts extends ImmutablePureComponent {
}
}
const messages = defineMessages({
remove: { id: 'groups.removed_accounts', defaultMessage: 'Allow joining' },
})
const mapStateToProps = (state, { params }) => {
const groupId = isObject(params) ? params['id'] : -1
const group = groupId === -1 ? null : state.getIn(['groups', groupId])
return {
group,
groupId,
accountIds: state.getIn(['user_lists', 'groups_removed_accounts', groupId, 'items']),
hasMore: !!state.getIn(['user_lists', 'groups_removed_accounts', groupId, 'next']),
}
}
const mapDispatchToProps = (dispatch) => ({
onFetchRemovedAccounts(groupId) {
dispatch(fetchRemovedAccounts(groupId))
},
onExpandRemovedAccounts(groupId) {
dispatch(expandRemovedAccounts(groupId))
},
onRemoveRemovedAccount(groupId, accountId) {
dispatch(removeRemovedAccount(groupId, accountId))
},
})
GroupRemovedAccounts.propTypes = {
groupId: PropTypes.string.isRequired,
accountIds: ImmutablePropTypes.list,
hasMore: PropTypes.bool,
onFetchRemovedAccounts: PropTypes.func.isRequired,
onExpandRemovedAccounts: PropTypes.func.isRequired,
onRemoveRemovedAccount: PropTypes.func.isRequired,
}
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(GroupRemovedAccounts))

View File

@@ -21,54 +21,8 @@ import StatusList from '../components/status_list'
import ColumnIndicator from '../components/column_indicator'
import GroupSortBlock from '../components/group_sort_block'
const messages = defineMessages({
empty: { id: 'empty_column.group', defaultMessage: 'There is nothing in this group yet.\nWhen members of this group post new statuses, they will appear here.' },
})
const mapStateToProps = (state, props) => ({
groupId: props.params.id,
group: state.getIn(['groups', props.params.id]),
sortByValue: state.getIn(['group_lists', 'sortByValue']),
sortByTopValue: state.getIn(['group_lists', 'sortByTopValue']),
})
const mapDispatchToProps = (dispatch) => ({
onConnectGroupStream(groupId) {
dispatch(connectGroupStream(groupId))
},
onClearTimeline(timelineId) {
dispatch(clearTimeline(timelineId))
},
onExpandGroupTimeline(groupId, options) {
dispatch(expandGroupTimeline(groupId, options))
},
setMemberNewest() {
dispatch(setGroupTimelineSort(GROUP_TIMELINE_SORTING_TYPE_NEWEST))
},
})
export default
@connect(mapStateToProps, mapDispatchToProps)
@injectIntl
class GroupTimeline extends ImmutablePureComponent {
static propTypes = {
params: PropTypes.object.isRequired,
group: PropTypes.oneOfType([
ImmutablePropTypes.map,
PropTypes.bool,
]),
groupId: PropTypes.string,
intl: PropTypes.object.isRequired,
onConnectGroupStream: PropTypes.func.isRequired,
onClearTimeline: PropTypes.func.isRequired,
onExpandGroupTimeline: PropTypes.func.isRequired,
setMemberNewest: PropTypes.func.isRequired,
sortByValue: PropTypes.string.isRequired,
sortByTopValue: PropTypes.string,
onlyMedia: PropTypes.bool,
}
state = {
//keep track of loads for if no user,
//only allow 2 loads before showing sign up msg
@@ -151,3 +105,48 @@ class GroupTimeline extends ImmutablePureComponent {
}
}
const messages = defineMessages({
empty: { id: 'empty_column.group', defaultMessage: 'There is nothing in this group yet.\nWhen members of this group post new statuses, they will appear here.' },
})
const mapStateToProps = (state, props) => ({
groupId: props.params.id,
group: state.getIn(['groups', props.params.id]),
sortByValue: state.getIn(['group_lists', 'sortByValue']),
sortByTopValue: state.getIn(['group_lists', 'sortByTopValue']),
})
const mapDispatchToProps = (dispatch) => ({
onConnectGroupStream(groupId) {
dispatch(connectGroupStream(groupId))
},
onClearTimeline(timelineId) {
dispatch(clearTimeline(timelineId))
},
onExpandGroupTimeline(groupId, options) {
dispatch(expandGroupTimeline(groupId, options))
},
setMemberNewest() {
dispatch(setGroupTimelineSort(GROUP_TIMELINE_SORTING_TYPE_NEWEST))
},
})
GroupTimeline.propTypes = {
params: PropTypes.object.isRequired,
group: PropTypes.oneOfType([
ImmutablePropTypes.map,
PropTypes.bool,
]),
groupId: PropTypes.string,
intl: PropTypes.object.isRequired,
onConnectGroupStream: PropTypes.func.isRequired,
onClearTimeline: PropTypes.func.isRequired,
onExpandGroupTimeline: PropTypes.func.isRequired,
setMemberNewest: PropTypes.func.isRequired,
sortByValue: PropTypes.string.isRequired,
sortByTopValue: PropTypes.string,
onlyMedia: PropTypes.bool,
}
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(GroupTimeline))

View File

@@ -13,46 +13,8 @@ import ColumnIndicator from '../components/column_indicator'
import Heading from '../components/heading'
import GroupListItem from '../components/group_list_item'
const messages = defineMessages({
empty: { id: 'groups.empty', defaultMessage: 'There are no groups to display' },
featured: { id: 'featured', defaultMessage: 'Featured' },
new: { id: 'new', defaultMessage: 'Just Added' },
member: { id: 'my_groups', defaultMessage: 'My Groups' },
admin: { id: 'admin', defaultMessage: 'Admin' },
})
const mapStateToProps = (state, { activeTab }) => ({
groupIds: state.getIn(['group_lists', activeTab, 'items']),
isFetched: state.getIn(['group_lists', activeTab, 'isFetched']),
isLoading: state.getIn(['group_lists', activeTab, 'isLoading']),
})
const mapDispatchToProps = (dispatch) => ({
onFetchGroups: (tab) => dispatch(fetchGroups(tab)),
onOpenSortPopover(tab, targetRef) {
dispatch(openPopover(POPOVER_GROUP_LIST_SORT_OPTIONS, {
targetRef,
tab,
position: 'bottom',
}))
}
})
export default
@injectIntl
@connect(mapStateToProps, mapDispatchToProps)
class GroupsCollection extends ImmutablePureComponent {
static propTypes = {
activeTab: PropTypes.string.isRequired,
groupIds: ImmutablePropTypes.list,
intl: PropTypes.object.isRequired,
isFetched: PropTypes.bool.isRequired,
isLoading: PropTypes.bool.isRequired,
onFetchGroups: PropTypes.func.isRequired,
onOpenSortPopover: PropTypes.func.isRequired,
}
componentWillMount() {
this.props.onFetchGroups(this.props.activeTab)
}
@@ -124,4 +86,41 @@ class GroupsCollection extends ImmutablePureComponent {
)
}
}
}
const messages = defineMessages({
empty: { id: 'groups.empty', defaultMessage: 'There are no groups to display' },
featured: { id: 'featured', defaultMessage: 'Featured' },
new: { id: 'new', defaultMessage: 'Just Added' },
member: { id: 'my_groups', defaultMessage: 'My Groups' },
admin: { id: 'admin', defaultMessage: 'Admin' },
})
const mapStateToProps = (state, { activeTab }) => ({
groupIds: state.getIn(['group_lists', activeTab, 'items']),
isFetched: state.getIn(['group_lists', activeTab, 'isFetched']),
isLoading: state.getIn(['group_lists', activeTab, 'isLoading']),
})
const mapDispatchToProps = (dispatch) => ({
onFetchGroups: (tab) => dispatch(fetchGroups(tab)),
onOpenSortPopover(tab, targetRef) {
dispatch(openPopover(POPOVER_GROUP_LIST_SORT_OPTIONS, {
targetRef,
tab,
position: 'bottom',
}))
}
})
GroupsCollection.propTypes = {
activeTab: PropTypes.string.isRequired,
groupIds: ImmutablePropTypes.list,
intl: PropTypes.object.isRequired,
isFetched: PropTypes.bool.isRequired,
isLoading: PropTypes.bool.isRequired,
onFetchGroups: PropTypes.func.isRequired,
onOpenSortPopover: PropTypes.func.isRequired,
}
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(GroupsCollection))

View File

@@ -7,22 +7,10 @@ import { expandHashtagTimeline, clearTimeline } from '../actions/timelines'
import { connectHashtagStream } from '../actions/streaming'
import StatusList from '../components/status_list'
const mapStateToProps = (state, props) => ({
hasUnread: state.getIn(['timelines', `hashtag:${props.params.id}`, 'unread']) > 0,
})
export default
@connect(mapStateToProps)
class HashtagTimeline extends React.PureComponent {
disconnects = [];
static propTypes = {
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
hasUnread: PropTypes.bool,
}
title = () => {
const title = [this.props.params.id]
@@ -141,3 +129,15 @@ class HashtagTimeline extends React.PureComponent {
}
}
const mapStateToProps = (state, props) => ({
hasUnread: state.getIn(['timelines', `hashtag:${props.params.id}`, 'unread']) > 0,
})
HashtagTimeline.propTypes = {
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
hasUnread: PropTypes.bool,
}
export default connect(mapStateToProps)(HashtagTimeline)

View File

@@ -10,34 +10,8 @@ import {
} from '../actions/timelines'
import StatusList from '../components/status_list'
const messages = defineMessages({
title: { id: 'column.home', defaultMessage: 'Home' },
empty: { id: 'empty_timeline.home', defaultMessage: 'Your home timeline is empty. Start following other users to receive their content here.' },
})
const mapStateToProps = (state) => ({
isPartial: state.getIn(['timelines', 'home', 'isPartial']),
})
const mapDispatchToProps = (dispatch) => ({
onExpandHomeTimeline(options) {
if (!options) dispatch(forceDequeueTimeline('home'))
dispatch(expandHomeTimeline(options))
},
})
export default
@injectIntl
@withRouter
@connect(mapStateToProps, mapDispatchToProps)
class HomeTimeline extends React.PureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
isPartial: PropTypes.bool,
onExpandHomeTimeline: PropTypes.func.isRequired,
}
componentDidMount () {
this._checkIfReloadNeeded(false, this.props.isPartial)
}
@@ -99,4 +73,28 @@ class HomeTimeline extends React.PureComponent {
)
}
}
}
const messages = defineMessages({
title: { id: 'column.home', defaultMessage: 'Home' },
empty: { id: 'empty_timeline.home', defaultMessage: 'Your home timeline is empty. Start following other users to receive their content here.' },
})
const mapStateToProps = (state) => ({
isPartial: state.getIn(['timelines', 'home', 'isPartial']),
})
const mapDispatchToProps = (dispatch) => ({
onExpandHomeTimeline(options) {
if (!options) dispatch(forceDequeueTimeline('home'))
dispatch(expandHomeTimeline(options))
},
})
HomeTimeline.propTypes = {
intl: PropTypes.object.isRequired,
isPartial: PropTypes.bool,
onExpandHomeTimeline: PropTypes.func.isRequired,
}
export default injectIntl(withRouter(connect(mapStateToProps, mapDispatchToProps)(HomeTimeline)))

View File

@@ -27,39 +27,29 @@ import Pagination from '../components/pagination'
import ComposeFormContainer from './compose/containers/compose_form_container'
import Responsive from './ui/util/responsive_component'
class SlideWelcome extends React.PureComponent {
const SlideWelcome = () => (
<div className={[_s.d, _s.w100PC, _s.h100PC].join(' ')}>
<Image src='/headers/onboarding.png' alt='Welcome to Gab' />
render() {
return (
<div className={[_s.d, _s.w100PC, _s.h100PC].join(' ')}>
<Image src='/headers/onboarding.png' alt='Welcome to Gab' />
<div className={[_s.d, _s.px15, _s.py15].join(' ')}>
<div className={[_s.d, _s.px15, _s.py15].join(' ')}>
<Text size='large'>Gab is the home of free speech online and a place where users shape their own experience. </Text>
<br />
<Text size='large'>You will discover many different ideas, people, and topics on Gab.</Text>
<br />
<Text size='large'>Follow the people you find interesting and block or mute people you don't want to associate with.</Text>
<br />
<Text size='large'>Speak freely, associate freely!</Text>
<br />
<Text size='large'>Let's get started!</Text>
<Text size='large'>Gab is the home of free speech online and a place where users shape their own experience. </Text>
<br />
<Text size='large'>You will discover many different ideas, people, and topics on Gab.</Text>
<br />
<Text size='large'>Follow the people you find interesting and block or mute people you don't want to associate with.</Text>
<br />
<Text size='large'>Speak freely, associate freely!</Text>
<br />
<Text size='large'>Let's get started!</Text>
</div>
</div>
</div>
)
}
}
</div>
)
class SlidePhotos extends ImmutablePureComponent {
static propTypes = {
account: ImmutablePropTypes.map.isRequired,
}
state = {
displayNameValue: this.props.account.get('display_name'),
}
@@ -138,11 +128,11 @@ class SlidePhotos extends ImmutablePureComponent {
}
class SlideGroups extends ImmutablePureComponent {
SlidePhotos.propTypes = {
account: ImmutablePropTypes.map.isRequired,
}
static propTypes = {
groupIds: ImmutablePropTypes.list,
}
class SlideGroups extends ImmutablePureComponent {
render() {
const { groupIds } = this.props
@@ -174,12 +164,11 @@ class SlideGroups extends ImmutablePureComponent {
}
class SlideFirstPost extends React.PureComponent {
SlideGroups.propTypes = {
groupIds: ImmutablePropTypes.list,
}
static propTypes = {
submitted: PropTypes.bool.isRequired,
onNext: PropTypes.func.isRequired,
}
class SlideFirstPost extends React.PureComponent {
render() {
const { submitted } = this.props
@@ -228,35 +217,13 @@ class SlideFirstPost extends React.PureComponent {
}
const mapStateToProps = (state) => ({
account: makeGetAccount()(state, me),
groupIds: state.getIn(['group_lists', 'featured', 'items']),
shownOnboarding: state.getIn(['settings', 'shownOnboarding'], false),
isSubmitting: state.getIn(['compose', 'is_submitting']),
})
SlideFirstPost.propTypes = {
submitted: PropTypes.bool.isRequired,
onNext: PropTypes.func.isRequired,
}
const mapDispatchToProps = (dispatch) => ({
onSaveShownOnboarding: () => dispatch(saveShownOnboarding()),
onFetchFeaturedGroups: () => dispatch(fetchGroups('featured')),
onSaveUserProfileInformation(data) {
dispatch(saveUserProfileInformation(data))
},
})
export default
@connect(mapStateToProps, mapDispatchToProps)
class Introduction extends ImmutablePureComponent {
static propTypes = {
account: ImmutablePropTypes.map.isRequired,
groupIds: ImmutablePropTypes.list,
isSubmitting: PropTypes.bool.isRequired,
shownOnboarding: PropTypes.bool.isRequired,
onSaveShownOnboarding: PropTypes.func.isRequired,
onFetchFeaturedGroups: PropTypes.func.isRequired,
onSaveUserProfileInformation: PropTypes.func.isRequired,
}
state = {
currentIndex: 0,
submittedFirstPost: false,
@@ -436,4 +403,31 @@ class Introduction extends ImmutablePureComponent {
)
}
}
}
const mapStateToProps = (state) => ({
account: makeGetAccount()(state, me),
groupIds: state.getIn(['group_lists', 'featured', 'items']),
shownOnboarding: state.getIn(['settings', 'shownOnboarding'], false),
isSubmitting: state.getIn(['compose', 'is_submitting']),
})
const mapDispatchToProps = (dispatch) => ({
onSaveShownOnboarding: () => dispatch(saveShownOnboarding()),
onFetchFeaturedGroups: () => dispatch(fetchGroups('featured')),
onSaveUserProfileInformation(data) {
dispatch(saveUserProfileInformation(data))
},
})
Introduction.propTypes = {
account: ImmutablePropTypes.map.isRequired,
groupIds: ImmutablePropTypes.list,
isSubmitting: PropTypes.bool.isRequired,
shownOnboarding: PropTypes.bool.isRequired,
onSaveShownOnboarding: PropTypes.func.isRequired,
onFetchFeaturedGroups: PropTypes.func.isRequired,
onSaveUserProfileInformation: PropTypes.func.isRequired,
}
export default connect(mapStateToProps, mapDispatchToProps)(Introduction)

View File

@@ -10,27 +10,8 @@ import { meUsername } from '../initial_state'
import StatusList from '../components/status_list'
import ColumnIndicator from '../components/column_indicator'
const mapStateToProps = (state, { params: { username } }) => {
return {
isMyAccount: (username.toLowerCase() === meUsername.toLowerCase()),
statusIds: state.getIn(['status_lists', 'favorites', 'items']),
isLoading: state.getIn(['status_lists', 'favorites', 'isLoading'], true),
hasMore: !!state.getIn(['status_lists', 'favorites', 'next']),
}
}
export default
@connect(mapStateToProps)
class LikedStatuses extends ImmutablePureComponent {
static propTypes = {
dispatch: PropTypes.func.isRequired,
statusIds: ImmutablePropTypes.list.isRequired,
hasMore: PropTypes.bool,
isLoading: PropTypes.bool,
isMyAccount: PropTypes.bool.isRequired,
}
componentWillMount() {
this.props.dispatch(fetchFavoritedStatuses())
}
@@ -64,3 +45,20 @@ class LikedStatuses extends ImmutablePureComponent {
}
}
const mapStateToProps = (state, { params: { username } }) => ({
isMyAccount: (username.toLowerCase() === meUsername.toLowerCase()),
statusIds: state.getIn(['status_lists', 'favorites', 'items']),
isLoading: state.getIn(['status_lists', 'favorites', 'isLoading'], true),
hasMore: !!state.getIn(['status_lists', 'favorites', 'next']),
})
LikedStatuses.propTypes = {
dispatch: PropTypes.func.isRequired,
statusIds: ImmutablePropTypes.list.isRequired,
hasMore: PropTypes.bool,
isLoading: PropTypes.bool,
isMyAccount: PropTypes.bool.isRequired,
}
export default connect(mapStateToProps)(LikedStatuses)

View File

@@ -10,39 +10,8 @@ import Input from '../components/input'
import Form from '../components/form'
import Text from '../components/text'
const messages = defineMessages({
label: { id: 'lists.new.title_placeholder', defaultMessage: 'New list title' },
create: { id: 'lists.new.create_title', defaultMessage: 'Create list' },
list_description: { id: 'list.description', defaultMessage: 'Lists are private and only you can see who is on a list.\nNo one else can view your lists. No one knows that they are on your list.' },
new_list_placeholder: { id: 'list.title_placeholder', defaultMessage: 'My new list...', },
})
const mapStateToProps = (state) => ({
value: state.getIn(['listEditor', 'title']),
disabled: state.getIn(['listEditor', 'isSubmitting']),
})
const mapDispatchToProps = (dispatch, { isModal }) => ({
onChange: (value) => dispatch(changeListEditorTitle(value)),
onSubmit: () => {
if (isModal) dispatch(closeModal(MODAL_LIST_CREATE))
dispatch(submitListEditor(true))
},
})
export default
@connect(mapStateToProps, mapDispatchToProps)
@injectIntl
class ListCreate extends React.PureComponent {
static propTypes = {
value: PropTypes.string,
intl: PropTypes.object.isRequired,
onChange: PropTypes.func.isRequired,
onSubmit: PropTypes.func.isRequired,
isModal: PropTypes.bool,
}
render() {
const {
value,
@@ -81,3 +50,33 @@ class ListCreate extends React.PureComponent {
}
}
const messages = defineMessages({
label: { id: 'lists.new.title_placeholder', defaultMessage: 'New list title' },
create: { id: 'lists.new.create_title', defaultMessage: 'Create list' },
list_description: { id: 'list.description', defaultMessage: 'Lists are private and only you can see who is on a list.\nNo one else can view your lists. No one knows that they are on your list.' },
new_list_placeholder: { id: 'list.title_placeholder', defaultMessage: 'My new list...', },
})
const mapStateToProps = (state) => ({
value: state.getIn(['listEditor', 'title']),
disabled: state.getIn(['listEditor', 'isSubmitting']),
})
const mapDispatchToProps = (dispatch, { isModal }) => ({
onChange: (value) => dispatch(changeListEditorTitle(value)),
onSubmit: () => {
if (isModal) dispatch(closeModal(MODAL_LIST_CREATE))
dispatch(submitListEditor(true))
},
})
ListCreate.propTypes = {
value: PropTypes.string,
intl: PropTypes.object.isRequired,
onChange: PropTypes.func.isRequired,
onSubmit: PropTypes.func.isRequired,
isModal: PropTypes.bool,
}
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(ListCreate))

View File

@@ -26,104 +26,8 @@ import Input from '../components/input'
import TabBar from '../components/tab_bar'
import Text from '../components/text'
const messages = defineMessages({
close: { id: 'lightbox.close', defaultMessage: 'Close' },
save: { id: 'lists.new.save_title', defaultMessage: 'Save Title' },
changeTitle: { id: 'lists.edit.submit', defaultMessage: 'Change title' },
addToList: { id: 'lists.account.add', defaultMessage: 'Add to list' },
removeFromList: { id: 'lists.account.remove', defaultMessage: 'Remove from list' },
editList: { id: 'lists.edit', defaultMessage: 'Edit list' },
editListTitle: { id: 'lists.new.edit_title_placeholder', defaultMessage: 'Edit list title' },
remove: { id: 'lists.account.remove', defaultMessage: 'Remove from list' },
add: { id: 'lists.account.add', defaultMessage: 'Add to list' },
search: { id: 'lists.search', defaultMessage: 'Search people...' },
searchMembers: { id: 'lists.search_members', defaultMessage: 'Search members...' },
searchTitle: { id: 'tabs_bar.search', defaultMessage: 'Search' },
})
const mapStateToProps = (state, { params, id }) => {
const listId = isObject(params) ? params['id'] : id
return {
listId,
list: state.getIn(['lists', listId]),
title: state.getIn(['listEditor', 'title']),
disabled: !state.getIn(['listEditor', 'isChanged']),
accountIds: state.getIn(['listEditor', 'accounts', 'items']),
searchAccountIds: state.getIn(['listEditor', 'suggestions', 'items']),
searchSuggestionsValue: state.getIn(['listEditor', 'suggestions', 'value']),
}
}
const mapDispatchToProps = (dispatch) => ({
onDeleteList(list) {
dispatch(openModal(MODAL_LIST_DELETE, { list }))
},
onChangeTitle(value) {
dispatch(changeListEditorTitle(value))
},
onUpdateList() {
dispatch(submitListEditor(false))
},
onInitialize(listId) {
dispatch(setupListEditor(listId))
},
onReset() {
dispatch(resetListEditor())
},
onRemoveAccountFromList(accountId) {
dispatch(removeFromListEditor(accountId))
},
onAddAccountToList(accountId) {
dispatch(addToListEditor(accountId))
},
onSubmitSearchSuggestions(value) {
dispatch(fetchListSuggestions(value))
},
onClearSearchSuggestions() {
dispatch(clearListSuggestions())
},
onChangeSuggestions(value) {
dispatch(changeListSuggestions(value))
},
})
export default
@connect(mapStateToProps, mapDispatchToProps)
@injectIntl
class ListEdit extends ImmutablePureComponent {
static propTypes = {
list: ImmutablePropTypes.map,
title: PropTypes.string,
listId: PropTypes.string.isRequired,
onClose: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
onInitialize: PropTypes.func.isRequired,
onReset: PropTypes.func.isRequired,
searchSuggestionsValue: PropTypes.string.isRequired,
accountIds: ImmutablePropTypes.list.isRequired,
searchAccountIds: ImmutablePropTypes.list.isRequired,
onRemoveAccountFromList: PropTypes.func.isRequired,
onAddAccountToList: PropTypes.func.isRequired,
onChangeSuggestions: PropTypes.func.isRequired,
onClearSearchSuggestions: PropTypes.func.isRequired,
onSubmitSearchSuggestions: PropTypes.func.isRequired,
onDeleteList: PropTypes.func.isRequired,
tab: PropTypes.string,
}
state = {
activeTab: this.props.tab || 'members'
}
@@ -317,3 +221,98 @@ class ListEdit extends ImmutablePureComponent {
}
}
const messages = defineMessages({
close: { id: 'lightbox.close', defaultMessage: 'Close' },
save: { id: 'lists.new.save_title', defaultMessage: 'Save Title' },
changeTitle: { id: 'lists.edit.submit', defaultMessage: 'Change title' },
addToList: { id: 'lists.account.add', defaultMessage: 'Add to list' },
removeFromList: { id: 'lists.account.remove', defaultMessage: 'Remove from list' },
editList: { id: 'lists.edit', defaultMessage: 'Edit list' },
editListTitle: { id: 'lists.new.edit_title_placeholder', defaultMessage: 'Edit list title' },
remove: { id: 'lists.account.remove', defaultMessage: 'Remove from list' },
add: { id: 'lists.account.add', defaultMessage: 'Add to list' },
search: { id: 'lists.search', defaultMessage: 'Search people...' },
searchMembers: { id: 'lists.search_members', defaultMessage: 'Search members...' },
searchTitle: { id: 'tabs_bar.search', defaultMessage: 'Search' },
})
const mapStateToProps = (state, { params, id }) => {
const listId = isObject(params) ? params['id'] : id
return {
listId,
list: state.getIn(['lists', listId]),
title: state.getIn(['listEditor', 'title']),
disabled: !state.getIn(['listEditor', 'isChanged']),
accountIds: state.getIn(['listEditor', 'accounts', 'items']),
searchAccountIds: state.getIn(['listEditor', 'suggestions', 'items']),
searchSuggestionsValue: state.getIn(['listEditor', 'suggestions', 'value']),
}
}
const mapDispatchToProps = (dispatch) => ({
onDeleteList(list) {
dispatch(openModal(MODAL_LIST_DELETE, { list }))
},
onChangeTitle(value) {
dispatch(changeListEditorTitle(value))
},
onUpdateList() {
dispatch(submitListEditor(false))
},
onInitialize(listId) {
dispatch(setupListEditor(listId))
},
onReset() {
dispatch(resetListEditor())
},
onRemoveAccountFromList(accountId) {
dispatch(removeFromListEditor(accountId))
},
onAddAccountToList(accountId) {
dispatch(addToListEditor(accountId))
},
onSubmitSearchSuggestions(value) {
dispatch(fetchListSuggestions(value))
},
onClearSearchSuggestions() {
dispatch(clearListSuggestions())
},
onChangeSuggestions(value) {
dispatch(changeListSuggestions(value))
},
})
ListEdit.propTypes = {
list: ImmutablePropTypes.map,
title: PropTypes.string,
listId: PropTypes.string.isRequired,
onClose: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
onInitialize: PropTypes.func.isRequired,
onReset: PropTypes.func.isRequired,
searchSuggestionsValue: PropTypes.string.isRequired,
accountIds: ImmutablePropTypes.list.isRequired,
searchAccountIds: ImmutablePropTypes.list.isRequired,
onRemoveAccountFromList: PropTypes.func.isRequired,
onAddAccountToList: PropTypes.func.isRequired,
onChangeSuggestions: PropTypes.func.isRequired,
onClearSearchSuggestions: PropTypes.func.isRequired,
onSubmitSearchSuggestions: PropTypes.func.isRequired,
onDeleteList: PropTypes.func.isRequired,
tab: PropTypes.string,
}
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(ListEdit))

View File

@@ -12,28 +12,11 @@ import StatusList from '../components/status_list'
import ColumnIndicator from '../components/column_indicator'
import Button from '../components/button'
import Text from '../components/text'
import Block from '../components/block'
const mapStateToProps = (state, props) => ({
list: state.getIn(['lists', props.params.id]),
})
export default
@connect(mapStateToProps)
class ListTimeline extends ImmutablePureComponent {
static contextTypes = {
router: PropTypes.object,
};
static propTypes = {
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
list: PropTypes.oneOfType([
ImmutablePropTypes.map,
PropTypes.bool,
]),
intl: PropTypes.object.isRequired,
}
componentDidMount() {
@@ -118,3 +101,19 @@ class ListTimeline extends ImmutablePureComponent {
}
}
const mapStateToProps = (state, props) => ({
list: state.getIn(['lists', props.params.id]),
})
ListTimeline.propTypes = {
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
list: PropTypes.oneOfType([
ImmutablePropTypes.map,
PropTypes.bool,
]),
intl: PropTypes.object.isRequired,
}
export default connect(mapStateToProps)(ListTimeline)

View File

@@ -6,33 +6,10 @@ import ImmutablePropTypes from 'react-immutable-proptypes'
import { defineMessages, injectIntl } from 'react-intl'
import { getOrderedLists } from '../selectors'
import { fetchLists } from '../actions/lists'
import ColumnIndicator from '../components/column_indicator'
import List from '../components/list'
const messages = defineMessages({
add: { id: 'lists.new.create', defaultMessage: 'Add List' },
empty: { id: 'empty_column.lists', defaultMessage: 'You don\'t have any lists yet. When you create one, it will show up here.' },
})
const mapStateToProps = (state) => ({
lists: getOrderedLists(state),
})
const mapDispatchToProps = (dispatch) => ({
onFetchLists: () => dispatch(fetchLists()),
})
export default
@connect(mapStateToProps, mapDispatchToProps)
@injectIntl
class ListsDirectory extends ImmutablePureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
lists: ImmutablePropTypes.list,
onFetchLists: PropTypes.func.isRequired,
}
state = {
fetched: false,
}
@@ -64,4 +41,25 @@ class ListsDirectory extends ImmutablePureComponent {
)
}
}
}
const messages = defineMessages({
add: { id: 'lists.new.create', defaultMessage: 'Add List' },
empty: { id: 'empty_column.lists', defaultMessage: 'You don\'t have any lists yet. When you create one, it will show up here.' },
})
const mapStateToProps = (state) => ({
lists: getOrderedLists(state),
})
const mapDispatchToProps = (dispatch) => ({
onFetchLists: () => dispatch(fetchLists()),
})
ListsDirectory.propTypes = {
intl: PropTypes.object.isRequired,
lists: ImmutablePropTypes.list,
onFetchLists: PropTypes.func.isRequired,
}
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(ListsDirectory))

View File

@@ -12,30 +12,8 @@ import Block from '../components/block'
import BlockHeading from '../components/block_heading'
import ScrollableList from '../components/scrollable_list'
const mapStateToProps = (state) => ({
accountIds: state.getIn(['user_lists', 'mutes', me, 'items']),
hasMore: !!state.getIn(['user_lists', 'mutes', me, 'next']),
isLoading: state.getIn(['user_lists', 'mutes', me, 'isLoading']),
})
const mapDispatchToProps = (dispatch) => ({
onFetchMutes: () => dispatch(fetchMutes()),
onExpandMutes: () => dispatch(expandMutes()),
})
export default
@connect(mapStateToProps, mapDispatchToProps)
@injectIntl
class Mutes extends ImmutablePureComponent {
static propTypes = {
accountIds: ImmutablePropTypes.list,
hasMore: PropTypes.bool,
isLoading: PropTypes.bool,
onExpandMutes: PropTypes.func.isRequired,
onFetchMutes: PropTypes.func.isRequired,
}
componentWillMount() {
this.props.onFetchMutes()
}
@@ -76,3 +54,24 @@ class Mutes extends ImmutablePureComponent {
}
}
const mapStateToProps = (state) => ({
accountIds: state.getIn(['user_lists', 'mutes', me, 'items']),
hasMore: !!state.getIn(['user_lists', 'mutes', me, 'next']),
isLoading: state.getIn(['user_lists', 'mutes', me, 'isLoading']),
})
const mapDispatchToProps = (dispatch) => ({
onFetchMutes: () => dispatch(fetchMutes()),
onExpandMutes: () => dispatch(expandMutes()),
})
Mutes.propTypes = {
accountIds: ImmutablePropTypes.list,
hasMore: PropTypes.bool,
isLoading: PropTypes.bool,
onExpandMutes: PropTypes.func.isRequired,
onFetchMutes: PropTypes.func.isRequired,
}
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(Mutes))

View File

@@ -17,37 +17,12 @@ import TabBar from '../components/tab_bar'
import Text from '../components/text'
import TrendsItem from '../components/trends_item'
// const messages = defineMessages({
// title: { id: 'trends.title', defaultMessage: 'Trending right now' },
// })
const mapStateToProps = (state) => ({
isError: state.getIn(['gab_trends', 'partner', 'isError']),
isLoading: state.getIn(['gab_trends', 'partner', 'isLoading']),
items: state.getIn(['gab_trends', 'partner', 'items']),
})
const mapDispatchToProps = (dispatch) => ({
onfetchGabTrends: () => dispatch(fetchGabTrends('partner')),
})
export default
@withRouter
@connect(mapStateToProps, mapDispatchToProps)
class News extends React.PureComponent {
static contextTypes = {
router: PropTypes.object.isRequired,
}
static propTypes = {
intl: PropTypes.object.isRequired,
isError: PropTypes.bool,
isLoading: PropTypes.bool,
items: PropTypes.object,
onfetchGabTrends: PropTypes.func.isRequired,
}
state = {
activeDomain: null,
}
@@ -75,7 +50,7 @@ class News extends React.PureComponent {
}
}
render () {
render() {
const {
intl,
isError,
@@ -102,7 +77,7 @@ class News extends React.PureComponent {
if (activeDomain) {
const domainBlock = items.trackedDomains.find((d) => `${d.domain}`.toLowerCase() === activeDomain)
if (domainBlock) domainExists = true
todaysTop = domainBlock.topUrls
todaysTopTitle = domainBlock.title
} else {
@@ -114,14 +89,14 @@ class News extends React.PureComponent {
domainTabs = domains.map((block) => ({
title: block.title,
to: `/news?domain=${block.domain}`,
onClick: () => {},
onClick: () => { },
active: activeDomain === `${block.domain}`.toLowerCase(),
}))
domainTabs = [
{
title: "Today's Top",
to: `/news`,
onClick: () => {},
onClick: () => { },
active: !activeDomain,
},
...domainTabs,
@@ -165,32 +140,32 @@ class News extends React.PureComponent {
</Heading>
</div>
}
{
!activeDomain && leadHeadlines.length > 0 &&
<div className={[_s.d, _s.mb15].join(' ')}>
<div className={[_s.d, _s.px15, _s.py10, _s.borderBottom1PX, _s.bgSubtle, _s.borderColorSecondary, _s.jcCenter].join(' ')}>
<Heading size='h2'>
<Icon id='trends' className={[_s.mr10].join(' ')} size='18px' />
Headlines
<div className={[_s.d, _s.mb15].join(' ')}>
<div className={[_s.d, _s.px15, _s.py10, _s.borderBottom1PX, _s.bgSubtle, _s.borderColorSecondary, _s.jcCenter].join(' ')}>
<Heading size='h2'>
<Icon id='trends' className={[_s.mr10].join(' ')} size='18px' />
Headlines
</Heading>
</div>
{
leadHeadlines.map((lead) => (
<Button
isText
backgroundColor='none'
color='primary'
className={[_s.d, _s.py7].join(' ')}
href={`https://trends.gab.com/trend?url=${lead.href}`}
>
<Text>
{lead.title}
</Text>
</Button>
))
}
</div>
{
leadHeadlines.map((lead) => (
<Button
isText
backgroundColor='none'
color='primary'
className={[_s.d, _s.py7].join(' ')}
href={`https://trends.gab.com/trend?url=${lead.href}`}
>
<Text>
{lead.title}
</Text>
</Button>
))
}
</div>
}
<div>
@@ -224,4 +199,24 @@ class News extends React.PureComponent {
)
}
}
}
const mapStateToProps = (state) => ({
isError: state.getIn(['gab_trends', 'partner', 'isError']),
isLoading: state.getIn(['gab_trends', 'partner', 'isLoading']),
items: state.getIn(['gab_trends', 'partner', 'items']),
})
const mapDispatchToProps = (dispatch) => ({
onfetchGabTrends: () => dispatch(fetchGabTrends('partner')),
})
News.propTypes = {
intl: PropTypes.object.isRequired,
isError: PropTypes.bool,
isLoading: PropTypes.bool,
items: PropTypes.object,
onfetchGabTrends: PropTypes.func.isRequired,
}
export default withRouter(connect(mapStateToProps, mapDispatchToProps)(News))

View File

@@ -20,45 +20,8 @@ import Block from '../components/block'
import Account from '../components/account'
import NotificationPlaceholder from '../components/placeholder/notification_placeholder'
const mapStateToProps = (state) => ({
notifications: state.getIn(['notifications', 'items']),
sortedNotifications: state.getIn(['notifications', 'sortedItems']),
isLoading: state.getIn(['notifications', 'isLoading'], true),
hasMore: state.getIn(['notifications', 'hasMore']),
totalQueuedNotificationsCount: state.getIn(['notifications', 'totalQueuedNotificationsCount'], 0),
selectedFilter: state.getIn(['notifications', 'filter', 'active']),
})
const mapDispatchToProps = (dispatch) => ({
onDequeueNotifications() {
dispatch(dequeueNotifications())
},
onExpandNotifications(options) {
if (!options) dispatch(forceDequeueNotifications())
dispatch(expandNotifications(options))
},
onScrollTopNotifications(top) {
dispatch(scrollTopNotifications(top))
},
})
export default
@withRouter
@connect(mapStateToProps, mapDispatchToProps)
class Notifications extends ImmutablePureComponent {
static propTypes = {
hasMore: PropTypes.bool,
isLoading: PropTypes.bool,
notifications: ImmutablePropTypes.list.isRequired,
onDequeueNotifications: PropTypes.func.isRequired,
onExpandNotifications: PropTypes.func.isRequired,
onScrollTopNotifications: PropTypes.func.isRequired,
sortedNotifications: ImmutablePropTypes.list.isRequired,
totalQueuedNotificationsCount: PropTypes.number,
selectedFilter: PropTypes.string.isRequired,
}
state = {
changedTabs: false,
}
@@ -189,3 +152,39 @@ class Notifications extends ImmutablePureComponent {
}
}
const mapStateToProps = (state) => ({
notifications: state.getIn(['notifications', 'items']),
sortedNotifications: state.getIn(['notifications', 'sortedItems']),
isLoading: state.getIn(['notifications', 'isLoading'], true),
hasMore: state.getIn(['notifications', 'hasMore']),
totalQueuedNotificationsCount: state.getIn(['notifications', 'totalQueuedNotificationsCount'], 0),
selectedFilter: state.getIn(['notifications', 'filter', 'active']),
})
const mapDispatchToProps = (dispatch) => ({
onDequeueNotifications() {
dispatch(dequeueNotifications())
},
onExpandNotifications(options) {
if (!options) dispatch(forceDequeueNotifications())
dispatch(expandNotifications(options))
},
onScrollTopNotifications(top) {
dispatch(scrollTopNotifications(top))
},
})
Notifications.propTypes = {
hasMore: PropTypes.bool,
isLoading: PropTypes.bool,
notifications: ImmutablePropTypes.list.isRequired,
onDequeueNotifications: PropTypes.func.isRequired,
onExpandNotifications: PropTypes.func.isRequired,
onScrollTopNotifications: PropTypes.func.isRequired,
sortedNotifications: ImmutablePropTypes.list.isRequired,
totalQueuedNotificationsCount: PropTypes.number,
selectedFilter: PropTypes.string.isRequired,
}
export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Notifications))

View File

@@ -6,24 +6,12 @@ import { expandProTimeline } from '../actions/timelines'
import { connectProStream } from '../actions/streaming'
import StatusList from '../components/status_list'
const messages = defineMessages({
empty: { id: 'empty_column.pro', defaultMessage: 'The pro timeline is empty.' },
})
export default
@injectIntl
@connect(null)
class ProTimeline extends React.PureComponent {
static contextTypes = {
router: PropTypes.object,
}
static propTypes = {
dispatch: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
}
componentDidMount () {
const { dispatch } = this.props
@@ -61,3 +49,14 @@ class ProTimeline extends React.PureComponent {
}
}
const messages = defineMessages({
empty: { id: 'empty_column.pro', defaultMessage: 'The pro timeline is empty.' },
})
ProTimeline.propTypes = {
dispatch: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
}
export default injectIntl(connect(null)(ProTimeline))

View File

@@ -14,26 +14,8 @@ import PanelLayout from '../components/panel/panel_layout'
import ColumnIndicator from '../components/column_indicator'
import Block from '../components/block'
const mapStateToProps = (state) => ({
isError: state.getIn(['search', 'isError']),
isLoading: state.getIn(['search', 'isLoading']),
results: state.getIn(['search', 'results']),
submitted: state.getIn(['search', 'submitted']),
});
export default
@withRouter
@connect(mapStateToProps)
class Search extends ImmutablePureComponent {
static propTypes = {
isError: PropTypes.bool.isRequired,
isLoading: PropTypes.bool.isRequired,
location: PropTypes.object,
results: ImmutablePropTypes.map.isRequired,
submitted: PropTypes.bool.isRequired,
}
state = {
isSmallScreen: (window.innerWidth <= 895),
}
@@ -193,3 +175,20 @@ class Search extends ImmutablePureComponent {
}
}
const mapStateToProps = (state) => ({
isError: state.getIn(['search', 'isError']),
isLoading: state.getIn(['search', 'isLoading']),
results: state.getIn(['search', 'results']),
submitted: state.getIn(['search', 'submitted']),
})
Search.propTypes = {
isError: PropTypes.bool.isRequired,
isLoading: PropTypes.bool.isRequired,
location: PropTypes.object,
results: ImmutablePropTypes.map.isRequired,
submitted: PropTypes.bool.isRequired,
}
export default withRouter(connect(mapStateToProps)(Search))

View File

@@ -7,29 +7,8 @@ import { fetchShortcuts } from '../actions/shortcuts'
import ColumnIndicator from '../components/column_indicator'
import List from '../components/list'
const mapStateToProps = (state) => ({
isError: state.getIn(['shortcuts', 'isError']),
isLoading: state.getIn(['shortcuts', 'isLoading']),
shortcuts: state.getIn(['shortcuts', 'items']),
})
const mapDispatchToProps = (dispatch) => ({
onFetchShortcuts() {
dispatch(fetchShortcuts())
},
})
export default
@connect(mapStateToProps, mapDispatchToProps)
class Shortcuts extends ImmutablePureComponent {
static propTypes = {
isLoading: PropTypes.bool.isRequired,
isError: PropTypes.bool.isRequired,
onFetchShortcuts: PropTypes.func.isRequired,
shortcuts: ImmutablePropTypes.list,
}
componentDidMount() {
this.props.onFetchShortcuts()
}
@@ -61,4 +40,25 @@ class Shortcuts extends ImmutablePureComponent {
)
}
}
}
const mapStateToProps = (state) => ({
isError: state.getIn(['shortcuts', 'isError']),
isLoading: state.getIn(['shortcuts', 'isLoading']),
shortcuts: state.getIn(['shortcuts', 'items']),
})
const mapDispatchToProps = (dispatch) => ({
onFetchShortcuts() {
dispatch(fetchShortcuts())
},
})
Shortcuts.propTypes = {
isLoading: PropTypes.bool.isRequired,
isError: PropTypes.bool.isRequired,
onFetchShortcuts: PropTypes.func.isRequired,
shortcuts: ImmutablePropTypes.list,
}
export default connect(mapStateToProps, mapDispatchToProps)(Shortcuts)

View File

@@ -11,32 +11,8 @@ import {
import StatusContainer from '../containers/status_container'
import StatusPlaceholder from '../components/placeholder/status_placeholder'
const mapStateToProps = (state, props) => {
const statusId = props.id || props.params.statusId
return {
status: state.getIn(['statuses', statusId]),
}
}
const mapDispatchToProps = (dispatch) => ({
onFetchStatus: (id) => dispatch(fetchStatus(id)),
onFetchContext: (id) => dispatch(fetchContext(id)),
onFetchComments: (id) => dispatch(fetchComments(id)),
})
export default
@connect(mapStateToProps, mapDispatchToProps)
class Status extends ImmutablePureComponent {
static propTypes = {
onFetchContext: PropTypes.func.isRequired,
onFetchStatus: PropTypes.func.isRequired,
onFetchComments: PropTypes.func.isRequired,
params: PropTypes.object,
status: ImmutablePropTypes.map,
}
componentDidMount() {
const statusId = this.props.id || this.props.params.statusId
this.props.onFetchStatus(statusId)
@@ -80,3 +56,27 @@ class Status extends ImmutablePureComponent {
}
}
const mapStateToProps = (state, props) => {
const statusId = props.id || props.params.statusId
return {
status: state.getIn(['statuses', statusId]),
}
}
const mapDispatchToProps = (dispatch) => ({
onFetchStatus: (id) => dispatch(fetchStatus(id)),
onFetchContext: (id) => dispatch(fetchContext(id)),
onFetchComments: (id) => dispatch(fetchComments(id)),
})
Status.propTypes = {
onFetchContext: PropTypes.func.isRequired,
onFetchStatus: PropTypes.func.isRequired,
onFetchComments: PropTypes.func.isRequired,
params: PropTypes.object,
status: ImmutablePropTypes.map,
}
export default connect(mapStateToProps, mapDispatchToProps)(Status)

View File

@@ -11,30 +11,8 @@ import Account from '../components/account'
import ColumnIndicator from '../components/column_indicator'
import ScrollableList from '../components/scrollable_list'
const mapStateToProps = (state, props) => {
const getStatus = makeGetStatus()
const status = getStatus(state, {
id: props.params.statusId,
username: props.params.username,
})
return {
status,
accountIds: state.getIn(['user_lists', 'liked_by', props.params.statusId]),
}
}
export default
@connect(mapStateToProps)
class StatusReposts extends ImmutablePureComponent {
static propTypes = {
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
accountIds: ImmutablePropTypes.list,
status: ImmutablePropTypes.map,
}
componentWillMount () {
this.props.dispatch(fetchLikes(this.props.params.statusId))
this.props.dispatch(fetchStatus(this.props.params.statusId))
@@ -71,3 +49,25 @@ class StatusReposts extends ImmutablePureComponent {
}
}
const mapStateToProps = (state, props) => {
const getStatus = makeGetStatus()
const status = getStatus(state, {
id: props.params.statusId,
username: props.params.username,
})
return {
status,
accountIds: state.getIn(['user_lists', 'liked_by', props.params.statusId]),
}
}
StatusReposts.propTypes = {
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
accountIds: ImmutablePropTypes.list,
status: ImmutablePropTypes.map,
}
export default connect(mapStateToProps)(StatusReposts)

View File

@@ -11,30 +11,8 @@ import Account from '../components/account'
import ColumnIndicator from '../components/column_indicator'
import ScrollableList from '../components/scrollable_list'
const mapStateToProps = (state, props) => {
const getStatus = makeGetStatus()
const status = getStatus(state, {
id: props.params.statusId,
username: props.params.username,
})
return {
status,
accountIds: state.getIn(['user_lists', 'reblogged_by', props.params.statusId]),
}
}
export default
@connect(mapStateToProps)
class StatusReposts extends ImmutablePureComponent {
static propTypes = {
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
accountIds: ImmutablePropTypes.list,
status: ImmutablePropTypes.map,
}
componentWillMount () {
this.props.dispatch(fetchReposts(this.props.params.statusId))
this.props.dispatch(fetchStatus(this.props.params.statusId))
@@ -71,3 +49,25 @@ class StatusReposts extends ImmutablePureComponent {
}
}
const mapStateToProps = (state, props) => {
const getStatus = makeGetStatus()
const status = getStatus(state, {
id: props.params.statusId,
username: props.params.username,
})
return {
status,
accountIds: state.getIn(['user_lists', 'reblogged_by', props.params.statusId]),
}
}
StatusReposts.propTypes = {
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
accountIds: ImmutablePropTypes.list,
status: ImmutablePropTypes.map,
}
export default connect(mapStateToProps)(StatusReposts)

View File

@@ -26,7 +26,6 @@ export function Following() { return import(/* webpackChunkName: "features/follo
export function FollowRequests() { return import(/* webpackChunkName: "features/follow_requests" */'../../follow_requests') }
export function LikedStatuses() { return import(/* webpackChunkName: "features/liked_statuses" */'../../liked_statuses') }
export function GenericNotFound() { return import(/* webpackChunkName: "features/generic_not_found" */'../../generic_not_found') }
export function GifPickerModal() { return import(/* webpackChunkName: "components/gif_picker_modal" */'../../../components/modal/gif_picker_modal') }
export function GlobalFooter() { return import(/* webpackChunkName: "components/global_footer" */'../../../components/global_footer') }
export function GroupsCollection() { return import(/* webpackChunkName: "features/groups_collection" */'../../groups_collection') }
export function GroupAbout() { return import(/* webpackChunkName: "features/group_about" */'../../group_about.js') }
@@ -86,7 +85,6 @@ export function Shortcuts() { return import(/*webpackChunkName: "features/shortc
export function Status() { return import(/* webpackChunkName: "components/status" */'../../../components/status') }
export function StatusFeature() { return import(/* webpackChunkName: "features/status" */'../../status') }
export function SearchFilterPanel() { return import(/* webpackChunkName: "components/search_filter_panel" */'../../../components/panel/search_filter_panel') }
export function SearchPopover() { return import(/* webpackChunkName: "components/search_popover" */'../../../components/popover/search_popover') }
export function ShopPanel() { return import(/* webpackChunkName: "components/shop_panel" */'../../../components/panel/shop_panel') }
export function SidebarMorePopover() { return import(/* webpackChunkName: "components/sidebar_more_popover" */'../../../components/popover/sidebar_more_popover') }
export function SignUpLogInPanel() { return import(/* webpackChunkName: "components/sign_up_log_in_panel" */'../../../components/panel/sign_up_log_in_panel') }