diff --git a/web_ui/src/app/home/plugins/page.tsx b/web_ui/src/app/home/plugins/page.tsx index c7448c75..e28db69d 100644 --- a/web_ui/src/app/home/plugins/page.tsx +++ b/web_ui/src/app/home/plugins/page.tsx @@ -14,7 +14,7 @@ export default function PluginConfigPage() { const [nowPageType, setNowPageType] = useState(PageType.INSTALLED) return ( -
+
-
+
{ nowPageType === PageType.INSTALLED && } diff --git a/web_ui/src/app/home/plugins/plugin-market/PluginMarketComponent.tsx b/web_ui/src/app/home/plugins/plugin-market/PluginMarketComponent.tsx index 90487cd5..64f73f7e 100644 --- a/web_ui/src/app/home/plugins/plugin-market/PluginMarketComponent.tsx +++ b/web_ui/src/app/home/plugins/plugin-market/PluginMarketComponent.tsx @@ -4,10 +4,10 @@ import {useCallback, useEffect, useState} from "react"; import styles from "@/app/home/plugins/plugins.module.css"; import {PluginMarketCardVO} from "@/app/home/plugins/plugin-market/plugin-market-card/PluginMarketCardVO"; import PluginMarketCardComponent from "@/app/home/plugins/plugin-market/plugin-market-card/PluginMarketCardComponent"; -import {Input} from "antd"; +import {Input, Pagination} from "antd"; import {debounce} from "lodash" -export default function PluginInstalledComponent () { +export default function PluginMarketComponent () { const [marketPluginList, setMarketPluginList] = useState([]) const [searchKeyword, setSearchKeyword] = useState("") @@ -16,9 +16,7 @@ export default function PluginInstalledComponent () { }, []) function initData() { - getPluginList().then((value) => { - setMarketPluginList(value) - }) + getPluginList() } function onInputSearchKeyword(keyword: string) { @@ -35,7 +33,7 @@ export default function PluginInstalledComponent () { }, 500), [] ) - async function searchPlugin(keyword: string): Promise { + async function searchPlugin(keyword: string, pageNumber: number = 1): Promise { // TODO 实现搜索 const demoResult: PluginMarketCardVO[] = [] for (let i = 0; i < keyword.length; i ++) { @@ -52,33 +50,66 @@ export default function PluginInstalledComponent () { return demoResult } - async function getPluginList(): Promise { - return [ - new PluginMarketCardVO({ - pluginId: "aaa", - description: "一般的描述", - name: "插件AAA", - author: "/hana", - version: "0.1", - githubURL: "", - starCount: 23 - }), - ] + function getPluginList(pageNumber: number = 1) { + new Promise((resolve, reject) => { + const result = [ + new PluginMarketCardVO({ + pluginId: "aaa", + description: "一般的描述", + name: "插件AAA", + author: "/hana", + version: "0.1", + githubURL: "", + starCount: 23 + }), + ] + for (let i = 0; i < pageNumber; i ++) { + result.push( + new PluginMarketCardVO({ + pluginId: "aaa", + description: "一般的描述", + name: "插件AAA", + author: "/hana", + version: "0.1", + githubURL: "", + starCount: 23 + }) + ) + } + resolve(result) + }).then((value) => { + setMarketPluginList(value) + }) } return ( -
+
onInputSearchKeyword(e.target.value)} /> - { - marketPluginList.map((vo, index) => { - return
- -
- }) - } +
+ { + marketPluginList.map((vo, index) => { + return
+ +
+ }) + } +
+ { + getPluginList(pageNumber) + }} + />
+ ) } diff --git a/web_ui/src/app/home/plugins/plugins.module.css b/web_ui/src/app/home/plugins/plugins.module.css index 438ce546..1393c15b 100644 --- a/web_ui/src/app/home/plugins/plugins.module.css +++ b/web_ui/src/app/home/plugins/plugins.module.css @@ -1,7 +1,19 @@ +.pageContainer { + width: 100%; + height: calc(100% - 30px); +} + +.marketComponentBody { + width: 100%; + height: calc(100% - 60px); +} + .pluginListContainer { align-self: flex-start; justify-self: flex-start; width: calc(100% - 60px); + height: 100%; + max-height: 100%; margin: auto; display: grid; grid-template-rows: repeat(auto-fill, minmax(160px, 1fr)); @@ -9,6 +21,7 @@ gap: 15px; justify-items: center; align-items: center; + overflow-y: scroll; } .modalTitle { @@ -22,4 +35,4 @@ display: flex; flex-direction: column; justify-content: space-around; -} \ No newline at end of file +}