mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 13:46:45 +00:00
refactor: change name for add blocks menu
This commit is contained in:
parent
0fb2cc7278
commit
e45be71abc
@ -20,6 +20,7 @@ import {
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import React, { useEffect, useMemo, useState } from 'react';
|
import React, { useEffect, useMemo, useState } from 'react';
|
||||||
import { createPortal } from 'react-dom';
|
import { createPortal } from 'react-dom';
|
||||||
|
import { usePluginTranslation } from '../../locale';
|
||||||
import { useMobileActionPageStyle } from './MobileActionPage.style';
|
import { useMobileActionPageStyle } from './MobileActionPage.style';
|
||||||
import { MobileTabsForMobileActionPage } from './MobileTabsForMobileActionPage';
|
import { MobileTabsForMobileActionPage } from './MobileTabsForMobileActionPage';
|
||||||
|
|
||||||
@ -39,6 +40,7 @@ const useMobileBlockInitializersInSubpage = (
|
|||||||
const [originalInitializers] = useState<SchemaInitializer>(() =>
|
const [originalInitializers] = useState<SchemaInitializer>(() =>
|
||||||
app.schemaInitializerManager.get('popup:common:addBlock'),
|
app.schemaInitializerManager.get('popup:common:addBlock'),
|
||||||
);
|
);
|
||||||
|
const { t } = usePluginTranslation();
|
||||||
|
|
||||||
const dataBlocks = originalInitializers.options.items.find((item) => item.name === 'dataBlocks');
|
const dataBlocks = originalInitializers.options.items.find((item) => item.name === 'dataBlocks');
|
||||||
const dataBlocksChildren = [...dataBlocks.useChildren(), ...dataBlocks.children];
|
const dataBlocksChildren = [...dataBlocks.useChildren(), ...dataBlocks.children];
|
||||||
@ -47,6 +49,7 @@ const useMobileBlockInitializersInSubpage = (
|
|||||||
const options = _.cloneDeep(originalInitializers.options);
|
const options = _.cloneDeep(originalInitializers.options);
|
||||||
options.items = options.items.filter((item) => {
|
options.items = options.items.filter((item) => {
|
||||||
if (item.name === 'dataBlocks') {
|
if (item.name === 'dataBlocks') {
|
||||||
|
item.title = t('Desktop data blocks');
|
||||||
item.children = dataBlocksChildren.filter((child) => {
|
item.children = dataBlocksChildren.filter((child) => {
|
||||||
return supportsDataBlocks.includes(child.name);
|
return supportsDataBlocks.includes(child.name);
|
||||||
});
|
});
|
||||||
@ -54,6 +57,10 @@ const useMobileBlockInitializersInSubpage = (
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.name === 'otherBlocks') {
|
||||||
|
item.title = t('Other desktop blocks');
|
||||||
|
}
|
||||||
|
|
||||||
return item.name !== 'filterBlocks';
|
return item.name !== 'filterBlocks';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user