Minor changes to error messages

This commit is contained in:
seotts 2021-05-20 14:23:42 -04:00
parent dbb258cf8b
commit 13739ae0bc
5 changed files with 32 additions and 28 deletions

View file

@ -13,7 +13,6 @@ import {
import ValidationMessage from '../../components/forms/validation-message.jsx';
import decorateText from '../../lib/decorate-text.jsx';
import {selectIsMuted} from '../../redux/session';
import StudioMuteEditMessage from './studio-mute-edit-message.jsx';
const errorToMessageId = error => {

View file

@ -12,7 +12,6 @@ import {
} from '../../redux/studio-mutations';
import ValidationMessage from '../../components/forms/validation-message.jsx';
import {selectIsMuted} from '../../redux/session';
import StudioMuteEditMessage from './studio-mute-edit-message.jsx';

View file

@ -5,18 +5,19 @@ import StudioOpenToAll from './studio-open-to-all.jsx';
import {FormattedMessage} from 'react-intl';
import {projects} from './lib/redux-modules';
import {selectCanAddProjects, selectCanEditOpenToAll, selectHasProjectPermissions, selectShowProjectMuteError} from '../../redux/studio-permissions';
import {selectCanAddProjects, selectCanEditOpenToAll, selectShowProjectMuteError} from '../../redux/studio-permissions';
import Debug from './debug.jsx';
import StudioProjectAdder from './studio-project-adder.jsx';
import StudioProjectTile from './studio-project-tile.jsx';
import {loadProjects} from './lib/studio-project-actions.js';
import classNames from 'classnames';
import CommentingStatus from '../../components/commenting-status/commenting-status.jsx';
import {selectMuteStatus} from '../../redux/session.js';
import {selectIsMuted, selectMuteStatus} from '../../redux/session.js';
import {formatRelativeTime} from '../../lib/format-time.js';
const StudioProjects = ({
canAddProjects, canEditOpenToAll, hasPermission, items, error, loading, moreToLoad, onLoadMore, muteExpiresAtMs, showMuteError
canAddProjects, canEditOpenToAll, items, isMuted, error,
loading, moreToLoad, onLoadMore, muteExpiresAtMs, showMuteError
}) => {
useEffect(() => {
if (items.length === 0) onLoadMore();
@ -31,13 +32,15 @@ const StudioProjects = ({
{showMuteError &&
<CommentingStatus>
<p>
<FormattedMessage
id="studios.mutedProjects"
values={{
inDuration: formatRelativeTime(muteExpiresAtMs, window._locale)
}}
/>
<FormattedMessage id="studios.mutedPaused" />
<div>
<FormattedMessage
id="studios.mutedProjects"
values={{
inDuration: formatRelativeTime(muteExpiresAtMs, window._locale)
}}
/>
</div>
<div><FormattedMessage id="studios.mutedPaused" /></div>
</p>
</CommentingStatus>
}
@ -72,7 +75,7 @@ const StudioProjects = ({
/>
<div className="studio-empty-msg">
<div><FormattedMessage id="studio.projectsEmpty1" /></div>
<div><FormattedMessage id="studio.projectsEmpty2" /></div>
{!isMuted && <div><FormattedMessage id="studio.projectsEmpty2" /></div>}
</div>
</React.Fragment>
)}
@ -121,6 +124,7 @@ StudioProjects.propTypes = {
title: PropTypes.string,
username: PropTypes.string
})),
isMuted: PropTypes.bool,
loading: PropTypes.bool,
error: PropTypes.object, // eslint-disable-line react/forbid-prop-types
moreToLoad: PropTypes.bool,
@ -134,6 +138,7 @@ export default connect(
...projects.selector(state),
canAddProjects: selectCanAddProjects(state),
canEditOpenToAll: selectCanEditOpenToAll(state),
isMuted: selectIsMuted(state),
showMuteError: selectShowProjectMuteError(state),
muteExpiresAtMs: (selectMuteStatus(state).muteExpiresAt * 1000 || 0)
}),

View file

@ -9,7 +9,6 @@ import {selectStudioTitle, selectIsFetchingInfo} from '../../redux/studio';
import {selectCanEditInfo, selectShowEditMuteError} from '../../redux/studio-permissions';
import {Errors, mutateStudioTitle, selectIsMutatingTitle, selectTitleMutationError} from '../../redux/studio-mutations';
import ValidationMessage from '../../components/forms/validation-message.jsx';
import {selectIsMuted} from '../../redux/session';
import StudioMuteEditMessage from './studio-mute-edit-message.jsx';
const errorToMessageId = error => {

View file

@ -38,13 +38,13 @@ const {commentsReducer} = require('../../redux/comments');
const {studioMutationsReducer} = require('../../redux/studio-mutations');
import './studio.scss';
import {selectIsMuted, selectMuteStatus} from '../../redux/session.js';
import {selectMuteStatus} from '../../redux/session.js';
import {formatRelativeTime} from '../../lib/format-time.js';
import CommentingStatus from '../../components/commenting-status/commenting-status.jsx';
import {FormattedMessage} from 'react-intl';
import { selectHasCuratorEditPermissions, selectShowCuratorMuteError } from '../../redux/studio-permissions.js';
import {selectShowCuratorMuteError} from '../../redux/studio-permissions.js';
const StudioShell = ({showCuratorMuteBox, muteExpiresAtMs, studioLoadFailed}) => {
const StudioShell = ({showCuratorMuteError, muteExpiresAtMs, studioLoadFailed}) => {
const match = useRouteMatch();
return (
@ -59,16 +59,18 @@ const StudioShell = ({showCuratorMuteBox, muteExpiresAtMs, studioLoadFailed}) =>
<div>
<Switch>
<Route path={`${match.path}/curators`}>
{showCuratorMuteBox &&
<CommentingStatus className="studio-curator-mute-box">
{showCuratorMuteError &&
<CommentingStatus>
<p>
<FormattedMessage
id="studios.mutedCurators"
values={{
inDuration: formatRelativeTime(muteExpiresAtMs, window._locale)
}}
/>
<FormattedMessage id="studios.mutedPaused" />
<div>
<FormattedMessage
id="studios.mutedProjects"
values={{
inDuration: formatRelativeTime(muteExpiresAtMs, window._locale)
}}
/>
</div>
<div><FormattedMessage id="studios.mutedPaused" /></div>
</p>
</CommentingStatus>
}
@ -96,14 +98,14 @@ const StudioShell = ({showCuratorMuteBox, muteExpiresAtMs, studioLoadFailed}) =>
};
StudioShell.propTypes = {
showCuratorMuteBox: PropTypes.bool,
showCuratorMuteError: PropTypes.bool,
muteExpiresAtMs: PropTypes.number,
studioLoadFailed: PropTypes.bool
};
const ConnectedStudioShell = connect(
state => ({
showCuratorMuteBox: selectShowCuratorMuteError(state),
showCuratorMuteError: selectShowCuratorMuteError(state),
studioLoadFailed: selectStudioLoadFailed(state),
muteExpiresAtMs: (selectMuteStatus(state).muteExpiresAt * 1000 || 0)
}),