From 9f0d43fe099a95ab1516ae951dcb60a89e76a5a5 Mon Sep 17 00:00:00 2001 From: 简律纯 Date: Fri, 3 Nov 2023 21:13:33 +0800 Subject: chore: delete useless codes --- docs/theme.config.js | 178 --------------------------------------------------- 1 file changed, 178 deletions(-) delete mode 100644 docs/theme.config.js (limited to 'docs/theme.config.js') diff --git a/docs/theme.config.js b/docs/theme.config.js deleted file mode 100644 index 3e7ec06..0000000 --- a/docs/theme.config.js +++ /dev/null @@ -1,178 +0,0 @@ -import { useState, useEffect } from "react"; -import { useRouter } from "next/router"; -import { useConfig, useTheme } from "nextra-theme-docs"; -import { Footer } from "./components/Footer"; -import Navigation from "./components/Navigation"; -import HeaderLogo from "./components/HeaderLogo"; -import ExtraContent from "./components/ExtraContent"; -import { Discord, Github } from "./components/Social"; - -const SITE_ROOT = "https://hydroroll.retrofor.space"; - -/** - * @type {import('nextra-theme-docs').DocsThemeConfig} - */ -const theme = { - sidebar: { - defaultMenuCollapseLevel: Number.POSITIVE_INFINITY, - }, - docsRepositoryBase: "https://github.com/retrofor/HydroRoll/blob/main/docs", - useNextSeoProps: function SEO() { - const router = useRouter(); - const { frontMatter } = useConfig(); - - let section = "HydroRoll"; - if (router?.pathname.startsWith("/AI")) { - section = "HydroRollAI"; - } - if (router?.pathname.startsWith("/TRPG")) { - section = "HydroRollTRPG"; - } - - const defaultTitle = frontMatter.overrideTitle || section; - - return { - description: frontMatter.description, - defaultTitle, - titleTemplate: `%s – ${section}`, - }; - }, - gitTimestamp({ timestamp }) { - // eslint-disable-next-line react-hooks/rules-of-hooks - const [dateString, setDateString] = useState(timestamp.toISOString()); - - // eslint-disable-next-line react-hooks/rules-of-hooks - useEffect(() => { - try { - setDateString( - timestamp.toLocaleDateString(navigator.language, { - day: "numeric", - month: "long", - year: "numeric", - }) - ); - } catch (e) { - // Ignore errors here; they get the ISO string. - // At least one person out there has manually misconfigured navigator.language. - } - }, [timestamp]); - - return <>Last updated on {dateString}; - }, - unstable_flexsearch: true, - unstable_staticImage: true, - toc: { - float: true, - extraContent: ExtraContent, - }, - font: false, - feedback: { - link: "Question? Give us feedback →", - }, - logo: HeaderLogo, - logoLink: false, - head: function Head() { - const router = useRouter(); - const { systemTheme = "dark" } = useTheme(); - const { frontMatter } = useConfig(); - const fullUrl = - router.asPath === "/" ? SITE_ROOT : `${SITE_ROOT}${router.asPath}`; - - const asPath = router.asPath; - - let ogUrl; - - if (asPath === "/") { - ogUrl = `${SITE_ROOT}/api/og`; - } else if (frontMatter?.ogImage) { - ogUrl = `${SITE_ROOT}${frontMatter.ogImage}`; - } else { - const type = asPath.startsWith("/AI") - ? "AI" - : asPath.startsWith("/TRPG") - ? "TRPG" - : ""; - const title = frontMatter.title - ? `&title=${encodeURIComponent(frontMatter.title)}` - : ""; - - ogUrl = `${SITE_ROOT}/api/og?type=${type}${title}`; - } - - return ( - <> - - - - - - - - - - - - - - - - - - - - - - - - - ); - }, - editLink: { - text: "Edit this page on GitHub", - }, - navbar: { - component: Navigation, - extraContent: ( - <> - - - - ), - }, - search: { - placeholder: "Search documentation…", - }, - footer: { - component: Footer, - }, - nextThemes: { - defaultTheme: "dark", - }, -}; -export default theme; -- cgit v1.2.3-70-g09d2