mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 04:55:44 +00:00
fix: settings center dropdown
This commit is contained in:
parent
989d11da34
commit
944f07045f
@ -1,7 +1,7 @@
|
|||||||
import { ApiOutlined, SettingOutlined } from '@ant-design/icons';
|
import { ApiOutlined, SettingOutlined } from '@ant-design/icons';
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
import { Button, Card, Dropdown, Popover, Tooltip } from 'antd';
|
import { Button, Card, Dropdown, Popover, Tooltip } from 'antd';
|
||||||
import React, { useState } from 'react';
|
import React, { useMemo, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Link, useNavigate } from 'react-router-dom';
|
import { Link, useNavigate } from 'react-router-dom';
|
||||||
import { useApp } from '../application';
|
import { useApp } from '../application';
|
||||||
@ -29,12 +29,24 @@ export const PluginManagerLink = () => {
|
|||||||
export const SettingsCenterDropdown = () => {
|
export const SettingsCenterDropdown = () => {
|
||||||
const [visible, setVisible] = useState(false);
|
const [visible, setVisible] = useState(false);
|
||||||
const compile = useCompile();
|
const compile = useCompile();
|
||||||
const { t } = useTranslation();
|
|
||||||
const { token } = useToken();
|
const { token } = useToken();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const app = useApp();
|
const app = useApp();
|
||||||
const settings = app.pluginSettingsManager.getList();
|
const settings = app.pluginSettingsManager.getList();
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
|
const items = useMemo(
|
||||||
|
() =>
|
||||||
|
settings
|
||||||
|
.filter((v) => v.isTopLevel !== false)
|
||||||
|
.map((setting) => {
|
||||||
|
return {
|
||||||
|
key: setting.name,
|
||||||
|
icon: setting.icon,
|
||||||
|
label: <Link to={setting.path}>{compile(setting.title)}</Link>,
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
[settings],
|
||||||
|
);
|
||||||
return (
|
return (
|
||||||
<Dropdown
|
<Dropdown
|
||||||
menu={{
|
menu={{
|
||||||
@ -42,15 +54,7 @@ export const SettingsCenterDropdown = () => {
|
|||||||
maxHeight: '70vh',
|
maxHeight: '70vh',
|
||||||
overflow: 'auto',
|
overflow: 'auto',
|
||||||
},
|
},
|
||||||
items: settings
|
items,
|
||||||
.filter((v) => v.isTopLevel !== false)
|
|
||||||
.map((setting) => {
|
|
||||||
return {
|
|
||||||
key: setting.name,
|
|
||||||
icon: setting.icon,
|
|
||||||
label: <Link to={setting.path}>{compile(setting.title)}</Link>,
|
|
||||||
};
|
|
||||||
}),
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
|
Loading…
Reference in New Issue
Block a user