Web:Files:fixed article display

This commit is contained in:
Timofey Boyko 2021-09-29 16:01:54 +08:00
parent 152fa9300e
commit 708439fd10
2 changed files with 46 additions and 22 deletions

View File

@ -9,8 +9,10 @@ import Loaders from '@appserver/common/components/Loaders';
const Items = ({ data, showText, selectedTreeNode, onClick, onBadgeClick }) => { const Items = ({ data, showText, selectedTreeNode, onClick, onBadgeClick }) => {
const isActive = (item) => { const isActive = (item) => {
if (selectedTreeNode[0] === '@my' && item.key === '0-0') return true; if (selectedTreeNode.length > 0) {
if (selectedTreeNode.length > 0) return `${item.id}` === selectedTreeNode[0]; if (selectedTreeNode[0] === '@my' && item.key === '0-0') return true;
return `${item.id}` === selectedTreeNode[0];
}
}; };
const getEndOfBlock = (item) => { const getEndOfBlock = (item) => {
switch (item.key) { switch (item.key) {

View File

@ -18,7 +18,15 @@ import { withTranslation } from 'react-i18next';
import { setDocumentTitle } from '../../helpers/utils'; import { setDocumentTitle } from '../../helpers/utils';
import { inject, observer } from 'mobx-react'; import { inject, observer } from 'mobx-react';
const PureSettings = ({ match, t, isLoading, isLoadedSettingsTree, setFirstLoad, tReady }) => { const PureSettings = ({
match,
t,
isLoading,
isLoadedSettingsTree,
setFirstLoad,
tReady,
showCatalog,
}) => {
const [title, setTitle] = useState(''); const [title, setTitle] = useState('');
const { setting } = match.params; const { setting } = match.params;
@ -60,27 +68,39 @@ const PureSettings = ({ match, t, isLoading, isLoadedSettingsTree, setFirstLoad,
return ( return (
<> <>
<PageLayout> <PageLayout>
<PageLayout.ArticleHeader> {!showCatalog && (
<ArticleHeaderContent /> <PageLayout.ArticleHeader>
</PageLayout.ArticleHeader> <ArticleHeaderContent />
</PageLayout.ArticleHeader>
)}
<PageLayout.ArticleMainButton> {!showCatalog && (
<ArticleMainButtonContent isDisabled={true} /> <PageLayout.ArticleMainButton>
</PageLayout.ArticleMainButton> <ArticleMainButtonContent isDisabled={true} />
</PageLayout.ArticleMainButton>
)}
<PageLayout.ArticleBody> {!showCatalog && (
<ArticleBodyContent /> <PageLayout.ArticleBody>
</PageLayout.ArticleBody> <ArticleBodyContent />
</PageLayout.ArticleBody>
)}
<PageLayout.CatalogHeader> {showCatalog && (
<CatalogHeaderContent /> <PageLayout.CatalogHeader>
</PageLayout.CatalogHeader> <CatalogHeaderContent />
<PageLayout.CatalogMainButton> </PageLayout.CatalogHeader>
<CatalogMainButtonContent /> )}
</PageLayout.CatalogMainButton> {showCatalog && (
<PageLayout.CatalogBody> <PageLayout.CatalogMainButton>
<CatalogBodyContent /> <CatalogMainButtonContent />
</PageLayout.CatalogBody> </PageLayout.CatalogMainButton>
)}
{showCatalog && (
<PageLayout.CatalogBody>
<CatalogBodyContent />
</PageLayout.CatalogBody>
)}
<PageLayout.SectionHeader> <PageLayout.SectionHeader>
{(!isLoadedSettingsTree && isLoading) || isLoading || !tReady ? ( {(!isLoadedSettingsTree && isLoading) || isLoading || !tReady ? (
@ -108,7 +128,7 @@ const PureSettings = ({ match, t, isLoading, isLoadedSettingsTree, setFirstLoad,
const Settings = withTranslation(['Settings', 'Common'])(PureSettings); const Settings = withTranslation(['Settings', 'Common'])(PureSettings);
export default inject(({ filesStore, settingsStore, treeFoldersStore }) => { export default inject(({ auth, filesStore, settingsStore, treeFoldersStore }) => {
const { setFirstLoad, isLoading } = filesStore; const { setFirstLoad, isLoading } = filesStore;
const { setSelectedNode } = treeFoldersStore; const { setSelectedNode } = treeFoldersStore;
const { getFilesSettings, isLoadedSettingsTree } = settingsStore; const { getFilesSettings, isLoadedSettingsTree } = settingsStore;
@ -120,5 +140,7 @@ export default inject(({ filesStore, settingsStore, treeFoldersStore }) => {
setFirstLoad, setFirstLoad,
setSelectedNode, setSelectedNode,
getFilesSettings, getFilesSettings,
showCatalog: auth.settingsStore.showCatalog,
}; };
})(withRouter(observer(Settings))); })(withRouter(observer(Settings)));