import React from 'react'; import {SelectField, Option} from 'react-mdl-selectfield'; import I18n from 'coral-framework/modules/i18n/i18n'; import translations from '../../translations.json'; import styles from './Configure.css'; import {Checkbox, Textfield} from 'react-mdl'; import {Card, Icon, TextArea} from 'coral-ui'; const TIMESTAMPS = { weeks: 60 * 60 * 24 * 7, days: 60 * 60 * 24, hours: 60 * 60 }; const updateCharCountEnable = (updateSettings, charCountChecked) => () => { const charCountEnable = !charCountChecked; updateSettings({charCountEnable}); }; const updateCharCount = (updateSettings, settingsError) => (event) => { const charCount = event.target.value; if (charCount.match(/[^0-9]/) || charCount.length === 0) { settingsError('charCount', true); } else { settingsError('charCount', false); } updateSettings({charCount: charCount}); }; const updateInfoBoxEnable = (updateSettings, infoBox) => () => { const infoBoxEnable = !infoBox; updateSettings({infoBoxEnable}); }; const updatePremodLinksEnable = (updateSettings, premodLinks) => () => { const premodLinksEnable = !premodLinks; updateSettings({premodLinksEnable}); }; const updateInfoBoxContent = (updateSettings) => (event) => { const infoBoxContent = event.target.value; updateSettings({infoBoxContent}); }; const updateClosedMessage = (updateSettings) => (event) => { const closedMessage = event.target.value; updateSettings({closedMessage}); }; // If we are changing the measure we need to recalculate using the old amount // Same thing if we are just changing the amount const updateClosedTimeout = (updateSettings, ts, isMeasure) => (event) => { if (isMeasure) { const amount = getTimeoutAmount(ts); const closedTimeout = amount * TIMESTAMPS[event]; updateSettings({closedTimeout}); } else { const val = event.target.value; const measure = getTimeoutMeasure(ts); const closedTimeout = val * TIMESTAMPS[measure]; updateSettings({closedTimeout}); } }; const StreamSettings = ({updateSettings, settingsError, settings, errors}) => { // just putting this here for shorthand below const on = styles.enabledSetting; const off = styles.disabledSetting; return (
{lang.t('configure.comment-count-header')}

{lang.t('configure.comment-count-text-pre')} {lang.t('configure.comment-count-text-post')} { errors.charCount &&
{lang.t('configure.comment-count-error')}
}

{lang.t('configure.enable-premod-links')}

{lang.t('configure.enable-premod-links-text')}

{lang.t('configure.include-comment-stream')}

{lang.t('configure.include-comment-stream-desc')}