|
|
@@ -4,7 +4,6 @@ import PropTypes from 'prop-types';
|
|
|
import { withTranslation } from 'react-i18next';
|
|
|
|
|
|
import { withUnstatedContainers } from '../UnstatedUtils';
|
|
|
-import AppContainer from '~/client/services/AppContainer';
|
|
|
import NavigationContainer from '~/client/services/NavigationContainer';
|
|
|
|
|
|
import RecentChanges from './RecentChanges';
|
|
|
@@ -12,26 +11,31 @@ import CustomSidebar from './CustomSidebar';
|
|
|
import Tag from './Tag';
|
|
|
|
|
|
const SidebarContents = (props) => {
|
|
|
- const { appContainer, navigationContainer, isSharedUser } = props;
|
|
|
+ const { navigationContainer, isSharedUser } = props;
|
|
|
|
|
|
if (isSharedUser) {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- if (navigationContainer.state.sidebarContentsId === 'recent') {
|
|
|
- return <RecentChanges />;
|
|
|
+ let Contents;
|
|
|
+ switch (navigationContainer.state.sidebarContentsId) {
|
|
|
+ case 'recent':
|
|
|
+ Contents = RecentChanges;
|
|
|
+ break;
|
|
|
+ case 'tag':
|
|
|
+ Contents = Tag;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ Contents = CustomSidebar;
|
|
|
+
|
|
|
+ return (
|
|
|
+ <Contents />
|
|
|
+ );
|
|
|
}
|
|
|
- if (navigationContainer.state.sidebarContentsId === 'tag') {
|
|
|
- return <Tag appContainer={appContainer} navigationContainer={navigationContainer} />;
|
|
|
- }
|
|
|
-
|
|
|
- return <CustomSidebar />;
|
|
|
-
|
|
|
};
|
|
|
|
|
|
SidebarContents.propTypes = {
|
|
|
navigationContainer: PropTypes.instanceOf(NavigationContainer).isRequired,
|
|
|
- appContainer: PropTypes.instanceOf(AppContainer).isRequired,
|
|
|
|
|
|
isSharedUser: PropTypes.bool,
|
|
|
};
|