mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-27 01:25:52 -05:00
Revert "Merge pull request #6731 from LLK/studios-rtl"
This reverts commit830a2e3ebf
, reversing changes made to1a2d1db3a1
.
This commit is contained in:
parent
2a72ab4adc
commit
604238d1a0
2 changed files with 7 additions and 51 deletions
|
@ -8,8 +8,7 @@ import {
|
|||
} from 'react-router-dom';
|
||||
import PropTypes from 'prop-types';
|
||||
import {connect} from 'react-redux';
|
||||
import {FormattedMessage, injectIntl, intlShape} from 'react-intl';
|
||||
import {isRtl} from 'scratch-l10n';
|
||||
|
||||
|
||||
import Page from '../../components/page/www/page.jsx';
|
||||
import render from '../../lib/render.jsx';
|
||||
|
@ -35,21 +34,20 @@ import './studio.scss';
|
|||
import {selectIsAdmin, 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 {selectShowCuratorMuteError} from '../../redux/studio-permissions.js';
|
||||
|
||||
export const StudioShell = ({intl, isAdmin, showCuratorMuteError, muteExpiresAtMs, studioLoadFailed, onLoadInfo}) => {
|
||||
const StudioShell = ({isAdmin, showCuratorMuteError, muteExpiresAtMs, studioLoadFailed, onLoadInfo}) => {
|
||||
const match = useRouteMatch();
|
||||
|
||||
useEffect(() => {
|
||||
onLoadInfo();
|
||||
}, [isAdmin]); // Reload any time isAdmin changes to allow admins to view deleted studios
|
||||
|
||||
|
||||
return (
|
||||
studioLoadFailed ?
|
||||
<NotAvailable /> :
|
||||
<div
|
||||
className="studio-shell"
|
||||
dir={isRtl(intl.locale) ? 'rtl' : null}
|
||||
>
|
||||
<div className="studio-shell">
|
||||
<StudioDeleted />
|
||||
<StudioMeta />
|
||||
<div className="studio-info">
|
||||
|
@ -100,7 +98,6 @@ export const StudioShell = ({intl, isAdmin, showCuratorMuteError, muteExpiresAtM
|
|||
};
|
||||
|
||||
StudioShell.propTypes = {
|
||||
intl: intlShape,
|
||||
isAdmin: PropTypes.bool,
|
||||
showCuratorMuteError: PropTypes.bool,
|
||||
muteExpiresAtMs: PropTypes.number,
|
||||
|
@ -120,8 +117,6 @@ const ConnectedStudioShell = connect(
|
|||
}
|
||||
)(StudioShell);
|
||||
|
||||
const IntlConnectedStudioShell = injectIntl(ConnectedStudioShell);
|
||||
|
||||
render(
|
||||
<Page className="studio-page">
|
||||
<StudioAdminPanel />
|
||||
|
@ -129,7 +124,7 @@ render(
|
|||
<Switch>
|
||||
{/* Use variable studioPath to support /studio-playground/ or future route */}
|
||||
<Route path="/:studioPath/:studioId">
|
||||
<IntlConnectedStudioShell />
|
||||
<ConnectedStudioShell />
|
||||
</Route>
|
||||
</Switch>
|
||||
</Router>
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
const React = require('react');
|
||||
const {shallow} = require('enzyme');
|
||||
import {StudioShell} from '../../../src/views/studio/studio.jsx';
|
||||
|
||||
jest.mock('react-dom', () => ({
|
||||
render: jest.fn()
|
||||
}));
|
||||
|
||||
jest.mock('react-router-dom', () => ({
|
||||
useRouteMatch: jest.fn(() => ({path: ''}))
|
||||
}));
|
||||
|
||||
describe('Studio', () => {
|
||||
test('dir is RTL when locale is rtl', () => {
|
||||
const component = shallow(
|
||||
<StudioShell
|
||||
intl={{
|
||||
locale: 'ar'
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
const studioShell = component.find('div.studio-shell');
|
||||
expect(studioShell.prop('dir')).toEqual('rtl');
|
||||
});
|
||||
|
||||
test('dir is LTR when locale is ltr', () => {
|
||||
const component = shallow(
|
||||
<StudioShell
|
||||
intl={{
|
||||
locale: 'ja'
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
const studioShell = component.find('div.studio-shell');
|
||||
expect(studioShell.prop('dir')).toBeNull();
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue