📝 [docs]: 新增统计信息

This commit is contained in:
远野千束 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 copyright: ThemeConfig.copyright
}, },
outline: ThemeConfig.getOutLine("Page Content"), 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 copyright: ThemeConfig.copyright
}, },
outline: ThemeConfig.getOutLine("页面内容"), outline: ThemeConfig.getOutLine("页面内容"),
langMenuLabel: '语言',
returnToTopLabel: '返回顶部',
sidebarMenuLabel: '菜单',
darkModeSwitchLabel: '主题',
lightModeSwitchTitle: '轻色模式',
darkModeSwitchTitle: '深色模式',
}, },
}) })

View File

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

View File

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

View File

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

View File

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