diff --git a/client/coral-configure/components/CloseCommentsInfo.js b/client/coral-configure/components/CloseCommentsInfo.js deleted file mode 100644 index d10419f3f..000000000 --- a/client/coral-configure/components/CloseCommentsInfo.js +++ /dev/null @@ -1,29 +0,0 @@ -import React from 'react'; -import {Button} from 'coral-ui'; -import PropTypes from 'prop-types'; -import t from 'coral-framework/services/i18n'; - -const CloseCommentsInfo = ({status, onClick}) => ( - status === 'open' ? ( -
-

- {t('configure.open_stream_configuration')} -

- -
- ) : ( -
-

- {t('configure.close_stream_configuration')} -

- -
- ) -); - -CloseCommentsInfo.propTypes = { - status: PropTypes.string, - onClick: PropTypes.func, -}; - -export default CloseCommentsInfo; \ No newline at end of file diff --git a/client/coral-configure/components/ConfigureCommentStream.css b/client/coral-configure/components/ConfigureCommentStream.css deleted file mode 100644 index 5575e073b..000000000 --- a/client/coral-configure/components/ConfigureCommentStream.css +++ /dev/null @@ -1,35 +0,0 @@ -.container { - position: relative; -} - -.apply { - float: right; - margin: 0 10px; -} - -.wrapper ul { - list-style: none; - padding: 0; -} - -.checkbox { - vertical-align: top; - margin: 12px 12px 12px 0; -} - -.wrapper h4 { - font-size: 14px; - margin-bottom: 5px; -} - -.wrapper p { - max-width: 380px; -} - -.wrapper { - margin-bottom: 20px; -} - -.hidden { - display: none; -} \ No newline at end of file diff --git a/client/coral-configure/components/ConfigureCommentStream.js b/client/coral-configure/components/ConfigureCommentStream.js deleted file mode 100644 index 20250ee86..000000000 --- a/client/coral-configure/components/ConfigureCommentStream.js +++ /dev/null @@ -1,71 +0,0 @@ -import React from 'react'; -import {Button, Checkbox} from 'coral-ui'; -import QuestionBoxBuilder from './QuestionBoxBuilder'; -import cn from 'classnames'; - -import styles from './ConfigureCommentStream.css'; - -import t from 'coral-framework/services/i18n'; - -export default ({handleChange, handleApply, changed, ...props}) => ( -
-
-
-

{t('configure.title')}

- -

{t('configure.description')}

-
- -
-
-); diff --git a/client/coral-configure/components/DefaultIcon.css b/client/coral-configure/components/DefaultIcon.css deleted file mode 100644 index 6125d2f6a..000000000 --- a/client/coral-configure/components/DefaultIcon.css +++ /dev/null @@ -1,27 +0,0 @@ -.iconBubble{ - position: absolute; - top: 8px; - left: 10px; - color: #9E9E9E; - font-size: 24px; - z-index: 0; -} - -.iconPerson{ - z-index: 2; - top: 12px; - left: 12px; - position: absolute; - font-size: 33px; - color: #262626; -} - -.qbIconContainer { - position: relative; - border: 0; - color: white; - display: inline-block; - padding: 5px 20px; - vertical-align: middle; - width: 10px; -} \ No newline at end of file diff --git a/client/coral-configure/components/DefaultIcon.js b/client/coral-configure/components/DefaultIcon.js deleted file mode 100644 index 5f6f4876c..000000000 --- a/client/coral-configure/components/DefaultIcon.js +++ /dev/null @@ -1,13 +0,0 @@ -import React from 'react'; -import cn from 'classnames'; -import styles from './DefaultIcon.css'; -import {Icon} from 'coral-ui'; - -const DefaultIcon = ({className}) => ( -
- - -
-); - -export default DefaultIcon; diff --git a/client/coral-configure/components/Markdown.js b/client/coral-configure/components/Markdown.js deleted file mode 100644 index d9d1bc4a7..000000000 --- a/client/coral-configure/components/Markdown.js +++ /dev/null @@ -1,24 +0,0 @@ -import React, {PureComponent} from 'react'; -import PropTypes from 'prop-types'; -import marked from 'marked'; - -const renderer = new marked.Renderer(); - -// Set link target to `_parent` to work properly in an embed. -renderer.link = (href, title, text) => - `${text}`; - -marked.setOptions({renderer}); - -export default class Markdown extends PureComponent { - render() { - const {content, ...rest} = this.props; - const __html = marked(content); - return
; - } -} - -Markdown.propTypes = { - content: PropTypes.string, -}; - diff --git a/client/coral-configure/components/QuestionBoxBuilder.css b/client/coral-configure/components/QuestionBoxBuilder.css deleted file mode 100644 index 758f350b9..000000000 --- a/client/coral-configure/components/QuestionBoxBuilder.css +++ /dev/null @@ -1,45 +0,0 @@ -.qbBuilder { - margin-left: 50px; -} - -.qbItemIconList { - padding: 0; - margin: 10px 0; -} - -.qbItemIcon { - background: #F0F0F0; - width: 45px; - height: 45px; - font-size: 24px; - text-align: center; - line-height: 45px; - color: #252525; - border-radius: 3px; - display: inline-block; - overflow: hidden; - margin-right: 10px; - position: relative; - border: solid 2px #F0F0F0; - transition: border 0.3s cubic-bezier(.4,0,.2,1); -} - -.qbItemIcon:hover { - cursor: pointer; -} - -.qbItemIconActive { - border: solid 2px #00796B; -} - -.defaultIcon { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; -} - -.qb { - margin: 10px 0; -} \ No newline at end of file diff --git a/client/coral-configure/components/QuestionBoxBuilder.js b/client/coral-configure/components/QuestionBoxBuilder.js deleted file mode 100644 index 28dfc30b3..000000000 --- a/client/coral-configure/components/QuestionBoxBuilder.js +++ /dev/null @@ -1,98 +0,0 @@ -import React from 'react'; -import QuestionBox from 'talk-plugin-questionbox/QuestionBox'; -import {Icon, Spinner} from 'coral-ui'; -import DefaultIcon from './DefaultIcon'; -import cn from 'classnames'; -import styles from './QuestionBoxBuilder.css'; - -class QuestionBoxBuilder extends React.Component { - constructor() { - super(); - - this.state = { - loading: true - }; - } - - componentWillMount() { - this.loadEditor(); - } - - async loadEditor() { - const {default: MarkdownEditor} = await import('coral-framework/components/MarkdownEditor'); - - return this.setState({ - loading : false, - MarkdownEditor - }); - } - - render() { - const {handleChange, questionBoxIcon, questionBoxContent} = this.props; - const {loading, MarkdownEditor} = this.state; - - if (loading) { - return ; - } - - return ( -
-

Include an Icon

- -
    -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
- - - - handleChange({}, {questionBoxContent: value})} - /> - -
- ); - } -} - -export default QuestionBoxBuilder; diff --git a/client/coral-configure/containers/ConfigureStreamContainer.js b/client/coral-configure/containers/ConfigureStreamContainer.js deleted file mode 100644 index 0ab71c1d7..000000000 --- a/client/coral-configure/containers/ConfigureStreamContainer.js +++ /dev/null @@ -1,145 +0,0 @@ -import React, {Component} from 'react'; -import {connect} from 'react-redux'; -import {compose} from 'react-apollo'; -import PropTypes from 'prop-types'; -import {updateOpenStatus, updateConfiguration} from 'coral-embed-stream/src/actions/asset'; -import CloseCommentsInfo from '../components/CloseCommentsInfo'; -import ConfigureCommentStream from '../components/ConfigureCommentStream'; -import t, {timeago} from 'coral-framework/services/i18n'; - -class ConfigureStreamContainer extends Component { - constructor (props) { - super(props); - - this.state = { - changed: false, - dirtySettings: {...props.asset.settings}, - closedAt: !props.asset.isClosed ? 'open' : 'closed' - }; - - this.toggleStatus = this.toggleStatus.bind(this); - this.handleChange = this.handleChange.bind(this); - this.handleApply = this.handleApply.bind(this); - } - - handleApply (e) { - e.preventDefault(); - const {elements} = e.target; - const {questionBoxIcon, questionBoxContent} = this.state.dirtySettings; - const premod = elements.premod.checked; - const questionBoxEnable = elements.qboxenable.checked; - const premodLinksEnable = elements.plinksenable.checked; - const {changed} = this.state; - - const newConfig = { - moderation: premod ? 'PRE' : 'POST', - questionBoxEnable, - questionBoxContent, - questionBoxIcon, - premodLinksEnable - }; - - if (changed) { - this.props.updateConfiguration(newConfig); - setTimeout(() => { - this.setState({ - changed: false - }); - }, 300); - } - } - - handleChange (e, newChanges) { - let changes = {}; - - if (changes) { - changes = {...newChanges}; - } - - if (e.target && e.target.id === 'qboxenable') { - changes.questionBoxEnable = e.target.checked; - } - if (e.currentTarget && e.currentTarget.id === 'qboxicon') { - changes.questionBoxIcon = e.currentTarget.dataset.icon; - } - if (e.target && e.target.id === 'plinksenable') { - changes.premodLinksEnable = e.target.value; - } - - this.setState({ - changed: true, - dirtySettings: { - ...this.state.dirtySettings, - ...changes, - }, - }); - } - - toggleStatus () { - - // update the closedAt status for the asset - this.props.updateStatus( - this.state.closedAt === 'open' ? 'closed' : 'open' - ); - this.setState({ - closedAt: (this.state.closedAt === 'open' ? 'closed' : 'open') - }); - } - - getClosedIn () { - const {closedTimeout} = this.props.asset.settings; - const {created_at} = this.props.asset; - - return timeago(new Date(created_at).getTime() + (1000 * closedTimeout)); - } - - render () { - const {dirtySettings} = this.state; - const premod = dirtySettings.moderation === 'PRE'; - const {closedAt} = this.state; - const closedTimeout = dirtySettings.closedTimeout; - - return ( -
- -
-

{closedAt === 'open' ? t('configure.close') : t('configure.open')} {t('configure.comment_stream')}

- {(closedAt === 'open' && closedTimeout) ?

{t('configure.comment_stream_will_close')} {this.getClosedIn()}.

: ''} - -
- ); - } -} - -const mapStateToProps = (state) => ({ - asset: state.asset -}); - -const mapDispatchToProps = (dispatch) => ({ - updateStatus: (status) => dispatch(updateOpenStatus(status)), - updateConfiguration: (newConfig) => dispatch(updateConfiguration(newConfig)), -}); - -ConfigureStreamContainer.propTypes = { - updateStatus: PropTypes.func, - closedTimeout: PropTypes.string, - created_at: PropTypes.string, - updateConfiguration: PropTypes.func, - asset: PropTypes.object, -}; - -export default compose( - connect(mapStateToProps, mapDispatchToProps) -)(ConfigureStreamContainer); diff --git a/client/coral-embed-stream/src/components/Embed.js b/client/coral-embed-stream/src/components/Embed.js index bbdaa2f19..7445bf300 100644 --- a/client/coral-embed-stream/src/components/Embed.js +++ b/client/coral-embed-stream/src/components/Embed.js @@ -12,8 +12,6 @@ import {Tab, TabPane} from 'coral-ui'; import ProfileContainer from 'coral-settings/containers/ProfileContainer'; import Popup from 'coral-framework/components/Popup'; import IfSlotIsNotEmpty from 'coral-framework/components/IfSlotIsNotEmpty'; -import ConfigureStreamContainer - from 'coral-configure/containers/ConfigureStreamContainer'; import cn from 'classnames'; export default class Embed extends React.Component { @@ -24,9 +22,6 @@ export default class Embed extends React.Component { case 'profile': this.props.data.refetch(); break; - case 'config': - this.props.data.refetch(); - break; } this.props.setActiveTab(tab); }; @@ -43,12 +38,7 @@ export default class Embed extends React.Component { ]; if (can(user, 'UPDATE_CONFIG')) { tabs.push( - - {t('framework.configure_stream')} - - ); - tabs.push( - + {t('framework.configure_stream')} ); @@ -101,9 +91,6 @@ export default class Embed extends React.Component { , - - , - , ]} diff --git a/client/coral-embed-stream/src/tabs/stream/components/Stream.js b/client/coral-embed-stream/src/tabs/stream/components/Stream.js index 0b58d250d..07774f348 100644 --- a/client/coral-embed-stream/src/tabs/stream/components/Stream.js +++ b/client/coral-embed-stream/src/tabs/stream/components/Stream.js @@ -11,7 +11,7 @@ import RestrictedMessageBox from 'coral-framework/components/RestrictedMessageBox'; import t, {timeago} from 'coral-framework/services/i18n'; import CommentBox from 'talk-plugin-commentbox/CommentBox'; -import QuestionBox from 'talk-plugin-questionbox/QuestionBox'; +import QuestionBox from '../../../components/QuestionBox'; import {isCommentActive} from 'coral-framework/utils'; import {Button, Tab, TabCount, TabPane} from 'coral-ui'; import cn from 'classnames'; diff --git a/client/coral-framework/graphql/mutations.js b/client/coral-framework/graphql/mutations.js index 2aa526a54..15d24a9ce 100644 --- a/client/coral-framework/graphql/mutations.js +++ b/client/coral-framework/graphql/mutations.js @@ -380,7 +380,7 @@ export const withUpdateAssetSettings = withMutation( input, }, optimisticResponse: { - updateAssetStatus: { + updateAssetSettings: { __typename: 'UpdateAssetSettingsResponse', errors: null, } diff --git a/client/coral-framework/utils/index.js b/client/coral-framework/utils/index.js index c7225f492..86e9e1915 100644 --- a/client/coral-framework/utils/index.js +++ b/client/coral-framework/utils/index.js @@ -4,7 +4,7 @@ import union from 'lodash/union'; import {capitalize} from 'coral-framework/helpers/strings'; import assignWith from 'lodash/assignWith'; import mapValues from 'lodash/mapValues'; -export * from 'coral-framework/helpers/strings' +export * from 'coral-framework/helpers/strings'; export const getTotalActionCount = (type, comment) => { return comment.action_summaries diff --git a/client/talk-plugin-questionbox/QuestionBox.css b/client/talk-plugin-questionbox/QuestionBox.css deleted file mode 100644 index cb9902ade..000000000 --- a/client/talk-plugin-questionbox/QuestionBox.css +++ /dev/null @@ -1,70 +0,0 @@ -.qbInfo { - top: 0; - border: 0; - background: #F0F0F0; - color: black; - width: 100%; - text-align: left; - padding-left: 0px; - margin-bottom: 0px; - font-weight: bold; - font-size: 14px; - overflow: hidden; - min-height: 50px; - display: flex; - border-radius: 3px; -} - -.icon { - z-index: 2; - top: 12px; - left: 12px; - position: absolute; - font-size: 33px; - color: #262626; -} - -.iconBubble{ - position: absolute; - top: 8px; - left: 10px; - color: #9E9E9E; - font-size: 24px; - z-index: 0; -} - -.iconPerson{ - z-index: 2; - top: 12px; - left: 12px; - position: absolute; - font-size: 33px; - color: #262626; -} - -.qbIconContainer { - position: relative; - border: 0; - color: white; - padding: 20px; - margin-left: 0px !important; - margin-right: 10px; - display: inline-block; - width: 10px; - min-height: 100%; - padding: 5px 20px; - vertical-align: middle; -} - -.qbContent { - padding: 5px; - display: flex; - align-items: center; - justify-content: center; - font-weight: 400; -} - -.hidden { - visibility: hidden; - display: none; -} \ No newline at end of file diff --git a/client/talk-plugin-questionbox/QuestionBox.js b/client/talk-plugin-questionbox/QuestionBox.js deleted file mode 100644 index f15549b7c..000000000 --- a/client/talk-plugin-questionbox/QuestionBox.js +++ /dev/null @@ -1,31 +0,0 @@ -import React from 'react'; -import cn from 'classnames'; -import styles from './QuestionBox.css'; -import {Icon} from 'coral-ui'; -import Markdown from 'coral-framework/components/Markdown'; - -import Slot from 'coral-framework/components/Slot'; - -const QuestionBox = ({content, enable, icon = '', className = ''}) => ( -
- { - icon === 'default' ? ( -
- - -
- ) : ( -
- -
- ) - } -
- -
- - -
-); - -export default QuestionBox;