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

@@ -15,37 +15,8 @@ import Text from '../text'
import DotTextSeperator from '../dot_text_seperator'
import ProfileInfoPanelPlaceholder from '../placeholder/profile_info_panel_placeholder'
const messages = defineMessages({
title: { id: 'about', defaultMessage: 'About' },
members: { id: 'members', defaultMessage: 'Members' },
created: { id: 'created', defaultMessage: 'Created' },
category: { id: 'category', defaultMessage: 'Category' },
tags: { id: 'tags', defaultMessage: 'Tags' },
privateGroup: { id: 'group.private', defaultMessage: 'Private' },
publicGroup: { id: 'group.public', defaultMessage: 'Public' },
visibleGroup: { id: 'group.visible', defaultMessage: 'Visible' },
invisibleGroup: { id: 'group.invisible', defaultMessage: 'Invisible' },
})
const mapStateToProps = (state, { group }) => {
const groupId = group ? group.get('id') : -1
const relationships = group === -1 ? null : state.getIn(['group_relationships', groupId])
return { relationships }
}
export default
@injectIntl
@connect(mapStateToProps)
class GroupInfoPanel extends ImmutablePureComponent {
static propTypes = {
group: ImmutablePropTypes.map.isRequired,
intl: PropTypes.object.isRequired,
noPanel: PropTypes.bool,
relationships: ImmutablePropTypes.map,
}
render() {
const {
intl,
@@ -214,11 +185,6 @@ class GroupInfoPanel extends ImmutablePureComponent {
class GroupInfoPanelRow extends React.PureComponent {
static propTypes = {
icon: PropTypes.string,
title: PropTypes.string.isRequired,
}
render() {
const { icon, title } = this.props
@@ -238,4 +204,37 @@ class GroupInfoPanelRow extends React.PureComponent {
}
}
}
GroupInfoPanelRow.propTypes = {
icon: PropTypes.string,
title: PropTypes.string.isRequired,
}
const messages = defineMessages({
title: { id: 'about', defaultMessage: 'About' },
members: { id: 'members', defaultMessage: 'Members' },
created: { id: 'created', defaultMessage: 'Created' },
category: { id: 'category', defaultMessage: 'Category' },
tags: { id: 'tags', defaultMessage: 'Tags' },
privateGroup: { id: 'group.private', defaultMessage: 'Private' },
publicGroup: { id: 'group.public', defaultMessage: 'Public' },
visibleGroup: { id: 'group.visible', defaultMessage: 'Visible' },
invisibleGroup: { id: 'group.invisible', defaultMessage: 'Invisible' },
})
const mapStateToProps = (state, { group }) => {
const groupId = group ? group.get('id') : -1
const relationships = group === -1 ? null : state.getIn(['group_relationships', groupId])
return { relationships }
}
GroupInfoPanel.propTypes = {
group: ImmutablePropTypes.map.isRequired,
intl: PropTypes.object.isRequired,
noPanel: PropTypes.bool,
relationships: ImmutablePropTypes.map,
}
export default injectIntl(connect(mapStateToProps)(GroupInfoPanel))

View File

@@ -10,38 +10,8 @@ import GroupListItem from '../group_list_item'
import ScrollableList from '../scrollable_list'
import GroupListItemPlaceholder from '../placeholder/group_list_item_placeholder'
const messages = defineMessages({
memberTitle: { id: 'groups.sidebar-panel.member_title', defaultMessage: 'Groups you\'re in' },
featuredTitle: { id: 'groups.sidebar-panel.featured_title', defaultMessage: 'Featured Groups' },
show_all: { id: 'groups.sidebar-panel.show_all', defaultMessage: 'Show all' },
all: { id: 'groups.sidebar-panel.all', defaultMessage: 'All' },
})
const mapStateToProps = (state, { groupType }) => ({
groupIds: state.getIn(['group_lists', groupType, 'items']),
})
const mapDispatchToProps = (dispatch) => ({
onFetchGroups: (type) => dispatch(fetchGroups(type))
})
export default
@connect(mapStateToProps, mapDispatchToProps)
@injectIntl
class GroupsPanel extends ImmutablePureComponent {
static propTypes = {
groupIds: ImmutablePropTypes.list,
isLazy: PropTypes.bool,
onFetchGroups: PropTypes.func.isRequired,
shouldLoad: PropTypes.bool,
groupType: PropTypes.string,
}
static defaultProps = {
groupType: 'member'
}
state = {
fetched: false,
}
@@ -109,4 +79,33 @@ class GroupsPanel extends ImmutablePureComponent {
)
}
}
}
const messages = defineMessages({
memberTitle: { id: 'groups.sidebar-panel.member_title', defaultMessage: 'Groups you\'re in' },
featuredTitle: { id: 'groups.sidebar-panel.featured_title', defaultMessage: 'Featured Groups' },
show_all: { id: 'groups.sidebar-panel.show_all', defaultMessage: 'Show all' },
all: { id: 'groups.sidebar-panel.all', defaultMessage: 'All' },
})
const mapStateToProps = (state, { groupType }) => ({
groupIds: state.getIn(['group_lists', groupType, 'items']),
})
const mapDispatchToProps = (dispatch) => ({
onFetchGroups: (type) => dispatch(fetchGroups(type))
})
GroupsPanel.propTypes = {
groupIds: ImmutablePropTypes.list,
isLazy: PropTypes.bool,
onFetchGroups: PropTypes.func.isRequired,
shouldLoad: PropTypes.bool,
groupType: PropTypes.string,
}
GroupsPanel.defaultProps = {
groupType: 'member'
}
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(GroupsPanel))

View File

@@ -10,21 +10,8 @@ import Divider from '../divider'
import Icon from '../icon'
import Text from '../text'
const messages = defineMessages({
title: { id: 'lists_information', defaultMessage: 'List Information' },
edit: { id: 'edit', defaultMessage: 'Edit' },
})
export default
@injectIntl
class ListDetailsPanel extends ImmutablePureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
list: ImmutablePropTypes.map,
onEdit: PropTypes.func.isRequired,
}
render() {
const {
intl,
@@ -77,4 +64,17 @@ class ListDetailsPanel extends ImmutablePureComponent {
</PanelLayout>
)
}
}
}
const messages = defineMessages({
title: { id: 'lists_information', defaultMessage: 'List Information' },
edit: { id: 'edit', defaultMessage: 'Edit' },
})
ListDetailsPanel.propTypes = {
intl: PropTypes.object.isRequired,
list: ImmutablePropTypes.map,
onEdit: PropTypes.func.isRequired,
}
export default injectIntl(ListDetailsPanel)

View File

@@ -9,33 +9,8 @@ import { fetchLists } from '../../actions/lists'
import PanelLayout from './panel_layout'
import List from '../list'
const messages = defineMessages({
title: { id: 'lists.subheading', defaultMessage: 'Your Lists' },
show_all: { id: 'groups.sidebar-panel.show_all', defaultMessage: 'Show all' },
all: { id: 'groups.sidebar-panel.all', defaultMessage: 'All' },
})
const mapStateToProps = (state) => ({
lists: getOrderedLists(state),
})
const mapDispatchToProps = (dispatch) => ({
onFetchLists: () => dispatch(fetchLists()),
})
export default
@connect(mapStateToProps, mapDispatchToProps)
@injectIntl
class ListsPanel extends ImmutablePureComponent {
static propTypes = {
onFetchLists: PropTypes.func.isRequired,
lists: ImmutablePropTypes.list,
intl: PropTypes.object.isRequired,
isLazy: PropTypes.bool,
shouldLoad: PropTypes.bool,
}
state = {
fetched: false,
}
@@ -96,4 +71,28 @@ class ListsPanel extends ImmutablePureComponent {
)
}
}
}
const messages = defineMessages({
title: { id: 'lists.subheading', defaultMessage: 'Your Lists' },
show_all: { id: 'groups.sidebar-panel.show_all', defaultMessage: 'Show all' },
all: { id: 'groups.sidebar-panel.all', defaultMessage: 'All' },
})
const mapStateToProps = (state) => ({
lists: getOrderedLists(state),
})
const mapDispatchToProps = (dispatch) => ({
onFetchLists: () => dispatch(fetchLists()),
})
ListsPanel.propTypes = {
onFetchLists: PropTypes.func.isRequired,
lists: ImmutablePropTypes.list,
intl: PropTypes.object.isRequired,
isLazy: PropTypes.bool,
shouldLoad: PropTypes.bool,
}
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(ListsPanel))

View File

@@ -10,35 +10,8 @@ import PanelLayout from './panel_layout'
import MediaItem from '../media_item'
import MediaGalleryPanelPlaceholder from '../placeholder/media_gallery_panel_placeholder'
const messages = defineMessages({
title: { id: 'media_gallery_panel.title', defaultMessage: 'Media' },
show_all: { id: 'media_gallery_panel.all', defaultMessage: 'Show all' },
})
const mapStateToProps = (state, { account }) => {
const accountId = !!account ? account.get('id') : -1
return {
accountId,
isLoading: state.getIn(['timelines', `account:${accountId}:media`, 'isLoading'], true),
attachments: getAccountGallery(state, accountId),
}
}
export default
@connect(mapStateToProps)
@injectIntl
class MediaGalleryPanel extends ImmutablePureComponent {
static propTypes = {
dispatch: PropTypes.func.isRequired,
accountId: PropTypes.string,
account: ImmutablePropTypes.map,
isLoading: PropTypes.bool,
attachments: ImmutablePropTypes.list.isRequired,
intl: PropTypes.object.isRequired,
}
componentDidMount() {
const { accountId } = this.props
@@ -93,3 +66,29 @@ class MediaGalleryPanel extends ImmutablePureComponent {
)
}
}
const messages = defineMessages({
title: { id: 'media_gallery_panel.title', defaultMessage: 'Media' },
show_all: { id: 'media_gallery_panel.all', defaultMessage: 'Show all' },
})
const mapStateToProps = (state, { account }) => {
const accountId = !!account ? account.get('id') : -1
return {
accountId,
isLoading: state.getIn(['timelines', `account:${accountId}:media`, 'isLoading'], true),
attachments: getAccountGallery(state, accountId),
}
}
MediaGalleryPanel.propTypes = {
dispatch: PropTypes.func.isRequired,
accountId: PropTypes.string,
account: ImmutablePropTypes.map,
isLoading: PropTypes.bool,
attachments: ImmutablePropTypes.list.isRequired,
intl: PropTypes.object.isRequired,
}
export default injectIntl(connect(mapStateToProps)(MediaGalleryPanel))

View File

@@ -9,35 +9,8 @@ import { setFilter } from '../../actions/notifications'
import PanelLayout from './panel_layout'
import SettingSwitch from '../setting_switch'
const messages = defineMessages({
title: { id: 'notification_filters', defaultMessage: 'Notification Filters' },
onlyVerified: { id: 'notification_only_verified', defaultMessage: 'Only Verified Users' },
// onlyFollowing: { id: 'notification_only_following', defaultMessage: 'Only People I Follow' },
})
const mapStateToProps = (state) => ({
settings: state.getIn(['notifications', 'filter']),
isPro: state.getIn(['accounts', me, 'is_pro']),
})
const mapDispatchToProps = (dispatch) => ({
onChange(path, value) {
dispatch(setFilter(path, value))
},
})
export default
@injectIntl
@connect(mapStateToProps, mapDispatchToProps)
class NotificationFilterPanel extends ImmutablePureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
onChange: PropTypes.func.isRequired,
settings: ImmutablePropTypes.map.isRequired,
isPro: PropTypes.bool.isRequired,
}
render() {
const {
intl,
@@ -69,4 +42,30 @@ class NotificationFilterPanel extends ImmutablePureComponent {
</PanelLayout>
)
}
}
}
const messages = defineMessages({
title: { id: 'notification_filters', defaultMessage: 'Notification Filters' },
onlyVerified: { id: 'notification_only_verified', defaultMessage: 'Only Verified Users' },
// onlyFollowing: { id: 'notification_only_following', defaultMessage: 'Only People I Follow' },
})
const mapStateToProps = (state) => ({
settings: state.getIn(['notifications', 'filter']),
isPro: state.getIn(['accounts', me, 'is_pro']),
})
const mapDispatchToProps = (dispatch) => ({
onChange(path, value) {
dispatch(setFilter(path, value))
},
})
NotificationFilterPanel.propTypes = {
intl: PropTypes.object.isRequired,
onChange: PropTypes.func.isRequired,
settings: ImmutablePropTypes.map.isRequired,
isPro: PropTypes.bool.isRequired,
}
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(NotificationFilterPanel))

View File

@@ -5,21 +5,7 @@ import Heading from '../heading'
import Button from '../button'
import Text from '../text'
export default class PanelLayout extends React.PureComponent {
static propTypes = {
title: PropTypes.string,
subtitle: PropTypes.string,
children: PropTypes.node,
headerButtonTitle: PropTypes.string,
headerButtonAction: PropTypes.func,
headerButtonTo: PropTypes.string,
footerButtonTitle: PropTypes.string,
footerButtonAction: PropTypes.func,
footerButtonTo: PropTypes.string,
footerButtonHref: PropTypes.string,
noPadding: PropTypes.bool,
}
class PanelLayout extends React.PureComponent {
render() {
const {
@@ -106,4 +92,20 @@ export default class PanelLayout extends React.PureComponent {
)
}
}
}
PanelLayout.propTypes = {
title: PropTypes.string,
subtitle: PropTypes.string,
children: PropTypes.node,
headerButtonTitle: PropTypes.string,
headerButtonAction: PropTypes.func,
headerButtonTo: PropTypes.string,
footerButtonTitle: PropTypes.string,
footerButtonAction: PropTypes.func,
footerButtonTo: PropTypes.string,
footerButtonHref: PropTypes.string,
noPadding: PropTypes.bool,
}
export default PanelLayout

View File

@@ -7,20 +7,8 @@ import Button from '../button'
import Icon from '../icon'
import Text from '../text'
const messages = defineMessages({
title: { id: 'promo.gab_pro', defaultMessage: 'Upgrade to GabPRO' },
text: { id: 'pro_upgrade_modal.text_sm', defaultMessage: 'Please consider supporting us on our mission to defend free expression online for all people.' },
})
export default
@injectIntl
class ProPanel extends React.PureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
isPro: PropTypes.bool.isRequired,
}
render() {
const { intl, isPro } = this.props
@@ -68,4 +56,16 @@ class ProPanel extends React.PureComponent {
)
}
}
}
const messages = defineMessages({
title: { id: 'promo.gab_pro', defaultMessage: 'Upgrade to GabPRO' },
text: { id: 'pro_upgrade_modal.text_sm', defaultMessage: 'Please consider supporting us on our mission to defend free expression online for all people.' },
})
ProPanel.propTypes = {
intl: PropTypes.object.isRequired,
isPro: PropTypes.bool.isRequired,
}
export default injectIntl(ProPanel)

View File

@@ -12,24 +12,8 @@ import Text from '../text'
import Dummy from '../dummy'
import ProfileInfoPanelPlaceholder from '../placeholder/profile_info_panel_placeholder'
const messages = defineMessages({
title: { id: 'about', defaultMessage: 'About' },
linkVerifiedOn: { id: 'account.link_verified_on', defaultMessage: 'Ownership of this link was checked on {date}' },
account_locked: { id: 'account.locked_info', defaultMessage: 'This account privacy status is set to locked. The owner manually reviews who can follow them.' },
bot: { id: 'account.badges.bot', defaultMessage: 'Bot' },
memberSince: { id: 'account.member_since', defaultMessage: 'Member since {date}' },
})
export default
@injectIntl
class ProfileInfoPanel extends ImmutablePureComponent {
static propTypes = {
account: ImmutablePropTypes.map,
noPanel: PropTypes.bool,
intl: PropTypes.object.isRequired,
}
render() {
const {
intl,
@@ -138,4 +122,20 @@ class ProfileInfoPanel extends ImmutablePureComponent {
</Wrapper>
)
}
}
}
const messages = defineMessages({
title: { id: 'about', defaultMessage: 'About' },
linkVerifiedOn: { id: 'account.link_verified_on', defaultMessage: 'Ownership of this link was checked on {date}' },
account_locked: { id: 'account.locked_info', defaultMessage: 'This account privacy status is set to locked. The owner manually reviews who can follow them.' },
bot: { id: 'account.badges.bot', defaultMessage: 'Bot' },
memberSince: { id: 'account.member_since', defaultMessage: 'Member since {date}' },
})
ProfileInfoPanel.propTypes = {
account: ImmutablePropTypes.map,
noPanel: PropTypes.bool,
intl: PropTypes.object.isRequired,
}
export default injectIntl(ProfileInfoPanel)

View File

@@ -11,23 +11,8 @@ import Dummy from '../dummy'
import ProfileStatsPanelPlaceholder from '../placeholder/profile_stats_panel_placeholder'
import ResponsiveClassesComponent from '../../features/ui/util/responsive_classes_component'
const messages = defineMessages({
gabs: { id: 'account.gabs', defaultMessage: 'Gabs' },
followers: { id: 'account.followers', defaultMessage: 'Followers' },
follows: { id: 'account.follows', defaultMessage: 'Following' },
likes: { id: 'likes', defaultMessage: 'Likes' },
})
export default
@injectIntl
class ProfileStatsPanel extends ImmutablePureComponent {
static propTypes = {
account: ImmutablePropTypes.map,
intl: PropTypes.object.isRequired,
noPanel: PropTypes.bool,
}
render() {
const {
intl,
@@ -82,3 +67,18 @@ class ProfileStatsPanel extends ImmutablePureComponent {
)
}
}
const messages = defineMessages({
gabs: { id: 'account.gabs', defaultMessage: 'Gabs' },
followers: { id: 'account.followers', defaultMessage: 'Followers' },
follows: { id: 'account.follows', defaultMessage: 'Following' },
likes: { id: 'likes', defaultMessage: 'Likes' },
})
ProfileStatsPanel.propTypes = {
account: ImmutablePropTypes.map,
intl: PropTypes.object.isRequired,
noPanel: PropTypes.bool,
}
export default injectIntl(ProfileStatsPanel)

View File

@@ -11,21 +11,8 @@ import ProgressBar from '../progress_bar'
import Button from '../button'
import Text from '../text'
const messages = defineMessages({
progressTitle: { id: 'progress_title', defaultMessage: '{value}% covered this month' },
operationsTitle: { id: 'operations_title', defaultMessage: "Gab's Operational Expenses" },
operationsSubtitle: { id: 'operations_subtitle', defaultMessage: 'We are 100% funded by you' },
donationTitle: { id: 'make_donation', defaultMessage: 'Make a Donation' },
})
export default
@injectIntl
class ProgressPanel extends React.PureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
}
render() {
const { intl } = this.props
@@ -63,4 +50,17 @@ class ProgressPanel extends React.PureComponent {
)
}
}
}
const messages = defineMessages({
progressTitle: { id: 'progress_title', defaultMessage: '{value}% covered this month' },
operationsTitle: { id: 'operations_title', defaultMessage: "Gab's Operational Expenses" },
operationsSubtitle: { id: 'operations_subtitle', defaultMessage: 'We are 100% funded by you' },
donationTitle: { id: 'make_donation', defaultMessage: 'Make a Donation' },
})
ProgressPanel.propTypes = {
intl: PropTypes.object.isRequired,
}
export default injectIntl(ProgressPanel)

View File

@@ -8,32 +8,8 @@ import { setFilter } from '../../actions/search'
import PanelLayout from './panel_layout'
import SettingSwitch from '../setting_switch'
const messages = defineMessages({
title: { id: 'search_filters', defaultMessage: 'Search Filters' },
onlyVerified: { id: 'notification_only_verified', defaultMessage: 'Only Verified Users' },
})
const mapStateToProps = (state) => ({
settings: state.getIn(['search', 'filter']),
})
const mapDispatchToProps = (dispatch) => ({
onChange(path, value) {
dispatch(setFilter(path, value, true))
},
})
export default
@injectIntl
@connect(mapStateToProps, mapDispatchToProps)
class SearchFilterPanel extends ImmutablePureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
onChange: PropTypes.func.isRequired,
settings: ImmutablePropTypes.map.isRequired,
}
componentWillUnmount () {
//reset
this.props.onChange('onlyVerified', false, false)
@@ -58,4 +34,27 @@ class SearchFilterPanel extends ImmutablePureComponent {
</PanelLayout>
)
}
}
}
const messages = defineMessages({
title: { id: 'search_filters', defaultMessage: 'Search Filters' },
onlyVerified: { id: 'notification_only_verified', defaultMessage: 'Only Verified Users' },
})
const mapStateToProps = (state) => ({
settings: state.getIn(['search', 'filter']),
})
const mapDispatchToProps = (dispatch) => ({
onChange(path, value) {
dispatch(setFilter(path, value, true))
},
})
SearchFilterPanel.propTypes = {
intl: PropTypes.object.isRequired,
onChange: PropTypes.func.isRequired,
settings: ImmutablePropTypes.map.isRequired,
}
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(SearchFilterPanel))

View File

@@ -7,33 +7,8 @@ import { URL_DISSENTER_SHOP } from '../../constants'
import PanelLayout from './panel_layout'
import ShopItem from '../shop_item'
const messages = defineMessages({
title: { id: 'shop_panel.title', defaultMessage: 'Dissenter Shop' },
shop_now: { id: 'shop_panel.shop_now', defaultMessage: 'Visit the Dissenter Shop' },
})
const mapStateToProps = (state) => ({
items: state.getIn(['shop', 'featured', 'items']),
isError: state.getIn(['shop', 'featured', 'isError']),
})
const mapDispatchToProps = (dispatch) => ({
onFetchFeaturedProducts: () => dispatch(fetchFeaturedProducts()),
})
export default
@connect(mapStateToProps, mapDispatchToProps)
@injectIntl
class ShopPanel extends React.PureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
products: PropTypes.array,
isLazy: PropTypes.bool,
onFetchFeaturedProducts: PropTypes.func.isRequired,
isError: PropTypes.bool.isRequired,
}
state = {
fetched: !this.props.isLazy,
}
@@ -74,7 +49,7 @@ class ShopPanel extends React.PureComponent {
footerButtonTitle={intl.formatMessage(messages.shop_now)}
footerButtonHref={URL_DISSENTER_SHOP}
>
<div className={[_s.d, _s.flexRow, _s.flexWrap, _s.pl5, _s.pt5].join(' ')}>
<div className={[_s._, _s.flexRow, _s.flexWrap, _s.pl5, _s.pt5].join(' ')}>
{
items.map((block, i) => (
<ShopItem
@@ -90,4 +65,28 @@ class ShopPanel extends React.PureComponent {
</PanelLayout>
)
}
}
}
const messages = defineMessages({
title: { id: 'shop_panel.title', defaultMessage: 'Dissenter Shop' },
shop_now: { id: 'shop_panel.shop_now', defaultMessage: 'Visit the Dissenter Shop' },
})
const mapStateToProps = (state) => ({
items: state.getIn(['shop', 'featured', 'items']),
isError: state.getIn(['shop', 'featured', 'isError']),
})
const mapDispatchToProps = (dispatch) => ({
onFetchFeaturedProducts: () => dispatch(fetchFeaturedProducts()),
})
ShopPanel.propTypes = {
intl: PropTypes.object.isRequired,
products: PropTypes.array,
isLazy: PropTypes.bool,
onFetchFeaturedProducts: PropTypes.func.isRequired,
isError: PropTypes.bool.isRequired,
}
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(ShopPanel))

View File

@@ -6,22 +6,8 @@ import { CX } from '../../constants'
import Button from '../button'
import Text from '../text'
const messages = defineMessages({
title: { id: 'signup_panel.welcome_title', defaultMessage: 'Welcome to Gab.com' },
subtitle: { id: 'signup_panel.welcome_subtitle', defaultMessage: 'A social network that champions free speech, individual liberty and the free flow of information online. All are welcome.' },
register: { id: 'account.register', defaultMessage: 'Sign up' },
login: { id: 'account.login', defaultMessage: 'Log in' },
})
export default
@injectIntl
class SignUpLogInPanel extends React.PureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
isXS: PropTypes.bool,
}
render() {
const { intl, isXS } = this.props
@@ -88,3 +74,17 @@ class SignUpLogInPanel extends React.PureComponent {
}
}
const messages = defineMessages({
title: { id: 'signup_panel.welcome_title', defaultMessage: 'Welcome to Gab.com' },
subtitle: { id: 'signup_panel.welcome_subtitle', defaultMessage: 'A social network that champions free speech, individual liberty and the free flow of information online. All are welcome.' },
register: { id: 'account.register', defaultMessage: 'Sign up' },
login: { id: 'account.login', defaultMessage: 'Log in' },
})
SignUpLogInPanel.propTypes = {
intl: PropTypes.object.isRequired,
isXS: PropTypes.bool,
}
export default injectIntl(SignUpLogInPanel)

View File

@@ -6,21 +6,8 @@ import Button from '../button'
import Text from '../text'
import PanelLayout from './panel_layout'
const messages = defineMessages({
title: { id: 'signup_panel.title', defaultMessage: 'New to Gab?' },
subtitle: { id: 'signup_panel.subtitle', defaultMessage: 'Sign up now to speak freely.' },
register: { id: 'account.register', defaultMessage: 'Sign up' },
login: { id: 'account.login', defaultMessage: 'Log in' },
})
export default
@injectIntl
class SignUpPanel extends React.PureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
}
render() {
if (me) return null
@@ -57,3 +44,16 @@ class SignUpPanel extends React.PureComponent {
}
}
const messages = defineMessages({
title: { id: 'signup_panel.title', defaultMessage: 'New to Gab?' },
subtitle: { id: 'signup_panel.subtitle', defaultMessage: 'Sign up now to speak freely.' },
register: { id: 'account.register', defaultMessage: 'Sign up' },
login: { id: 'account.login', defaultMessage: 'Log in' },
})
SignUpPanel.propTypes = {
intl: PropTypes.object.isRequired,
}
export default injectIntl(SignUpPanel)

View File

@@ -2,7 +2,6 @@ import React from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import { NavLink } from 'react-router-dom'
import { injectIntl, defineMessages } from 'react-intl'
import ImmutablePropTypes from 'react-immutable-proptypes'
import ImmutablePureComponent from 'react-immutable-pure-component'
import { fetchStatus } from '../../actions/statuses'
@@ -19,33 +18,8 @@ import ColumnIndicator from '../column_indicator'
import StatusContent from '../status_content'
import StatusMedia from '../status_media'
const messages = defineMessages({
gabs: { id: 'account.posts', defaultMessage: 'Gabs' },
followers: { id: 'account.followers', defaultMessage: 'Followers' },
follows: { id: 'account.follows', defaultMessage: 'Following' },
edit_profile: { id: 'account.edit_profile', defaultMessage: 'Edit profile' },
headerPhoto: { id: 'header_photo', defaultMessage: 'Header photo' },
})
const mapStateToProps = (state, { statusId }) => ({
status: makeGetStatus()(state, { id: statusId }),
})
const mapDispatchToProps = (dispatch) => ({
onFetchStatus: (id) => dispatch(fetchStatus(id)),
})
export default
@connect(mapStateToProps, mapDispatchToProps)
@injectIntl
class StatusPromotionPanel extends ImmutablePureComponent {
static propTypes = {
status: ImmutablePropTypes.map.isRequired,
statusId: PropTypes.string.isRequired,
onFetchStatus: PropTypes.func.isRequired,
}
componentDidMount() {
if (!this.props.status) {
this.props.onFetchStatus(this.props.statusId)
@@ -135,4 +109,20 @@ class StatusPromotionPanel extends ImmutablePureComponent {
)
}
}
}
const mapStateToProps = (state, { statusId }) => ({
status: makeGetStatus()(state, { id: statusId }),
})
const mapDispatchToProps = (dispatch) => ({
onFetchStatus: (id) => dispatch(fetchStatus(id)),
})
StatusPromotionPanel.propTypes = {
status: ImmutablePropTypes.map.isRequired,
statusId: PropTypes.string.isRequired,
onFetchStatus: PropTypes.func.isRequired,
}
export default connect(mapStateToProps, mapDispatchToProps)(StatusPromotionPanel)

View File

@@ -10,35 +10,8 @@ import ScrollableList from '../scrollable_list'
import TrendsItem from '../trends_item'
import TrendsItemPlaceholder from '../placeholder/trends_item_placeholder'
const messages = defineMessages({
title: { id: 'trends.title', defaultMessage: 'Trending right now' },
readMore: { id: 'status.read_more', defaultMessage: 'Read more' },
})
const mapStateToProps = (state) => ({
isError: state.getIn(['gab_trends', 'feed', 'isError']),
isLoading: state.getIn(['gab_trends', 'feed', 'isLoading']),
items: state.getIn(['gab_trends', 'feed', 'items']),
})
const mapDispatchToProps = (dispatch) => ({
onfetchGabTrends: () => dispatch(fetchGabTrends('feed')),
})
export default
@injectIntl
@connect(mapStateToProps, mapDispatchToProps)
class TrendsPanel extends ImmutablePureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
isError: PropTypes.bool,
isLazy: PropTypes.bool,
isLoading: PropTypes.bool,
items: ImmutablePropTypes.list.isRequired,
onfetchGabTrends: PropTypes.func.isRequired,
}
updateOnProps = [
'items',
'isLazy',
@@ -116,4 +89,30 @@ class TrendsPanel extends ImmutablePureComponent {
</PanelLayout>
)
}
}
}
const messages = defineMessages({
title: { id: 'trends.title', defaultMessage: 'Trending right now' },
readMore: { id: 'status.read_more', defaultMessage: 'Read more' },
})
const mapStateToProps = (state) => ({
isError: state.getIn(['gab_trends', 'feed', 'isError']),
isLoading: state.getIn(['gab_trends', 'feed', 'isLoading']),
items: state.getIn(['gab_trends', 'feed', 'items']),
})
const mapDispatchToProps = (dispatch) => ({
onfetchGabTrends: () => dispatch(fetchGabTrends('feed')),
})
TrendsPanel.propTypes = {
intl: PropTypes.object.isRequired,
isError: PropTypes.bool,
isLazy: PropTypes.bool,
isLoading: PropTypes.bool,
items: ImmutablePropTypes.list.isRequired,
onfetchGabTrends: PropTypes.func.isRequired,
}
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(TrendsPanel))

View File

@@ -20,35 +20,8 @@ import DisplayName from '../display_name'
import Image from '../image'
import UserStat from '../user_stat'
const messages = defineMessages({
gabs: { id: 'account.posts', defaultMessage: 'Gabs' },
followers: { id: 'account.followers', defaultMessage: 'Followers' },
follows: { id: 'account.follows', defaultMessage: 'Following' },
edit_profile: { id: 'account.edit_profile', defaultMessage: 'Edit profile' },
headerPhoto: { id: 'header_photo', defaultMessage: 'Header photo' },
})
const mapStateToProps = (state) => ({
account: makeGetAccount()(state, me),
})
const mapDispatchToProps = (dispatch) => ({
onOpenEditProfile() {
dispatch(openModal(MODAL_EDIT_PROFILE))
},
})
export default
@connect(mapStateToProps, mapDispatchToProps)
@injectIntl
class UserPanel extends ImmutablePureComponent {
static propTypes = {
account: ImmutablePropTypes.map.isRequired,
intl: PropTypes.object.isRequired,
onOpenEditProfile: PropTypes.func.isRequired,
}
state = {
hovering: false,
}
@@ -144,4 +117,31 @@ class UserPanel extends ImmutablePureComponent {
)
}
}
}
const messages = defineMessages({
gabs: { id: 'account.posts', defaultMessage: 'Gabs' },
followers: { id: 'account.followers', defaultMessage: 'Followers' },
follows: { id: 'account.follows', defaultMessage: 'Following' },
edit_profile: { id: 'account.edit_profile', defaultMessage: 'Edit profile' },
headerPhoto: { id: 'header_photo', defaultMessage: 'Header photo' },
})
const mapStateToProps = (state) => ({
account: makeGetAccount()(state, me),
})
const mapDispatchToProps = (dispatch) => ({
onOpenEditProfile() {
dispatch(openModal(MODAL_EDIT_PROFILE))
},
})
UserPanel.propTypes = {
account: ImmutablePropTypes.map.isRequired,
intl: PropTypes.object.isRequired,
onOpenEditProfile: PropTypes.func.isRequired,
}
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(UserPanel))

View File

@@ -8,32 +8,8 @@ import ImmutablePropTypes from 'react-immutable-proptypes'
import Account from '../account'
import PanelLayout from './panel_layout'
const messages = defineMessages({
dismissSuggestion: { id: 'suggestions.dismiss', defaultMessage: 'Dismiss suggestion' },
title: { id: 'who_to_follow.title', defaultMessage: 'Verified Accounts to Follow' },
show_more: { id: 'who_to_follow.more', defaultMessage: 'Show more' },
})
const mapStateToProps = (state) => ({
suggestions: state.getIn(['suggestions', 'verified', 'items']),
})
const mapDispatchToProps = (dispatch) => ({
fetchPopularSuggestions: () => dispatch(fetchPopularSuggestions()),
})
export default
@connect(mapStateToProps, mapDispatchToProps)
@injectIntl
class VerifiedAccountsPanel extends ImmutablePureComponent {
static propTypes = {
fetchPopularSuggestions: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
suggestions: ImmutablePropTypes.list.isRequired,
isLazy: PropTypes.bool,
}
state = {
fetched: !this.props.isLazy,
}
@@ -90,4 +66,27 @@ class VerifiedAccountsPanel extends ImmutablePureComponent {
</PanelLayout>
)
}
}
}
const messages = defineMessages({
dismissSuggestion: { id: 'suggestions.dismiss', defaultMessage: 'Dismiss suggestion' },
title: { id: 'who_to_follow.title', defaultMessage: 'Verified Accounts to Follow' },
show_more: { id: 'who_to_follow.more', defaultMessage: 'Show more' },
})
const mapStateToProps = (state) => ({
suggestions: state.getIn(['suggestions', 'verified', 'items']),
})
const mapDispatchToProps = (dispatch) => ({
fetchPopularSuggestions: () => dispatch(fetchPopularSuggestions()),
})
VerifiedAccountsPanel.propTypes = {
fetchPopularSuggestions: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
suggestions: ImmutablePropTypes.list.isRequired,
isLazy: PropTypes.bool,
}
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(VerifiedAccountsPanel))

View File

@@ -11,34 +11,8 @@ import Account from '../account'
import AccountPlaceholder from '../placeholder/account_placeholder'
import PanelLayout from './panel_layout'
const messages = defineMessages({
dismissSuggestion: { id: 'suggestions.dismiss', defaultMessage: 'Dismiss suggestion' },
title: { id: 'who_to_follow.title', defaultMessage: 'Who to Follow' },
show_more: { id: 'who_to_follow.more', defaultMessage: 'Show more' },
})
const mapStateToProps = (state) => ({
suggestions: state.getIn(['suggestions', 'related', 'items']),
isLoading: state.getIn(['suggestions', 'related', 'isLoading']),
})
const mapDispatchToProps = (dispatch) => ({
fetchRelatedSuggestions: () => dispatch(fetchRelatedSuggestions()),
})
export default
@connect(mapStateToProps, mapDispatchToProps)
@injectIntl
class WhoToFollowPanel extends ImmutablePureComponent {
static propTypes = {
fetchRelatedSuggestions: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
suggestions: ImmutablePropTypes.list.isRequired,
isLoading: PropTypes.bool.isRequired,
isLazy: PropTypes.bool,
}
state = {
fetched: !this.props.isLazy,
}
@@ -103,4 +77,29 @@ class WhoToFollowPanel extends ImmutablePureComponent {
</PanelLayout>
)
}
}
}
const messages = defineMessages({
dismissSuggestion: { id: 'suggestions.dismiss', defaultMessage: 'Dismiss suggestion' },
title: { id: 'who_to_follow.title', defaultMessage: 'Who to Follow' },
show_more: { id: 'who_to_follow.more', defaultMessage: 'Show more' },
})
const mapStateToProps = (state) => ({
suggestions: state.getIn(['suggestions', 'related', 'items']),
isLoading: state.getIn(['suggestions', 'related', 'isLoading']),
})
const mapDispatchToProps = (dispatch) => ({
fetchRelatedSuggestions: () => dispatch(fetchRelatedSuggestions()),
})
WhoToFollowPanel.propTypes = {
fetchRelatedSuggestions: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
suggestions: ImmutablePropTypes.list.isRequired,
isLoading: PropTypes.bool.isRequired,
isLazy: PropTypes.bool,
}
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(WhoToFollowPanel))