diff --git a/app/javascript/gabsocial/components/modal/block_account_modal.js b/app/javascript/gabsocial/components/modal/block_account_modal.js
index 73cbc978..ad73c1b2 100644
--- a/app/javascript/gabsocial/components/modal/block_account_modal.js
+++ b/app/javascript/gabsocial/components/modal/block_account_modal.js
@@ -6,38 +6,8 @@ import { makeGetAccount } from '../../selectors'
import { blockAccount } from '../../actions/accounts'
import ConfirmationModal from './confirmation_modal'
-const messages = defineMessages({
- title: { id: 'block_title', defaultMessage: 'Block {name}' },
- muteMessage: { id: 'confirmations.block.message', defaultMessage: 'Are you sure you want to block {name}?' },
- block: { id: 'confirmations.block.confirm', defaultMessage: 'Block' },
-})
-
-const mapStateToProps = (state, { accountId }) => {
- const getAccount = makeGetAccount()
-
- return {
- account: getAccount(state, accountId),
- }
-}
-
-const mapDispatchToProps = (dispatch) => ({
- onConfirm(account) {
- dispatch(blockAccount(account.get('id')))
- },
-})
-
-export default
-@connect(mapStateToProps, mapDispatchToProps)
-@injectIntl
class BlockAccountModal extends React.PureComponent {
- static propTypes = {
- account: PropTypes.object.isRequired,
- onConfirm: PropTypes.func.isRequired,
- onClose: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired,
- }
-
handleClick = () => {
this.props.onConfirm(this.props.account)
}
@@ -64,3 +34,28 @@ class BlockAccountModal extends React.PureComponent {
}
}
+
+const messages = defineMessages({
+ title: { id: 'block_title', defaultMessage: 'Block {name}' },
+ muteMessage: { id: 'confirmations.block.message', defaultMessage: 'Are you sure you want to block {name}?' },
+ block: { id: 'confirmations.block.confirm', defaultMessage: 'Block' },
+})
+
+const mapStateToProps = (state, { accountId }) => ({
+ account: makeGetAccount()(state, accountId),
+})
+
+const mapDispatchToProps = (dispatch) => ({
+ onConfirm(account) {
+ dispatch(blockAccount(account.get('id')))
+ },
+})
+
+BlockAccountModal.propTypes = {
+ account: PropTypes.object.isRequired,
+ onConfirm: PropTypes.func.isRequired,
+ onClose: PropTypes.func.isRequired,
+ intl: PropTypes.object.isRequired,
+}
+
+export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(BlockAccountModal))
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/boost_modal.js b/app/javascript/gabsocial/components/modal/boost_modal.js
index 7fba65f6..dfa2399e 100644
--- a/app/javascript/gabsocial/components/modal/boost_modal.js
+++ b/app/javascript/gabsocial/components/modal/boost_modal.js
@@ -8,27 +8,12 @@ import StatusContainer from '../../containers/status_container'
import Text from '../text'
import ModalLayout from './modal_layout'
-const messages = defineMessages({
- removeRepost: { id: 'status.cancel_repost_private', defaultMessage: 'Remove Repost' },
- repost: { id: 'status.repost', defaultMessage: 'Repost' },
- combo: { id: 'boost_modal.combo', defaultMessage: 'You can press Shift + Repost to skip this next time' },
-})
-
-export default
-@injectIntl
class BoostModal extends ImmutablePureComponent {
static contextTypes = {
router: PropTypes.object,
}
- static propTypes = {
- status: ImmutablePropTypes.map.isRequired,
- onRepost: PropTypes.func.isRequired,
- onClose: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired,
- }
-
componentDidMount() {
this.button.focus()
}
@@ -80,3 +65,18 @@ class BoostModal extends ImmutablePureComponent {
}
}
+
+const messages = defineMessages({
+ removeRepost: { id: 'status.cancel_repost_private', defaultMessage: 'Remove Repost' },
+ repost: { id: 'status.repost', defaultMessage: 'Repost' },
+ combo: { id: 'boost_modal.combo', defaultMessage: 'You can press Shift + Repost to skip this next time' },
+})
+
+BoostModal.propTypes = {
+ status: ImmutablePropTypes.map.isRequired,
+ onRepost: PropTypes.func.isRequired,
+ onClose: PropTypes.func.isRequired,
+ intl: PropTypes.object.isRequired,
+}
+
+export default injectIntl(BoostModal)
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/bundle_error_modal.js b/app/javascript/gabsocial/components/modal/bundle_error_modal.js
index fd2a245f..2abd4fc3 100644
--- a/app/javascript/gabsocial/components/modal/bundle_error_modal.js
+++ b/app/javascript/gabsocial/components/modal/bundle_error_modal.js
@@ -3,22 +3,8 @@ import PropTypes from 'prop-types'
import { defineMessages, injectIntl } from 'react-intl'
import ConfirmationModal from './confirmation_modal'
-const messages = defineMessages({
- error: { id: 'bundle_modal_error.message', defaultMessage: 'Something went wrong while loading this component.' },
- retry: { id: 'bundle_modal_error.retry', defaultMessage: 'Try again' },
- title: { id: 'bundle_modal_error.error', defaultMessage: 'Error' },
-})
-
-export default
-@injectIntl
class BundleErrorModal extends React.PureComponent {
- static propTypes = {
- onRetry: PropTypes.func.isRequired,
- onClose: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired,
- }
-
handleRetry = () => {
this.props.onRetry()
}
@@ -39,3 +25,16 @@ class BundleErrorModal extends React.PureComponent {
}
+const messages = defineMessages({
+ error: { id: 'bundle_modal_error.message', defaultMessage: 'Something went wrong while loading this component.' },
+ retry: { id: 'bundle_modal_error.retry', defaultMessage: 'Try again' },
+ title: { id: 'bundle_modal_error.error', defaultMessage: 'Error' },
+})
+
+BundleErrorModal.propTypes = {
+ onRetry: PropTypes.func.isRequired,
+ onClose: PropTypes.func.isRequired,
+ intl: PropTypes.object.isRequired,
+}
+
+export default injectIntl(BundleErrorModal)
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/community_timeline_settings_modal.js b/app/javascript/gabsocial/components/modal/community_timeline_settings_modal.js
index 525ebe69..507f6de5 100644
--- a/app/javascript/gabsocial/components/modal/community_timeline_settings_modal.js
+++ b/app/javascript/gabsocial/components/modal/community_timeline_settings_modal.js
@@ -10,39 +10,8 @@ import Button from '../button'
import SettingSwitch from '../setting_switch'
import Text from '../text'
-const messages = defineMessages({
- title: { id: 'community_timeline_settings', defaultMessage: 'Community Feed Settings' },
- saveAndClose: { id: 'saveClose', defaultMessage: 'Save & Close' },
- onlyMedia: { id: 'community.column_settings.media_only', defaultMessage: 'Media Only' },
-})
-
-const mapStateToProps = (state) => ({
- settings: state.getIn(['settings', 'community']),
-})
-
-const mapDispatchToProps = (dispatch, { onClose }) => ({
- onChange(key, checked) {
- dispatch(changeSetting(['community', ...key], checked))
- },
- onSave() {
- dispatch(saveSettings())
- onClose()
- },
-})
-
-export default
-@connect(mapStateToProps, mapDispatchToProps)
-@injectIntl
class CommunityTimelineSettingsModal extends ImmutablePureComponent {
- static propTypes = {
- intl: PropTypes.object.isRequired,
- settings: ImmutablePropTypes.map.isRequired,
- onChange: PropTypes.func.isRequired,
- onClose: PropTypes.func.isRequired,
- onSave: PropTypes.func.isRequired,
- }
-
handleSaveAndClose = () => {
this.props.onSave()
}
@@ -87,3 +56,33 @@ class CommunityTimelineSettingsModal extends ImmutablePureComponent {
)
}
}
+
+const messages = defineMessages({
+ title: { id: 'community_timeline_settings', defaultMessage: 'Community Feed Settings' },
+ saveAndClose: { id: 'saveClose', defaultMessage: 'Save & Close' },
+ onlyMedia: { id: 'community.column_settings.media_only', defaultMessage: 'Media Only' },
+})
+
+const mapStateToProps = (state) => ({
+ settings: state.getIn(['settings', 'community']),
+})
+
+const mapDispatchToProps = (dispatch, { onClose }) => ({
+ onChange(key, checked) {
+ dispatch(changeSetting(['community', ...key], checked))
+ },
+ onSave() {
+ dispatch(saveSettings())
+ onClose()
+ },
+})
+
+CommunityTimelineSettingsModal.propTypes = {
+ intl: PropTypes.object.isRequired,
+ settings: ImmutablePropTypes.map.isRequired,
+ onChange: PropTypes.func.isRequired,
+ onClose: PropTypes.func.isRequired,
+ onSave: PropTypes.func.isRequired,
+}
+
+export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(CommunityTimelineSettingsModal))
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/compose_modal.js b/app/javascript/gabsocial/components/modal/compose_modal.js
index 2c4d051f..b6c5e845 100644
--- a/app/javascript/gabsocial/components/modal/compose_modal.js
+++ b/app/javascript/gabsocial/components/modal/compose_modal.js
@@ -8,37 +8,8 @@ import { cancelReplyCompose } from '../../actions/compose'
import ModalLayout from './modal_layout'
import TimelineComposeBlock from '../timeline_compose_block'
-const messages = defineMessages({
- confirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' },
- title: { id: 'navigation_bar.compose', defaultMessage: 'Compose new gab' },
- comment: { id: 'navigation_bar.compose_comment', defaultMessage: 'Compose new comment' },
- edit: { id: 'navigation_bar.edit_gab', defaultMessage: 'Edit' },
-})
-
-const mapStateToProps = (state) => {
- const status = state.getIn(['statuses', state.getIn(['compose', 'id'])])
-
- return {
- composeText: state.getIn(['compose', 'text']),
- isEditing: !!status,
- isComment: !!state.getIn(['compose', 'in_reply_to']),
- }
-}
-
-export default
-@connect(mapStateToProps)
-@injectIntl
class ComposeModal extends ImmutablePureComponent {
- static propTypes = {
- intl: PropTypes.object.isRequired,
- onClose: PropTypes.func.isRequired,
- composeText: PropTypes.string,
- dispatch: PropTypes.func.isRequired,
- isEditing: PropTypes.bool,
- isComment: PropTypes.bool,
- }
-
onClickClose = () => {
const {
composeText,
@@ -81,3 +52,31 @@ class ComposeModal extends ImmutablePureComponent {
)
}
}
+
+const messages = defineMessages({
+ confirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' },
+ title: { id: 'navigation_bar.compose', defaultMessage: 'Compose new gab' },
+ comment: { id: 'navigation_bar.compose_comment', defaultMessage: 'Compose new comment' },
+ edit: { id: 'navigation_bar.edit_gab', defaultMessage: 'Edit' },
+})
+
+const mapStateToProps = (state) => {
+ const status = state.getIn(['statuses', state.getIn(['compose', 'id'])])
+
+ return {
+ composeText: state.getIn(['compose', 'text']),
+ isEditing: !!status,
+ isComment: !!state.getIn(['compose', 'in_reply_to']),
+ }
+}
+
+ComposeModal.propTypes = {
+ intl: PropTypes.object.isRequired,
+ onClose: PropTypes.func.isRequired,
+ composeText: PropTypes.string,
+ dispatch: PropTypes.func.isRequired,
+ isEditing: PropTypes.bool,
+ isComment: PropTypes.bool,
+}
+
+export default injectIntl(connect(mapStateToProps)(ComposeModal))
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/confirmation_modal.js b/app/javascript/gabsocial/components/modal/confirmation_modal.js
index 85703fb7..d20253b1 100644
--- a/app/javascript/gabsocial/components/modal/confirmation_modal.js
+++ b/app/javascript/gabsocial/components/modal/confirmation_modal.js
@@ -6,20 +6,8 @@ import Button from '../button'
import Heading from '../heading'
import Text from '../text'
-export default
-@injectIntl
class ConfirmationModal extends React.PureComponent {
- static propTypes = {
- title: PropTypes.any.isRequired,
- message: PropTypes.any.isRequired,
- confirm: PropTypes.any.isRequired,
- onClose: PropTypes.func.isRequired,
- onConfirm: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired,
- onCancel: PropTypes.func,
- }
-
componentDidMount() {
this.button.focus()
}
@@ -96,3 +84,15 @@ class ConfirmationModal extends React.PureComponent {
}
}
+
+ConfirmationModal.propTypes = {
+ title: PropTypes.any.isRequired,
+ message: PropTypes.any.isRequired,
+ confirm: PropTypes.any.isRequired,
+ onClose: PropTypes.func.isRequired,
+ onConfirm: PropTypes.func.isRequired,
+ intl: PropTypes.object.isRequired,
+ onCancel: PropTypes.func,
+}
+
+export default injectIntl(ConfirmationModal)
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/display_options_modal.js b/app/javascript/gabsocial/components/modal/display_options_modal.js
index 0cf11a80..c9e53d90 100644
--- a/app/javascript/gabsocial/components/modal/display_options_modal.js
+++ b/app/javascript/gabsocial/components/modal/display_options_modal.js
@@ -15,39 +15,8 @@ import Button from '../button'
import Text from '../text'
import SettingSwitch from '../setting_switch'
-const messages = defineMessages({
- message: { id: 'display_options.message', defaultMessage: 'Display settings affect your Gab account on this browser. These settings are only visible to you.' },
- title: { id: 'display_options', defaultMessage: 'Customize your view' },
-})
-
-const mapStateToProps = (state) => ({
- displayOptionsSettings: state.getIn(['settings', 'displayOptions']),
- fontSize: state.getIn(['settings', 'displayOptions', 'fontSize'], DEFAULT_FONT_SIZE),
- theme: state.getIn(['settings', 'displayOptions', 'theme'], DEFAULT_THEME),
-})
-
-const mapDispatchToProps = (dispatch) => ({
- onChange(key, value) {
- dispatch(changeSetting(['displayOptions', key], value))
- dispatch(saveSettings())
- },
-})
-
-export default
-@connect(mapStateToProps, mapDispatchToProps)
-@injectIntl
class DisplayOptionsModal extends ImmutablePureComponent {
- static propTypes = {
- fontSize: PropTypes.string,
- intl: PropTypes.object.isRequired,
- onClose: PropTypes.func.isRequired,
- displayOptionsSettings: ImmutablePropTypes.map,
- theme: PropTypes.string,
- onChange: PropTypes.func.isRequired,
- onClose: PropTypes.func.isRequired,
- }
-
handleOnFontSizeChange = (e) => {
const fontSizeNames = Object.keys(FONT_SIZES)
const index = fontSizeNames[e.target.value]
@@ -244,4 +213,34 @@ class ThemeBlock extends React.PureComponent {
)
}
-}
\ No newline at end of file
+}
+
+const messages = defineMessages({
+ message: { id: 'display_options.message', defaultMessage: 'Display settings affect your Gab account on this browser. These settings are only visible to you.' },
+ title: { id: 'display_options', defaultMessage: 'Customize your view' },
+})
+
+const mapStateToProps = (state) => ({
+ displayOptionsSettings: state.getIn(['settings', 'displayOptions']),
+ fontSize: state.getIn(['settings', 'displayOptions', 'fontSize'], DEFAULT_FONT_SIZE),
+ theme: state.getIn(['settings', 'displayOptions', 'theme'], DEFAULT_THEME),
+})
+
+const mapDispatchToProps = (dispatch) => ({
+ onChange(key, value) {
+ dispatch(changeSetting(['displayOptions', key], value))
+ dispatch(saveSettings())
+ },
+})
+
+DisplayOptionsModal.propTypes = {
+ fontSize: PropTypes.string,
+ intl: PropTypes.object.isRequired,
+ onClose: PropTypes.func.isRequired,
+ displayOptionsSettings: ImmutablePropTypes.map,
+ theme: PropTypes.string,
+ onChange: PropTypes.func.isRequired,
+ onClose: PropTypes.func.isRequired,
+}
+
+export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(DisplayOptionsModal))
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/edit_profile_modal.js b/app/javascript/gabsocial/components/modal/edit_profile_modal.js
index cc4018fd..553ee672 100644
--- a/app/javascript/gabsocial/components/modal/edit_profile_modal.js
+++ b/app/javascript/gabsocial/components/modal/edit_profile_modal.js
@@ -15,33 +15,8 @@ import Switch from '../switch'
import Heading from '../heading'
import Textarea from '../textarea'
-const messages = defineMessages({
- edit_profile: { id: 'account.edit_profile', defaultMessage: 'Edit profile' },
- headerPhoto: { id: 'header_photo', defaultMessage: 'Header photo' },
- close: { id: 'lightbox.close', defaultMessage: 'Close' },
- save: { id: 'lightbox.save', defaultMessage: 'Save' },
-})
-
-const mapStateToProps = (state) => ({
- account: state.getIn(['accounts', me]),
-})
-
-const mapDispatchToProps = (dispatch) => ({
- onSave: (data) => dispatch(saveUserProfileInformation(data)),
-})
-
-export default
-@injectIntl
-@connect(mapStateToProps, mapDispatchToProps)
class EditProfileModal extends ImmutablePureComponent {
- static propTypes = {
- account: ImmutablePropTypes.map,
- intl: PropTypes.object.isRequired,
- onClose: PropTypes.func.isRequired,
- onSave: PropTypes.func.isRequired,
- }
-
state = {
avatarSrc: this.props.account ? this.props.account.get('avatar_static') : undefined,
bioValue: this.props.account ? this.props.account.get('note_plain') : '',
@@ -222,3 +197,27 @@ class EditProfileModal extends ImmutablePureComponent {
)
}
}
+
+const messages = defineMessages({
+ edit_profile: { id: 'account.edit_profile', defaultMessage: 'Edit profile' },
+ headerPhoto: { id: 'header_photo', defaultMessage: 'Header photo' },
+ close: { id: 'lightbox.close', defaultMessage: 'Close' },
+ save: { id: 'lightbox.save', defaultMessage: 'Save' },
+})
+
+const mapStateToProps = (state) => ({
+ account: state.getIn(['accounts', me]),
+})
+
+const mapDispatchToProps = (dispatch) => ({
+ onSave: (data) => dispatch(saveUserProfileInformation(data)),
+})
+
+EditProfileModal.propTypes = {
+ account: ImmutablePropTypes.map,
+ intl: PropTypes.object.isRequired,
+ onClose: PropTypes.func.isRequired,
+ onSave: PropTypes.func.isRequired,
+}
+
+export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(EditProfileModal))
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/edit_shortcuts_modal.js b/app/javascript/gabsocial/components/modal/edit_shortcuts_modal.js
index 9b952002..f7dc8fc9 100644
--- a/app/javascript/gabsocial/components/modal/edit_shortcuts_modal.js
+++ b/app/javascript/gabsocial/components/modal/edit_shortcuts_modal.js
@@ -8,33 +8,8 @@ import { removeShortcut } from '../../actions/shortcuts'
import ModalLayout from './modal_layout'
import List from '../list'
-const messages = defineMessages({
- title: { id: 'shortcuts.edit', defaultMessage: 'Edit Shortcuts' },
- close: { id: 'lightbox.close', defaultMessage: 'Close' },
-})
-
-const mapStateToProps = (state) => ({
- shortcuts: state.getIn(['shortcuts', 'items']),
-})
-
-const mapDispatchToProps = (dispatch) => ({
- onRemoveShortcut(shortcutId) {
- dispatch(removeShortcut(shortcutId))
- },
-})
-
-export default
-@injectIntl
-@connect(mapStateToProps, mapDispatchToProps)
class EditShortcutsModal extends ImmutablePureComponent {
- static propTypes = {
- intl: PropTypes.object.isRequired,
- onClose: PropTypes.func.isRequired,
- onRemoveShortcut: PropTypes.func.isRequired,
- shortcuts: ImmutablePropTypes.list,
- }
-
handleOnRemoveShortcut = (shortcutId) => {
this.props.onRemoveShortcut(shortcutId)
}
@@ -72,3 +47,28 @@ class EditShortcutsModal extends ImmutablePureComponent {
}
}
+
+
+const messages = defineMessages({
+ title: { id: 'shortcuts.edit', defaultMessage: 'Edit Shortcuts' },
+ close: { id: 'lightbox.close', defaultMessage: 'Close' },
+})
+
+const mapStateToProps = (state) => ({
+ shortcuts: state.getIn(['shortcuts', 'items']),
+})
+
+const mapDispatchToProps = (dispatch) => ({
+ onRemoveShortcut(shortcutId) {
+ dispatch(removeShortcut(shortcutId))
+ },
+})
+
+EditShortcutsModal.propTypes = {
+ intl: PropTypes.object.isRequired,
+ onClose: PropTypes.func.isRequired,
+ onRemoveShortcut: PropTypes.func.isRequired,
+ shortcuts: ImmutablePropTypes.list,
+}
+
+export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(EditShortcutsModal))
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/embed_modal.js b/app/javascript/gabsocial/components/modal/embed_modal.js
index 937f4cc1..a2bfe390 100644
--- a/app/javascript/gabsocial/components/modal/embed_modal.js
+++ b/app/javascript/gabsocial/components/modal/embed_modal.js
@@ -9,23 +9,8 @@ import Icon from '../icon'
import Input from '../input'
import Text from '../text'
-const messages = defineMessages({
- embed: { id: 'status.embed', defaultMessage: 'Embed' },
- instructions: { id: 'embed.instructions', defaultMessage: 'Embed this status on your website by copying the code below.' },
- preview: { id: 'embed.preview', defaultMessage: 'Here is what it will look like:' },
-})
-
-export default
-@injectIntl
class EmbedModal extends ImmutablePureComponent {
- static propTypes = {
- url: PropTypes.string.isRequired,
- onClose: PropTypes.func.isRequired,
- onError: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired,
- }
-
state = {
loading: false,
oembed: null,
@@ -111,3 +96,18 @@ class EmbedModal extends ImmutablePureComponent {
}
}
+
+const messages = defineMessages({
+ embed: { id: 'status.embed', defaultMessage: 'Embed' },
+ instructions: { id: 'embed.instructions', defaultMessage: 'Embed this status on your website by copying the code below.' },
+ preview: { id: 'embed.preview', defaultMessage: 'Here is what it will look like:' },
+})
+
+EmbedModal.propTypes = {
+ url: PropTypes.string.isRequired,
+ onClose: PropTypes.func.isRequired,
+ onError: PropTypes.func.isRequired,
+ intl: PropTypes.object.isRequired,
+}
+
+export default injectIntl(EmbedModal)
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/feature_modal.js b/app/javascript/gabsocial/components/modal/feature_modal.js
deleted file mode 100644
index 407218a1..00000000
--- a/app/javascript/gabsocial/components/modal/feature_modal.js
+++ /dev/null
@@ -1,75 +0,0 @@
-import React from 'react'
-import PropTypes from 'prop-types'
-import ImmutablePropTypes from 'react-immutable-proptypes';
-import ImmutablePureComponent from 'react-immutable-pure-component';
-import { FormattedMessage } from 'react-intl';
-import Video from '../../features/video';
-
-export const previewState = 'previewVideoModal';
-
-export default class FeatureModal extends ImmutablePureComponent {
-
- static propTypes = {
- media: ImmutablePropTypes.map.isRequired,
- status: ImmutablePropTypes.map,
- time: PropTypes.number,
- onClose: PropTypes.func.isRequired,
- };
-
- static contextTypes = {
- router: PropTypes.object,
- };
-
- componentDidMount () {
- if (this.context.router) {
- const history = this.context.router.history;
-
- history.push(history.location.pathname, previewState);
-
- this.unlistenHistory = history.listen(() => {
- this.props.onClose();
- });
- }
- }
-
- componentWillUnmount () {
- if (this.context.router) {
- this.unlistenHistory();
-
- if (this.context.router.history.location.state === previewState) {
- this.context.router.history.goBack();
- }
- }
- }
-
- handleStatusClick = e => {
- if (e.button === 0 && !(e.ctrlKey || e.metaKey)) {
- e.preventDefault();
- this.context.router.history.push(`/${this.props.status.getIn(['account', 'acct'])}/posts/${this.props.status.get('id')}`);
- }
- }
-
- render () {
- const { media, status, time, onClose } = this.props;
-
- const link = status && ;
-
- return (
-
- );
- }
-
-}
diff --git a/app/javascript/gabsocial/components/modal/gif_picker_modal.js b/app/javascript/gabsocial/components/modal/gif_picker_modal.js
index 71b5e9d7..18610abe 100644
--- a/app/javascript/gabsocial/components/modal/gif_picker_modal.js
+++ b/app/javascript/gabsocial/components/modal/gif_picker_modal.js
@@ -16,72 +16,8 @@ import Image from '../image'
import Input from '../input'
import Text from '../text'
-const messages = defineMessages({
- close: { id: 'lightbox.close', defaultMessage: 'Close' },
- title: { id: 'pick_gif', defaultMessage: 'Select a GIF' },
- searchGifs: { id: 'search_gifs', defaultMessage: 'Search for GIFs' },
-})
-
-const mapStateToProps = (state) => ({
- categories: state.getIn(['tenor', 'categories']),
- suggestions: state.getIn(['tenor', 'suggestions']),
- results: state.getIn(['tenor', 'results']),
- loading: state.getIn(['tenor', 'loading']),
- error: state.getIn(['tenor', 'error']),
- searchText: state.getIn(['tenor', 'searchText']),
-})
-
-const mapDispatchToProps = (dispatch, { onClose }) => ({
-
- handleCloseModal() {
- dispatch(changeGifSearchText(''))
- dispatch(clearGifResults())
- onClose()
- },
-
- handleFetchCategories: () => {
- dispatch(fetchGifCategories())
- },
-
- handleOnChange: (value) => {
- dispatch(changeGifSearchText(value))
- if (value.length >= 3) {
- dispatch(fetchGifResults())
- } else if (value.length === 0) {
- dispatch(clearGifResults())
- }
- },
-
- handleSelectResult: (result) => {
- dispatch(setSelectedGif(result))
- onClose()
- },
-
- // dispatchSubmit: (e) => {
- // e.preventDefault();
- // dispatch(getGifs());
- // },
-
-})
-
-export default
-@connect(mapStateToProps, mapDispatchToProps)
-@injectIntl
class GifPickerModal extends React.PureComponent {
- static propTypes = {
- intl: PropTypes.object.isRequired,
- handleCloseModal: PropTypes.func.isRequired,
- handleFetchCategories: PropTypes.func.isRequired,
- handleOnChange: PropTypes.func.isRequired,
- handleSelectResult: PropTypes.func.isRequired,
- categories: PropTypes.array.isRequired,
- results: PropTypes.array.isRequired,
- loading: PropTypes.bool,
- error: PropTypes.bool,
- searchText: PropTypes.string,
- }
-
state = {
row: 0,
}
@@ -277,4 +213,67 @@ class GifCategoriesCollection extends React.PureComponent {
)
}
-}
\ No newline at end of file
+}
+
+const messages = defineMessages({
+ close: { id: 'lightbox.close', defaultMessage: 'Close' },
+ title: { id: 'pick_gif', defaultMessage: 'Select a GIF' },
+ searchGifs: { id: 'search_gifs', defaultMessage: 'Search for GIFs' },
+})
+
+const mapStateToProps = (state) => ({
+ categories: state.getIn(['tenor', 'categories']),
+ suggestions: state.getIn(['tenor', 'suggestions']),
+ results: state.getIn(['tenor', 'results']),
+ loading: state.getIn(['tenor', 'loading']),
+ error: state.getIn(['tenor', 'error']),
+ searchText: state.getIn(['tenor', 'searchText']),
+})
+
+const mapDispatchToProps = (dispatch, { onClose }) => ({
+
+ handleCloseModal() {
+ dispatch(changeGifSearchText(''))
+ dispatch(clearGifResults())
+ onClose()
+ },
+
+ handleFetchCategories: () => {
+ dispatch(fetchGifCategories())
+ },
+
+ handleOnChange: (value) => {
+ dispatch(changeGifSearchText(value))
+ if (value.length >= 3) {
+ dispatch(fetchGifResults())
+ } else if (value.length === 0) {
+ dispatch(clearGifResults())
+ }
+ },
+
+ handleSelectResult: (result) => {
+ dispatch(setSelectedGif(result))
+ onClose()
+ },
+
+ // dispatchSubmit: (e) => {
+ // e.preventDefault();
+ // dispatch(getGifs());
+ // },
+
+})
+
+GifPickerModal.propTypes = {
+ intl: PropTypes.object.isRequired,
+ handleCloseModal: PropTypes.func.isRequired,
+ handleFetchCategories: PropTypes.func.isRequired,
+ handleOnChange: PropTypes.func.isRequired,
+ handleSelectResult: PropTypes.func.isRequired,
+ categories: PropTypes.array.isRequired,
+ results: PropTypes.array.isRequired,
+ loading: PropTypes.bool,
+ error: PropTypes.bool,
+ searchText: PropTypes.string,
+}
+
+export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(GifPickerModal))
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/group_create_modal.js b/app/javascript/gabsocial/components/modal/group_create_modal.js
index c9bcbc87..bf8743d7 100644
--- a/app/javascript/gabsocial/components/modal/group_create_modal.js
+++ b/app/javascript/gabsocial/components/modal/group_create_modal.js
@@ -5,21 +5,8 @@ import ModalLayout from './modal_layout'
import { GroupCreate } from '../../features/ui/util/async_components'
import WrappedBundle from '../../features/ui/util/wrapped_bundle'
-const messages = defineMessages({
- title: { id: 'create_group', defaultMessage: 'Create group' },
- update: { id: 'groups.form.update', defaultMessage: 'Update group' },
-})
-
-export default
-@injectIntl
class GroupCreateModal extends React.PureComponent {
- static propTypes = {
- intl: PropTypes.object.isRequired,
- onClose: PropTypes.func.isRequired,
- groupId: PropTypes.string,
- }
-
render() {
const { intl, onClose, groupId } = this.props
@@ -35,4 +22,18 @@ class GroupCreateModal extends React.PureComponent {
)
}
+
}
+
+const messages = defineMessages({
+ title: { id: 'create_group', defaultMessage: 'Create group' },
+ update: { id: 'groups.form.update', defaultMessage: 'Update group' },
+})
+
+GroupCreateModal.propTypes = {
+ intl: PropTypes.object.isRequired,
+ onClose: PropTypes.func.isRequired,
+ groupId: PropTypes.string,
+}
+
+export default injectIntl(GroupCreateModal)
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/group_delete_modal.js b/app/javascript/gabsocial/components/modal/group_delete_modal.js
index 6a9caa0d..9fd71ab3 100644
--- a/app/javascript/gabsocial/components/modal/group_delete_modal.js
+++ b/app/javascript/gabsocial/components/modal/group_delete_modal.js
@@ -6,30 +6,8 @@ import { makeGetAccount } from '../../selectors'
import { blockAccount } from '../../actions/accounts'
import ConfirmationModal from './confirmation_modal'
-const messages = defineMessages({
- title: { id: 'group_delete_title', defaultMessage: 'Delete "{group}"' },
- groupMessage: { id: 'confirmations.group_delete.message', defaultMessage: 'Are you sure you want to delete "{group}"?' },
- delete: { id: 'delete', defaultMessage: 'Delete' },
-})
-
-const mapDispatchToProps = (dispatch) => ({
- onConfirm(account) {
- // dispatch(blockAccount(account.get('id')))
- },
-})
-
-export default
-@connect(null, mapDispatchToProps)
-@injectIntl
class GroupDeleteModal extends React.PureComponent {
- static propTypes = {
- group: PropTypes.object.isRequired,
- onConfirm: PropTypes.func.isRequired,
- onClose: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired,
- }
-
handleClick = () => {
this.props.onConfirm(this.props.account)
}
@@ -56,3 +34,24 @@ class GroupDeleteModal extends React.PureComponent {
}
}
+
+const messages = defineMessages({
+ title: { id: 'group_delete_title', defaultMessage: 'Delete "{group}"' },
+ groupMessage: { id: 'confirmations.group_delete.message', defaultMessage: 'Are you sure you want to delete "{group}"?' },
+ delete: { id: 'delete', defaultMessage: 'Delete' },
+})
+
+const mapDispatchToProps = (dispatch) => ({
+ onConfirm(account) {
+ // dispatch(blockAccount(account.get('id')))
+ },
+})
+
+GroupDeleteModal.propTypes = {
+ group: PropTypes.object.isRequired,
+ onConfirm: PropTypes.func.isRequired,
+ onClose: PropTypes.func.isRequired,
+ intl: PropTypes.object.isRequired,
+}
+
+export default injectIntl(connect(null, mapDispatchToProps)(GroupDeleteModal))
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/group_timeline_settings_modal.js b/app/javascript/gabsocial/components/modal/group_timeline_settings_modal.js
index 487071d2..2315636e 100644
--- a/app/javascript/gabsocial/components/modal/group_timeline_settings_modal.js
+++ b/app/javascript/gabsocial/components/modal/group_timeline_settings_modal.js
@@ -6,20 +6,8 @@ import Button from '../button'
import Text from '../text'
import ModalLayout from './modal_layout'
-const messages = defineMessages({
- title: { id: 'promo.gab_pro', defaultMessage: 'Upgrade to GabPRO' },
- text: { id: 'pro_upgrade_modal.text', defaultMessage: 'Gab is fully funded by people like you. Please consider supporting us on our mission to defend free expression online for all people.' },
- benefits: { id: 'pro_upgrade_modal.benefits', defaultMessage: 'Here are just some of the benefits that thousands of GabPRO members receive:' },
-})
-
-export default
-@injectIntl
class HomeTimelineSettingsModal extends ImmutablePureComponent {
- static propTypes = {
- intl: PropTypes.object.isRequired,
- }
-
render() {
const { intl } = this.props
@@ -58,3 +46,15 @@ class HomeTimelineSettingsModal extends ImmutablePureComponent {
)
}
}
+
+const messages = defineMessages({
+ title: { id: 'promo.gab_pro', defaultMessage: 'Upgrade to GabPRO' },
+ text: { id: 'pro_upgrade_modal.text', defaultMessage: 'Gab is fully funded by people like you. Please consider supporting us on our mission to defend free expression online for all people.' },
+ benefits: { id: 'pro_upgrade_modal.benefits', defaultMessage: 'Here are just some of the benefits that thousands of GabPRO members receive:' },
+})
+
+HomeTimelineSettingsModal.propTypes = {
+ intl: PropTypes.object.isRequired,
+}
+
+export default injectIntl(HomeTimelineSettingsModal)
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/hashtag_timeline_settings_modal.js b/app/javascript/gabsocial/components/modal/hashtag_timeline_settings_modal.js
index 6f45051a..f121e73b 100644
--- a/app/javascript/gabsocial/components/modal/hashtag_timeline_settings_modal.js
+++ b/app/javascript/gabsocial/components/modal/hashtag_timeline_settings_modal.js
@@ -10,42 +10,8 @@ import Button from '../button'
import SettingSwitch from '../setting_switch'
import Text from '../text'
-const messages = defineMessages({
- title: { id: 'hashtag_timeline_settings', defaultMessage: 'Hashtag Timeline Settings' },
- saveAndClose: { id: 'saveClose', defaultMessage: 'Save & Close' },
- onlyMedia: { id: 'community.column_settings.media_only', defaultMessage: 'Media Only' },
- showInSidebar: { id: 'show_in_sidebar', defaultMessage: 'Show in Sidebar' },
-})
-
-const mapStateToProps = (state) => ({
- settings: state.getIn(['settings', 'community']),
-})
-
-const mapDispatchToProps = (dispatch, { onClose }) => {
- return {
- onChange(key, checked) {
- dispatch(changeSetting(['community', ...key], checked))
- },
- onSave() {
- dispatch(saveSettings())
- onClose()
- },
- }
-}
-
-export default
-@connect(mapStateToProps, mapDispatchToProps)
-@injectIntl
class HashtagTimelineSettingsModal extends ImmutablePureComponent {
- static propTypes = {
- intl: PropTypes.object.isRequired,
- settings: ImmutablePropTypes.map.isRequired,
- onChange: PropTypes.func.isRequired,
- onSave: PropTypes.func.isRequired,
- onClose: PropTypes.func.isRequired,
- }
-
handleSaveAndClose = () => {
this.props.onSave()
}
@@ -87,3 +53,36 @@ class HashtagTimelineSettingsModal extends ImmutablePureComponent {
)
}
}
+
+const messages = defineMessages({
+ title: { id: 'hashtag_timeline_settings', defaultMessage: 'Hashtag Timeline Settings' },
+ saveAndClose: { id: 'saveClose', defaultMessage: 'Save & Close' },
+ onlyMedia: { id: 'community.column_settings.media_only', defaultMessage: 'Media Only' },
+ showInSidebar: { id: 'show_in_sidebar', defaultMessage: 'Show in Sidebar' },
+})
+
+const mapStateToProps = (state) => ({
+ settings: state.getIn(['settings', 'community']),
+})
+
+const mapDispatchToProps = (dispatch, { onClose }) => {
+ return {
+ onChange(key, checked) {
+ dispatch(changeSetting(['community', ...key], checked))
+ },
+ onSave() {
+ dispatch(saveSettings())
+ onClose()
+ },
+ }
+}
+
+HasttagTimelineSettingsModal.propTypes = {
+ intl: PropTypes.object.isRequired,
+ settings: ImmutablePropTypes.map.isRequired,
+ onChange: PropTypes.func.isRequired,
+ onSave: PropTypes.func.isRequired,
+ onClose: PropTypes.func.isRequired,
+}
+
+export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(HashtagTimelineSettingsModal))
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/home_timeline_settings_modal.js b/app/javascript/gabsocial/components/modal/home_timeline_settings_modal.js
index 1497a208..f0d65e63 100644
--- a/app/javascript/gabsocial/components/modal/home_timeline_settings_modal.js
+++ b/app/javascript/gabsocial/components/modal/home_timeline_settings_modal.js
@@ -10,45 +10,8 @@ import Button from '../button'
import SettingSwitch from '../setting_switch'
import Text from '../text'
-const messages = defineMessages({
- title: { id: 'home_timeline_settings', defaultMessage: 'Home Timeline Settings' },
- saveAndClose: { id: 'saveClose', defaultMessage: 'Save & Close' },
- showVideos: { id: 'home.column_settings.show_videos', defaultMessage: 'Show videos' },
- showPhotos: { id: 'home.column_settings.show_photos', defaultMessage: 'Show photos' },
- showPolls: { id: 'home.column_settings.show_polls', defaultMessage: 'Show polls' },
- showReposts: { id: 'home.column_settings.show_reposts', defaultMessage: 'Show comments' },
- showReplies: { id: 'home.column_settings.show_replies', defaultMessage: 'Show replies' },
-})
-
-const mapStateToProps = (state) => ({
- settings: state.getIn(['settings', 'home']),
-})
-
-const mapDispatchToProps = (dispatch, {onClose}) => {
- return {
- onChange(key, checked) {
- dispatch(changeSetting(['home', ...key], checked))
- },
- onSave() {
- dispatch(saveSettings())
- onClose()
- },
- }
-}
-
-export default
-@connect(mapStateToProps, mapDispatchToProps)
-@injectIntl
class HomeTimelineSettingsModal extends ImmutablePureComponent {
- static propTypes = {
- intl: PropTypes.object.isRequired,
- settings: ImmutablePropTypes.map.isRequired,
- onChange: PropTypes.func.isRequired,
- onClose: PropTypes.func.isRequired,
- onSave: PropTypes.func.isRequired,
- }
-
handleSaveAndClose = () => {
this.props.onSave()
}
@@ -124,3 +87,39 @@ class HomeTimelineSettingsModal extends ImmutablePureComponent {
)
}
}
+
+const messages = defineMessages({
+ title: { id: 'home_timeline_settings', defaultMessage: 'Home Timeline Settings' },
+ saveAndClose: { id: 'saveClose', defaultMessage: 'Save & Close' },
+ showVideos: { id: 'home.column_settings.show_videos', defaultMessage: 'Show videos' },
+ showPhotos: { id: 'home.column_settings.show_photos', defaultMessage: 'Show photos' },
+ showPolls: { id: 'home.column_settings.show_polls', defaultMessage: 'Show polls' },
+ showReposts: { id: 'home.column_settings.show_reposts', defaultMessage: 'Show comments' },
+ showReplies: { id: 'home.column_settings.show_replies', defaultMessage: 'Show replies' },
+})
+
+const mapStateToProps = (state) => ({
+ settings: state.getIn(['settings', 'home']),
+})
+
+const mapDispatchToProps = (dispatch, {onClose}) => {
+ return {
+ onChange(key, checked) {
+ dispatch(changeSetting(['home', ...key], checked))
+ },
+ onSave() {
+ dispatch(saveSettings())
+ onClose()
+ },
+ }
+}
+
+HomeTimelineSettingsModal.propTypes = {
+ intl: PropTypes.object.isRequired,
+ settings: ImmutablePropTypes.map.isRequired,
+ onChange: PropTypes.func.isRequired,
+ onClose: PropTypes.func.isRequired,
+ onSave: PropTypes.func.isRequired,
+}
+
+export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(HomeTimelineSettingsModal))
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/hotkeys_modal.js b/app/javascript/gabsocial/components/modal/hotkeys_modal.js
index 47cc264b..5c51794d 100644
--- a/app/javascript/gabsocial/components/modal/hotkeys_modal.js
+++ b/app/javascript/gabsocial/components/modal/hotkeys_modal.js
@@ -6,47 +6,8 @@ import ModalLayout from './modal_layout'
import Text from '../text'
import Heading from '../heading'
-const messages = defineMessages({
- heading: { id: 'keyboard_shortcuts.heading', defaultMessage: 'Keyboard Shortcuts' },
- close: { id: 'lightbox.close', defaultMessage: 'Close' },
- hotkey: { id: 'keyboard_shortcuts.hotkey', defaultMessage: 'Hotkey' },
- reply: { id: 'keyboard_shortcuts.reply', defaultMessage: 'reply' },
- mention: { id: 'keyboard_shortcuts.mention', defaultMessage: 'mention author' },
- profile: { id: 'keyboard_shortcuts.profile', defaultMessage: 'open author\'s profile' },
- favorite: { id: 'keyboard_shortcuts.favorite', defaultMessage: 'favorite' },
- boost: { id: 'keyboard_shortcuts.boost', defaultMessage: 'repost' },
- enter: { id: 'keyboard_shortcuts.enter', defaultMessage: 'open status' },
- toggle_hidden: { id: 'keyboard_shortcuts.toggle_hidden', defaultMessage: 'show/hide text behind CW' },
- toggle_sensitivity: { id: 'keyboard_shortcuts.toggle_sensitivity', defaultMessage: 'show/hide media' },
- up: { id: 'keyboard_shortcuts.up', defaultMessage: 'move up in the list' },
- down: { id: 'keyboard_shortcuts.down', defaultMessage: 'move down in the list' },
- column: { id: 'keyboard_shortcuts.column', defaultMessage: 'focus a status in one of the columns' },
- compose: { id: 'keyboard_shortcuts.compose', defaultMessage: 'focus the compose textarea' },
- gab: { id: 'keyboard_shortcuts.toot', defaultMessage: 'start a brand new gab' },
- back: { id: 'keyboard_shortcuts.back', defaultMessage: 'navigate back' },
- search: { id: 'keyboard_shortcuts.search', defaultMessage: 'focus search' },
- unfocus: { id: 'keyboard_shortcuts.unfocus', defaultMessage: 'un-focus compose textarea/search' },
- home: { id: 'keyboard_shortcuts.home', defaultMessage: 'open home timeline' },
- notifications: { id: 'keyboard_shortcuts.notifications', defaultMessage: 'open notifications column' },
- start: { id: 'keyboard_shortcuts.start', defaultMessage: 'open "get started" column' },
- favorites: { id: 'keyboard_shortcuts.favorites', defaultMessage: 'open favorites list' },
- pinned: { id: 'keyboard_shortcuts.pinned', defaultMessage: 'open pinned gabs list' },
- my_profile: { id: 'keyboard_shortcuts.my_profile', defaultMessage: 'open your profile' },
- blocked: { id: 'keyboard_shortcuts.blocked', defaultMessage: 'open blocked users list' },
- muted: { id: 'keyboard_shortcuts.muted', defaultMessage: 'open muted users list' },
- requests: { id: 'keyboard_shortcuts.requests', defaultMessage: 'open follow requests list' },
- legend: { id: 'keyboard_shortcuts.legend', defaultMessage: 'display this legend' },
-})
-
-export default
-@injectIntl
class HotkeysModal extends ImmutablePureComponent {
- static propTypes = {
- intl: PropTypes.object.isRequired,
- onClose: PropTypes.func.isRequired,
- }
-
render() {
const { intl, onClose } = this.props
@@ -129,10 +90,6 @@ class HotkeysModal extends ImmutablePureComponent {
}
class HotKeysModalRow extends React.PureComponent {
- static propTypes = {
- hotkey: PropTypes.string.isRequired,
- action: PropTypes.string.isRequired,
- }
render() {
const { hotkey, action } = this.props
@@ -154,4 +111,48 @@ class HotKeysModalRow extends React.PureComponent {
)
}
-}
\ No newline at end of file
+}
+
+HotKeysModalRow.propTypes = {
+ hotkey: PropTypes.string.isRequired,
+ action: PropTypes.string.isRequired,
+}
+
+const messages = defineMessages({
+ heading: { id: 'keyboard_shortcuts.heading', defaultMessage: 'Keyboard Shortcuts' },
+ close: { id: 'lightbox.close', defaultMessage: 'Close' },
+ hotkey: { id: 'keyboard_shortcuts.hotkey', defaultMessage: 'Hotkey' },
+ reply: { id: 'keyboard_shortcuts.reply', defaultMessage: 'reply' },
+ mention: { id: 'keyboard_shortcuts.mention', defaultMessage: 'mention author' },
+ profile: { id: 'keyboard_shortcuts.profile', defaultMessage: 'open author\'s profile' },
+ favorite: { id: 'keyboard_shortcuts.favorite', defaultMessage: 'favorite' },
+ boost: { id: 'keyboard_shortcuts.boost', defaultMessage: 'repost' },
+ enter: { id: 'keyboard_shortcuts.enter', defaultMessage: 'open status' },
+ toggle_hidden: { id: 'keyboard_shortcuts.toggle_hidden', defaultMessage: 'show/hide text behind CW' },
+ toggle_sensitivity: { id: 'keyboard_shortcuts.toggle_sensitivity', defaultMessage: 'show/hide media' },
+ up: { id: 'keyboard_shortcuts.up', defaultMessage: 'move up in the list' },
+ down: { id: 'keyboard_shortcuts.down', defaultMessage: 'move down in the list' },
+ column: { id: 'keyboard_shortcuts.column', defaultMessage: 'focus a status in one of the columns' },
+ compose: { id: 'keyboard_shortcuts.compose', defaultMessage: 'focus the compose textarea' },
+ gab: { id: 'keyboard_shortcuts.toot', defaultMessage: 'start a brand new gab' },
+ back: { id: 'keyboard_shortcuts.back', defaultMessage: 'navigate back' },
+ search: { id: 'keyboard_shortcuts.search', defaultMessage: 'focus search' },
+ unfocus: { id: 'keyboard_shortcuts.unfocus', defaultMessage: 'un-focus compose textarea/search' },
+ home: { id: 'keyboard_shortcuts.home', defaultMessage: 'open home timeline' },
+ notifications: { id: 'keyboard_shortcuts.notifications', defaultMessage: 'open notifications column' },
+ start: { id: 'keyboard_shortcuts.start', defaultMessage: 'open "get started" column' },
+ favorites: { id: 'keyboard_shortcuts.favorites', defaultMessage: 'open favorites list' },
+ pinned: { id: 'keyboard_shortcuts.pinned', defaultMessage: 'open pinned gabs list' },
+ my_profile: { id: 'keyboard_shortcuts.my_profile', defaultMessage: 'open your profile' },
+ blocked: { id: 'keyboard_shortcuts.blocked', defaultMessage: 'open blocked users list' },
+ muted: { id: 'keyboard_shortcuts.muted', defaultMessage: 'open muted users list' },
+ requests: { id: 'keyboard_shortcuts.requests', defaultMessage: 'open follow requests list' },
+ legend: { id: 'keyboard_shortcuts.legend', defaultMessage: 'display this legend' },
+})
+
+HotkeysModal.propTypes = {
+ intl: PropTypes.object.isRequired,
+ onClose: PropTypes.func.isRequired,
+}
+
+export default injectIntl(HotkeysModal)
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/list_add_user_modal.js b/app/javascript/gabsocial/components/modal/list_add_user_modal.js
index 2d0c4732..151fa470 100644
--- a/app/javascript/gabsocial/components/modal/list_add_user_modal.js
+++ b/app/javascript/gabsocial/components/modal/list_add_user_modal.js
@@ -13,36 +13,8 @@ import ModalLayout from './modal_layout'
import Button from '../button'
import Text from '../text'
-const messages = defineMessages({
- add: { id: 'lists.account.add', defaultMessage: 'Add to list' },
-})
-
-const mapStateToProps = (state) => ({
- lists: getOrderedLists(state),
-})
-
-const mapDispatchToProps = (dispatch) => ({
- onFetchLists: () => dispatch(fetchLists()),
-
- onAddToList(listId, accountId) {
- dispatch(addToList(listId, accountId))
- },
-})
-
-export default
-@connect(mapStateToProps, mapDispatchToProps)
-@injectIntl
class ListAddUserModal extends ImmutablePureComponent {
- static propTypes = {
- accountId: PropTypes.string.isRequired,
- lists: ImmutablePropTypes.list,
- intl: PropTypes.object.isRequired,
- onAddToList: PropTypes.func.isRequired,
- onClose: PropTypes.func.isRequired,
- onFetchLists: PropTypes.func.isRequired,
- }
-
updateOnProps = [
'lists',
]
@@ -97,4 +69,31 @@ class ListAddUserModal extends ImmutablePureComponent {
)
}
-}
\ No newline at end of file
+}
+
+const messages = defineMessages({
+ add: { id: 'lists.account.add', defaultMessage: 'Add to list' },
+})
+
+const mapStateToProps = (state) => ({
+ lists: getOrderedLists(state),
+})
+
+const mapDispatchToProps = (dispatch) => ({
+ onFetchLists: () => dispatch(fetchLists()),
+
+ onAddToList(listId, accountId) {
+ dispatch(addToList(listId, accountId))
+ },
+})
+
+ListAddUserModal.propTypes = {
+ accountId: PropTypes.string.isRequired,
+ lists: ImmutablePropTypes.list,
+ intl: PropTypes.object.isRequired,
+ onAddToList: PropTypes.func.isRequired,
+ onClose: PropTypes.func.isRequired,
+ onFetchLists: PropTypes.func.isRequired,
+}
+
+export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(ListAddUserModal))
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/list_create_modal.js b/app/javascript/gabsocial/components/modal/list_create_modal.js
index e4c12bad..408acf40 100644
--- a/app/javascript/gabsocial/components/modal/list_create_modal.js
+++ b/app/javascript/gabsocial/components/modal/list_create_modal.js
@@ -5,19 +5,8 @@ import ImmutablePureComponent from 'react-immutable-pure-component'
import ModalLayout from './modal_layout'
import ListCreate from '../../features/list_create'
-const messages = defineMessages({
- title: { id: 'create_list', defaultMessage: 'Create List' },
-})
-
-export default
-@injectIntl
class ListCreateModal extends ImmutablePureComponent {
- static propTypes = {
- intl: PropTypes.object.isRequired,
- onClose: PropTypes.func.isRequired,
- }
-
render() {
const { intl, onClose } = this.props
@@ -31,4 +20,16 @@ class ListCreateModal extends ImmutablePureComponent {
)
}
+
}
+
+const messages = defineMessages({
+ title: { id: 'create_list', defaultMessage: 'Create List' },
+})
+
+ListCreateModal.propTypes = {
+ intl: PropTypes.object.isRequired,
+ onClose: PropTypes.func.isRequired,
+}
+
+export default injectIntl(ListCreateModal)
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/list_delete_modal.js b/app/javascript/gabsocial/components/modal/list_delete_modal.js
index 761111a3..c1bba1ba 100644
--- a/app/javascript/gabsocial/components/modal/list_delete_modal.js
+++ b/app/javascript/gabsocial/components/modal/list_delete_modal.js
@@ -7,27 +7,8 @@ import { injectIntl, defineMessages } from 'react-intl'
import { deleteList } from '../../actions/lists'
import ConfirmationModal from './confirmation_modal'
-const messages = defineMessages({
- title: { id: 'list_delete_title', defaultMessage: 'Delete "{list}"' },
- listMessage: { id: 'confirmations.list_delete.message', defaultMessage: 'Are you sure you want to delete "{list}"?' },
- delete: { id: 'delete', defaultMessage: 'Delete' },
-})
-
-const mapDispatchToProps = (dispatch) => ({
- onConfirm: (listId) => dispatch(deleteList(listId)),
-})
-
-export default
-@injectIntl
-@connect(null, mapDispatchToProps)
class ListDeleteModal extends ImmutablePureComponent {
- static propTypes = {
- list: ImmutablePropTypes.map.isRequired,
- intl: PropTypes.object.isRequired,
- onConfirm: PropTypes.func.isRequired,
- }
-
handleClick = () => {
this.props.onConfirm(this.props.list.get('id'))
// : todo :
@@ -56,3 +37,21 @@ class ListDeleteModal extends ImmutablePureComponent {
}
}
+
+const messages = defineMessages({
+ title: { id: 'list_delete_title', defaultMessage: 'Delete "{list}"' },
+ listMessage: { id: 'confirmations.list_delete.message', defaultMessage: 'Are you sure you want to delete "{list}"?' },
+ delete: { id: 'delete', defaultMessage: 'Delete' },
+})
+
+const mapDispatchToProps = (dispatch) => ({
+ onConfirm: (listId) => dispatch(deleteList(listId)),
+})
+
+ListDeleteModal.propTypes = {
+ list: ImmutablePropTypes.map.isRequired,
+ intl: PropTypes.object.isRequired,
+ onConfirm: PropTypes.func.isRequired,
+}
+
+export default injectIntl(connect(null, mapDispatchToProps)(ListDeleteModal))
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/list_editor_modal.js b/app/javascript/gabsocial/components/modal/list_editor_modal.js
index 3de6aa5a..33c22c6c 100644
--- a/app/javascript/gabsocial/components/modal/list_editor_modal.js
+++ b/app/javascript/gabsocial/components/modal/list_editor_modal.js
@@ -6,20 +6,8 @@ import ModalLayout from './modal_layout'
import { ListEdit } from '../../features/ui/util/async_components'
import WrappedBundle from '../../features/ui/util/wrapped_bundle'
-const messages = defineMessages({
- title: { id: 'lists.edit', defaultMessage: 'Edit list' },
-})
-
-export default
-@injectIntl
class ListEditorModal extends ImmutablePureComponent {
- static propTypes = {
- intl: PropTypes.object.isRequired,
- onClose: PropTypes.func.isRequired,
- id: PropTypes.string.isRequired,
- }
-
render() {
const { intl, onClose, id } = this.props
@@ -34,4 +22,17 @@ class ListEditorModal extends ImmutablePureComponent {
)
}
+
}
+
+const messages = defineMessages({
+ title: { id: 'lists.edit', defaultMessage: 'Edit list' },
+})
+
+ListEditorModal.propTypes = {
+ intl: PropTypes.object.isRequired,
+ onClose: PropTypes.func.isRequired,
+ id: PropTypes.string.isRequired,
+}
+
+export default injectIntl(ListEditorModal)
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/list_timeline_settings_modal.js b/app/javascript/gabsocial/components/modal/list_timeline_settings_modal.js
index 2955dafe..5f42f489 100644
--- a/app/javascript/gabsocial/components/modal/list_timeline_settings_modal.js
+++ b/app/javascript/gabsocial/components/modal/list_timeline_settings_modal.js
@@ -10,43 +10,8 @@ import Button from '../button'
import SettingSwitch from '../setting_switch'
import Text from '../text'
-const messages = defineMessages({
- title: { id: 'list_timeline_settings', defaultMessage: 'List Timeline Settings' },
- saveAndClose: { id: 'saveClose', defaultMessage: 'Save & Close' },
- showVideos: { id: 'home.column_settings.show_videos', defaultMessage: 'Show videos' },
- showPhotos: { id: 'home.column_settings.show_photos', defaultMessage: 'Show photos' },
- showPolls: { id: 'home.column_settings.show_polls', defaultMessage: 'Show polls' },
- showReposts: { id: 'home.column_settings.show_reposts', defaultMessage: 'Show comments' },
- showReplies: { id: 'home.column_settings.show_replies', defaultMessage: 'Show replies' },
-})
-
-const mapStateToProps = (state) => ({
- settings: state.getIn(['settings', 'list']),
-})
-
-const mapDispatchToProps = (dispatch, { onClose }) => ({
- onChange(key, checked) {
- dispatch(changeSetting(['list', ...key], checked))
- },
- onSave() {
- dispatch(saveSettings())
- onClose()
- },
-})
-
-export default
-@connect(mapStateToProps, mapDispatchToProps)
-@injectIntl
class ListTimelineSettingsModal extends ImmutablePureComponent {
- static propTypes = {
- intl: PropTypes.object.isRequired,
- settings: ImmutablePropTypes.map.isRequired,
- onChange: PropTypes.func.isRequired,
- onClose: PropTypes.func.isRequired,
- onSave: PropTypes.func.isRequired,
- }
-
handleSaveAndClose = () => {
this.props.onSave()
}
@@ -118,3 +83,37 @@ class ListTimelineSettingsModal extends ImmutablePureComponent {
)
}
}
+
+const messages = defineMessages({
+ title: { id: 'list_timeline_settings', defaultMessage: 'List Timeline Settings' },
+ saveAndClose: { id: 'saveClose', defaultMessage: 'Save & Close' },
+ showVideos: { id: 'home.column_settings.show_videos', defaultMessage: 'Show videos' },
+ showPhotos: { id: 'home.column_settings.show_photos', defaultMessage: 'Show photos' },
+ showPolls: { id: 'home.column_settings.show_polls', defaultMessage: 'Show polls' },
+ showReposts: { id: 'home.column_settings.show_reposts', defaultMessage: 'Show comments' },
+ showReplies: { id: 'home.column_settings.show_replies', defaultMessage: 'Show replies' },
+})
+
+const mapStateToProps = (state) => ({
+ settings: state.getIn(['settings', 'list']),
+})
+
+const mapDispatchToProps = (dispatch, { onClose }) => ({
+ onChange(key, checked) {
+ dispatch(changeSetting(['list', ...key], checked))
+ },
+ onSave() {
+ dispatch(saveSettings())
+ onClose()
+ },
+})
+
+ListTimelineSettingsModal.propTypes = {
+ intl: PropTypes.object.isRequired,
+ settings: ImmutablePropTypes.map.isRequired,
+ onChange: PropTypes.func.isRequired,
+ onClose: PropTypes.func.isRequired,
+ onSave: PropTypes.func.isRequired,
+}
+
+export default injectInt(connect(mapStateToProps, mapDispatchToProps)(ListTimelineSettingsModal))
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/loading_modal.js b/app/javascript/gabsocial/components/modal/loading_modal.js
index 6d9cdfd6..84a59ca0 100644
--- a/app/javascript/gabsocial/components/modal/loading_modal.js
+++ b/app/javascript/gabsocial/components/modal/loading_modal.js
@@ -2,22 +2,16 @@ import React from 'react'
import Block from '../block'
import ColumnIndicator from '../column_indicator'
-export default class LoadingModal extends React.PureComponent {
-
- render() {
- return (
-
-
-
-
+const LoadingModal = () => (
+
+)
+
+export default LoadingModal
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/media_modal.js b/app/javascript/gabsocial/components/modal/media_modal.js
index 505f1a38..479e7c16 100644
--- a/app/javascript/gabsocial/components/modal/media_modal.js
+++ b/app/javascript/gabsocial/components/modal/media_modal.js
@@ -11,27 +11,10 @@ import Button from '../button'
import ImageLoader from '../image_loader'
import Pagination from '../pagination'
-const messages = defineMessages({
- close: { id: 'lightbox.close', defaultMessage: 'Close' },
- previous: { id: 'lightbox.previous', defaultMessage: 'Previous' },
- next: { id: 'lightbox.next', defaultMessage: 'Next' },
- viewContext: { id: 'lightbox.view_context', defaultMessage: 'View context' },
-})
-
export const previewState = 'previewMediaModal'
-export default
-@injectIntl
class MediaModal extends ImmutablePureComponent {
- static propTypes = {
- media: ImmutablePropTypes.list.isRequired,
- status: ImmutablePropTypes.map,
- index: PropTypes.number.isRequired,
- onClose: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired,
- }
-
static contextTypes = {
router: PropTypes.object,
}
@@ -286,3 +269,20 @@ class MediaModal extends ImmutablePureComponent {
}
}
+
+const messages = defineMessages({
+ close: { id: 'lightbox.close', defaultMessage: 'Close' },
+ previous: { id: 'lightbox.previous', defaultMessage: 'Previous' },
+ next: { id: 'lightbox.next', defaultMessage: 'Next' },
+ viewContext: { id: 'lightbox.view_context', defaultMessage: 'View context' },
+})
+
+MediaModal.propTypes = {
+ media: ImmutablePropTypes.list.isRequired,
+ status: ImmutablePropTypes.map,
+ index: PropTypes.number.isRequired,
+ onClose: PropTypes.func.isRequired,
+ intl: PropTypes.object.isRequired,
+}
+
+export default injectIntl(MediaModal)
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/modal_base.js b/app/javascript/gabsocial/components/modal/modal_base.js
index 398ec701..6a3c0688 100644
--- a/app/javascript/gabsocial/components/modal/modal_base.js
+++ b/app/javascript/gabsocial/components/modal/modal_base.js
@@ -13,42 +13,8 @@ import Responsive from '../../features/ui/util/responsive_component'
const initialState = getWindowDimension()
-const messages = defineMessages({
- confirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' },
- delete: { id: 'confirmations.delete.message', defaultMessage: 'Are you sure you want to delete this status?' },
-})
-
-const mapStateToProps = (state) => ({
- composeId: state.getIn(['compose', 'id']),
- composeText: state.getIn(['compose', 'text']),
-})
-
-const mapDispatchToProps = (dispatch) => ({
- onOpenModal(type, opts) {
- dispatch(openModal(type, opts))
- },
- onCancelReplyCompose() {
- dispatch(cancelReplyCompose())
- },
-})
-
-export default
-@connect(mapStateToProps, mapDispatchToProps)
-@injectIntl
class ModalBase extends React.PureComponent {
- static propTypes = {
- children: PropTypes.node,
- onClose: PropTypes.func.isRequired,
- onOpenModal: PropTypes.func.isRequired,
- onCancelReplyCompose: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired,
- composeId: PropTypes.string,
- composeText: PropTypes.string,
- type: PropTypes.string,
- isCenteredXS: PropTypes.bool,
- }
-
state = {
revealed: !!this.props.children,
width: initialState.width,
@@ -188,4 +154,37 @@ class ModalBase extends React.PureComponent {
)
}
-}
\ No newline at end of file
+}
+
+const messages = defineMessages({
+ confirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' },
+ delete: { id: 'confirmations.delete.message', defaultMessage: 'Are you sure you want to delete this status?' },
+})
+
+const mapStateToProps = (state) => ({
+ composeId: state.getIn(['compose', 'id']),
+ composeText: state.getIn(['compose', 'text']),
+})
+
+const mapDispatchToProps = (dispatch) => ({
+ onOpenModal(type, opts) {
+ dispatch(openModal(type, opts))
+ },
+ onCancelReplyCompose() {
+ dispatch(cancelReplyCompose())
+ },
+})
+
+ModalBase.propTypes = {
+ children: PropTypes.node,
+ onClose: PropTypes.func.isRequired,
+ onOpenModal: PropTypes.func.isRequired,
+ onCancelReplyCompose: PropTypes.func.isRequired,
+ intl: PropTypes.object.isRequired,
+ composeId: PropTypes.string,
+ composeText: PropTypes.string,
+ type: PropTypes.string,
+ isCenteredXS: PropTypes.bool,
+}
+
+export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(ModalBase))
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/modal_layout.js b/app/javascript/gabsocial/components/modal/modal_layout.js
index 4d6cda8a..136493cf 100644
--- a/app/javascript/gabsocial/components/modal/modal_layout.js
+++ b/app/javascript/gabsocial/components/modal/modal_layout.js
@@ -8,28 +8,8 @@ import Heading from '../heading'
const cx = classNames.bind(_s)
-const messages = defineMessages({
- close: { id: 'lightbox.close', defaultMessage: 'Close' },
-})
-
-export default
-@injectIntl
class ModalLayout extends React.PureComponent {
- static propTypes = {
- title: PropTypes.string,
- children: PropTypes.node,
- onClose: PropTypes.func.isRequired,
- width: PropTypes.number,
- hideClose: PropTypes.bool,
- noPadding: PropTypes.bool,
- isXS: PropTypes.bool,
- }
-
- static defaultProps = {
- width: 600,
- }
-
onHandleCloseModal = () => {
this.props.onClose()
}
@@ -81,4 +61,24 @@ class ModalLayout extends React.PureComponent {
)
}
-}
\ No newline at end of file
+}
+
+const messages = defineMessages({
+ close: { id: 'lightbox.close', defaultMessage: 'Close' },
+})
+
+ModalLayout.propTypes = {
+ title: PropTypes.string,
+ children: PropTypes.node,
+ onClose: PropTypes.func.isRequired,
+ width: PropTypes.number,
+ hideClose: PropTypes.bool,
+ noPadding: PropTypes.bool,
+ isXS: PropTypes.bool,
+}
+
+ModalLayout.defaultProps = {
+ width: 600,
+}
+
+export default injectIntl(ModalLayout)
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/modal_root.js b/app/javascript/gabsocial/components/modal/modal_root.js
index 6ffda85e..2f0a868a 100644
--- a/app/javascript/gabsocial/components/modal/modal_root.js
+++ b/app/javascript/gabsocial/components/modal/modal_root.js
@@ -116,31 +116,8 @@ const CENTERED_XS_MODALS = [
MODAL_UNFOLLOW,
]
-const mapStateToProps = (state) => ({
- type: state.getIn(['modal', 'modalType']),
- props: state.getIn(['modal', 'modalProps'], {}),
-})
-
-const mapDispatchToProps = (dispatch) => ({
- onClose(optionalType) {
- if (optionalType === 'COMPOSE') {
- dispatch(cancelReplyCompose())
- }
-
- dispatch(closeModal())
- },
-})
-
-export default
-@connect(mapStateToProps, mapDispatchToProps)
class ModalRoot extends React.PureComponent {
- static propTypes = {
- type: PropTypes.string,
- props: PropTypes.object,
- onClose: PropTypes.func.isRequired,
- }
-
getSnapshotBeforeUpdate() {
return { visible: !!this.props.type }
}
@@ -193,3 +170,26 @@ class ModalRoot extends React.PureComponent {
}
}
+
+const mapStateToProps = (state) => ({
+ type: state.getIn(['modal', 'modalType']),
+ props: state.getIn(['modal', 'modalProps'], {}),
+})
+
+const mapDispatchToProps = (dispatch) => ({
+ onClose(optionalType) {
+ if (optionalType === 'COMPOSE') {
+ dispatch(cancelReplyCompose())
+ }
+
+ dispatch(closeModal())
+ },
+})
+
+ModalRoot.propTypes = {
+ type: PropTypes.string,
+ props: PropTypes.object,
+ onClose: PropTypes.func.isRequired,
+}
+
+export default connect(mapStateToProps, mapDispatchToProps)(ModalRoot)
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/mute_modal.js b/app/javascript/gabsocial/components/modal/mute_modal.js
index f3d78b0b..0c945917 100644
--- a/app/javascript/gabsocial/components/modal/mute_modal.js
+++ b/app/javascript/gabsocial/components/modal/mute_modal.js
@@ -6,38 +6,8 @@ import { makeGetAccount } from '../../selectors'
import { muteAccount } from '../../actions/accounts'
import ConfirmationModal from './confirmation_modal'
-const messages = defineMessages({
- title: { id: 'mute_title', defaultMessage: 'Mute {name}' },
- muteMessage: { id: 'confirmations.mute.message', defaultMessage: 'Are you sure you want to mute {name}?' },
- mute: { id: 'confirmations.mute.confirm', defaultMessage: 'Mute' },
-})
-
-const mapStateToProps = (state, { accountId }) => {
- const getAccount = makeGetAccount()
-
- return {
- account: getAccount(state, accountId),
- }
-}
-
-const mapDispatchToProps = (dispatch) => ({
- onConfirm(account, notifications) {
- dispatch(muteAccount(account.get('id'), notifications))
- },
-})
-
-export default
-@connect(mapStateToProps, mapDispatchToProps)
-@injectIntl
class MuteModal extends React.PureComponent {
- static propTypes = {
- account: PropTypes.object.isRequired,
- onConfirm: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired,
- onClose: PropTypes.func.isRequired,
- }
-
handleClick = () => {
this.props.onConfirm(this.props.account)
}
@@ -64,3 +34,32 @@ class MuteModal extends React.PureComponent {
}
}
+
+const messages = defineMessages({
+ title: { id: 'mute_title', defaultMessage: 'Mute {name}' },
+ muteMessage: { id: 'confirmations.mute.message', defaultMessage: 'Are you sure you want to mute {name}?' },
+ mute: { id: 'confirmations.mute.confirm', defaultMessage: 'Mute' },
+})
+
+const mapStateToProps = (state, { accountId }) => {
+ const getAccount = makeGetAccount()
+
+ return {
+ account: getAccount(state, accountId),
+ }
+}
+
+const mapDispatchToProps = (dispatch) => ({
+ onConfirm(account, notifications) {
+ dispatch(muteAccount(account.get('id'), notifications))
+ },
+})
+
+MuteModal.propTypes = {
+ account: PropTypes.object.isRequired,
+ onConfirm: PropTypes.func.isRequired,
+ intl: PropTypes.object.isRequired,
+ onClose: PropTypes.func.isRequired,
+}
+
+export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(MuteModal))
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/pro_upgrade_modal.js b/app/javascript/gabsocial/components/modal/pro_upgrade_modal.js
index 141e162f..711297ba 100644
--- a/app/javascript/gabsocial/components/modal/pro_upgrade_modal.js
+++ b/app/javascript/gabsocial/components/modal/pro_upgrade_modal.js
@@ -13,29 +13,8 @@ import Icon from '../icon'
import Image from '../image'
import ModalLayout from './modal_layout'
-const messages = defineMessages({
- title: { id: 'promo.gab_pro', defaultMessage: 'Upgrade to GabPRO' },
- upgrade: { id: 'promo.upgrade', defaultMessage: 'Upgrade' },
- learnMore: { id: 'promo.learn_more', defaultMessage: 'Learn more' },
- text: { id: 'pro_upgrade_modal.text', defaultMessage: 'Gab is fully funded by people like you. Please consider supporting us on our mission to defend free expression online for all people.' },
- benefits: { id: 'pro_upgrade_modal.benefits', defaultMessage: 'Here are some benefits that GabPRO members receive:' },
-})
-
-const mapStateToProps = (state) => ({
- theme: state.getIn(['settings', 'displayOptions', 'theme'], DEFAULT_THEME),
-})
-
-export default
-@injectIntl
-@connect(mapStateToProps)
class ProUpgradeModal extends ImmutablePureComponent {
- static propTypes = {
- intl: PropTypes.object.isRequired,
- onClose: PropTypes.func.isRequired,
- theme: PropTypes.string.isRequired,
- }
-
render() {
const {
intl,
@@ -105,3 +84,23 @@ class ProUpgradeModal extends ImmutablePureComponent {
}
}
+
+const messages = defineMessages({
+ title: { id: 'promo.gab_pro', defaultMessage: 'Upgrade to GabPRO' },
+ upgrade: { id: 'promo.upgrade', defaultMessage: 'Upgrade' },
+ learnMore: { id: 'promo.learn_more', defaultMessage: 'Learn more' },
+ text: { id: 'pro_upgrade_modal.text', defaultMessage: 'Gab is fully funded by people like you. Please consider supporting us on our mission to defend free expression online for all people.' },
+ benefits: { id: 'pro_upgrade_modal.benefits', defaultMessage: 'Here are some benefits that GabPRO members receive:' },
+})
+
+const mapStateToProps = (state) => ({
+ theme: state.getIn(['settings', 'displayOptions', 'theme'], DEFAULT_THEME),
+})
+
+ProUpgradeModal.propTypes = {
+ intl: PropTypes.object.isRequired,
+ onClose: PropTypes.func.isRequired,
+ theme: PropTypes.string.isRequired,
+}
+
+export default injectIntl(connect(mapStateToProps)(ProUpgradeModal))
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/report_modal.js b/app/javascript/gabsocial/components/modal/report_modal.js
index 9c24c898..1ff23f4d 100644
--- a/app/javascript/gabsocial/components/modal/report_modal.js
+++ b/app/javascript/gabsocial/components/modal/report_modal.js
@@ -15,46 +15,8 @@ import StatusCheckBox from '../status_check_box'
import Text from '../text'
import Textarea from '../textarea'
-const messages = defineMessages({
- close: { id: 'lightbox.close', defaultMessage: 'Close' },
- placeholder: { id: 'report.placeholder', defaultMessage: 'Additional comments' },
- submit: { id: 'report.submit', defaultMessage: 'Submit' },
- hint: { id: 'report.hint', defaultMessage: 'The report will be sent to your server moderators. You can provide an explanation of why you are reporting this account below:' },
- target: { id: 'report.target', defaultMessage: 'Report {target}' },
-})
-
-const makeMapStateToProps = () => {
- const getAccount = makeGetAccount()
-
- const mapStateToProps = (state) => {
- const accountId = state.getIn(['reports', 'new', 'account_id'])
-
- return {
- isSubmitting: state.getIn(['reports', 'new', 'isSubmitting']),
- account: getAccount(state, accountId),
- comment: state.getIn(['reports', 'new', 'comment']),
- statusIds: OrderedSet(state.getIn(['timelines', `account:${accountId}:with_replies`, 'items'])).union(state.getIn(['reports', 'new', 'status_ids'])),
- }
- }
-
- return mapStateToProps
-}
-
-export default
-@connect(makeMapStateToProps)
-@injectIntl
class ReportModal extends ImmutablePureComponent {
- static propTypes = {
- isSubmitting: PropTypes.bool,
- account: ImmutablePropTypes.map,
- statusIds: ImmutablePropTypes.orderedSet.isRequired,
- comment: PropTypes.string.isRequired,
- dispatch: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired,
- onClose: PropTypes.func.isRequired,
- }
-
handleCommentChange = (value) => {
this.props.dispatch(changeReportComment(value))
}
@@ -151,3 +113,40 @@ class ReportModal extends ImmutablePureComponent {
}
}
+
+const messages = defineMessages({
+ close: { id: 'lightbox.close', defaultMessage: 'Close' },
+ placeholder: { id: 'report.placeholder', defaultMessage: 'Additional comments' },
+ submit: { id: 'report.submit', defaultMessage: 'Submit' },
+ hint: { id: 'report.hint', defaultMessage: 'The report will be sent to your server moderators. You can provide an explanation of why you are reporting this account below:' },
+ target: { id: 'report.target', defaultMessage: 'Report {target}' },
+})
+
+const makeMapStateToProps = () => {
+ const getAccount = makeGetAccount()
+
+ const mapStateToProps = (state) => {
+ const accountId = state.getIn(['reports', 'new', 'account_id'])
+
+ return {
+ isSubmitting: state.getIn(['reports', 'new', 'isSubmitting']),
+ account: getAccount(state, accountId),
+ comment: state.getIn(['reports', 'new', 'comment']),
+ statusIds: OrderedSet(state.getIn(['timelines', `account:${accountId}:with_replies`, 'items'])).union(state.getIn(['reports', 'new', 'status_ids'])),
+ }
+ }
+
+ return mapStateToProps
+}
+
+ReportModal.propTypes = {
+ isSubmitting: PropTypes.bool,
+ account: ImmutablePropTypes.map,
+ statusIds: ImmutablePropTypes.orderedSet.isRequired,
+ comment: PropTypes.string.isRequired,
+ dispatch: PropTypes.func.isRequired,
+ intl: PropTypes.object.isRequired,
+ onClose: PropTypes.func.isRequired,
+}
+
+export default injectIntl(connect(makeMapStateToProps)(ReportModal))
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/status_likes_modal.js b/app/javascript/gabsocial/components/modal/status_likes_modal.js
index da8a95bf..708e9eea 100644
--- a/app/javascript/gabsocial/components/modal/status_likes_modal.js
+++ b/app/javascript/gabsocial/components/modal/status_likes_modal.js
@@ -7,20 +7,8 @@ import { StatusLikes } from '../../features/ui/util/async_components'
import WrappedBundle from '../../features/ui/util/wrapped_bundle'
import ModalLayout from './modal_layout'
-const messages = defineMessages({
- title: { id: 'likes', defaultMessage: 'Likes' },
-})
-
-export default
-@injectIntl
class StatusLikesModal extends ImmutablePureComponent {
- static propTypes = {
- intl: PropTypes.object.isRequired,
- onClose: PropTypes.func.isRequired,
- status: ImmutablePropTypes.map.isRequired,
- }
-
render() {
const {
intl,
@@ -45,3 +33,15 @@ class StatusLikesModal extends ImmutablePureComponent {
}
}
+
+const messages = defineMessages({
+ title: { id: 'likes', defaultMessage: 'Likes' },
+})
+
+StatusLikesModal.propTypes = {
+ intl: PropTypes.object.isRequired,
+ onClose: PropTypes.func.isRequired,
+ status: ImmutablePropTypes.map.isRequired,
+}
+
+export default injectIntl(StatusLikesModal)
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/status_reposts_modal.js b/app/javascript/gabsocial/components/modal/status_reposts_modal.js
index d38aa078..4b159a49 100644
--- a/app/javascript/gabsocial/components/modal/status_reposts_modal.js
+++ b/app/javascript/gabsocial/components/modal/status_reposts_modal.js
@@ -7,20 +7,8 @@ import { StatusReposts } from '../../features/ui/util/async_components'
import WrappedBundle from '../../features/ui/util/wrapped_bundle'
import ModalLayout from './modal_layout'
-const messages = defineMessages({
- title: { id: 'reposts', defaultMessage: 'Reposts' },
-})
-
-export default
-@injectIntl
class StatusRepostsModal extends ImmutablePureComponent {
- static propTypes = {
- intl: PropTypes.object.isRequired,
- onClose: PropTypes.func.isRequired,
- status: ImmutablePropTypes.map.isRequired,
- }
-
render() {
const {
intl,
@@ -45,3 +33,15 @@ class StatusRepostsModal extends ImmutablePureComponent {
}
}
+
+const messages = defineMessages({
+ title: { id: 'reposts', defaultMessage: 'Reposts' },
+})
+
+StatusRepostsModal.propTypes = {
+ intl: PropTypes.object.isRequired,
+ onClose: PropTypes.func.isRequired,
+ status: ImmutablePropTypes.map.isRequired,
+}
+
+export default injectIntl(StatusRepostsModal)
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/status_revisions_modal.js b/app/javascript/gabsocial/components/modal/status_revisions_modal.js
index 9829e590..9ff40d7a 100644
--- a/app/javascript/gabsocial/components/modal/status_revisions_modal.js
+++ b/app/javascript/gabsocial/components/modal/status_revisions_modal.js
@@ -12,37 +12,8 @@ import Text from '../text'
const cx = classNames.bind(_s)
-const messages = defineMessages({
- title: { id: 'status_revisions.heading', defaultMessage: 'Revision History' },
-})
-
-const mapStateToProps = (state) => ({
- loading: state.getIn(['status_revisions', 'loading']),
- error: state.getIn(['status_revisions', 'error']),
- revisions: state.getIn(['status_revisions', 'revisions']),
-})
-
-const mapDispatchToProps = (dispatch) => ({
- onLoadStatusRevisions(statusId) {
- dispatch(loadStatusRevisions(statusId))
- },
-})
-
-export default
-@injectIntl
-@connect(mapStateToProps, mapDispatchToProps)
class StatusRevisionsModal extends ImmutablePureComponent {
- static propTypes = {
- intl: PropTypes.object.isRequired,
- status: ImmutablePropTypes.map.isRequired,
- onLoadStatusRevisions: PropTypes.func.isRequired,
- loading: PropTypes.bool.isRequired,
- error: PropTypes.bool,
- revisions: ImmutablePropTypes.list.isRequired,
- onClose: PropTypes.func.isRequired,
- }
-
componentDidMount() {
this.props.onLoadStatusRevisions(this.props.status.get('id'))
}
@@ -96,4 +67,32 @@ class StatusRevisionsModal extends ImmutablePureComponent {
)
}
-}
\ No newline at end of file
+}
+
+const messages = defineMessages({
+ title: { id: 'status_revisions.heading', defaultMessage: 'Revision History' },
+})
+
+const mapStateToProps = (state) => ({
+ loading: state.getIn(['status_revisions', 'loading']),
+ error: state.getIn(['status_revisions', 'error']),
+ revisions: state.getIn(['status_revisions', 'revisions']),
+})
+
+const mapDispatchToProps = (dispatch) => ({
+ onLoadStatusRevisions(statusId) {
+ dispatch(loadStatusRevisions(statusId))
+ },
+})
+
+StatusRevisionsModal.propTypes = {
+ intl: PropTypes.object.isRequired,
+ status: ImmutablePropTypes.map.isRequired,
+ onLoadStatusRevisions: PropTypes.func.isRequired,
+ loading: PropTypes.bool.isRequired,
+ error: PropTypes.bool,
+ revisions: ImmutablePropTypes.list.isRequired,
+ onClose: PropTypes.func.isRequired,
+}
+
+export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(StatusRevisionsModal))
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/unauthorized_modal.js b/app/javascript/gabsocial/components/modal/unauthorized_modal.js
index b852a78e..6a3020f0 100644
--- a/app/javascript/gabsocial/components/modal/unauthorized_modal.js
+++ b/app/javascript/gabsocial/components/modal/unauthorized_modal.js
@@ -6,22 +6,8 @@ import ModalLayout from './modal_layout'
import Text from '../text'
import Button from '../button'
-const messages = defineMessages({
- signup: { id: 'unauthorized_modal.title', defaultMessage: 'Sign up for Gab' },
- text: { id: 'unauthorized_modal.text', defaultMessage: 'You need to be logged in to do that.' },
- register: { id: 'account.register', defaultMessage: 'Sign up' },
- login: { id: 'account.login', defaultMessage: 'Log in' },
-})
-
-export default
-@injectIntl
class UnauthorizedModal extends ImmutablePureComponent {
- static propTypes = {
- intl: PropTypes.object.isRequired,
- onClose: PropTypes.func.isRequired,
- }
-
render() {
const { intl, onClose } = this.props
@@ -62,4 +48,18 @@ class UnauthorizedModal extends ImmutablePureComponent {
)
}
-}
\ No newline at end of file
+}
+
+const messages = defineMessages({
+ signup: { id: 'unauthorized_modal.title', defaultMessage: 'Sign up for Gab' },
+ text: { id: 'unauthorized_modal.text', defaultMessage: 'You need to be logged in to do that.' },
+ register: { id: 'account.register', defaultMessage: 'Sign up' },
+ login: { id: 'account.login', defaultMessage: 'Log in' },
+})
+
+UnauthorizedModal.propTypes = {
+ intl: PropTypes.object.isRequired,
+ onClose: PropTypes.func.isRequired,
+}
+
+export default injectIntl(UnauthorizedModal)
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/unfollow_modal.js b/app/javascript/gabsocial/components/modal/unfollow_modal.js
index a542e5d8..a74de87b 100644
--- a/app/javascript/gabsocial/components/modal/unfollow_modal.js
+++ b/app/javascript/gabsocial/components/modal/unfollow_modal.js
@@ -7,23 +7,8 @@ import ImmutablePropTypes from 'react-immutable-proptypes'
import { unfollowAccount } from '../../actions/accounts'
import ConfirmationModal from './confirmation_modal'
-const mapDispatchToProps = (dispatch) => ({
- onConfirm(accountId) {
- dispatch(unfollowAccount(accountId))
- },
-})
-
-export default
-@connect(null, mapDispatchToProps)
class UnfollowModal extends ImmutablePureComponent {
- static propTypes = {
- isSubmitting: PropTypes.bool.isRequired,
- account: ImmutablePropTypes.map.isRequired,
- onConfirm: PropTypes.func.isRequired,
- onClose: PropTypes.func.isRequired,
- }
-
handleClick = () => {
this.props.onClose()
this.props.onConfirm(this.props.account.get('id'))
@@ -48,3 +33,18 @@ class UnfollowModal extends ImmutablePureComponent {
}
}
+
+const mapDispatchToProps = (dispatch) => ({
+ onConfirm(accountId) {
+ dispatch(unfollowAccount(accountId))
+ },
+})
+
+UnfollowModal.propTypes = {
+ isSubmitting: PropTypes.bool.isRequired,
+ account: ImmutablePropTypes.map.isRequired,
+ onConfirm: PropTypes.func.isRequired,
+ onClose: PropTypes.func.isRequired,
+}
+
+export default connect(null, mapDispatchToProps)(UnfollowModal)
\ No newline at end of file
diff --git a/app/javascript/gabsocial/components/modal/video_modal.js b/app/javascript/gabsocial/components/modal/video_modal.js
index cb1a67e2..a1d1ca1e 100644
--- a/app/javascript/gabsocial/components/modal/video_modal.js
+++ b/app/javascript/gabsocial/components/modal/video_modal.js
@@ -7,14 +7,7 @@ import Video from '../video'
export const previewState = 'previewVideoModal'
-export default class VideoModal extends ImmutablePureComponent {
-
- static propTypes = {
- media: ImmutablePropTypes.map.isRequired,
- status: ImmutablePropTypes.map,
- time: PropTypes.number,
- onClose: PropTypes.func.isRequired,
- }
+class VideoModal extends ImmutablePureComponent {
static contextTypes = {
router: PropTypes.object,
@@ -73,3 +66,12 @@ export default class VideoModal extends ImmutablePureComponent {
}
}
+
+VideoModal.propTypes = {
+ media: ImmutablePropTypes.map.isRequired,
+ status: ImmutablePropTypes.map,
+ time: PropTypes.number,
+ onClose: PropTypes.func.isRequired,
+}
+
+export default VideoModal
\ No newline at end of file