version docs pages

This commit is contained in:
outfoxxed 2025-07-22 01:08:30 -07:00
parent 5865251560
commit f5b537f511
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
27 changed files with 321 additions and 278 deletions

View file

@ -2,7 +2,6 @@
import "@pagefind/default-ui/css/ui.css";
import magnifierIcon from "@icons/magnifier.svg?raw"
---
<site-search class="search-wrapper">
<button
data-open-modal
@ -52,7 +51,6 @@ import magnifierIcon from "@icons/magnifier.svg?raw"
<script>
import { getQMLTypeLinkObject, getQMLTypeLink, getIconForLink } from '@src/config/io/helpers';
class SiteSearch extends HTMLElement {
constructor() {
super();
@ -107,7 +105,7 @@ import { getQMLTypeLinkObject, getQMLTypeLink, getIconForLink } from '@src/confi
if (match.length > 0){
for (const matching of match) {
const linkObject = getQMLTypeLinkObject(matching[1]);
const link = getQMLTypeLink(linkObject);
const link = getQMLTypeLink("NOVERSION", linkObject);
const icon = linkObject.mtype ? getIconForLink(linkObject.mtype, false) : null;
// for signal

View file

@ -5,15 +5,19 @@ export interface Props {
currentClass?: string;
}
import { getModulesData } from "@config/io/generateTypeData";
import { getVersionsData } from "@config/io/generateTypeData";
import type { TreeEntry } from "./Tree.astro";
import Tree from "./Tree.astro";
import Link from "./Link.astro";
import VersionSelector from "./VersionSelector.astro"
const modules = await getModulesData();
import { getCollection } from "astro:content";
const versions = await getVersionsData();
const versionName = Astro.params.version;
const modules = versions.versions.find(version => version.name === versionName)?.modules;
const currentPath = Astro.url.pathname.split('/').filter(s => s !== "");
const guidePages = await getCollection("guide");
interface NavTree {
@ -22,8 +26,6 @@ interface NavTree {
entries?: NavTree[],
}
const currentPath = Astro.url.pathname.slice(1).split('/');
function mkTree(mount: string, pathIdx: number, { title, slug, entries }: NavTree): TreeEntry {
const link = `${mount}/${slug}`;
@ -48,43 +50,67 @@ function genGuideNav(base: string): NavTree[] | undefined {
return pages.length === 0 ? undefined : pages;
}
const guide = mkTree("/docs", 1, {
title: "Usage Guide",
slug: "guide",
entries: genGuideNav(""),
});
let versionedEntries;
let versionsTree;
const types = mkTree("/docs", 1, {
title: "Quickshell Types",
slug: "types",
entries: modules.map(module => ({
title: module.name,
slug: module.name,
entries: module.types.map(type => ({
title: type.name,
slug: type.name,
}))
}))
});
if (versionName) {
versionedEntries = {
guide: mkTree(`/docs/${versionName}`, 2, {
title: "Usage Guide",
slug: "guide",
entries: genGuideNav(""),
}),
types: mkTree(`/docs/${versionName}`, 2, {
title: "Quickshell Types",
slug: "types",
entries: modules!.map(module => ({
title: module.name,
slug: module.name,
entries: module.types.map(type => ({
title: type.name,
slug: type.name,
}))
}))
}),
};
versionsTree = {
title: `Switch Version (${versionName})`,
link: "#",
entries: versions.versions.map(version => ({
title: version.name,
link: `/docs/${version.name}${Astro.url.pathname.slice(6 + versionName.length)}`,
current: version.name == versionName,
})),
};
}
---
<nav class="navtree">
<VersionSelector title="Versions" link=`${Astro.currentLocale}` current/>
<Link
title="About Quickshell"
title="About"
link="/about"
current={Astro.url.pathname === "/about"}
/>
<Tree {...guide}/>
<Tree {...types}/>
<Link
title="QtQuick Types"
link="https://doc.qt.io/qt-6/qtquick-qmlmodule.html"
showIcon={true}
/>
<Link
title="Quickshell Examples"
link="https://git.outfoxxed.me/outfoxxed/quickshell-examples"
showIcon={true}
current={currentPath.length === 1 && currentPath[0] === "about"}
/>
{ versionedEntries && <Tree {...versionsTree as TreeEntry}/>}
<hr/>
{ versionedEntries && (
<Tree {...versionedEntries.guide}/>
<Tree {...versionedEntries.types}/>
<Link
title="QtQuick Types"
link="https://doc.qt.io/qt-6/qtquick-qmlmodule.html"
showIcon={true}
/>
<Link
title="Quickshell Examples"
link="https://git.outfoxxed.me/outfoxxed/quickshell-examples"
showIcon={true}
/>
)}
{ !versionedEntries && versions.versions.map(version => (
<Link
title={`Quickshell Documentation (${version.name})`}
link={`/docs/${version.name}/guide`}
/>
))}
</nav>