From eeb537048bd4349f6e4fb21942394d3dca4161f4 Mon Sep 17 00:00:00 2001 From: Teo Date: Fri, 28 Mar 2025 15:08:24 +0800 Subject: [PATCH] refactor(mcp settings): enhance NpxSearch component layout and styling (#4053) * refactor: mcp setting ui refactor * refactor(mcp settings): enhance NpxSearch component layout and styling --- .../pages/settings/MCPSettings/NpxSearch.tsx | 107 +++++++++++------- src/renderer/src/pages/settings/index.tsx | 4 +- 2 files changed, 65 insertions(+), 46 deletions(-) diff --git a/src/renderer/src/pages/settings/MCPSettings/NpxSearch.tsx b/src/renderer/src/pages/settings/MCPSettings/NpxSearch.tsx index 13c95b9e..12c1a6b1 100644 --- a/src/renderer/src/pages/settings/MCPSettings/NpxSearch.tsx +++ b/src/renderer/src/pages/settings/MCPSettings/NpxSearch.tsx @@ -8,6 +8,7 @@ import { Button, Card, Flex, Input, Space, Spin, Tag, Typography } from 'antd' import { npxFinder } from 'npx-scope-finder' import { type FC, useState } from 'react' import { useTranslation } from 'react-i18next' +import styled, { css } from 'styled-components' import { SettingDivider, SettingGroup, SettingTitle } from '..' @@ -27,7 +28,7 @@ let _searchResults: SearchResult[] = [] const NpxSearch: FC = () => { const { theme } = useTheme() const { t } = useTranslation() - const { Paragraph, Text, Link } = Typography + const { Text, Link } = Typography // Add new state variables for npm scope search const [npmScope, setNpmScope] = useState('@modelcontextprotocol') @@ -87,42 +88,44 @@ const NpxSearch: FC = () => { } return ( - - {t('settings.mcp.npx_list.title')} - - - {t('settings.mcp.npx_list.desc')} - + +
+ + {t('settings.mcp.npx_list.title')} {t('settings.mcp.npx_list.desc')} + + - - - setNpmScope(e.target.value)} - onPressEnter={handleNpmSearch} - /> - - - - - {npmScopes.map((scope) => ( - { - if (!searchLoading) { - setNpmScope(scope) - setTimeout(handleNpmSearch, 100) - } - }} - style={{ cursor: searchLoading ? 'not-allowed' : 'pointer' }}> - {scope} - - ))} - + + + setNpmScope(e.target.value)} + onPressEnter={handleNpmSearch} + /> + + + + {npmScopes.map((scope) => ( + { + if (!searchLoading) { + setNpmScope(scope) + setTimeout(handleNpmSearch, 100) + } + }} + style={{ cursor: searchLoading ? 'not-allowed' : 'pointer' }}> + {scope} + + ))} + + +
+ {searchLoading ? (
@@ -139,7 +142,7 @@ const NpxSearch: FC = () => { } extra={ - + v{record.version}