diff --git a/client/coral-embed-stream/src/components/DefaultQuestionBoxIcon.css b/client/coral-embed-stream/src/components/DefaultQuestionBoxIcon.css
new file mode 100644
index 000000000..414a48e7a
--- /dev/null
+++ b/client/coral-embed-stream/src/components/DefaultQuestionBoxIcon.css
@@ -0,0 +1,20 @@
+.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;
+}
+
+.root {
+}
diff --git a/client/coral-embed-stream/src/components/DefaultQuestionBoxIcon.js b/client/coral-embed-stream/src/components/DefaultQuestionBoxIcon.js
new file mode 100644
index 000000000..acb3f2e64
--- /dev/null
+++ b/client/coral-embed-stream/src/components/DefaultQuestionBoxIcon.js
@@ -0,0 +1,13 @@
+import React from 'react';
+import cn from 'classnames';
+import styles from './DefaultQuestionBoxIcon.css';
+import {Icon} from 'coral-ui';
+
+const DefaultQuestionBoxIcon = ({className}) => (
+
{checked !== undefined &&
@@ -26,6 +26,7 @@ class Configuration extends React.Component {
[styles.content]: checked !== undefined,
})}>
+
{description}
{children}
@@ -37,6 +38,7 @@ class Configuration extends React.Component {
Configuration.propTypes = {
title: PropTypes.string.isRequired,
+ description: PropTypes.string,
className: PropTypes.string,
onCheckbox: PropTypes.func,
checked: PropTypes.bool,
diff --git a/client/coral-embed-stream/src/tabs/configure/components/QuestionBoxBuilder.css b/client/coral-embed-stream/src/tabs/configure/components/QuestionBoxBuilder.css
new file mode 100644
index 000000000..c3e0b896e
--- /dev/null
+++ b/client/coral-embed-stream/src/tabs/configure/components/QuestionBoxBuilder.css
@@ -0,0 +1,60 @@
+.root {
+}
+
+.iconList {
+ display: flex;
+ padding: 0;
+ margin: 10px 0;
+}
+
+.item {
+ list-style-type: none;
+}
+
+.button {
+ composes: buttonReset from "coral-framework/styles/reset.css";
+
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ text-align: center;
+ background: #F0F0F0;
+ width: 48px;
+ height: 48px;
+ font-size: 24px;
+ text-align: center;
+ line-height: 48px;
+ color: #252525;
+ border-radius: 3px;
+ overflow: hidden;
+ margin-right: 10px;
+ position: relative;
+ border: solid 2px #F0F0F0;
+ transition: border 0.3s cubic-bezier(.4,0,.2,1);
+ outline: 0;
+
+ &:hover {
+ cursor: pointer;
+ }
+}
+
+.button:focus {
+ border: solid 2px #00c96B;
+}
+
+.buttonActive {
+ border: solid 2px #00796B;
+}
+
+.defaultIcon {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+}
+
+.questionBox {
+ margin: 10px 0;
+}
+
diff --git a/client/coral-embed-stream/src/tabs/configure/components/QuestionBoxBuilder.js b/client/coral-embed-stream/src/tabs/configure/components/QuestionBoxBuilder.js
new file mode 100644
index 000000000..0d44b4a3a
--- /dev/null
+++ b/client/coral-embed-stream/src/tabs/configure/components/QuestionBoxBuilder.js
@@ -0,0 +1,93 @@
+import React from 'react';
+import QuestionBox from '../../../components/QuestionBox';
+import {Icon, Spinner} from 'coral-ui';
+import DefaultQuestionBoxIcon from '../../../components/DefaultQuestionBoxIcon';
+import cn from 'classnames';
+import styles from './QuestionBoxBuilder.css';
+
+const DefaultIcon =
;
+
+const icons = [
+ {'default': DefaultIcon},
+ 'forum',
+ 'build',
+ 'format_quote',
+];
+
+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 {questionBoxIcon, questionBoxContent, onContentChange, onIconChange} = this.props;
+ const {loading, MarkdownEditor} = this.state;
+
+ if (loading) {
+ return
;
+ }
+
+ return (
+
+
Include an Icon
+
+
+ {icons.map((item) => {
+ const name = typeof item === 'object' ? Object.keys(item)[0] : item;
+ const icon = typeof item === 'object' ? item[name] : item;
+ return (
+ -
+
+
+ );
+ })}
+
+
+
+
+
+
+
+ );
+ }
+}
+
+export default QuestionBoxBuilder;
diff --git a/client/coral-embed-stream/src/tabs/configure/components/Settings.css b/client/coral-embed-stream/src/tabs/configure/components/Settings.css
index 914b7332b..1a97c3fc1 100644
--- a/client/coral-embed-stream/src/tabs/configure/components/Settings.css
+++ b/client/coral-embed-stream/src/tabs/configure/components/Settings.css
@@ -24,3 +24,6 @@
margin-bottom: 20px;
}
+.questionBoxContainer {
+ margin-top: 24px;
+}
diff --git a/client/coral-embed-stream/src/tabs/configure/components/Settings.js b/client/coral-embed-stream/src/tabs/configure/components/Settings.js
index 6b6e14656..c029940dc 100644
--- a/client/coral-embed-stream/src/tabs/configure/components/Settings.js
+++ b/client/coral-embed-stream/src/tabs/configure/components/Settings.js
@@ -5,10 +5,24 @@ import t from 'coral-framework/services/i18n';
import cn from 'classnames';
import styles from './Settings.css';
import Configuration from './Configuration';
+import QuestionBoxBuilder from './QuestionBoxBuilder';
class Settings extends React.Component {
render() {
- const {settings: {moderation, premodLinksEnable}, toggleModeration, togglePremodLinks} = this.props;
+ const {
+ settings: {
+ moderation,
+ premodLinksEnable,
+ questionBoxEnable,
+ questionBoxContent,
+ questionBoxIcon,
+ },
+ onToggleModeration,
+ onTogglePremodLinks,
+ onToggleQuestionBox,
+ onQuestionBoxIconChange,
+ onQuestionBoxContentChange,
+ } = this.props;
const changed = false;
return (
@@ -28,16 +42,32 @@ class Settings extends React.Component {
- {t('configure.enable_premod_description')}
-
+ description={t('configure.enable_premod_description')}
+ onCheckbox={onToggleModeration}
+ />
+
- {t('configure.enable_premod_description')}
+ {
+ questionBoxEnable &&
+
+
+
+ }
@@ -47,8 +77,9 @@ class Settings extends React.Component {
Settings.propTypes = {
settings: PropTypes.object.isRequired,
- toggleModeration: PropTypes.func.isRequired,
- togglePremodLinks: PropTypes.func.isRequired,
+ onToggleModeration: PropTypes.func.isRequired,
+ onTogglePremodLinks: PropTypes.func.isRequired,
+ onToggleQuestionBox: PropTypes.func.isRequired,
};
export default Settings;
diff --git a/client/coral-embed-stream/src/tabs/configure/containers/Settings.js b/client/coral-embed-stream/src/tabs/configure/containers/Settings.js
index 8e978e4c8..4953ffef1 100644
--- a/client/coral-embed-stream/src/tabs/configure/containers/Settings.js
+++ b/client/coral-embed-stream/src/tabs/configure/containers/Settings.js
@@ -22,6 +22,21 @@ class SettingsContainer extends React.Component {
this.props.updatePending({updater});
};
+ toggleQuestionBox = () => {
+ const updater = {questionBoxEnable: {$set: !this.props.mergedSettings.questionBoxEnable}};
+ this.props.updatePending({updater});
+ };
+
+ setQuestionBoxIcon = (icon) => {
+ const updater = {questionBoxIcon: {$set: icon}};
+ this.props.updatePending({updater});
+ };
+
+ setQuestionBoxContent = (content) => {
+ const updater = {questionBoxContent: {$set: content}};
+ this.props.updatePending({updater});
+ };
+
savePending = async () => {
try {
await this.props.updateAssetSettings(this.props.asset.id, this.props.pending);
@@ -36,8 +51,12 @@ class SettingsContainer extends React.Component {
return