🔧 refactor(UI): Consolidate dropdown styles and remove global styles
- Remove global style components from MentionModelsButton and MCPToolsButton - Move dropdown styles to a centralized SCSS file - Refactor components to use styled-components for localized styling - Improve code organization and reduce redundant styling - Adjust table column widths in MCPSettings for better layout - Simplify dropdown rendering by removing unnecessary fragments
This commit is contained in:
parent
d714a53dc6
commit
602a6a5f66
@ -53,3 +53,142 @@
|
|||||||
background-color: initial !important;
|
background-color: initial !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mention-models-dropdown {
|
||||||
|
&.ant-dropdown {
|
||||||
|
background: rgba(var(--color-base-rgb), 0.65) !important;
|
||||||
|
backdrop-filter: blur(35px) saturate(150%) !important;
|
||||||
|
animation-duration: 0.15s !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 移动其他样式到 mention-models-dropdown 类下 */
|
||||||
|
.ant-slide-up-enter .ant-dropdown-menu,
|
||||||
|
.ant-slide-up-appear .ant-dropdown-menu,
|
||||||
|
.ant-slide-up-leave .ant-dropdown-menu,
|
||||||
|
.ant-slide-up-enter-active .ant-dropdown-menu,
|
||||||
|
.ant-slide-up-appear-active .ant-dropdown-menu,
|
||||||
|
.ant-slide-up-leave-active .ant-dropdown-menu {
|
||||||
|
background: rgba(var(--color-base-rgb), 0.65) !important;
|
||||||
|
backdrop-filter: blur(35px) saturate(150%) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-dropdown-menu {
|
||||||
|
/* 保持原有的下拉菜单样式,但限定在 mention-models-dropdown 类下 */
|
||||||
|
max-height: 400px;
|
||||||
|
overflow-y: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
|
padding: 4px 12px;
|
||||||
|
position: relative;
|
||||||
|
background: rgba(var(--color-base-rgb), 0.65) !important;
|
||||||
|
backdrop-filter: blur(35px) saturate(150%) !important;
|
||||||
|
border: 0.5px solid rgba(var(--color-border-rgb), 0.3);
|
||||||
|
border-radius: 10px;
|
||||||
|
box-shadow:
|
||||||
|
0 0 0 0.5px rgba(0, 0, 0, 0.15),
|
||||||
|
0 4px 16px rgba(0, 0, 0, 0.15),
|
||||||
|
0 2px 8px rgba(0, 0, 0, 0.12),
|
||||||
|
inset 0 0 0 0.5px rgba(255, 255, 255, var(--inner-glow-opacity, 0.1));
|
||||||
|
transform-origin: top;
|
||||||
|
will-change: transform, opacity;
|
||||||
|
transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
|
margin-bottom: 0;
|
||||||
|
|
||||||
|
&.no-scrollbar {
|
||||||
|
padding-right: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.has-scrollbar {
|
||||||
|
padding-right: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Scrollbar styles
|
||||||
|
&::-webkit-scrollbar {
|
||||||
|
width: 14px;
|
||||||
|
height: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&::-webkit-scrollbar-thumb {
|
||||||
|
border: 4px solid transparent;
|
||||||
|
background-clip: padding-box;
|
||||||
|
border-radius: 7px;
|
||||||
|
background-color: var(--color-scrollbar-thumb);
|
||||||
|
min-height: 50px;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover::-webkit-scrollbar-thumb {
|
||||||
|
background-color: var(--color-scrollbar-thumb);
|
||||||
|
}
|
||||||
|
|
||||||
|
&::-webkit-scrollbar-thumb:hover {
|
||||||
|
background-color: var(--color-scrollbar-thumb-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
&::-webkit-scrollbar-thumb:active {
|
||||||
|
background-color: var(--color-scrollbar-thumb-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
&::-webkit-scrollbar-track {
|
||||||
|
background: transparent;
|
||||||
|
border-radius: 7px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-dropdown-menu-item-group {
|
||||||
|
margin-bottom: 4px;
|
||||||
|
|
||||||
|
&:not(:first-child) {
|
||||||
|
margin-top: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-dropdown-menu-item-group-title {
|
||||||
|
padding: 5px 12px;
|
||||||
|
color: var(--color-text-3);
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 500;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.03em;
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle no-results case margin
|
||||||
|
.no-results {
|
||||||
|
padding: 8px 12px;
|
||||||
|
color: var(--color-text-3);
|
||||||
|
cursor: default;
|
||||||
|
font-size: 13px;
|
||||||
|
opacity: 0.8;
|
||||||
|
margin-bottom: 40px;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-dropdown-menu-item {
|
||||||
|
padding: 5px 12px;
|
||||||
|
margin: 0 -12px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 13px;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: rgba(var(--color-hover-rgb), 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.ant-dropdown-menu-item-selected {
|
||||||
|
background-color: rgba(var(--color-primary-rgb), 0.12);
|
||||||
|
color: var(--color-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-dropdown-menu-item-icon {
|
||||||
|
margin-right: 0;
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { MCPServer } from '@renderer/types'
|
|||||||
import { Dropdown, Switch, Tooltip } from 'antd'
|
import { Dropdown, Switch, Tooltip } from 'antd'
|
||||||
import { FC, useEffect, useRef, useState } from 'react'
|
import { FC, useEffect, useRef, useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { createGlobalStyle } from 'styled-components'
|
import styled from 'styled-components'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
enabledMCPs: MCPServer[]
|
enabledMCPs: MCPServer[]
|
||||||
@ -43,7 +43,7 @@ const MCPToolsButton: FC<Props> = ({ enabledMCPs, onEnableMCP, ToolbarButton })
|
|||||||
|
|
||||||
const menu = (
|
const menu = (
|
||||||
<div ref={menuRef} className="ant-dropdown-menu">
|
<div ref={menuRef} className="ant-dropdown-menu">
|
||||||
<div className="dropdown-header">
|
<DropdownHeader className="dropdown-header">
|
||||||
<div className="header-content">
|
<div className="header-content">
|
||||||
<h4>{t('settings.mcp.title')}</h4>
|
<h4>{t('settings.mcp.title')}</h4>
|
||||||
<div className="enable-all-container">
|
<div className="enable-all-container">
|
||||||
@ -51,12 +51,12 @@ const MCPToolsButton: FC<Props> = ({ enabledMCPs, onEnableMCP, ToolbarButton })
|
|||||||
<Switch size="small" checked={enableAll} onChange={setEnableAll} />
|
<Switch size="small" checked={enableAll} onChange={setEnableAll} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</DropdownHeader>
|
||||||
{mcpServers.length > 0 ? (
|
{mcpServers.length > 0 ? (
|
||||||
mcpServers
|
mcpServers
|
||||||
.filter((s) => s.isActive)
|
.filter((s) => s.isActive)
|
||||||
.map((server) => (
|
.map((server) => (
|
||||||
<div key={server.name} className="ant-dropdown-menu-item mcp-server-item">
|
<McpServerItems key={server.name} className="ant-dropdown-menu-item">
|
||||||
<div className="server-info">
|
<div className="server-info">
|
||||||
<div className="server-name">{server.name}</div>
|
<div className="server-name">{server.name}</div>
|
||||||
{server.description && (
|
{server.description && (
|
||||||
@ -67,7 +67,7 @@ const MCPToolsButton: FC<Props> = ({ enabledMCPs, onEnableMCP, ToolbarButton })
|
|||||||
{server.baseUrl && <div className="server-url">{server.baseUrl}</div>}
|
{server.baseUrl && <div className="server-url">{server.baseUrl}</div>}
|
||||||
</div>
|
</div>
|
||||||
<Switch size="small" checked={enabledMCPs.includes(server)} onChange={() => onEnableMCP(server)} />
|
<Switch size="small" checked={enabledMCPs.includes(server)} onChange={() => onEnableMCP(server)} />
|
||||||
</div>
|
</McpServerItems>
|
||||||
))
|
))
|
||||||
) : (
|
) : (
|
||||||
<div className="ant-dropdown-menu-item-group">
|
<div className="ant-dropdown-menu-item-group">
|
||||||
@ -78,125 +78,81 @@ const MCPToolsButton: FC<Props> = ({ enabledMCPs, onEnableMCP, ToolbarButton })
|
|||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<Dropdown
|
||||||
<DropdownMenuStyle />
|
dropdownRender={() => menu}
|
||||||
<Dropdown
|
trigger={['click']}
|
||||||
dropdownRender={() => menu}
|
open={isOpen}
|
||||||
trigger={['click']}
|
onOpenChange={setIsOpen}
|
||||||
open={isOpen}
|
overlayClassName="mention-models-dropdown">
|
||||||
onOpenChange={setIsOpen}
|
<Tooltip placement="top" title="MCP Servers" arrow>
|
||||||
overlayClassName="mention-models-dropdown">
|
<ToolbarButton type="text" ref={dropdownRef}>
|
||||||
<Tooltip placement="top" title="MCP Servers" arrow>
|
<i className="iconfont icon-mcp" style={{ fontSize: 18 }}></i>
|
||||||
<ToolbarButton type="text" ref={dropdownRef}>
|
</ToolbarButton>
|
||||||
<i className="iconfont icon-mcp" style={{ fontSize: 18 }}></i>
|
</Tooltip>
|
||||||
</ToolbarButton>
|
</Dropdown>
|
||||||
</Tooltip>
|
|
||||||
</Dropdown>
|
|
||||||
</>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const DropdownMenuStyle = createGlobalStyle`
|
const McpServerItems = styled.div`
|
||||||
.mention-models-dropdown {
|
display: flex;
|
||||||
.ant-dropdown-menu {
|
justify-content: space-between;
|
||||||
max-height: 400px;
|
align-items: center;
|
||||||
overflow-y: auto;
|
padding: 8px 12px;
|
||||||
overflow-x: hidden;
|
|
||||||
padding: 4px 0;
|
|
||||||
margin-bottom: 40px;
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
&::-webkit-scrollbar {
|
.server-info {
|
||||||
width: 6px;
|
flex: 1;
|
||||||
height: 6px;
|
overflow: hidden;
|
||||||
}
|
|
||||||
|
|
||||||
&::-webkit-scrollbar-thumb {
|
.server-name {
|
||||||
border-radius: 10px;
|
font-weight: 500;
|
||||||
background: var(--color-scrollbar-thumb);
|
font-size: 14px;
|
||||||
|
color: var(--color-text-1);
|
||||||
|
}
|
||||||
|
|
||||||
&:hover {
|
.server-description {
|
||||||
background: var(--color-scrollbar-thumb-hover);
|
font-size: 12px;
|
||||||
}
|
color: var(--color-text-3);
|
||||||
}
|
margin-top: 2px;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
&::-webkit-scrollbar-track {
|
.server-url {
|
||||||
background: transparent;
|
font-size: 11px;
|
||||||
}
|
color: var(--color-text-4);
|
||||||
|
margin-top: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
.no-results {
|
const DropdownHeader = styled.div`
|
||||||
padding: 8px 12px;
|
padding: 8px 12px;
|
||||||
color: var(--color-text-3);
|
border-bottom: 1px solid var(--color-border);
|
||||||
cursor: default;
|
margin-bottom: 4px;
|
||||||
font-size: 14px;
|
|
||||||
|
|
||||||
&:hover {
|
.header-content {
|
||||||
background: none;
|
display: flex;
|
||||||
}
|
justify-content: space-between;
|
||||||
}
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
.dropdown-header {
|
h4 {
|
||||||
padding: 8px 12px;
|
margin: 0;
|
||||||
border-bottom: 1px solid var(--color-border);
|
color: var(--color-text-1);
|
||||||
margin-bottom: 4px;
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
.header-content {
|
.enable-all-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
align-items: center;
|
||||||
align-items: center;
|
gap: 8px;
|
||||||
}
|
|
||||||
|
|
||||||
h4 {
|
.enable-all-label {
|
||||||
margin: 0;
|
font-size: 12px;
|
||||||
color: var(--color-text-1);
|
color: var(--color-text-3);
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.enable-all-container {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
|
||||||
|
|
||||||
.enable-all-label {
|
|
||||||
font-size: 12px;
|
|
||||||
color: var(--color-text-3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.mcp-server-item {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
padding: 8px 12px;
|
|
||||||
|
|
||||||
.server-info {
|
|
||||||
flex: 1;
|
|
||||||
overflow: hidden;
|
|
||||||
|
|
||||||
.server-name {
|
|
||||||
font-weight: 500;
|
|
||||||
font-size: 14px;
|
|
||||||
color: var(--color-text-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.server-description {
|
|
||||||
font-size: 12px;
|
|
||||||
color: var(--color-text-3);
|
|
||||||
margin-top: 2px;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
|
||||||
|
|
||||||
.server-url {
|
|
||||||
font-size: 11px;
|
|
||||||
color: var(--color-text-4);
|
|
||||||
margin-top: 2px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import { Avatar, Dropdown, Tooltip } from 'antd'
|
|||||||
import { first, sortBy } from 'lodash'
|
import { first, sortBy } from 'lodash'
|
||||||
import { FC, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'
|
import { FC, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import styled, { createGlobalStyle } from 'styled-components'
|
import styled from 'styled-components'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
mentionModels: Model[]
|
mentionModels: Model[]
|
||||||
@ -348,169 +348,25 @@ const MentionModelsButton: FC<Props> = ({ mentionModels, onMentionModel: onSelec
|
|||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<Dropdown
|
||||||
<DropdownMenuStyle />
|
overlayStyle={{ marginBottom: 20 }}
|
||||||
<Dropdown
|
dropdownRender={() => menu}
|
||||||
overlayStyle={{ marginBottom: 20 }}
|
trigger={['click']}
|
||||||
dropdownRender={() => menu}
|
open={isOpen}
|
||||||
trigger={['click']}
|
onOpenChange={(open) => {
|
||||||
open={isOpen}
|
setIsOpen(open)
|
||||||
onOpenChange={(open) => {
|
open && setFromKeyboard(false) // Set fromKeyboard to false when opened by button click
|
||||||
setIsOpen(open)
|
}}
|
||||||
open && setFromKeyboard(false) // Set fromKeyboard to false when opened by button click
|
overlayClassName="mention-models-dropdown">
|
||||||
}}
|
<Tooltip placement="top" title={t('agents.edit.model.select.title')} arrow>
|
||||||
overlayClassName="mention-models-dropdown">
|
<ToolbarButton type="text" ref={dropdownRef}>
|
||||||
<Tooltip placement="top" title={t('agents.edit.model.select.title')} arrow>
|
<i className="iconfont icon-at" style={{ fontSize: 18 }}></i>
|
||||||
<ToolbarButton type="text" ref={dropdownRef}>
|
</ToolbarButton>
|
||||||
<i className="iconfont icon-at" style={{ fontSize: 18 }}></i>
|
</Tooltip>
|
||||||
</ToolbarButton>
|
</Dropdown>
|
||||||
</Tooltip>
|
|
||||||
</Dropdown>
|
|
||||||
</>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const DropdownMenuStyle = createGlobalStyle`
|
|
||||||
/* 将样式限定在 mention-models-dropdown 类下 */
|
|
||||||
.mention-models-dropdown {
|
|
||||||
&.ant-dropdown {
|
|
||||||
background: rgba(var(--color-base-rgb), 0.65) !important;
|
|
||||||
backdrop-filter: blur(35px) saturate(150%) !important;
|
|
||||||
animation-duration: 0.15s !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 移动其他样式到 mention-models-dropdown 类下 */
|
|
||||||
.ant-slide-up-enter .ant-dropdown-menu,
|
|
||||||
.ant-slide-up-appear .ant-dropdown-menu,
|
|
||||||
.ant-slide-up-leave .ant-dropdown-menu,
|
|
||||||
.ant-slide-up-enter-active .ant-dropdown-menu,
|
|
||||||
.ant-slide-up-appear-active .ant-dropdown-menu,
|
|
||||||
.ant-slide-up-leave-active .ant-dropdown-menu {
|
|
||||||
background: rgba(var(--color-base-rgb), 0.65) !important;
|
|
||||||
backdrop-filter: blur(35px) saturate(150%) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ant-dropdown-menu {
|
|
||||||
/* 保持原有的下拉菜单样式,但限定在 mention-models-dropdown 类下 */
|
|
||||||
max-height: 400px;
|
|
||||||
overflow-y: auto;
|
|
||||||
overflow-x: hidden;
|
|
||||||
padding: 4px 12px;
|
|
||||||
position: relative;
|
|
||||||
background: rgba(var(--color-base-rgb), 0.65) !important;
|
|
||||||
backdrop-filter: blur(35px) saturate(150%) !important;
|
|
||||||
border: 0.5px solid rgba(var(--color-border-rgb), 0.3);
|
|
||||||
border-radius: 10px;
|
|
||||||
box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.15),
|
|
||||||
0 4px 16px rgba(0, 0, 0, 0.15),
|
|
||||||
0 2px 8px rgba(0, 0, 0, 0.12),
|
|
||||||
inset 0 0 0 0.5px rgba(255, 255, 255, var(--inner-glow-opacity, 0.1));
|
|
||||||
transform-origin: top;
|
|
||||||
will-change: transform, opacity;
|
|
||||||
transition: all 0.15s cubic-bezier(0.4, 0.0, 0.2, 1);
|
|
||||||
margin-bottom: 0;
|
|
||||||
|
|
||||||
&.no-scrollbar {
|
|
||||||
padding-right: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.has-scrollbar {
|
|
||||||
padding-right: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Scrollbar styles
|
|
||||||
&::-webkit-scrollbar {
|
|
||||||
width: 14px;
|
|
||||||
height: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
&::-webkit-scrollbar-thumb {
|
|
||||||
border: 4px solid transparent;
|
|
||||||
background-clip: padding-box;
|
|
||||||
border-radius: 7px;
|
|
||||||
background-color: var(--color-scrollbar-thumb);
|
|
||||||
min-height: 50px;
|
|
||||||
transition: all 0.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:hover::-webkit-scrollbar-thumb {
|
|
||||||
background-color: var(--color-scrollbar-thumb);
|
|
||||||
}
|
|
||||||
|
|
||||||
&::-webkit-scrollbar-thumb:hover {
|
|
||||||
background-color: var(--color-scrollbar-thumb-hover);
|
|
||||||
}
|
|
||||||
|
|
||||||
&::-webkit-scrollbar-thumb:active {
|
|
||||||
background-color: var(--color-scrollbar-thumb-hover);
|
|
||||||
}
|
|
||||||
|
|
||||||
&::-webkit-scrollbar-track {
|
|
||||||
background: transparent;
|
|
||||||
border-radius: 7px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.ant-dropdown-menu-item-group {
|
|
||||||
margin-bottom: 4px;
|
|
||||||
|
|
||||||
&:not(:first-child) {
|
|
||||||
margin-top: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ant-dropdown-menu-item-group-title {
|
|
||||||
padding: 5px 12px;
|
|
||||||
color: var(--color-text-3);
|
|
||||||
font-size: 12px;
|
|
||||||
font-weight: 500;
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 0.03em;
|
|
||||||
opacity: 0.7;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle no-results case margin
|
|
||||||
.no-results {
|
|
||||||
padding: 8px 12px;
|
|
||||||
color: var(--color-text-3);
|
|
||||||
cursor: default;
|
|
||||||
font-size: 13px;
|
|
||||||
opacity: 0.8;
|
|
||||||
margin-bottom: 40px;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.ant-dropdown-menu-item {
|
|
||||||
padding: 5px 12px;
|
|
||||||
margin: 0 -12px;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
|
||||||
border-radius: 6px;
|
|
||||||
font-size: 13px;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background: rgba(var(--color-hover-rgb), 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
&.ant-dropdown-menu-item-selected {
|
|
||||||
background-color: rgba(var(--color-primary-rgb), 0.12);
|
|
||||||
color: var(--color-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.ant-dropdown-menu-item-icon {
|
|
||||||
margin-right: 0;
|
|
||||||
opacity: 0.9;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
|
|
||||||
const ModelItem = styled.div`
|
const ModelItem = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@ -189,20 +189,20 @@ const MCPSettings: FC = () => {
|
|||||||
title: t('settings.mcp.name'),
|
title: t('settings.mcp.name'),
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
key: 'name',
|
key: 'name',
|
||||||
width: '10%',
|
width: '300px',
|
||||||
render: (text: string, record: MCPServer) => <Text strong={record.isActive}>{text}</Text>
|
render: (text: string, record: MCPServer) => <Text strong={record.isActive}>{text}</Text>
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('settings.mcp.type'),
|
title: t('settings.mcp.type'),
|
||||||
key: 'type',
|
key: 'type',
|
||||||
width: '5%',
|
width: '100px',
|
||||||
render: (_: any, record: MCPServer) => <Tag color="cyan">{record.baseUrl ? 'SSE' : 'STDIO'}</Tag>
|
render: (_: any, record: MCPServer) => <Tag color="cyan">{record.baseUrl ? 'SSE' : 'STDIO'}</Tag>
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('settings.mcp.description'),
|
title: t('settings.mcp.description'),
|
||||||
dataIndex: 'description',
|
dataIndex: 'description',
|
||||||
key: 'description',
|
key: 'description',
|
||||||
width: '50%',
|
width: 'auto',
|
||||||
render: (text: string) => {
|
render: (text: string) => {
|
||||||
if (!text) {
|
if (!text) {
|
||||||
return (
|
return (
|
||||||
@ -231,7 +231,7 @@ const MCPSettings: FC = () => {
|
|||||||
title: t('settings.mcp.active'),
|
title: t('settings.mcp.active'),
|
||||||
dataIndex: 'isActive',
|
dataIndex: 'isActive',
|
||||||
key: 'isActive',
|
key: 'isActive',
|
||||||
width: '5%',
|
width: '100px',
|
||||||
render: (isActive: boolean, record: MCPServer) => (
|
render: (isActive: boolean, record: MCPServer) => (
|
||||||
<Switch checked={isActive} onChange={(checked) => handleToggleActive(record.name, checked)} />
|
<Switch checked={isActive} onChange={(checked) => handleToggleActive(record.name, checked)} />
|
||||||
)
|
)
|
||||||
@ -239,7 +239,7 @@ const MCPSettings: FC = () => {
|
|||||||
{
|
{
|
||||||
title: t('settings.mcp.actions'),
|
title: t('settings.mcp.actions'),
|
||||||
key: 'actions',
|
key: 'actions',
|
||||||
width: '10%',
|
width: '100px',
|
||||||
render: (_: any, record: MCPServer) => (
|
render: (_: any, record: MCPServer) => (
|
||||||
<Space>
|
<Space>
|
||||||
<Tooltip title={t('common.edit')}>
|
<Tooltip title={t('common.edit')}>
|
||||||
@ -283,7 +283,10 @@ const MCPSettings: FC = () => {
|
|||||||
</Text>
|
</Text>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Card bordered={false} style={{ background: theme === 'dark' ? '#1f1f1f' : '#fff' }}>
|
<Card
|
||||||
|
bordered={false}
|
||||||
|
style={{ background: theme === 'dark' ? '#1f1f1f' : '#fff' }}
|
||||||
|
styles={{ body: { padding: 0 } }}>
|
||||||
<Table
|
<Table
|
||||||
dataSource={mcpServers}
|
dataSource={mcpServers}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
@ -350,11 +353,11 @@ const MCPSettings: FC = () => {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item name="args" label={t('settings.mcp.args')} tooltip={t('settings.mcp.argsTooltip')}>
|
<Form.Item name="args" label={t('settings.mcp.args')} tooltip={t('settings.mcp.argsTooltip')}>
|
||||||
<TextArea rows={3} placeholder="arg1\narg2" style={{ fontFamily: 'monospace' }} />
|
<TextArea rows={3} placeholder={`arg1\narg2`} style={{ fontFamily: 'monospace' }} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item name="env" label={t('settings.mcp.env')} tooltip={t('settings.mcp.envTooltip')}>
|
<Form.Item name="env" label={t('settings.mcp.env')} tooltip={t('settings.mcp.envTooltip')}>
|
||||||
<TextArea rows={3} placeholder="KEY1=value1\nKEY2=value2" style={{ fontFamily: 'monospace' }} />
|
<TextArea rows={3} placeholder={`KEY1=value1\nKEY2=value2`} style={{ fontFamily: 'monospace' }} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user