From db547fb3788bf1f4ae703196e3324f97c2a48e89 Mon Sep 17 00:00:00 2001 From: chris <1637083533@qq.com> Date: Tue, 29 Apr 2025 15:36:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin-card/PluginCardComponent.tsx | 114 +++++++++--------- 1 file changed, 56 insertions(+), 58 deletions(-) diff --git a/web/src/app/home/plugins/plugin-installed/plugin-card/PluginCardComponent.tsx b/web/src/app/home/plugins/plugin-installed/plugin-card/PluginCardComponent.tsx index 9efbbe9e..53b3ecf9 100644 --- a/web/src/app/home/plugins/plugin-installed/plugin-card/PluginCardComponent.tsx +++ b/web/src/app/home/plugins/plugin-installed/plugin-card/PluginCardComponent.tsx @@ -1,67 +1,65 @@ -import styles from "./pluginCard.module.css" +import styles from "./pluginCard.module.css"; import { PluginCardVO } from "@/app/home/plugins/plugin-installed/PluginCardVO"; -import { GithubOutlined, LinkOutlined, ToolOutlined } from '@ant-design/icons'; -import { Switch, Tag } from 'antd' +import { GithubOutlined, LinkOutlined, ToolOutlined } from "@ant-design/icons"; +import { Switch, Tag } from "antd"; import { useState } from "react"; import { httpClient } from "@/app/infra/http/HttpClient"; export default function PluginCardComponent({ - cardVO + cardVO }: { - cardVO: PluginCardVO + cardVO: PluginCardVO; }) { - const [initialized, setInitialized] = useState(cardVO.isInitialized); - const [switchEnable, setSwitchEnable] = useState(true); + const [initialized, setInitialized] = useState(cardVO.isInitialized); + const [switchEnable, setSwitchEnable] = useState(true); - function handleEnable() { - setSwitchEnable(false); - httpClient - .togglePlugin(cardVO.author, cardVO.name, !initialized) - .then(() => { - setInitialized(!initialized); - }) - .catch((err) => { - console.log("error: ", err); - }) - .finally(() => { - setSwitchEnable(true); - }); - } - - return ( -
- {/* header */} -
- {/* left author */} -
{cardVO.author}
- {/* right icon & version */} -
- - v{cardVO.version} -
-
- {/* content */} -
-
{cardVO.name}
-
{cardVO.description}
-
- {/* footer */} -
-
-
- - 1 -
- -
-
+ function handleEnable() { + setSwitchEnable(false); + httpClient + .togglePlugin(cardVO.author, cardVO.name, !initialized) + .then(() => { + setInitialized(!initialized); + }) + .catch((err) => { + console.log("error: ", err); + }) + .finally(() => { + setSwitchEnable(true); + }); + } + return ( +
+ {/* header */} +
+ {/* left author */} +
{cardVO.author}
+ {/* right icon & version */} +
+ + v{cardVO.version}
- ); -} +
+ {/* content */} +
+
{cardVO.name}
+
{cardVO.description}
+
+ {/* footer */} +
+
+
+ + 1 +
+ +
+ + +
+
+ ); +} \ No newline at end of file