Skip to content

Commit de44e8c

Browse files
committed
add changelog page
1 parent 6236ebf commit de44e8c

File tree

10 files changed

+250
-8
lines changed

10 files changed

+250
-8
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<template>
2+
<div class="text-formatted" v-html="renderedMarkdown" />
3+
</template>
4+
5+
<script lang="ts" setup>
6+
import markdownIt from 'markdown-it';
7+
8+
const props = defineProps<{
9+
markdown: string;
10+
}>();
11+
let md = new markdownIt({ html: true });
12+
let renderedMarkdown = md.render(props.markdown);
13+
</script>

docs/.vuepress/components/NaiveConfig.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ observer.observe(document.getElementsByTagName("html")[0], {
2424
2525
const themeOverrides: GlobalThemeOverrides = {
2626
common: {
27-
borderRadius: "8px"
27+
borderRadius: "8px",
28+
borderRadiusSmall: "6px"
2829
}
2930
}
3031
</script>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<script lang="ts" setup>
2+
import { NSpace } from 'naive-ui';
3+
import { ref } from 'vue';
4+
import { Releases, Release } from './types'
5+
import Version from './version.vue'
6+
7+
const core = ref<Releases>();
8+
const web = ref<Map<string, Release>>();
9+
10+
async function fetchCore() {
11+
const resp = await fetch('https://api.github.com/repos/alist-org/alist/releases')
12+
core.value = await resp.json()
13+
}
14+
async function fetchWeb() {
15+
const resp = await fetch('https://api.github.com/repos/alist-org/alist-web/releases')
16+
const releases = await resp.json()
17+
web.value = new Map(releases.map((release: Release) => [`v${release.tag_name}`, release]))
18+
}
19+
20+
await Promise.all([fetchCore(), fetchWeb()])
21+
22+
</script>
23+
<template>
24+
<NSpace vertical size="large">
25+
<Version v-for="(c, i) in core" :core="c" :web="web?.get(c.tag_name)" :latest="i === 0" />
26+
</NSpace>
27+
</template>
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
export type Releases = Release[];
2+
3+
export interface Release {
4+
url: string;
5+
assets_url: string;
6+
upload_url: string;
7+
html_url: string;
8+
id: number;
9+
author: Author;
10+
node_id: string;
11+
tag_name: string;
12+
target_commitish: string;
13+
name: string;
14+
draft: boolean;
15+
prerelease: boolean;
16+
created_at: string;
17+
published_at: string;
18+
assets: Asset[];
19+
tarball_url: string;
20+
zipball_url: string;
21+
body: string;
22+
reactions: Reactions;
23+
mentions_count: number;
24+
}
25+
26+
export interface Author {
27+
login: string;
28+
id: number;
29+
node_id: string;
30+
avatar_url: string;
31+
gravatar_id: string;
32+
url: string;
33+
html_url: string;
34+
followers_url: string;
35+
following_url: string;
36+
gists_url: string;
37+
starred_url: string;
38+
subscriptions_url: string;
39+
organizations_url: string;
40+
repos_url: string;
41+
events_url: string;
42+
received_events_url: string;
43+
type: string;
44+
site_admin: boolean;
45+
}
46+
47+
export interface Asset {
48+
url: string;
49+
id: number;
50+
node_id: string;
51+
name: string;
52+
label?: string;
53+
uploader: Uploader;
54+
content_type: string;
55+
state: string;
56+
size: number;
57+
download_count: number;
58+
created_at: string;
59+
updated_at: string;
60+
browser_download_url: string;
61+
}
62+
63+
export interface Uploader {
64+
login: string;
65+
id: number;
66+
node_id: string;
67+
avatar_url: string;
68+
gravatar_id: string;
69+
url: string;
70+
html_url: string;
71+
followers_url: string;
72+
following_url: string;
73+
gists_url: string;
74+
starred_url: string;
75+
subscriptions_url: string;
76+
organizations_url: string;
77+
repos_url: string;
78+
events_url: string;
79+
received_events_url: string;
80+
type: string;
81+
site_admin: boolean;
82+
}
83+
84+
export interface Reactions {
85+
url: string;
86+
total_count: number;
87+
"+1": number;
88+
"-1": number;
89+
laugh: number;
90+
hooray: number;
91+
confused: number;
92+
heart: number;
93+
rocket: number;
94+
eyes: number;
95+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<script lang="ts" setup>
2+
import Markdown from '../Markdown.vue'
3+
import { Release } from './types';
4+
import { NCollapseItem, NCard, NTag, NCollapse, NSpace, NH1, NDropdown, NButton } from 'naive-ui'
5+
const props = defineProps<{
6+
core: Release
7+
web?: Release
8+
latest?: boolean
9+
}>()
10+
const reactions = {
11+
'+1': '👍',
12+
'-1': '👎',
13+
laugh: '😄',
14+
hooray: '🎉',
15+
confused: '😕',
16+
heart: '❤️',
17+
rocket: '🚀',
18+
eyes: '👀'
19+
}
20+
const options = props.core.assets.map(asset => {
21+
return {
22+
label: asset.name,
23+
key: asset.browser_download_url
24+
}
25+
})
26+
27+
function handleSelect(url: string) {
28+
window.open(url, "_blank")
29+
}
30+
</script>
31+
32+
<template>
33+
<NCard>
34+
<NSpace vertical size="large">
35+
<NSpace size="large" justify="space-between" align="baseline">
36+
<NH1>{{ core.name }}</NH1>
37+
<NTag v-if="latest" type="info">latest</NTag>
38+
</NSpace>
39+
<Markdown :markdown="props.core.body" />
40+
<NCollapse v-if="props.web">
41+
<NCollapseItem title="Web">
42+
<Markdown :markdown="props.web.body" />
43+
</NCollapseItem>
44+
</NCollapse>
45+
<NSpace>
46+
<template v-for="(reaction, name) in reactions">
47+
<NTag style="cursor: pointer;" :bordered="false" round v-if="core.reactions[name]">
48+
{{ reaction }} {{ core.reactions[name] }}
49+
</NTag>
50+
</template>
51+
</NSpace>
52+
</NSpace>
53+
</NCard>
54+
</template>

docs/.vuepress/config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ export default defineUserConfig({
127127
"./components/aliyundrive/Callback.vue"
128128
),
129129
"@Pricing": path.resolve(__dirname, "./components/Pricing.vue"),
130-
"@Desktop": path.resolve(__dirname, "./components/Desktop.vue")
130+
"@Desktop": path.resolve(__dirname, "./components/Desktop.vue"),
131+
"@Changelog": path.resolve(__dirname, "./components/changelog/index.vue"),
131132
},
132133
});

docs/guide/changelog.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: Changelog
3+
toc: false
4+
icon: change
5+
order: 13
6+
# A page can have multiple categories
7+
category:
8+
- Guide
9+
# A page can have multiple tags
10+
tag:
11+
- Changelog
12+
- Guide
13+
# this page is sticky in article list
14+
sticky: true
15+
# this page will appear in starred articles
16+
star: true
17+
---
18+
19+
<NaiveClient>
20+
<Changelog />
21+
</NaiveClient>
22+
23+
<script setup lang="ts">
24+
import Changelog from "@Changelog";
25+
</script>

docs/zh/guide/changelog.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: 更新日志
3+
toc: false
4+
icon: change
5+
order: 13
6+
# A page can have multiple categories
7+
category:
8+
- Guide
9+
# A page can have multiple tags
10+
tag:
11+
- Changelog
12+
- Guide
13+
# this page is sticky in article list
14+
sticky: true
15+
# this page will appear in starred articles
16+
star: true
17+
---
18+
19+
<NaiveClient>
20+
<Changelog />
21+
</NaiveClient>
22+
23+
<script setup lang="ts">
24+
import Changelog from "@Changelog";
25+
</script>

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,8 @@
1717
"vuepress": "2.0.0-beta.60",
1818
"vuepress-theme-hope": "^2.0.0-beta.172",
1919
"vuepress-vite": "2.0.0-beta.60"
20+
},
21+
"dependencies": {
22+
"markdown-it": "^13.0.1"
2023
}
2124
}

pnpm-lock.yaml

Lines changed: 4 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)