diff options
author | kibigo! <marrus-sh@users.noreply.github.com> | 2017-07-12 01:02:51 -0700 |
---|---|---|
committer | kibigo! <marrus-sh@users.noreply.github.com> | 2017-07-12 01:02:51 -0700 |
commit | 297921fce570bfab413bab4e16a4ae694ecc4f28 (patch) | |
tree | 279bd98fe3102bd607c222f0497b7549fbb749d8 /app | |
parent | 74eff5456c8655e6783ffe49a96042320af3848c (diff) |
Moved glitch files to their own location ;)
Diffstat (limited to 'app')
33 files changed, 315 insertions, 263 deletions
diff --git a/app/javascript/mastodon/actions/local_settings.js b/app/javascript/glitch/actions/local_settings.js index 18e0c245c..18e0c245c 100644 --- a/app/javascript/mastodon/actions/local_settings.js +++ b/app/javascript/glitch/actions/local_settings.js diff --git a/app/javascript/mastodon/features/account/components/header.js b/app/javascript/glitch/components/account/header.js index 32424400f..875ee3c54 100644 --- a/app/javascript/mastodon/features/account/components/header.js +++ b/app/javascript/glitch/components/account/header.js @@ -1,13 +1,18 @@ +// Package imports // import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import emojify from '../../../emoji'; import escapeTextContentForBrowser from 'escape-html'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import IconButton from '../../../components/icon_button'; -import Avatar from '../../../components/avatar'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import { processBio } from '../util/bio_metadata'; + +// Mastodon imports // +import emojify from '../../../mastodon/emoji'; +import IconButton from '../../../mastodon/components/icon_button'; +import Avatar from '../../../mastodon/components/avatar'; + +// Our imports // +import { processBio } from '../../util/bio_metadata'; const messages = defineMessages({ unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' }, diff --git a/app/javascript/mastodon/features/compose/components/advanced_options_dropdown.js b/app/javascript/glitch/components/compose/advanced_options.js index aea810b66..0e72bd053 100644 --- a/app/javascript/mastodon/features/compose/components/advanced_options_dropdown.js +++ b/app/javascript/glitch/components/compose/advanced_options.js @@ -1,10 +1,13 @@ +// Package imports // import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import IconButton from '../../../components/icon_button'; import Toggle from 'react-toggle'; import { injectIntl, defineMessages } from 'react-intl'; +// Mastodon imports // +import IconButton from '../../../mastodon/components/icon_button'; + const messages = defineMessages({ local_only_short: { id: 'advanced-options.local-only.short', defaultMessage: 'Local-only' }, local_only_long: { id: 'advanced-options.local-only.long', defaultMessage: 'Do not post to other instances' }, @@ -17,7 +20,7 @@ const iconStyle = { }; @injectIntl -export default class AdvancedOptionsDropdown extends React.PureComponent { +export default class ComposeAdvancedOptions extends React.PureComponent { static propTypes = { values: ImmutablePropTypes.contains({ diff --git a/app/javascript/mastodon/features/notifications/components/notification.js b/app/javascript/glitch/components/notification/index.js index 2b2171f8b..3f424d85d 100644 --- a/app/javascript/mastodon/features/notifications/components/notification.js +++ b/app/javascript/glitch/components/notification/index.js @@ -1,13 +1,18 @@ +// Package imports // import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import StatusContainer from '../../../containers/status_container'; -import AccountContainer from '../../../containers/account_container'; import { FormattedMessage } from 'react-intl'; -import Permalink from '../../../components/permalink'; -import emojify from '../../../emoji'; import escapeTextContentForBrowser from 'escape-html'; import ImmutablePureComponent from 'react-immutable-pure-component'; +// Mastodon imports // +import AccountContainer from '../../../mastodon/containers/account_container'; +import Permalink from '../../../mastodon/components/permalink'; +import emojify from '../../../mastodon/emoji'; + +// Our imports // +import StatusContainer from '../../containers/status'; + export default class Notification extends ImmutablePureComponent { static propTypes = { diff --git a/app/javascript/mastodon/features/ui/components/settings_modal.js b/app/javascript/glitch/components/settings/index.js index 9ed2acbc7..afe7e9a87 100644 --- a/app/javascript/mastodon/features/ui/components/settings_modal.js +++ b/app/javascript/glitch/components/settings/index.js @@ -1,7 +1,11 @@ +// Package imports // import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import { FormattedMessage, injectIntl, defineMessages } from 'react-intl'; +import { injectIntl, defineMessages, FormattedMessage } from 'react-intl'; + +// Our imports // +import SettingsItem from './item'; const messages = defineMessages({ layout_auto: { id: 'layout.auto', defaultMessage: 'Auto' }, @@ -10,89 +14,14 @@ const messages = defineMessages({ }); @injectIntl -class SettingsItem extends React.PureComponent { - - static propTypes = { - settings: ImmutablePropTypes.map.isRequired, - item: PropTypes.array.isRequired, - id: PropTypes.string.isRequired, - options: PropTypes.arrayOf(PropTypes.shape({ - value: PropTypes.string.isRequired, - message: PropTypes.object.isRequired, - })), - dependsOn: PropTypes.array, - dependsOnNot: PropTypes.array, - children: PropTypes.element.isRequired, - onChange: PropTypes.func.isRequired, - intl: PropTypes.object.isRequired, - }; - - handleChange = (e) => { - const { item, onChange } = this.props; - onChange(item, e); - } - - render () { - const { settings, item, id, options, children, dependsOn, dependsOnNot, intl } = this.props; - let enabled = true; - - if (dependsOn) { - for (let i = 0; i < dependsOn.length; i++) { - enabled = enabled && settings.getIn(dependsOn[i]); - } - } - if (dependsOnNot) { - for (let i = 0; i < dependsOnNot.length; i++) { - enabled = enabled && !settings.getIn(dependsOnNot[i]); - } - } - - if (options && options.length > 0) { - const currentValue = settings.getIn(item); - const optionElems = options && options.length > 0 && options.map((opt) => ( - <option key={opt.value} selected={currentValue === opt.value} value={opt.value} > - {intl.formatMessage(opt.message)} - </option> - )); - return ( - <label htmlFor={id}> - <p>{children}</p> - <p> - <select - id={id} - disabled={!enabled} - onBlur={this.handleChange} - > - {optionElems} - </select> - </p> - </label> - ); - } else { - return ( - <label htmlFor={id}> - <input - id={id} - type='checkbox' - checked={settings.getIn(item)} - onChange={this.handleChange} - disabled={!enabled} - /> - {children} - </label> - ); - } - } - -} - -export default class SettingsModal extends React.PureComponent { +export default class Settings extends React.PureComponent { static propTypes = { settings: ImmutablePropTypes.map.isRequired, toggleSetting: PropTypes.func.isRequired, changeSetting: PropTypes.func.isRequired, onClose: PropTypes.func.isRequired, + intl: PropTypes.object.isRequired, }; state = { @@ -100,6 +29,7 @@ export default class SettingsModal extends React.PureComponent { }; General = () => { + const { intl } = this.props; return ( <div> <h1><FormattedMessage id='settings.general' defaultMessage='General' /></h1> @@ -108,9 +38,9 @@ export default class SettingsModal extends React.PureComponent { item={['layout']} id='mastodon-settings--layout' options={[ - { value: 'auto', message: messages.layout_auto }, - { value: 'multiple', message: messages.layout_desktop }, - { value: 'single', message: messages.layout_mobile }, + { value: 'auto', message: intl.formatMessage(messages.layout_auto) }, + { value: 'multiple', message: intl.formatMessage(messages.layout_desktop) }, + { value: 'single', message: intl.formatMessage(messages.layout_mobile) }, ]} onChange={this.props.changeSetting} > diff --git a/app/javascript/glitch/components/settings/item.js b/app/javascript/glitch/components/settings/item.js new file mode 100644 index 000000000..4c67cc2ac --- /dev/null +++ b/app/javascript/glitch/components/settings/item.js @@ -0,0 +1,79 @@ +// Package imports // +import React from 'react'; +import PropTypes from 'prop-types'; +import ImmutablePropTypes from 'react-immutable-proptypes'; + +export default class SettingsItem extends React.PureComponent { + + static propTypes = { + settings: ImmutablePropTypes.map.isRequired, + item: PropTypes.array.isRequired, + id: PropTypes.string.isRequired, + options: PropTypes.arrayOf(PropTypes.shape({ + value: PropTypes.string.isRequired, + message: PropTypes.object.isRequired, + })), + dependsOn: PropTypes.array, + dependsOnNot: PropTypes.array, + children: PropTypes.element.isRequired, + onChange: PropTypes.func.isRequired, + }; + + handleChange = (e) => { + const { item, onChange } = this.props; + onChange(item, e); + } + + render () { + const { settings, item, id, options, children, dependsOn, dependsOnNot } = this.props; + let enabled = true; + + if (dependsOn) { + for (let i = 0; i < dependsOn.length; i++) { + enabled = enabled && settings.getIn(dependsOn[i]); + } + } + if (dependsOnNot) { + for (let i = 0; i < dependsOnNot.length; i++) { + enabled = enabled && !settings.getIn(dependsOnNot[i]); + } + } + + if (options && options.length > 0) { + const currentValue = settings.getIn(item); + const optionElems = options && options.length > 0 && options.map((opt) => ( + <option key={opt.value} selected={currentValue === opt.value} value={opt.value} > + {opt.message} + </option> + )); + return ( + <label htmlFor={id}> + <p>{children}</p> + <p> + <select + id={id} + disabled={!enabled} + onBlur={this.handleChange} + > + {optionElems} + </select> + </p> + </label> + ); + } else { + return ( + <label htmlFor={id}> + <input + id={id} + type='checkbox' + checked={settings.getIn(item)} + onChange={this.handleChange} + disabled={!enabled} + /> + {children} + </label> + ); + } + } + +} diff --git a/app/javascript/mastodon/components/status_action_bar.js b/app/javascript/glitch/components/status/action_bar.js index c26261d1a..f298dcaa8 100644 --- a/app/javascript/mastodon/components/status_action_bar.js +++ b/app/javascript/glitch/components/status/action_bar.js @@ -1,11 +1,14 @@ +// Package imports // import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import IconButton from './icon_button'; -import DropdownMenu from './dropdown_menu'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import RelativeTimestamp from './relative_timestamp'; + +// Mastodon imports // +import RelativeTimestamp from '../../../mastodon/components/relative_timestamp'; +import IconButton from '../../../mastodon/components/icon_button'; +import DropdownMenu from '../../../mastodon/components/dropdown_menu'; const messages = defineMessages({ delete: { id: 'status.delete', defaultMessage: 'Delete' }, diff --git a/app/javascript/mastodon/components/status_content.js b/app/javascript/glitch/components/status/content.js index 26103e1a3..76f5b765a 100644 --- a/app/javascript/mastodon/components/status_content.js +++ b/app/javascript/glitch/components/status/content.js @@ -1,11 +1,14 @@ +// Package imports // import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import escapeTextContentForBrowser from 'escape-html'; import PropTypes from 'prop-types'; -import emojify from '../emoji'; -import { isRtl } from '../rtl'; import { FormattedMessage } from 'react-intl'; -import Permalink from './permalink'; + +// Mastodon imports // +import emojify from '../../../mastodon/emoji'; +import { isRtl } from '../../../mastodon/rtl'; +import Permalink from '../../../mastodon/components/permalink'; export default class StatusContent extends React.PureComponent { diff --git a/app/javascript/glitch/components/status/gallery/index.js b/app/javascript/glitch/components/status/gallery/index.js new file mode 100644 index 000000000..ae03dc08d --- /dev/null +++ b/app/javascript/glitch/components/status/gallery/index.js @@ -0,0 +1,79 @@ +// Package imports // +import React from 'react'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import PropTypes from 'prop-types'; +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; + +// Mastodon imports // +import IconButton from '../../../../mastodon/components/icon_button'; + +// Our imports // +import StatusGalleryItem from './item'; + +const messages = defineMessages({ + toggle_visible: { id: 'media_gallery.toggle_visible', defaultMessage: 'Toggle visibility' }, +}); + +@injectIntl +export default class StatusGallery extends React.PureComponent { + + static propTypes = { + sensitive: PropTypes.bool, + media: ImmutablePropTypes.list.isRequired, + letterbox: PropTypes.bool, + fullwidth: PropTypes.bool, + height: PropTypes.number.isRequired, + onOpenMedia: PropTypes.func.isRequired, + intl: PropTypes.object.isRequired, + autoPlayGif: PropTypes.bool.isRequired, + }; + + state = { + visible: !this.props.sensitive, + }; + + handleOpen = () => { + this.setState({ visible: !this.state.visible }); + } + + handleClick = (index) => { + this.props.onOpenMedia(this.props.media, index); + } + + render () { + const { media, intl, sensitive, letterbox, fullwidth } = this.props; + + let children; + + if (!this.state.visible) { + let warning; + + if (sensitive) { + warning = <FormattedMessage id='status.sensitive_warning' defaultMessage='Sensitive content' />; + } else { + warning = <FormattedMessage id='status.media_hidden' defaultMessage='Media hidden' />; + } + + children = ( + <div role='button' tabIndex='0' className='media-spoiler' onClick={this.handleOpen}> + <span className='media-spoiler__warning'>{warning}</span> + <span className='media-spoiler__trigger'><FormattedMessage id='status.sensitive_toggle' defaultMessage='Click to view' /></span> + </div> + ); + } else { + const size = media.take(4).size; + children = media.take(4).map((attachment, i) => <StatusGalleryItem key={attachment.get('id')} onClick={this.handleClick} attachment={attachment} autoPlayGif={this.props.autoPlayGif} index={i} size={size} letterbox={letterbox} />); + } + + return ( + <div className={`media-gallery ${fullwidth ? 'full-width' : ''}`} style={{ height: `${this.props.height}px` }}> + <div className={`spoiler-button ${this.state.visible ? 'spoiler-button--visible' : ''}`}> + <IconButton title={intl.formatMessage(messages.toggle_visible)} icon={this.state.visible ? 'eye' : 'eye-slash'} overlay onClick={this.handleOpen} /> + </div> + + {children} + </div> + ); + } + +} diff --git a/app/javascript/mastodon/components/media_gallery.js b/app/javascript/glitch/components/status/gallery/item.js index a71c94ef2..d646825a3 100644 --- a/app/javascript/mastodon/components/media_gallery.js +++ b/app/javascript/glitch/components/status/gallery/item.js @@ -1,15 +1,12 @@ +// Package imports // import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import IconButton from './icon_button'; -import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import { isIOS } from '../is_mobile'; -const messages = defineMessages({ - toggle_visible: { id: 'media_gallery.toggle_visible', defaultMessage: 'Toggle visibility' }, -}); +// Mastodon imports // +import { isIOS } from '../../../../mastodon/is_mobile'; -class Item extends React.PureComponent { +export default class StatusGalleryItem extends React.PureComponent { static propTypes = { attachment: ImmutablePropTypes.map.isRequired, @@ -133,67 +130,3 @@ class Item extends React.PureComponent { } } - -@injectIntl -export default class MediaGallery extends React.PureComponent { - - static propTypes = { - sensitive: PropTypes.bool, - media: ImmutablePropTypes.list.isRequired, - letterbox: PropTypes.bool, - fullwidth: PropTypes.bool, - height: PropTypes.number.isRequired, - onOpenMedia: PropTypes.func.isRequired, - intl: PropTypes.object.isRequired, - autoPlayGif: PropTypes.bool.isRequired, - }; - - state = { - visible: !this.props.sensitive, - }; - - handleOpen = () => { - this.setState({ visible: !this.state.visible }); - } - - handleClick = (index) => { - this.props.onOpenMedia(this.props.media, index); - } - - render () { - const { media, intl, sensitive, letterbox, fullwidth } = this.props; - - let children; - - if (!this.state.visible) { - let warning; - - if (sensitive) { - warning = <FormattedMessage id='status.sensitive_warning' defaultMessage='Sensitive content' />; - } else { - warning = <FormattedMessage id='status.media_hidden' defaultMessage='Media hidden' />; - } - - children = ( - <div role='button' tabIndex='0' className='media-spoiler' onClick={this.handleOpen}> - <span className='media-spoiler__warning'>{warning}</span> - <span className='media-spoiler__trigger'><FormattedMessage id='status.sensitive_toggle' defaultMessage='Click to view' /></span> - </div> - ); - } else { - const size = media.take(4).size; - children = media.take(4).map((attachment, i) => <Item key={attachment.get('id')} onClick={this.handleClick} attachment={attachment} autoPlayGif={this.props.autoPlayGif} index={i} size={size} letterbox={letterbox} />); - } - - return ( - <div className={`media-gallery ${fullwidth ? 'full-width' : ''}`} style={{ height: `${this.props.height}px` }}> - <div className={`spoiler-button ${this.state.visible ? 'spoiler-button--visible' : ''}`}> - <IconButton title={intl.formatMessage(messages.toggle_visible)} icon={this.state.visible ? 'eye' : 'eye-slash'} overlay onClick={this.handleOpen} /> - </div> - - {children} - </div> - ); - } - -} diff --git a/app/javascript/mastodon/components/status_header.js b/app/javascript/glitch/components/status/header.js index ce7f942b1..78aef1ed5 100644 --- a/app/javascript/mastodon/components/status_header.js +++ b/app/javascript/glitch/components/status/header.js @@ -18,19 +18,17 @@ Imports: */ -// Our standard React imports: +// Package imports // import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; - -// We will need internationalization in this component: import { defineMessages, injectIntl } from 'react-intl'; -// The various components used when constructing our header: -import Avatar from './avatar'; -import AvatarOverlay from './avatar_overlay'; -import DisplayName from './display_name'; -import IconButton from './icon_button'; +// Mastodon imports // +import Avatar from '../../../mastodon/components/avatar'; +import AvatarOverlay from '../../../mastodon/components/avatar_overlay'; +import DisplayName from '../../../mastodon/components/display_name'; +import IconButton from '../../../mastodon/components/icon_button'; /* * * * */ diff --git a/app/javascript/mastodon/components/status.js b/app/javascript/glitch/components/status/index.js index e19f194b8..a11cc0b6e 100644 --- a/app/javascript/mastodon/components/status.js +++ b/app/javascript/glitch/components/status/index.js @@ -31,27 +31,22 @@ Imports: */ -// Our standard React imports: +// Package imports // import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; - -// `ImmutablePureComponent` gives us `updateOnProps` and -// `updateOnStates`: import ImmutablePureComponent from 'react-immutable-pure-component'; -// These are our various media types: -import MediaGallery from './media_gallery'; -import VideoPlayer from './video_player'; - -// These are our core status components: -import StatusPrepend from './status_prepend'; -import StatusHeader from './status_header'; -import StatusContent from './status_content'; -import StatusActionBar from './status_action_bar'; +// Mastodon imports // +import scheduleIdleTask from '../../../mastodon/features/ui/util/schedule_idle_task'; -// This is used to schedule tasks at the browser's convenience: -import scheduleIdleTask from '../features/ui/util/schedule_idle_task'; +// Our imports // +import StatusPrepend from './prepend'; +import StatusHeader from './header'; +import StatusContent from './content'; +import StatusActionBar from './action_bar'; +import StatusGallery from './gallery'; +import StatusVideoPlayer from './video_player'; /* * * * */ @@ -622,7 +617,7 @@ backgrounds for collapsed statuses are enabled. attachments.getIn([0, 'type']) === 'video' ) { media = ( // Media type is 'video' - <VideoPlayer + <StatusVideoPlayer media={attachments.get(0)} sensitive={status.get('sensitive')} letterbox={settings.getIn(['media', 'letterbox'])} @@ -634,7 +629,7 @@ backgrounds for collapsed statuses are enabled. mediaIcon = 'video-camera'; } else { // Media type is 'image' or 'gifv' media = ( - <MediaGallery + <StatusGallery media={attachments} sensitive={status.get('sensitive')} letterbox={settings.getIn(['media', 'letterbox'])} diff --git a/app/javascript/mastodon/components/status_prepend.js b/app/javascript/glitch/components/status/prepend.js index 34ccee358..ef9209e81 100644 --- a/app/javascript/mastodon/components/status_prepend.js +++ b/app/javascript/glitch/components/status/prepend.js @@ -18,16 +18,16 @@ Imports: */ -// Our standard React imports: +// Package imports // import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; - -// This helps us process our text: -import emojify from '../emoji'; import escapeTextContentForBrowser from 'escape-html'; import { FormattedMessage } from 'react-intl'; +// Mastodon imports // +import emojify from '../../../mastodon/emoji'; + /* * * * */ /* diff --git a/app/javascript/mastodon/components/video_player.js b/app/javascript/glitch/components/status/video_player.js index 5e43ee7e6..6583107c8 100644 --- a/app/javascript/mastodon/components/video_player.js +++ b/app/javascript/glitch/components/status/video_player.js @@ -1,9 +1,12 @@ +// Package imports // import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import IconButton from './icon_button'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import { isIOS } from '../is_mobile'; + +// Mastodon imports // +import IconButton from '../../../mastodon/components/icon_button'; +import { isIOS } from '../../../mastodon/is_mobile'; const messages = defineMessages({ toggle_sound: { id: 'video_player.toggle_sound', defaultMessage: 'Toggle sound' }, @@ -12,7 +15,7 @@ const messages = defineMessages({ }); @injectIntl -export default class VideoPlayer extends React.PureComponent { +export default class StatusVideoPlayer extends React.PureComponent { static propTypes = { media: ImmutablePropTypes.map.isRequired, diff --git a/app/javascript/glitch/containers/compose/advanced_options.js b/app/javascript/glitch/containers/compose/advanced_options.js new file mode 100644 index 000000000..f8b7354ff --- /dev/null +++ b/app/javascript/glitch/containers/compose/advanced_options.js @@ -0,0 +1,22 @@ +// Package imports // +import { connect } from 'react-redux'; + +// Mastodon imports // +import { changeComposeAdvancedOption } from '../../../mastodon/actions/compose'; + +// Our imports // +import ComposeAdvancedOptions from '../../components/compose/advanced_options'; + +const mapStateToProps = state => ({ + values: state.getIn(['compose', 'advanced_options']), +}); + +const mapDispatchToProps = dispatch => ({ + + onChange (option) { + dispatch(changeComposeAdvancedOption(option)); + }, + +}); + +export default connect(mapStateToProps, mapDispatchToProps)(ComposeAdvancedOptions); diff --git a/app/javascript/mastodon/features/notifications/containers/notification_container.js b/app/javascript/glitch/containers/notification/index.js index 66baf98a1..783c838ae 100644 --- a/app/javascript/mastodon/features/notifications/containers/notification_container.js +++ b/app/javascript/glitch/containers/notification/index.js @@ -1,6 +1,11 @@ +// Package imports // import { connect } from 'react-redux'; -import { makeGetNotification } from '../../../selectors'; -import Notification from '../components/notification'; + +// Mastodon imports // +import { makeGetNotification } from '../../../mastodon/selectors'; + +// Our imports // +import Notification from '../../components/notification'; const makeMapStateToProps = () => { const getNotification = makeGetNotification(); diff --git a/app/javascript/mastodon/features/ui/containers/settings_modal_container.js b/app/javascript/glitch/containers/settings/index.js index 571f028ed..6034935eb 100644 --- a/app/javascript/mastodon/features/ui/containers/settings_modal_container.js +++ b/app/javascript/glitch/containers/settings/index.js @@ -1,7 +1,12 @@ +// Package imports // import { connect } from 'react-redux'; -import { changeLocalSetting } from '../../../actions/local_settings'; -import { closeModal } from '../../../actions/modal'; -import SettingsModal from '../components/settings_modal'; + +// Mastodon imports // +import { closeModal } from '../../../mastodon/actions/modal'; + +// Our imports // +import { changeLocalSetting } from '../../actions/local_settings'; +import Settings from '../../components/settings'; const mapStateToProps = state => ({ settings: state.get('local_settings'), @@ -19,4 +24,4 @@ const mapDispatchToProps = dispatch => ({ }, }); -export default connect(mapStateToProps, mapDispatchToProps)(SettingsModal); +export default connect(mapStateToProps, mapDispatchToProps)(Settings); diff --git a/app/javascript/mastodon/containers/status_container.js b/app/javascript/glitch/containers/status/index.js index 4c0829fd0..baf898e97 100644 --- a/app/javascript/mastodon/containers/status_container.js +++ b/app/javascript/glitch/containers/status/index.js @@ -18,45 +18,41 @@ Imports: */ -// Our standard React/Redux imports: +// Package imports // import React from 'react'; import { connect } from 'react-redux'; +import { + defineMessages, + injectIntl, + FormattedMessage, +} from 'react-intl'; -// Our `<Status>`: -import Status from '../components/status'; - -// This selector helps us get our status from the store: -import { makeGetStatus } from '../selectors'; - -// These are our various `<Status>`-related actions: +// Mastodon imports // +import { makeGetStatus } from '../../../mastodon/selectors'; import { replyCompose, mentionCompose, -} from '../actions/compose'; +} from '../../../mastodon/actions/compose'; import { reblog, favourite, unreblog, unfavourite, -} from '../actions/interactions'; +} from '../../../mastodon/actions/interactions'; import { blockAccount, muteAccount, -} from '../actions/accounts'; +} from '../../../mastodon/actions/accounts'; import { muteStatus, unmuteStatus, deleteStatus, -} from '../actions/statuses'; -import { initReport } from '../actions/reports'; -import { openModal } from '../actions/modal'; +} from '../../../mastodon/actions/statuses'; +import { initReport } from '../../../mastodon/actions/reports'; +import { openModal } from '../../../mastodon/actions/modal'; -// We will need internationalization in this component: -import { - defineMessages, - injectIntl, - FormattedMessage, -} from 'react-intl'; +// Our imports // +import Status from '../../components/status'; /* * * * */ diff --git a/app/javascript/mastodon/reducers/local_settings.js b/app/javascript/glitch/reducers/local_settings.js index 0b5354797..db99f2c46 100644 --- a/app/javascript/mastodon/reducers/local_settings.js +++ b/app/javascript/glitch/reducers/local_settings.js @@ -1,7 +1,12 @@ -import { LOCAL_SETTING_CHANGE } from '../actions/local_settings'; -import { STORE_HYDRATE } from '../actions/store'; +// Package imports // import Immutable from 'immutable'; +// Mastodon imports // +import { STORE_HYDRATE } from '../../mastodon/actions/store'; + +// Our imports // +import { LOCAL_SETTING_CHANGE } from '../actions/local_settings'; + const initialState = Immutable.fromJS({ layout : 'auto', stretch : true, diff --git a/app/javascript/mastodon/features/account/util/bio_metadata.js b/app/javascript/glitch/util/bio_metadata.js index bdbb1750b..bdbb1750b 100644 --- a/app/javascript/mastodon/features/account/util/bio_metadata.js +++ b/app/javascript/glitch/util/bio_metadata.js diff --git a/app/javascript/mastodon/components/status_list.js b/app/javascript/mastodon/components/status_list.js index 5bc46e8ee..b5c6c2053 100644 --- a/app/javascript/mastodon/components/status_list.js +++ b/app/javascript/mastodon/components/status_list.js @@ -2,7 +2,7 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { ScrollContainer } from 'react-router-scroll'; import PropTypes from 'prop-types'; -import StatusContainer from '../containers/status_container'; +import StatusContainer from '../../glitch/containers/status'; import LoadMore from './load_more'; import ImmutablePureComponent from 'react-immutable-pure-component'; import IntersectionObserverWrapper from '../features/ui/util/intersection_observer_wrapper'; diff --git a/app/javascript/mastodon/features/account_timeline/components/header.js b/app/javascript/mastodon/features/account_timeline/components/header.js index 167a2097e..09883d7d6 100644 --- a/app/javascript/mastodon/features/account_timeline/components/header.js +++ b/app/javascript/mastodon/features/account_timeline/components/header.js @@ -1,7 +1,7 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import InnerHeader from '../../account/components/header'; +import InnerHeader from '../../../../glitch/components/account/header'; import ActionBar from '../../account/components/action_bar'; import MissingIndicator from '../../../components/missing_indicator'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/compose/components/compose_form.js b/app/javascript/mastodon/features/compose/components/compose_form.js index 3559e4c82..313635443 100644 --- a/app/javascript/mastodon/features/compose/components/compose_form.js +++ b/app/javascript/mastodon/features/compose/components/compose_form.js @@ -11,7 +11,7 @@ import { defineMessages, injectIntl } from 'react-intl'; import Collapsable from '../../../components/collapsable'; import SpoilerButtonContainer from '../containers/spoiler_button_container'; import PrivacyDropdownContainer from '../containers/privacy_dropdown_container'; -import AdvancedOptionsContainer from '../containers/advanced_options_container'; +import ComposeAdvancedOptionsContainer from '../../../../glitch/containers/compose/advanced_options'; import SensitiveButtonContainer from '../containers/sensitive_button_container'; import EmojiPickerDropdown from './emoji_picker_dropdown'; import UploadFormContainer from '../containers/upload_form_container'; @@ -196,7 +196,7 @@ export default class ComposeForm extends ImmutablePureComponent { <div className='compose-form__buttons'> <UploadButtonContainer /> <PrivacyDropdownContainer /> - <AdvancedOptionsContainer /> + <ComposeAdvancedOptionsContainer /> <SensitiveButtonContainer /> <SpoilerButtonContainer /> </div> diff --git a/app/javascript/mastodon/features/compose/components/search_results.js b/app/javascript/mastodon/features/compose/components/search_results.js index ae4d1e86a..3d1c3ca5e 100644 --- a/app/javascript/mastodon/features/compose/components/search_results.js +++ b/app/javascript/mastodon/features/compose/components/search_results.js @@ -2,7 +2,7 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { FormattedMessage } from 'react-intl'; import AccountContainer from '../../../containers/account_container'; -import StatusContainer from '../../../containers/status_container'; +import StatusContainer from '../../../../glitch/containers/status'; import Link from 'react-router-dom/Link'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/compose/containers/advanced_options_container.js b/app/javascript/mastodon/features/compose/containers/advanced_options_container.js deleted file mode 100644 index 01a9c9a72..000000000 --- a/app/javascript/mastodon/features/compose/containers/advanced_options_container.js +++ /dev/null @@ -1,17 +0,0 @@ -import { connect } from 'react-redux'; -import AdvancedOptionsDropdown from '../components/advanced_options_dropdown'; -import { changeComposeAdvancedOption } from '../../../actions/compose'; - -const mapStateToProps = state => ({ - values: state.getIn(['compose', 'advanced_options']), -}); - -const mapDispatchToProps = dispatch => ({ - - onChange (option) { - dispatch(changeComposeAdvancedOption(option)); - }, - -}); - -export default connect(mapStateToProps, mapDispatchToProps)(AdvancedOptionsDropdown); \ No newline at end of file diff --git a/app/javascript/mastodon/features/compose/index.js b/app/javascript/mastodon/features/compose/index.js index 537e425d9..3ec205f2c 100644 --- a/app/javascript/mastodon/features/compose/index.js +++ b/app/javascript/mastodon/features/compose/index.js @@ -5,7 +5,7 @@ import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { mountCompose, unmountCompose } from '../../actions/compose'; import { openModal } from '../../actions/modal'; -import { changeLocalSetting } from '../../actions/local_settings'; +import { changeLocalSetting } from '../../../glitch/actions/local_settings'; import Link from 'react-router-dom/Link'; import { injectIntl, defineMessages } from 'react-intl'; import SearchContainer from './containers/search_container'; diff --git a/app/javascript/mastodon/features/notifications/index.js b/app/javascript/mastodon/features/notifications/index.js index ed4b3ad98..d4e1555b2 100644 --- a/app/javascript/mastodon/features/notifications/index.js +++ b/app/javascript/mastodon/features/notifications/index.js @@ -6,7 +6,7 @@ import Column from '../../components/column'; import ColumnHeader from '../../components/column_header'; import { expandNotifications, scrollTopNotifications } from '../../actions/notifications'; import { addColumn, removeColumn, moveColumn } from '../../actions/columns'; -import NotificationContainer from './containers/notification_container'; +import NotificationContainer from '../../../glitch/containers/notification'; import { ScrollContainer } from 'react-router-scroll'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ColumnSettingsContainer from './containers/column_settings_container'; diff --git a/app/javascript/mastodon/features/status/components/detailed_status.js b/app/javascript/mastodon/features/status/components/detailed_status.js index 277b79810..db0181f23 100644 --- a/app/javascript/mastodon/features/status/components/detailed_status.js +++ b/app/javascript/mastodon/features/status/components/detailed_status.js @@ -3,9 +3,9 @@ import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import Avatar from '../../../components/avatar'; import DisplayName from '../../../components/display_name'; -import StatusContent from '../../../components/status_content'; -import MediaGallery from '../../../components/media_gallery'; -import VideoPlayer from '../../../components/video_player'; +import StatusContent from '../../../../glitch/components/status/content'; +import StatusGallery from '../../../../glitch/components/status/gallery'; +import StatusVideoPlayer from '../../../../glitch/components/status/video_player'; import AttachmentList from '../../../components/attachment_list'; import Link from 'react-router-dom/Link'; import { FormattedDate, FormattedNumber } from 'react-intl'; @@ -48,7 +48,7 @@ export default class DetailedStatus extends ImmutablePureComponent { media = <AttachmentList media={status.get('media_attachments')} />; } else if (status.getIn(['media_attachments', 0, 'type']) === 'video') { media = ( - <VideoPlayer + <StatusVideoPlayer sensitive={status.get('sensitive')} media={status.getIn(['media_attachments', 0])} letterbox={settings.getIn(['media', 'letterbox'])} @@ -60,7 +60,7 @@ export default class DetailedStatus extends ImmutablePureComponent { mediaIcon = 'video-camera'; } else { media = ( - <MediaGallery + <StatusGallery sensitive={status.get('sensitive')} media={status.get('media_attachments')} letterbox={settings.getIn(['media', 'letterbox'])} diff --git a/app/javascript/mastodon/features/status/index.js b/app/javascript/mastodon/features/status/index.js index 5ec26c2d5..b24beadd2 100644 --- a/app/javascript/mastodon/features/status/index.js +++ b/app/javascript/mastodon/features/status/index.js @@ -22,7 +22,7 @@ import { initReport } from '../../actions/reports'; import { makeGetStatus } from '../../selectors'; import { ScrollContainer } from 'react-router-scroll'; import ColumnBackButton from '../../components/column_back_button'; -import StatusContainer from '../../containers/status_container'; +import StatusContainer from '../../../glitch/containers/status'; import { openModal } from '../../actions/modal'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/ui/components/boost_modal.js b/app/javascript/mastodon/features/ui/components/boost_modal.js index 6c80a1084..a1b0cf4bd 100644 --- a/app/javascript/mastodon/features/ui/components/boost_modal.js +++ b/app/javascript/mastodon/features/ui/components/boost_modal.js @@ -3,7 +3,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import Button from '../../../components/button'; -import StatusContent from '../../../components/status_content'; +import StatusContent from '../../../../glitch/components/status/content'; import Avatar from '../../../components/avatar'; import RelativeTimestamp from '../../../components/relative_timestamp'; import DisplayName from '../../../components/display_name'; diff --git a/app/javascript/mastodon/features/ui/components/modal_root.js b/app/javascript/mastodon/features/ui/components/modal_root.js index 3e3894441..3777c1bf6 100644 --- a/app/javascript/mastodon/features/ui/components/modal_root.js +++ b/app/javascript/mastodon/features/ui/components/modal_root.js @@ -6,7 +6,7 @@ import VideoModal from './video_modal'; import BoostModal from './boost_modal'; import ConfirmationModal from './confirmation_modal'; import ReportModal from './report_modal'; -import SettingsModal from '../containers/settings_modal_container'; +import SettingsContainer from '../../../../glitch/containers/settings'; import TransitionMotion from 'react-motion/lib/TransitionMotion'; import spring from 'react-motion/lib/spring'; @@ -17,7 +17,7 @@ const MODAL_COMPONENTS = { 'BOOST': BoostModal, 'CONFIRM': ConfirmationModal, 'REPORT': ReportModal, - 'SETTINGS': SettingsModal, + 'SETTINGS': SettingsContainer, }; export default class ModalRoot extends React.PureComponent { diff --git a/app/javascript/mastodon/reducers/index.js b/app/javascript/mastodon/reducers/index.js index 0749a4e4a..a3f5cb58e 100644 --- a/app/javascript/mastodon/reducers/index.js +++ b/app/javascript/mastodon/reducers/index.js @@ -14,7 +14,7 @@ import relationships from './relationships'; import search from './search'; import notifications from './notifications'; import settings from './settings'; -import local_settings from './local_settings'; +import local_settings from '../../glitch/reducers/local_settings'; import status_lists from './status_lists'; import cards from './cards'; import reports from './reports'; diff --git a/app/javascript/packs/public.js b/app/javascript/packs/public.js index ae903cdd3..8a3ae0b3c 100644 --- a/app/javascript/packs/public.js +++ b/app/javascript/packs/public.js @@ -4,7 +4,7 @@ import { delegate } from 'rails-ujs'; import emojify from '../mastodon/emoji'; import { getLocale } from '../mastodon/locales'; import loadPolyfills from '../mastodon/load_polyfills'; -import { processBio } from '../mastodon/features/account/util/bio_metadata'; +import { processBio } from '../glitch/util/bio_metadata'; require.context('../images/', true); |