Skip to content

Commit 5419efb

Browse files
authored
feat(extension): add category filtering for market plugins and enhance UI components (#6762)
1 parent 52beeef commit 5419efb

File tree

9 files changed

+388
-164
lines changed

9 files changed

+388
-164
lines changed

dashboard/src/components/extension/MarketPluginCard.vue

Lines changed: 124 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -41,80 +41,42 @@ const handleInstall = (plugin) => {
4141
<v-card
4242
class="rounded-lg d-flex flex-column plugin-card"
4343
elevation="0"
44-
style="height: 13rem; position: relative"
4544
>
46-
<v-chip
47-
v-if="plugin?.pinned"
48-
color="warning"
49-
size="x-small"
50-
label
51-
style="
52-
position: absolute;
53-
right: 8px;
54-
top: 8px;
55-
z-index: 10;
56-
height: 20px;
57-
font-weight: bold;
58-
"
59-
>
60-
{{ tm("market.recommended") }}
61-
</v-chip>
6245
6346
<v-card-text
64-
style="
65-
padding: 12px;
66-
padding-bottom: 8px;
67-
display: flex;
68-
gap: 12px;
69-
width: 100%;
70-
flex: 1;
71-
overflow: hidden;
72-
"
47+
class="plugin-card-content"
7348
>
74-
<div style="flex-shrink: 0">
49+
<div class="plugin-cover">
7550
<img
7651
:src="plugin?.logo || defaultPluginIcon"
7752
:alt="plugin.name"
78-
style="
79-
height: 75px;
80-
width: 75px;
81-
border-radius: 8px;
82-
object-fit: cover;
83-
"
53+
class="plugin-cover__image"
8454
/>
8555
</div>
8656
87-
<div
88-
style="
89-
flex: 1;
90-
overflow: hidden;
91-
display: flex;
92-
flex-direction: column;
93-
"
94-
>
95-
<div
96-
class="font-weight-bold"
97-
style="
98-
margin-bottom: 4px;
99-
line-height: 1.3;
100-
font-size: 1.2rem;
101-
white-space: nowrap;
102-
overflow: hidden;
103-
text-overflow: ellipsis;
104-
"
105-
>
106-
<span style="overflow: hidden; text-overflow: ellipsis">
57+
<div class="plugin-info">
58+
<div class="d-flex align-center plugin-title-row">
59+
<div class="font-weight-bold plugin-title">
10760
{{
10861
plugin.display_name?.length
10962
? plugin.display_name
11063
: showPluginFullName
11164
? plugin.name
11265
: plugin.trimmedName
11366
}}
114-
</span>
67+
</div>
68+
<v-chip
69+
v-if="plugin?.pinned"
70+
color="warning"
71+
size="x-small"
72+
label
73+
class="market-recommended-chip"
74+
>
75+
{{ tm("market.recommended") }}
76+
</v-chip>
11577
</div>
11678
117-
<div class="d-flex align-center" style="gap: 4px; margin-bottom: 6px">
79+
<div class="d-flex align-center plugin-meta">
11880
<v-icon
11981
icon="mdi-account"
12082
size="x-small"
@@ -159,6 +121,18 @@ const handleInstall = (plugin) => {
159121
></v-icon>
160122
<span>{{ plugin.version }}</span>
161123
</div>
124+
<div
125+
v-if="plugin.stars !== undefined"
126+
class="d-flex align-center text-subtitle-2 ml-2"
127+
style="color: rgba(var(--v-theme-on-surface), 0.7)"
128+
>
129+
<v-icon
130+
icon="mdi-star"
131+
size="x-small"
132+
style="margin-right: 2px"
133+
></v-icon>
134+
<span>{{ plugin.stars }}</span>
135+
</div>
162136
</div>
163137
164138
<div class="text-caption plugin-description">
@@ -167,8 +141,7 @@ const handleInstall = (plugin) => {
167141
168142
<div
169143
v-if="plugin.astrbot_version || platformDisplayList.length"
170-
class="d-flex align-center flex-wrap"
171-
style="gap: 4px; margin-top: 4px; margin-bottom: 4px"
144+
class="plugin-badges"
172145
>
173146
<v-chip
174147
v-if="plugin.astrbot_version"
@@ -186,32 +159,7 @@ const handleInstall = (plugin) => {
186159
/>
187160
</div>
188161
189-
<div class="d-flex align-center" style="gap: 8px; margin-top: auto">
190-
<div
191-
v-if="plugin.stars !== undefined"
192-
class="d-flex align-center text-subtitle-2"
193-
style="color: rgba(var(--v-theme-on-surface), 0.7)"
194-
>
195-
<v-icon
196-
icon="mdi-star"
197-
size="x-small"
198-
style="margin-right: 2px"
199-
></v-icon>
200-
<span>{{ plugin.stars }}</span>
201-
</div>
202-
<div
203-
v-if="plugin.updated_at"
204-
class="d-flex align-center text-subtitle-2"
205-
style="color: rgba(var(--v-theme-on-surface), 0.7)"
206-
>
207-
<v-icon
208-
icon="mdi-clock-outline"
209-
size="x-small"
210-
style="margin-right: 2px"
211-
></v-icon>
212-
<span>{{ new Date(plugin.updated_at).toLocaleString() }}</span>
213-
</div>
214-
</div>
162+
<div class="plugin-stats"></div>
215163
</div>
216164
</v-card-text>
217165
@@ -274,24 +222,112 @@ const handleInstall = (plugin) => {
274222
>
275223
{{ tm("buttons.install") }}
276224
</v-btn>
277-
<v-chip v-else color="success" size="x-small" label style="height: 20px">
225+
<v-btn
226+
v-else
227+
color="success"
228+
size="small"
229+
variant="flat"
230+
disabled
231+
class="market-action-btn"
232+
style="height: 32px"
233+
>
278234
✓ {{ tm("status.installed") }}
279-
</v-chip>
235+
</v-btn>
280236
</v-card-actions>
281237
</v-card>
282238
</template>
283239
284240
<style scoped>
241+
.plugin-card-content {
242+
padding: 12px;
243+
padding-bottom: 8px;
244+
display: flex;
245+
flex-direction: row;
246+
gap: 12px;
247+
width: 100%;
248+
flex: 1;
249+
overflow: hidden;
250+
min-height: 0;
251+
}
252+
253+
.plugin-cover {
254+
flex-shrink: 0;
255+
width: 76px;
256+
height: 76px;
257+
display: flex;
258+
align-items: center;
259+
justify-content: center;
260+
border-radius: 8px;
261+
background: transparent;
262+
}
263+
264+
.plugin-cover__image {
265+
width: 76px;
266+
height: 76px;
267+
border-radius: 8px;
268+
object-fit: cover;
269+
}
270+
271+
.plugin-info {
272+
display: flex;
273+
flex-direction: column;
274+
flex: 1;
275+
overflow: hidden;
276+
}
277+
278+
.plugin-title-row {
279+
margin-bottom: 4px;
280+
gap: 8px;
281+
}
282+
283+
.market-recommended-chip {
284+
flex-shrink: 0;
285+
font-weight: bold;
286+
height: 20px;
287+
}
288+
289+
.plugin-title {
290+
line-height: 1.3;
291+
font-size: 1rem;
292+
white-space: nowrap;
293+
overflow: hidden;
294+
text-overflow: ellipsis;
295+
}
296+
297+
.plugin-meta {
298+
gap: 4px;
299+
margin-bottom: 6px;
300+
flex-wrap: nowrap;
301+
}
302+
285303
.plugin-description {
286304
color: rgba(var(--v-theme-on-surface), 0.6);
287305
line-height: 1.3;
288306
margin-bottom: 6px;
289307
flex: 1;
290-
overflow-y: hidden;
308+
overflow: hidden;
309+
display: -webkit-box;
310+
-webkit-line-clamp: 3;
311+
line-clamp: 3;
312+
-webkit-box-orient: vertical;
313+
min-height: calc(1.3em * 3);
314+
max-height: calc(1.3em * 3);
315+
}
316+
317+
.plugin-badges {
318+
display: flex;
319+
align-items: center;
320+
flex-wrap: wrap;
321+
gap: 4px;
322+
margin-top: 4px;
323+
margin-bottom: 4px;
291324
}
292325
293-
.plugin-card:hover .plugin-description {
294-
overflow-y: auto;
326+
.plugin-stats {
327+
display: flex;
328+
align-items: center;
329+
gap: 8px;
330+
margin-top: auto;
295331
}
296332
297333
.plugin-description::-webkit-scrollbar {

dashboard/src/components/extension/PluginSortControl.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ const toggleOrder = () => {
8585
8686
.plugin-sort-control__select {
8787
min-width: 180px;
88+
width: 190px;
8889
max-width: 220px;
8990
}
9091

dashboard/src/i18n/locales/en-US/features/extension.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,16 @@
9696
"market": {
9797
"recommended": "🥳 Recommended",
9898
"allPlugins": "📦 All Extensions",
99+
"category": "Category",
100+
"categories": {
101+
"all": "All",
102+
"ai_tools": "AI Tools",
103+
"entertainment": "Entertainment",
104+
"productivity": "Productivity",
105+
"integrations": "Integrations",
106+
"utilities": "Utilities",
107+
"other": "Other"
108+
},
99109
"showFullName": "Full Name",
100110
"devDocs": "Extension Development Docs",
101111
"submitRepo": "Submit Extension Repository",

dashboard/src/i18n/locales/ru-RU/features/extension.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,15 @@
9696
"market": {
9797
"recommended": "🥳 Рекомендуем",
9898
"allPlugins": "📦 Все плагины",
99+
"categories": {
100+
"all": "Все",
101+
"ai_tools": "AI Tools",
102+
"entertainment": "Развлечения",
103+
"productivity": "Продуктивность",
104+
"integrations": "Интеграции",
105+
"utilities": "Утилиты",
106+
"other": "Другое"
107+
},
99108
"showFullName": "Полное имя",
100109
"devDocs": "Документация для разработчиков",
101110
"submitRepo": "Добавить репозиторий",
@@ -355,4 +364,4 @@
355364
"pluginChangelog": {
356365
"menuTitle": "Журнал изменений"
357366
}
358-
}
367+
}

dashboard/src/i18n/locales/zh-CN/features/extension.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,16 @@
9696
"market": {
9797
"recommended": "🥳 推荐",
9898
"allPlugins": "📦 全部插件",
99+
"category": "分类",
100+
"categories": {
101+
"all": "全部",
102+
"ai_tools": "AI 增强",
103+
"entertainment": "娱乐",
104+
"productivity": "效率",
105+
"integrations": "外部集成",
106+
"utilities": "生活实用",
107+
"other": "其他"
108+
},
99109
"showFullName": "完整名称",
100110
"devDocs": "插件开发文档",
101111
"submitRepo": "提交插件仓库",

dashboard/src/stores/common.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ export const useCommonStore = defineStore({
178178
"updated_at": pluginData?.updated_at ? pluginData.updated_at : "",
179179
"display_name": pluginData?.display_name ? pluginData.display_name : "",
180180
"astrbot_version": pluginData?.astrbot_version ? pluginData.astrbot_version : "",
181+
"category": pluginData?.category ? pluginData.category : "",
181182
"support_platforms": Array.isArray(pluginData?.support_platforms)
182183
? pluginData.support_platforms
183184
: Array.isArray(pluginData?.support_platform)

dashboard/src/views/ExtensionPage.vue

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -218,15 +218,6 @@ const {
218218
<!-- 插件市场标签页内容 -->
219219
<MarketPluginsTab :state="pageState" />
220220

221-
<v-row v-if="loading_">
222-
<v-col cols="12" class="d-flex justify-center">
223-
<v-progress-circular
224-
indeterminate
225-
color="primary"
226-
size="48"
227-
></v-progress-circular>
228-
</v-col>
229-
</v-row>
230221
</v-card-text>
231222
</v-card>
232223
</v-col>

0 commit comments

Comments
 (0)