-
onInputSearchKeyword(e.target.value)}
- />
-
- {marketPluginList.map((vo, index) => {
- return (
-
-
+ for (let i = 0; i < totalPlugins; i++) {
+ allPlugins.push(new PluginMarketCardVO({
+ pluginId: `plugin-${i}`,
+ description: `这是插件 ${i} 的描述,包含一些详细信息`,
+ name: `插件 ${i}`,
+ author: `/author-${i % 5}`, // 模拟5个不同的作者
+ version: `0.${i % 10}`,
+ githubURL: `https://github.com/author-${i % 5}/plugin-${i}`,
+ starCount: 10 + Math.floor(Math.random() * 100)
+ }))
+ }
+
+ // 根据关键词过滤
+ const filtered = keyword
+ ? allPlugins.filter(p =>
+ p.name.toLowerCase().includes(keyword.toLowerCase()) ||
+ p.description.toLowerCase().includes(keyword.toLowerCase()))
+ : allPlugins
+
+ // 分页处理
+ const start = (page - 1) * pageSize
+ const end = start + pageSize
+ const paginatedData = filtered.slice(start, end)
+
+ return {
+ data: paginatedData,
+ total: filtered.length
+ }
+ }
+
+ function onInputSearchKeyword(keyword: string) {
+ setSearchKeyword(keyword)
+ setCurrentPage(1) // 搜索时重置为第一页
+ debounceSearch(keyword)
+ }
+
+ const debounceSearch = useCallback(
+ debounce((keyword: string) => {
+ fetchPlugins(keyword, 1)
+ }, 500), []
+ )
+
+ function handlePageChange(page: number) {
+ setCurrentPage(page)
+ }
+
+ return (
+
+
onInputSearchKeyword(e.target.value)}
+ />
+
+ {loading ? (
+
加载中...
+ ) : marketPluginList.length === 0 ? (
+
没有找到匹配的插件
+ ) : (
+ marketPluginList.map((vo, index) => (
+
+ ))
+ )}
- );
- })}
-
-
{
- setNowPage(pageNumber);
- getPluginList(pageNumber);
- }}
- />
-
- );
+ {totalItems > 0 && (
+
+ )}
+
+ )
}
diff --git a/web/src/app/home/plugins/plugin-market/plugin-market-card/PluginMarketCardVO.ts b/web/src/app/home/plugins/plugin-market/plugin-market-card/PluginMarketCardVO.ts
index 6af3f199..9d508066 100644
--- a/web/src/app/home/plugins/plugin-market/plugin-market-card/PluginMarketCardVO.ts
+++ b/web/src/app/home/plugins/plugin-market/plugin-market-card/PluginMarketCardVO.ts
@@ -5,6 +5,7 @@ export interface IPluginMarketCardVO {
description: string,
starCount: number,
githubURL: string,
+ version: string,
}
export class PluginMarketCardVO implements IPluginMarketCardVO {
@@ -14,6 +15,7 @@ export class PluginMarketCardVO implements IPluginMarketCardVO {
author: string;
githubURL: string;
starCount: number;
+ version: string;
constructor(prop: IPluginMarketCardVO) {
this.description = prop.description
@@ -22,5 +24,6 @@ export class PluginMarketCardVO implements IPluginMarketCardVO {
this.githubURL = prop.githubURL
this.starCount = prop.starCount
this.pluginId = prop.pluginId
+ this.version = prop.version
}
}
diff --git a/web/src/app/home/plugins/plugin-market/plugin-market-card/pluginMarketCard.module.css b/web/src/app/home/plugins/plugin-market/plugin-market-card/pluginMarketCard.module.css
index f611f335..33297b09 100644
--- a/web/src/app/home/plugins/plugin-market/plugin-market-card/pluginMarketCard.module.css
+++ b/web/src/app/home/plugins/plugin-market/plugin-market-card/pluginMarketCard.module.css
@@ -1,6 +1,4 @@
.cardContainer {
- width: 360px;
- height: 140px;
box-sizing: border-box;
background-color: #FFF;
border-radius: 9px;
@@ -74,4 +72,4 @@
align-self: center;
justify-content: space-between;
}
-}
+}
\ No newline at end of file
diff --git a/web/src/app/home/plugins/plugins.module.css b/web/src/app/home/plugins/plugins.module.css
index 1393c15b..24688273 100644
--- a/web/src/app/home/plugins/plugins.module.css
+++ b/web/src/app/home/plugins/plugins.module.css
@@ -1,8 +1,8 @@
.pageContainer {
width: 100%;
- height: calc(100% - 30px);
}
+
.marketComponentBody {
width: 100%;
height: calc(100% - 60px);
@@ -11,17 +11,13 @@
.pluginListContainer {
align-self: flex-start;
justify-self: flex-start;
- width: calc(100% - 60px);
- height: 100%;
- max-height: 100%;
- margin: auto;
+ margin: auto;
display: grid;
grid-template-rows: repeat(auto-fill, minmax(160px, 1fr));
grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
gap: 15px;
- justify-items: center;
+ /* justify-items: center; */
align-items: center;
- overflow-y: scroll;
}
.modalTitle {
@@ -35,4 +31,4 @@
display: flex;
flex-direction: column;
justify-content: space-around;
-}
+}
\ No newline at end of file
diff --git a/web/src/app/infra/basic-component/create-card-component/CreateCardComponent.tsx b/web/src/app/infra/basic-component/create-card-component/CreateCardComponent.tsx
index 3e33d712..f1a280fc 100644
--- a/web/src/app/infra/basic-component/create-card-component/CreateCardComponent.tsx
+++ b/web/src/app/infra/basic-component/create-card-component/CreateCardComponent.tsx
@@ -1,12 +1,10 @@
import styles from "./createCartComponent.module.css";
export default function CreateCardComponent({
- width,
height,
plusSize,
onClick,
}: {
- width: number;
height: number;
plusSize: number;
onClick: () => void
@@ -15,7 +13,7 @@ export default function CreateCardComponent({
-
-
- {/* Ant Design 图标,可以换成 Langbot 的 Logo */}
-
-
-
+
+
+
+
+
+ {/* Ant Design 图标,可以换成 Langbot 的 Logo */}
+
+
+
-
-
- 404
-
-
- 页面不存在
-
-
- 您要查找的页面似乎不存在。请检查您输入的 URL 是否正确,或者返回首页。
-
-
+
+
+ 404
+
+
+ 页面不存在
+
+
+ 您要查找的页面似乎不存在。请检查您输入的 URL 是否正确,或者返回首页。
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
+
+
);
}