Skip to content

Commit 90f9105

Browse files
committed
更新页面
1 parent c3687c2 commit 90f9105

20 files changed

+165
-86
lines changed

.vitepress/components/CustomLayout.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const plugin = computed<PluginDetailedInfo | undefined>(() => data.all[useData()
1818
<template>
1919
<Layout>
2020
<template #doc-before>
21-
<div v-if="frontmatter.id" class="vp-doc">
21+
<div v-if="frontmatter.id" class="vp-doc external-link-icon-enabled">
2222
<h1>
2323
{{ frontmatter.title }}
2424
<Badge v-text="frontmatter.id" type="info" />
@@ -28,7 +28,7 @@ const plugin = computed<PluginDetailedInfo | undefined>(() => data.all[useData()
2828
</template>
2929

3030
<template #doc-footer-before>
31-
<div v-if="frontmatter.id" class="vp-doc">
31+
<div v-if="frontmatter.id" class="vp-doc external-link-icon-enabled">
3232
<h2>下载</h2>
3333
<DownloadBar :plugin="plugin" />
3434
</div>

.vitepress/components/DownloadBar.vue

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,46 @@ defineProps({
55
plugin: {
66
type: Object as () => PluginDetailedInfo | undefined,
77
required: true,
8-
}
9-
})
8+
},
9+
});
1010
</script>
1111

1212
<template>
1313
<div v-if="plugin">
14-
<div v-if="Object.keys(plugin.repo.releases).length > 0" v-for="tag of Object.keys(plugin.repo.releases)">
14+
<div
15+
class="info custom-block"
16+
v-if="plugin.dependencies && plugin.dependencies.length > 0"
17+
>
18+
<p class="custom-block-title">信息</p>
19+
<p>此插件可能还需要以下依赖:</p>
20+
21+
<ul>
22+
<li v-for="dependency of plugin.dependencies">
23+
<code> {{ dependency.id }}</code>
24+
25+
<ul>
26+
<li v-for="version of dependency.version">
27+
<code> {{ version }}</code>
28+
</li>
29+
</ul>
30+
</li>
31+
</ul>
32+
</div>
33+
34+
<div
35+
v-if="Object.keys(plugin.repo.releases).length > 0"
36+
v-for="tag of Object.keys(plugin.repo.releases)"
37+
>
1538
<h3>
1639
<a :href="plugin.repo.releases[tag].url" target="_blank">{{ tag }}</a>
1740

18-
<span class="published-at">({{
19-
new Date(
20-
plugin.repo.releases[tag].publishedAt
21-
).toLocaleDateString()
22-
}})</span>
41+
<span class="published-at"
42+
>({{
43+
new Date(
44+
plugin.repo.releases[tag].publishedAt
45+
).toLocaleDateString()
46+
}})</span
47+
>
2348
</h3>
2449

2550
<table v-if="plugin.repo.releases[tag].assets">
@@ -33,8 +58,8 @@ defineProps({
3358
<td>
3459
<a :href="asset.url" target="_blank">
3560
<code>
36-
{{ asset.name }}
37-
</code>
61+
{{ asset.name }}
62+
</code>
3863
</a>
3964
</td>
4065
<td>{{ (asset.size / 1024).toFixed(2) }} KB</td>
@@ -46,7 +71,7 @@ defineProps({
4671

4772
<div v-else>
4873
<div class="warning custom-block">
49-
<p class="custom-block-title">WARNING</p>
74+
<p class="custom-block-title">注意</p>
5075
<p>
5176
暂无发布版本,你可以到
5277
<a :href="plugin.repo.url" target="_blank">插件的仓库</a>

.vitepress/components/PluginInfoBar.vue

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ defineProps({
55
plugin: {
66
type: Object as () => PluginDetailedInfo | undefined,
77
required: true,
8-
}
9-
})
8+
},
9+
});
1010
</script>
1111

1212
<template>
@@ -28,24 +28,27 @@ defineProps({
2828
<tr>
2929
<td>标签</td>
3030
<td>
31-
<Badge v-for="tag of plugin.tags" type="tip" :text="{
32-
entertainment: '娱乐',
33-
development: '开发',
34-
tool: '工具',
35-
information: '信息',
36-
management: '管理',
37-
api: 'API',
38-
}[tag]
39-
" />
31+
<Badge
32+
v-for="tag of plugin.tags"
33+
type="tip"
34+
:text="
35+
{
36+
entertainment: '娱乐',
37+
development: '开发',
38+
tool: '工具',
39+
information: '信息',
40+
management: '管理',
41+
api: 'API',
42+
}[tag]
43+
"
44+
/>
4045
</td>
4146
</tr>
4247

4348
<tr>
4449
<td>作者</td>
4550
<td>
46-
{{
47-
plugin.authors.map((author) => author.name).join(', ') || '-'
48-
}}
51+
{{ plugin.authors.map((author) => author.name).join(', ') || '-' }}
4952
</td>
5053
</tr>
5154

@@ -61,8 +64,7 @@ defineProps({
6164
</div>
6265

6366
<div class="updated-at">
64-
(
65-
最后更新于
67+
( 最后更新于
6668
{{ new Date(plugin.repo.updatedAt).toLocaleString() }}
6769
)
6870
</div>

.vitepress/components/PluginListPage.vue

Lines changed: 70 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,35 @@ import { computed, ref } from 'vue';
55
import { PluginDetailedInfo } from '../libs/type.ts';
66
import { useRouter } from 'vitepress';
77
8+
const tags = {
9+
entertainment: '娱乐',
10+
development: '开发',
11+
tool: '工具',
12+
information: '信息',
13+
management: '管理',
14+
api: 'API',
15+
};
16+
17+
const selectTags = ref<string[]>([]);
18+
819
const router = useRouter();
920
const plugins = Object.entries(
1021
data.all as { [key: string]: PluginDetailedInfo }
1122
);
1223
1324
const search = ref('');
1425
const filteredPlugins = computed(() => {
15-
if (!search.value) return plugins;
26+
if (!search.value && !selectTags.value.length) return plugins;
1627
1728
const searchLower = search.value.toLowerCase();
18-
return plugins.filter(
19-
([id, plugin]) =>
20-
id.toLowerCase().includes(searchLower) ||
21-
plugin.name.toLowerCase().includes(searchLower) ||
22-
plugin.description.toLowerCase().includes(searchLower)
29+
return plugins.filter(([id, plugin]) =>
30+
search.value
31+
? id.toLowerCase().includes(searchLower) ||
32+
plugin.name.toLowerCase().includes(searchLower) ||
33+
plugin.description.toLowerCase().includes(searchLower)
34+
: false || selectTags.value.length
35+
? plugin.tags.some((tag) => selectTags.value.includes(tag))
36+
: false
2337
);
2438
});
2539
</script>
@@ -40,9 +54,26 @@ const filteredPlugins = computed(() => {
4054
/>
4155
</div>
4256

57+
<div class="tag-filter">
58+
<Badge
59+
v-for="tag in Object.keys(tags)"
60+
:key="tag"
61+
:type="selectTags.includes(tag) ? 'tip' : 'info'"
62+
:text="tags[tag]"
63+
:class="{ selected: selectTags.includes(tag) }"
64+
@click="
65+
selectTags.includes(tag)
66+
? selectTags.splice(selectTags.indexOf(tag), 1)
67+
: selectTags.push(tag)
68+
"
69+
/>
70+
</div>
71+
4372
<div class="plugin-count">
44-
当前共{{ plugins.length }}个插件
45-
<span v-if="search">,搜索结果:{{ filteredPlugins.length }}个</span>
73+
共 {{ plugins.length }} 个插件
74+
<span v-if="search || selectTags.length">
75+
· 搜索结果:{{ filteredPlugins.length }} 个
76+
</span>
4677
</div>
4778

4879
<div class="plugin-list">
@@ -102,7 +133,6 @@ h1 {
102133
border-radius: 8px;
103134
border-color: transparent;
104135
background: var(--vp-c-bg-alt);
105-
cursor: pointer;
106136
outline: none;
107137
transition: border-color 0.25s;
108138
}
@@ -111,9 +141,33 @@ h1 {
111141
border-color: var(--vp-c-brand-1);
112142
}
113143
144+
#search-box:hover:not(:focus) {
145+
cursor: pointer;
146+
}
147+
114148
.search-box-container {
115149
margin: 20px 0;
116150
}
151+
152+
.tag-filter {
153+
display: flex;
154+
justify-content: center;
155+
flex-wrap: wrap;
156+
}
157+
158+
.tag-filter > * {
159+
margin: 10px;
160+
user-select: none;
161+
-moz-user-select: none;
162+
-webkit-user-select: none;
163+
cursor: pointer;
164+
transition: opacity 0.25s;
165+
}
166+
167+
.tag-filter > *:hover {
168+
opacity: 0.8;
169+
}
170+
117171
.plugin-count {
118172
width: 100%;
119173
text-align: center;
@@ -123,7 +177,7 @@ h1 {
123177
124178
.plugin-list {
125179
display: grid;
126-
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
180+
grid-template-columns: repeat(2, 1fr);
127181
gap: 20px;
128182
margin: 20px 5px;
129183
}
@@ -135,7 +189,6 @@ h1 {
135189
border-color: var(--vp-c-gray-3);
136190
transition: border-color 0.25s;
137191
cursor: pointer;
138-
139192
display: flex;
140193
flex-direction: column;
141194
min-height: 180px;
@@ -157,4 +210,10 @@ h1 {
157210
flex-wrap: wrap;
158211
gap: 4px;
159212
}
213+
214+
@media screen and (max-width: 768px) {
215+
.plugin-list {
216+
grid-template-columns: 1fr;
217+
}
218+
}
160219
</style>

.vitepress/config.mts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { DefaultTheme, defineConfig } from 'vitepress';
22
import { generateSidebar } from 'vitepress-sidebar';
3+
import { MermaidMarkdown, MermaidPlugin } from 'vitepress-plugin-mermaid';
34

45
const locales: Partial<DefaultTheme.Config> = {
56
outline: {
@@ -25,18 +26,35 @@ const locales: Partial<DefaultTheme.Config> = {
2526
darkModeSwitchTitle: '切换到深色模式',
2627
};
2728

28-
// https://vitepress.dev/reference/site-config
2929
export default defineConfig({
3030
title: 'Serein 社区',
3131
description: 'Serein 社区',
3232
cleanUrls: true,
3333
head: [['link', { rel: 'icon', href: '/logo.png' }]],
3434

35-
vite: { server: { port: 5100 } },
35+
vite: {
36+
server: { port: 5100 },
37+
plugins: [MermaidPlugin()],
38+
optimizeDeps: {
39+
include: ['mermaid'],
40+
},
41+
},
3642
srcExclude: ['README.md'],
3743

44+
markdown: {
45+
container: {
46+
tipLabel: '提示',
47+
warningLabel: '注意',
48+
dangerLabel: '警告',
49+
infoLabel: '信息',
50+
detailsLabel: '详细信息',
51+
},
52+
config: (md) => md.use(MermaidMarkdown),
53+
},
54+
3855
themeConfig: {
39-
// https://vitepress.dev/reference/default-theme-config
56+
externalLinkIcon: true,
57+
4058
nav: [
4159
{ text: '插件', link: '/plugins/' },
4260
{ text: '整合包', link: '/packages/' },
@@ -58,7 +76,7 @@ export default defineConfig({
5876

5977
footer: {
6078
message: 'Built with VitePress',
61-
copyright: 'Copyright © 2022 Zaitonn. All Rights Reserved.',
79+
copyright: 'Copyright © 2025 SereinCommunity. All Rights Reserved.',
6280
},
6381

6482
search: {

.vitepress/libs/pluginManager.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

gallery.data.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ export default {
1414

1515
function read(fileName: string) {
1616
return JSON.parse(
17-
readFileSync(path.join('public', 'gallery', 'plugins', fileName), 'utf-8')
17+
readFileSync(path.join('public', 'indexes', 'plugins', fileName), 'utf-8')
1818
).data;
1919
}

0 commit comments

Comments
 (0)