📝 [docs]: 新增统计信息

This commit is contained in:
snowykami 2024-09-01 22:30:46 +08:00
parent c805db3371
commit 0f9683de89
6 changed files with 43 additions and 16 deletions

View File

@ -24,5 +24,12 @@ export const en = defineConfig({
copyright: ThemeConfig.copyright
},
outline: ThemeConfig.getOutLine("Page Content"),
langMenuLabel: 'Language',
returnToTopLabel: 'Back to top',
sidebarMenuLabel: 'Menu',
darkModeSwitchLabel: 'Theme',
lightModeSwitchTitle: 'Light Mode',
darkModeSwitchTitle: 'Dark Mode',
},
})

View File

@ -24,5 +24,12 @@ export const zh = defineConfig({
copyright: ThemeConfig.copyright
},
outline: ThemeConfig.getOutLine("页面内容"),
langMenuLabel: '语言',
returnToTopLabel: '返回顶部',
sidebarMenuLabel: '菜单',
darkModeSwitchLabel: '主题',
lightModeSwitchTitle: '轻色模式',
darkModeSwitchTitle: '深色模式',
},
})

View File

@ -1,10 +1,9 @@
<script setup lang="ts">
import DefaultTheme from "vitepress/theme";
import {ref, onMounted, onUnmounted, watch} from "vue";
import {ref, onMounted, onUnmounted} from "vue";
import {statsApi, GithubStats, RepoUrl, StarMapUrl} from "./scripts/statsApi";
import {getTextRef, updateRefData} from "./scripts/i18n";
import { onBeforeRouteUpdate } from 'vue-router';
import {useData} from "vitepress";
import {onBeforeRouteUpdate} from 'vue-router';
const {Layout} = DefaultTheme;
@ -104,17 +103,19 @@ onBeforeRouteUpdate(() => {
<Layout>
<template #home-features-before>
<div class="stats-bar-content">
<div class="button" @click="updateRefData">Update</div>
<div class="stats-bar">
<div class="stats-info">
<div v-for="section in Object.values(dataSections)" :key="section.name" class="section">
<a :href="section.link" target="_blank">
<div class="section-tab">
<span class="dot" :style="{backgroundColor: section.color}"></span>
<span class="text">{{ getTextRef(section.name) }}</span>
</div>
<div class="number">{{ section.value.value }}</div>
</a>
<div class="stats-title">{{ getTextRef('stats') }}</div>
<div class="sections">
<div v-for="section in Object.values(dataSections)" :key="section.name" class="section">
<a :href="section.link" target="_blank">
<div class="section-tab">
<span class="dot" :style="{backgroundColor: section.color}"></span>
<span class="text">{{ getTextRef(section.name) }}</span>
</div>
<div class="number">{{ section.value.value }}</div>
</a>
</div>
</div>
</div>
<div class="starmap">
@ -147,7 +148,19 @@ onBeforeRouteUpdate(() => {
flex-direction: column; /* 默认纵向布局 */
}
.stats-info {
.stats-info{
margin-bottom: 20px;
}
.stats-title {
font-size: 20px;
font-weight: bold;
margin-bottom: 20px;
text-align: center;
}
.sections {
height: 100%;
width: 100%;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
@ -232,7 +245,7 @@ onBeforeRouteUpdate(() => {
.stats-info {
width: 40%;
margin: 20px;
margin: 30px;
}
.starmap {

View File

@ -4,6 +4,7 @@ import {useData} from "vitepress";
const i18nData = {
en: {
stats: 'Stats',
online: 'Online',
offline: 'Offline',
total: 'Total',
@ -22,6 +23,7 @@ const i18nData = {
resourceStore: 'Resources Store',
},
zh: {
stats: '统计信息',
online: '在线',
offline: '离线',
total: '实例',

View File

@ -3,7 +3,6 @@ layout: home
hero:
name: "LiteyukiBot"
text: "Litedoc"
tagline: "An integrated chat bot application and management framework"
actions:
- theme: brand

View File

@ -3,7 +3,6 @@ layout: home
hero:
name: "轻雪机器人"
text: "文档"
tagline: "一个综合性的聊天机器人应用及管理框架"
actions:
- theme: brand