mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-29 12:04:02 +00:00
optimize add view menu list (#7548)
Co-authored-by: zhouwenxuan <aries@Mac.local>
This commit is contained in:
parent
cc0d3a281c
commit
1230dda8bd
@ -46,7 +46,7 @@ const translateLabel = (type) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getNewViewSubMenus = () => {
|
export const getNewViewSubMenu = () => {
|
||||||
return ADD_VIEW_OPTIONS.map((option) => {
|
return ADD_VIEW_OPTIONS.map((option) => {
|
||||||
const { key, type } = option;
|
const { key, type } = option;
|
||||||
return {
|
return {
|
||||||
@ -61,6 +61,6 @@ export const getNewViewMenuItem = () => {
|
|||||||
return {
|
return {
|
||||||
...TextTranslation.ADD_VIEW,
|
...TextTranslation.ADD_VIEW,
|
||||||
subOpListHeader: gettext('New view'),
|
subOpListHeader: gettext('New view'),
|
||||||
subOpList: getNewViewSubMenus(),
|
subOpList: getNewViewSubMenu(),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -4,7 +4,8 @@ import TextTranslation from '../../../utils/text-translation';
|
|||||||
import { isMobile } from '../../../utils/utils';
|
import { isMobile } from '../../../utils/utils';
|
||||||
import EventBus from '../../common/event-bus';
|
import EventBus from '../../common/event-bus';
|
||||||
import { EVENT_BUS_TYPE, VIEW_TYPE } from '../../../metadata/constants';
|
import { EVENT_BUS_TYPE, VIEW_TYPE } from '../../../metadata/constants';
|
||||||
import { getNewViewMenuItem, KEY_ADD_VIEW_MAP } from './new-view-menu';
|
import { getNewViewSubMenu, KEY_ADD_VIEW_MAP } from './new-view-menu';
|
||||||
|
import Icon from '../../icon';
|
||||||
|
|
||||||
const ViewsMoreOperations = ({ menuProps }) => {
|
const ViewsMoreOperations = ({ menuProps }) => {
|
||||||
const eventBus = EventBus.getInstance();
|
const eventBus = EventBus.getInstance();
|
||||||
@ -43,8 +44,13 @@ const ViewsMoreOperations = ({ menuProps }) => {
|
|||||||
|
|
||||||
const getMoreOperationsMenus = useCallback(() => {
|
const getMoreOperationsMenus = useCallback(() => {
|
||||||
return [
|
return [
|
||||||
TextTranslation.ADD_FOLDER,
|
{
|
||||||
getNewViewMenuItem(),
|
key: KEY_ADD_VIEW_MAP.ADD_FOLDER,
|
||||||
|
value: TextTranslation.ADD_FOLDER.value,
|
||||||
|
icon_dom: <Icon symbol="folder" className="metadata-view-icon" />
|
||||||
|
},
|
||||||
|
'Divider',
|
||||||
|
...getNewViewSubMenu(),
|
||||||
];
|
];
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@ -54,7 +60,7 @@ const ViewsMoreOperations = ({ menuProps }) => {
|
|||||||
{...menuProps}
|
{...menuProps}
|
||||||
item={{ name: 'views' }}
|
item={{ name: 'views' }}
|
||||||
menuClassname="metadata-views-dropdown-menu"
|
menuClassname="metadata-views-dropdown-menu"
|
||||||
toggleClass="sf3-font sf3-font-more"
|
toggleClass="sf3-font sf3-font-new"
|
||||||
menuStyle={isMobile ? { zIndex: 1050 } : {}}
|
menuStyle={isMobile ? { zIndex: 1050 } : {}}
|
||||||
getMenuList={getMoreOperationsMenus}
|
getMenuList={getMoreOperationsMenus}
|
||||||
onMenuItemClick={clickMenu}
|
onMenuItemClick={clickMenu}
|
||||||
|
@ -259,6 +259,7 @@ class ItemDropdownMenu extends React.Component {
|
|||||||
{menuItem.key === 'Display files' && this.props.isDisplayFiles && (
|
{menuItem.key === 'Display files' && this.props.isDisplayFiles && (
|
||||||
<i className="dropdown-item-tick sf2-icon-tick"></i>
|
<i className="dropdown-item-tick sf2-icon-tick"></i>
|
||||||
)}
|
)}
|
||||||
|
{menuItem.icon_dom || null}
|
||||||
{menuItem.value}
|
{menuItem.value}
|
||||||
</DropdownItem>
|
</DropdownItem>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user