From efe4ea0e2568522130c4638b7633e1c0f6b3ebed Mon Sep 17 00:00:00 2001 From: "Apple\\Apple" Date: Sun, 1 Jun 2025 17:39:41 +0800 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20Refactor=20the?= =?UTF-8?q?=20structure=20of=20the=20common=20component?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/components/LoginForm.js | 6 ++-- web/src/components/RegisterForm.js | 6 ++-- .../{ => common/logo}/LinuxDoIcon.js | 0 .../components/{ => common/logo}/OIDCIcon.js | 0 .../{ => common/logo}/WeChatIcon.js | 0 .../common/{ => markdown}/MarkdownRenderer.js | 2 +- .../common/{ => markdown}/markdown.css | 0 web/src/components/custom/TextInput.js | 28 ------------------- web/src/components/custom/TextNumberInput.js | 21 -------------- .../components/playground/MessageContent.js | 2 +- 10 files changed, 8 insertions(+), 57 deletions(-) rename web/src/components/{ => common/logo}/LinuxDoIcon.js (100%) rename web/src/components/{ => common/logo}/OIDCIcon.js (100%) rename web/src/components/{ => common/logo}/WeChatIcon.js (100%) rename web/src/components/common/{ => markdown}/MarkdownRenderer.js (99%) rename web/src/components/common/{ => markdown}/markdown.css (100%) delete mode 100644 web/src/components/custom/TextInput.js delete mode 100644 web/src/components/custom/TextNumberInput.js diff --git a/web/src/components/LoginForm.js b/web/src/components/LoginForm.js index 3ed799f1..fd583262 100644 --- a/web/src/components/LoginForm.js +++ b/web/src/components/LoginForm.js @@ -29,10 +29,10 @@ import Text from '@douyinfe/semi-ui/lib/es/typography/text'; import TelegramLoginButton from 'react-telegram-login'; import { IconGithubLogo, IconMail, IconLock } from '@douyinfe/semi-icons'; -import OIDCIcon from './OIDCIcon.js'; -import WeChatIcon from './WeChatIcon'; +import OIDCIcon from './common/logo/OIDCIcon.js'; +import WeChatIcon from './common/logo/WeChatIcon.js'; import { setUserData } from '../helpers/data.js'; -import LinuxDoIcon from './LinuxDoIcon.js'; +import LinuxDoIcon from './common/logo/LinuxDoIcon.js'; import { useTranslation } from 'react-i18next'; import Background from '../images/example.png'; diff --git a/web/src/components/RegisterForm.js b/web/src/components/RegisterForm.js index c0368caa..1c893a72 100644 --- a/web/src/components/RegisterForm.js +++ b/web/src/components/RegisterForm.js @@ -26,9 +26,9 @@ import { onLinuxDOOAuthClicked, onOIDCClicked, } from './utils.js'; -import OIDCIcon from './OIDCIcon.js'; -import LinuxDoIcon from './LinuxDoIcon.js'; -import WeChatIcon from './WeChatIcon.js'; +import OIDCIcon from './common/logo/OIDCIcon.js'; +import LinuxDoIcon from './common/logo/LinuxDoIcon.js'; +import WeChatIcon from './common/logo/WeChatIcon.js'; import TelegramLoginButton from 'react-telegram-login/src'; import { setUserData } from '../helpers/data.js'; import { UserContext } from '../context/User/index.js'; diff --git a/web/src/components/LinuxDoIcon.js b/web/src/components/common/logo/LinuxDoIcon.js similarity index 100% rename from web/src/components/LinuxDoIcon.js rename to web/src/components/common/logo/LinuxDoIcon.js diff --git a/web/src/components/OIDCIcon.js b/web/src/components/common/logo/OIDCIcon.js similarity index 100% rename from web/src/components/OIDCIcon.js rename to web/src/components/common/logo/OIDCIcon.js diff --git a/web/src/components/WeChatIcon.js b/web/src/components/common/logo/WeChatIcon.js similarity index 100% rename from web/src/components/WeChatIcon.js rename to web/src/components/common/logo/WeChatIcon.js diff --git a/web/src/components/common/MarkdownRenderer.js b/web/src/components/common/markdown/MarkdownRenderer.js similarity index 99% rename from web/src/components/common/MarkdownRenderer.js rename to web/src/components/common/markdown/MarkdownRenderer.js index 12662265..5368b078 100644 --- a/web/src/components/common/MarkdownRenderer.js +++ b/web/src/components/common/markdown/MarkdownRenderer.js @@ -13,7 +13,7 @@ import React from 'react'; import { useDebouncedCallback } from 'use-debounce'; import clsx from 'clsx'; import { Button, Tooltip, Toast } from '@douyinfe/semi-ui'; -import { copy } from '../../helpers/utils'; +import { copy } from '../../../helpers/utils'; import { IconCopy } from '@douyinfe/semi-icons'; import { useTranslation } from 'react-i18next'; diff --git a/web/src/components/common/markdown.css b/web/src/components/common/markdown/markdown.css similarity index 100% rename from web/src/components/common/markdown.css rename to web/src/components/common/markdown/markdown.css diff --git a/web/src/components/custom/TextInput.js b/web/src/components/custom/TextInput.js deleted file mode 100644 index 8c137fe1..00000000 --- a/web/src/components/custom/TextInput.js +++ /dev/null @@ -1,28 +0,0 @@ -import { Input, Typography } from '@douyinfe/semi-ui'; -import React from 'react'; - -const TextInput = ({ - label, - name, - value, - onChange, - placeholder, - type = 'text', -}) => { - return ( - <> -
- {label} -
- onChange(value)} - value={value} - autoComplete='new-password' - /> - - ); -}; - -export default TextInput; diff --git a/web/src/components/custom/TextNumberInput.js b/web/src/components/custom/TextNumberInput.js deleted file mode 100644 index 36e0cac0..00000000 --- a/web/src/components/custom/TextNumberInput.js +++ /dev/null @@ -1,21 +0,0 @@ -import { Input, InputNumber, Typography } from '@douyinfe/semi-ui'; -import React from 'react'; - -const TextNumberInput = ({ label, name, value, onChange, placeholder }) => { - return ( - <> -
- {label} -
- onChange(value)} - value={value} - autoComplete='new-password' - /> - - ); -}; - -export default TextNumberInput; diff --git a/web/src/components/playground/MessageContent.js b/web/src/components/playground/MessageContent.js index efed6b0c..6d687e2a 100644 --- a/web/src/components/playground/MessageContent.js +++ b/web/src/components/playground/MessageContent.js @@ -4,7 +4,7 @@ import { TextArea, Button, } from '@douyinfe/semi-ui'; -import MarkdownRenderer from '../common/MarkdownRenderer'; +import MarkdownRenderer from '../common/markdown/MarkdownRenderer'; import { ChevronRight, ChevronUp,