Use the correct l10n string, fix imports and add mutating css class

This commit is contained in:
Paul Kaplan 2021-05-13 21:01:23 -04:00
parent 3d1bd3768e
commit 1b0b5a09b9
2 changed files with 11 additions and 5 deletions

View file

@ -36,6 +36,9 @@
"studio.curatorsEmpty1": "This studio has no curators right now.",
"studio.commentsHeader": "Comments",
"studio.comments.toggleOff": "Commenting off",
"studio.comments.toggleOn": "Commenting on",
"studio.comments.turnedOff": "Sorry, comment posting has been turned off for this studio.",
"studio.sharedFilter": "Shared",
"studio.favoritedFilter": "Favorited",

View file

@ -2,14 +2,15 @@
import React from 'react';
import PropTypes from 'prop-types';
import {connect} from 'react-redux';
import {FormattedMessage} from 'react-intl';
import classNames from 'classnames';
import {selectStudioCommentsAllowed, selectIsFetchingInfo} from '../../redux/studio';
import {
mutateStudioCommentsAllowed, selectIsMutatingCommentsAllowed, selectCommentsAllowedMutationError
} from '../../redux/studio-mutations';
const ToggleSlider = require('../../components/forms/toggle-slider.jsx');
const FormattedMessage = require('react-intl').FormattedMessage;
import ToggleSlider from '../../components/forms/toggle-slider.jsx';
const StudioCommentsAllowed = ({
commentsAllowedError, isFetching, isMutating, commentsAllowed, handleUpdate
@ -20,14 +21,16 @@ const StudioCommentsAllowed = ({
) : (
<div>
{commentsAllowed ? (
<FormattedMessage id="project.comments.toggleOn" />
<FormattedMessage id="studio.comments.toggleOn" />
) : (
<FormattedMessage id="project.comments.toggleOff" />
<FormattedMessage id="studio.comments.toggleOff" />
)}
<ToggleSlider
disabled={isMutating}
checked={commentsAllowed}
className="comments-allowed-input"
className={classNames('comments-allowed-input', {
'mod-mutating': isMutating
})}
onChange={e => handleUpdate(e.target.checked)}
/>
{commentsAllowedError && <div>Error mutating commentsAllowed: {commentsAllowedError}</div>}