Skip to content

Commit

Permalink
🦄 refactor(theme): edit theme structure
Browse files Browse the repository at this point in the history
  • Loading branch information
bingling-sama committed Apr 9, 2024
1 parent 94ef9d8 commit d60d75f
Show file tree
Hide file tree
Showing 8 changed files with 197 additions and 162 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,6 @@ dist-ssr

# macOS
.DS_Store

# Obsidian
.obsidian
24 changes: 0 additions & 24 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,30 +116,6 @@ const themeConfig: DefaultTheme.Config = {
nav: [
{ text: "主页", link: "/" },
{ text: "崩溃分析工具", link: "/analyzer" },
{ text: "通用问题", link: "/commons" },
{
text: "客户端崩溃",
activeMatch: "/client/*",
items: [
{ text: "通用问题", link: "/client/shared" },
{ text: "系统问题", link: "/client/system" },
{ text: "原版问题", link: "/client/vanilla" },
{ text: "Mod 问题", link: "/client/mods" },
],
},
{
text: "服务端崩溃",
activeMatch: "/server/*",
items: [
{ text: "通用问题", link: "/server/shared" },
{ text: "原版问题", link: "/server/vanilla" },
{ text: "Mod 端问题", link: "/server/mods" },
{ text: "插件端问题", link: "/server/plugins" },
{ text: "整合端问题", link: "/server/hybrid" },
{ text: "跨服端问题", link: "/server/proxy" },
],
},
{ text: "Mixin", link: "/mixin" },
{
text: "贡献",
activeMatch: "/contribute/*",
Expand Down
5 changes: 5 additions & 0 deletions docs/.vitepress/theme/global-components/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare module "*.vue" {
import { defineComponent } from "vue"
const component: ReturnType<typeof defineComponent>
export default component
}
34 changes: 24 additions & 10 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
import type { EnhanceAppContext } from "vitepress"
import { useData, useRoute } from "vitepress"
import Theme from "vitepress/theme"
import { h } from "vue"

// Layouts
import Layout from "./Layout.vue"

// Components
import LauncherBadge from "./global-components/LauncherBadge.vue"
import Contributors from "./components/Contributors.vue"
import LauncherBadge from "./components/LauncherBadge.vue"
import ReloadPrompt from "./components/ReloadPrompt.vue"

// Plugins
import giscusTalk from "vitepress-plugin-comment-with-giscus"
import vitepressNprogress from "@andatoshiki/vitepress-plugin-nprogress"
import "@andatoshiki/vitepress-plugin-nprogress/lib/css/index.css"
import "viewerjs/dist/viewer.min.css"
import imageViewer from "vitepress-plugin-image-viewer"
import vImageViewer from "vitepress-plugin-image-viewer/lib/vImageViewer.vue"
import { useData, useRoute } from "vitepress"
import codeblocksFold from "vitepress-plugin-codeblocks-fold" // import method
import "vitepress-plugin-codeblocks-fold/style/index.scss" // import style
import "./style.css"
import vitepressBackToTop from "vitepress-plugin-back-to-top"

// Styles
import "./style.css"
import "vitepress-plugin-back-to-top/dist/style.css"
import Layout from "./Layout.vue"
import "vitepress-plugin-codeblocks-fold/style/index.scss"
import "@andatoshiki/vitepress-plugin-nprogress/lib/css/index.css"
import "viewerjs/dist/viewer.min.css"

export default {
extends: Theme,
Expand All @@ -28,13 +36,19 @@ export default {
})
},
enhanceApp(ctx: EnhanceAppContext) {
ctx.app.component("LauncherBadge", LauncherBadge)
vitepressNprogress(ctx)
ctx.app.component("vImageViewer", vImageViewer)
vitepressBackToTop({
// default
threshold: 300,
})
ctx.app.component("LauncherBadge", LauncherBadge)
vitepressNprogress(ctx)
ctx.app.component("vImageViewer", vImageViewer)
// Why it doesn't work?
// const layouts = import.meta.glob("./layouts/*.vue")
// for (const path in layouts) {
// const layout = layouts[path].default
// ctx.app.component(layout.name, layout)
// }
},
setup(): void {
// Get frontmatter and route
Expand Down
2 changes: 1 addition & 1 deletion docs/basis.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ A:要对 `Minecraft` 的游戏错误 / 崩溃进行处理,您首先要对游
:::

:::tip BakaXL / PCL2 / HMCL 无法使用?
若在启动 BakaXL 或 PCL2 时出现了。NET Framework 异常,请在[此处](https://dotnet.microsoft.com/zh-cn/download/dotnet-framework/thank-you/net48-offline-installer)下载安装NET Framework 4.8。
若在启动 BakaXL 或 PCL2 时出现了。NET Framework 异常,请在[此处](https://dotnet.microsoft.com/zh-cn/download/dotnet-framework/thank-you/net48-offline-installer)下载安装 .NET Framework 4.8。

若使用 HMCL 启动失败或启动时出现 JavaFX 缺失相关提示,请尝试在系统设置中卸载相关 Java,然后下载并安装[微软 JDK](https://learn.microsoft.com/zh-cn/java/openjdk/download#openjdk-17) 后再尝试启动。

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"prettier": "^3.2.4",
"sass": "^1.70.0",
"tslib": "^2.6.2",
"vite": "^5.2.8",
"vite-plugin-pwa": "^0.19.4",
"vitepress": "1.0.0-rc.41",
"vue": "^3.4.15",
Expand Down
Loading

0 comments on commit d60d75f

Please sign in to comment.