Skip to content

Commit 9438e5f

Browse files
d-w-xSuperManito
andauthored
feat: update website (#49)
* chore: 更新依赖 * perf: 优化表格性能 * chore: update deps * feat: 镜像列表表格新增名称排序与状态过滤 * feat: 优化主题色配置 * feat: 镜像列表表格新增搜索高亮 * feat: 更新UI设计 * fix: 超链接 --------- Co-authored-by: Super Manito <[email protected]>
1 parent 20a5c20 commit 9438e5f

12 files changed

Lines changed: 336 additions & 222 deletions

File tree

package.json

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,33 +21,35 @@
2121
"dependencies": {
2222
"dayjs": "^1.11.18",
2323
"lodash-es": "^4.17.21",
24-
"marked": "^4.2.5",
24+
"marked": "^16.3.0",
2525
"pinia": "^3.0.3",
26+
"tinycolor2": "^1.6.0",
2627
"vue": "^3.5.22",
2728
"vue-gtag": "^3.6.1",
2829
"vue-i18n": "^11.1.12",
2930
"vue-router": "^4.5.1"
3031
},
3132
"devDependencies": {
32-
"@antfu/eslint-config": "~4.13.2",
33+
"@antfu/eslint-config": "~5.4.1",
3334
"@intlify/devtools-types": "^11.1.12",
34-
"@intlify/unplugin-vue-i18n": "^6.0.8",
35+
"@intlify/unplugin-vue-i18n": "^11.0.1",
3536
"@types/lodash-es": "^4.17.12",
36-
"@types/marked": "^4.0.8",
37+
"@types/marked": "^6.0.0",
3738
"@types/ms": "^2.1.0",
38-
"@types/node": "^22.15.29",
39+
"@types/node": "^24.5.2",
40+
"@types/tinycolor2": "^1.4.6",
3941
"@vicons/ionicons5": "^0.13.0",
40-
"@vitejs/plugin-vue": "^5.2.4",
41-
"@vitejs/plugin-vue-jsx": "^4.2.0",
42+
"@vitejs/plugin-vue": "^6.0.1",
43+
"@vitejs/plugin-vue-jsx": "^5.1.1",
4244
"eslint": "^9.36.0",
4345
"less": "^4.4.1",
4446
"naive-ui": "^2.43.1",
4547
"prettier": "^3.6.2",
4648
"rimraf": "^6.0.1",
4749
"rollup-plugin-visualizer": "^6.0.3",
48-
"typescript": "^5.9.2",
50+
"typescript": "~5.9.2",
4951
"vfonts": "^0.0.3",
50-
"vite": "^6.3.5",
52+
"vite": "^7.1.7",
5153
"vue-tsc": "^3.1.0"
5254
}
5355
}

src/App.vue

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script setup lang="ts">
22
import type { GlobalThemeOverrides } from 'naive-ui'
33
import { darkTheme, NConfigProvider, NLoadingBarProvider, NMessageProvider } from 'naive-ui'
4+
import Tiny from 'tinycolor2'
45
import { computed, onMounted } from 'vue'
56
import { useI18n } from 'vue-i18n'
67
@@ -13,15 +14,20 @@ const store = useStore()
1314
1415
const theme = computed(() => (store.darkMode ? darkTheme : null))
1516
const override = computed(
16-
() =>
17-
({
17+
() => {
18+
const themeColor = store.darkMode ? '#a879db' : '#6f106e'
19+
return ({
1820
common: {
19-
primaryColor: store.darkMode ? '#ffffff' : '#6f106e',
20-
primaryColorHover: store.darkMode ? '#fcfcfc' : '#6f106e',
21-
primaryColorPressed: store.darkMode ? 'd4d4d4' : '#560c56',
22-
primaryColorSuppl: '#6f106e',
21+
primaryColor: Tiny(themeColor).toHex8String(),
22+
primaryColorSecondary: Tiny(themeColor).setAlpha(0.16).toHex8String(),
23+
primaryColorHover: Tiny(themeColor).lighten(7.5).brighten(1).desaturate(20).spin(-2).toHex8String(),
24+
primaryColorPressed: Tiny(themeColor).darken(10).saturate(8).spin(2).toHex8String(),
25+
primaryColorSuppl: Tiny(themeColor).lighten(7.5).brighten(1).desaturate(20).spin(-2).toHex8String(),
26+
borderRadius: '5px',
2327
},
24-
} as GlobalThemeOverrides),
28+
} as GlobalThemeOverrides)
29+
},
30+
2531
)
2632
2733
onMounted(

src/components/Mirror/RouteButton.vue

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

src/components/SideBar/SideCard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ defineProps<{ entry: CardItem }>()
2727
</NButton>
2828
</NH3>
2929
<NRow v-for="(link, index) in entry.links" :key="index">
30-
<NButton text tag="a" :href="link.url" target="_blank">
30+
<NButton quaternary :focusable="false" tag="a" :href="link.url" target="_blank" style="width: 218px; justify-content: left">
3131
{{ link.title }}
3232
<template #icon>
3333
<NamedIcon :name="link.icon || 'unknown'" :size="16" />
Lines changed: 16 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,28 @@
11
<script setup lang="ts">
2-
import type { CSSProperties } from 'vue'
3-
import { NSwitch, useMessage } from 'naive-ui'
2+
import { MoonOutline, SunnyOutline } from '@vicons/ionicons5'
3+
import { NButton, NIcon } from 'naive-ui'
44
import { useStore } from '@/store'
55
66
const store = useStore()
7-
const message = useMessage()
87
9-
function onUpdate(value: boolean) {
10-
store.setDarkMode(value)
11-
message.info(`Side of ${value ? 'Tairitsu' : 'Hikari'}`)
12-
}
13-
14-
function railStyle({
15-
focused,
16-
checked,
17-
}: {
18-
focused: boolean
19-
checked: boolean
20-
}) {
21-
const style: CSSProperties = {}
22-
if (checked) {
23-
style.background = '#138ff2'
24-
if (focused) {
25-
style.boxShadow = '0 0 0 2px #138ff240'
26-
}
27-
}
28-
else {
29-
style.background = '#c0203d'
30-
if (focused) {
31-
style.boxShadow = '0 0 0 2px #c0203d40'
32-
}
33-
}
34-
return style
8+
function onUpdate() {
9+
store.setDarkMode(!store.darkMode)
3510
}
3611
</script>
3712

3813
<template>
39-
<NSwitch
40-
:default-value="store.darkMode"
41-
:on-update-value="onUpdate"
42-
:rail-style="railStyle"
43-
style="margin: 6px"
14+
<NButton
15+
quaternary
16+
size="small"
17+
:focusable="false"
18+
style="padding: 0 6px"
19+
@click="onUpdate"
4420
>
45-
<template #checked>
46-
Conflict
47-
</template>
48-
<template #unchecked>
49-
Light
21+
<template #icon>
22+
<NIcon>
23+
<SunnyOutline v-if="store.darkMode" />
24+
<MoonOutline v-else />
25+
</NIcon>
5026
</template>
51-
</NSwitch>
27+
</NButton>
5228
</template>

src/i18n/lang/en.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ export default {
5151
lastUpdate: 'Last Sync',
5252
nextUpdate: 'Next Sync',
5353
searchText: 'Search mirrors...',
54+
statusTitle: {
55+
success: 'Synced',
56+
cache: 'Cached',
57+
proxy: 'Proxying',
58+
failed: 'Failed',
59+
syncing: 'Syncing',
60+
},
5461
},
5562
error: {
5663
description: 'Where...am I?',

src/i18n/lang/zh.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ export default {
5151
lastUpdate: '上次同步',
5252
nextUpdate: '下次同步',
5353
searchText: '搜索镜像...',
54+
statusTitle: {
55+
success: '同步成功',
56+
cache: '已缓存',
57+
proxy: '代理中',
58+
failed: '同步失败',
59+
syncing: '正在同步',
60+
},
5461
},
5562
error: {
5663
description: '我...在哪儿?',

src/models/documents.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export async function fetchDoc(item?: DocItem): Promise<string> {
1616
if (item?.path === undefined) {
1717
return Promise.resolve('No document available.')
1818
}
19-
return await text(`${ServerPrefix}documentations/${item.path}`, data =>
20-
marked(data))
19+
return await text(`${ServerPrefix}documentations/${item.path}`, async (data) => {
20+
return await marked(data)
21+
})
2122
}

src/models/news.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export async function fetchNews(item?: NewsEntry): Promise<string> {
4141
if (item === undefined) {
4242
return Promise.resolve('No document available.')
4343
}
44-
return await text(`${ServerPrefix}news/${item.content}`, data =>
45-
marked(data))
44+
return await text(`${ServerPrefix}news/${item.content}`, async (data) => {
45+
return await marked(data)
46+
})
4647
}

src/utils/network.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ export async function json<T, U = unknown>(
2929

3030
export async function text(
3131
url: string,
32-
callback?: (text: string) => string,
32+
callback?: (text: string) => string | Promise<string>,
3333
config?: RequestInit,
3434
): Promise<string> {
3535
const res = await get(url, config)
3636
const data = await res.text()
3737
if (callback) {
38-
return callback(data)
38+
return await callback(data)
3939
}
4040
return data
4141
}

0 commit comments

Comments
 (0)