Skip to content

Commit 21e175d

Browse files
committed
version docs pages
1 parent 5865251 commit 21e175d

31 files changed

+336
-395
lines changed

default.nix

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
yarn-berry,
77
nodejs,
88
cacert,
9-
quickshell-types ? null,
10-
masterBranch ? false,
9+
versions ? null,
1110
}: stdenv.mkDerivation (final: let
1211
nodeModules = stdenv.mkDerivation {
1312
pname = "${final.pname}-node_modules";
@@ -70,8 +69,7 @@ in {
7069
'';
7170

7271
PRODUCTION = true;
73-
MASTER_BRANCH = masterBranch;
74-
SECRET_MODULES_PATH = if quickshell-types == null then "" else quickshell-types;
72+
VERSION_FILE_PATH = versions;
7573

7674
buildPhase = ''
7775
HOME=$(pwd)/garbage-tooling yarn build

flake.lock

Lines changed: 4 additions & 47 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,15 @@
11
{
22
inputs = {
33
nixpkgs.url = "nixpkgs/nixos-unstable";
4-
5-
quickshell-docs = {
6-
url = "git+https://git.outfoxxed.me/quickshell/quickshell-docs";
7-
inputs.nixpkgs.follows = "nixpkgs";
8-
};
94
};
105

11-
outputs = { self, nixpkgs, quickshell-docs }: let
6+
outputs = { self, nixpkgs }: let
127
forEachSystem = fn: nixpkgs.lib.genAttrs
138
[ "x86_64-linux" "aarch64-linux" ]
149
(system: fn system nixpkgs.legacyPackages.${system});
1510
in {
1611
packages = forEachSystem (system: pkgs: rec {
17-
quickshell-web = pkgs.callPackage ./default.nix {
18-
quickshell-types = quickshell-docs.packages.${system}.quickshell-types;
19-
};
20-
12+
quickshell-web = pkgs.callPackage ./default.nix {};
2113
default = quickshell-web;
2214
});
2315
};

redirects.caddyfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ redir /docs/configuration/intro* /docs/guide/introduction permanent
33
redir /docs/configuration/positioning* /docs/guide/size-position permanent
44
redir /docs/configuration/qml-overview* /docs/guide/qml-language permanent
55
redir /docs/configuration* /docs/guide permanent
6+
7+
@unversioned_docs path_regexp ^/docs/((guide|types).*)$
8+
redir @unversioned_docs /docs/v0.1.0/{re.1}

src/components/featurelist/FeatureList.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
import { processMarkdown } from "@config/io/markdown";
33
4-
const codeDesktop = await processMarkdown(`\`\`\`qml
4+
const codeDesktop = await processMarkdown("N/A", `\`\`\`qml
55
// a standard desktop window
66
FloatingWindow {
77
Timer {
@@ -21,7 +21,7 @@ FloatingWindow {
2121
}
2222
\`\`\``);
2323
24-
const codeMobile = await processMarkdown(`\`\`\`qml
24+
const codeMobile = await processMarkdown("N/A", `\`\`\`qml
2525
// a standard desktop window
2626
FloatingWindow {
2727
Timer {

src/components/navigation/Search.astro

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import "@pagefind/default-ui/css/ui.css";
33
import magnifierIcon from "@icons/magnifier.svg?raw"
44
---
5-
65
<site-search class="search-wrapper">
76
<button
87
data-open-modal
@@ -52,7 +51,6 @@ import magnifierIcon from "@icons/magnifier.svg?raw"
5251

5352
<script>
5453
import { getQMLTypeLinkObject, getQMLTypeLink, getIconForLink } from '@src/config/io/helpers';
55-
5654
class SiteSearch extends HTMLElement {
5755
constructor() {
5856
super();
@@ -107,7 +105,7 @@ import { getQMLTypeLinkObject, getQMLTypeLink, getIconForLink } from '@src/confi
107105
if (match.length > 0){
108106
for (const matching of match) {
109107
const linkObject = getQMLTypeLinkObject(matching[1]);
110-
const link = getQMLTypeLink(linkObject);
108+
const link = getQMLTypeLink("NOVERSION", linkObject);
111109
const icon = linkObject.mtype ? getIconForLink(linkObject.mtype, false) : null;
112110

113111
// for signal

src/components/navigation/sidebars/nav/RootNav.astro

Lines changed: 63 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,18 @@ export interface Props {
55
currentClass?: string;
66
}
77
8-
import { getModulesData } from "@config/io/generateTypeData";
8+
import { getVersionsData } from "@config/io/generateTypeData";
99
import type { TreeEntry } from "./Tree.astro";
1010
import Tree from "./Tree.astro";
1111
import Link from "./Link.astro";
12-
import VersionSelector from "./VersionSelector.astro"
12+
import { getCollection } from "astro:content";
1313
14-
const modules = await getModulesData();
14+
const versions = await getVersionsData();
15+
const versionName = Astro.params.version;
16+
const modules = versions.versions.find(version => version.name === versionName)?.modules;
17+
18+
const currentPath = Astro.url.pathname.split('/').filter(s => s !== "");
1519
16-
import { getCollection } from "astro:content";
1720
const guidePages = await getCollection("guide");
1821
1922
interface NavTree {
@@ -22,8 +25,6 @@ interface NavTree {
2225
entries?: NavTree[],
2326
}
2427
25-
const currentPath = Astro.url.pathname.slice(1).split('/');
26-
2728
function mkTree(mount: string, pathIdx: number, { title, slug, entries }: NavTree): TreeEntry {
2829
const link = `${mount}/${slug}`;
2930
@@ -48,43 +49,67 @@ function genGuideNav(base: string): NavTree[] | undefined {
4849
return pages.length === 0 ? undefined : pages;
4950
}
5051
51-
const guide = mkTree("/docs", 1, {
52-
title: "Usage Guide",
53-
slug: "guide",
54-
entries: genGuideNav(""),
55-
});
52+
let versionedEntries;
53+
let versionsTree;
5654
57-
const types = mkTree("/docs", 1, {
58-
title: "Quickshell Types",
59-
slug: "types",
60-
entries: modules.map(module => ({
61-
title: module.name,
62-
slug: module.name,
63-
entries: module.types.map(type => ({
64-
title: type.name,
65-
slug: type.name,
66-
}))
67-
}))
68-
});
55+
if (versionName) {
56+
versionedEntries = {
57+
guide: mkTree(`/docs/${versionName}`, 2, {
58+
title: "Usage Guide",
59+
slug: "guide",
60+
entries: genGuideNav(""),
61+
}),
62+
types: mkTree(`/docs/${versionName}`, 2, {
63+
title: "Quickshell Types",
64+
slug: "types",
65+
entries: modules!.map(module => ({
66+
title: module.name,
67+
slug: module.name,
68+
entries: module.types.map(type => ({
69+
title: type.name,
70+
slug: type.name,
71+
}))
72+
}))
73+
}),
74+
};
6975
76+
versionsTree = {
77+
title: `Switch Version (${versionName})`,
78+
link: "#",
79+
entries: versions.versions.map(version => ({
80+
title: version.name,
81+
link: `/docs/${version.name}${Astro.url.pathname.slice(6 + versionName.length)}`,
82+
current: version.name == versionName,
83+
})),
84+
};
85+
}
7086
---
7187
<nav class="navtree">
72-
<VersionSelector title="Versions" link=`${Astro.currentLocale}` current/>
7388
<Link
74-
title="About Quickshell"
89+
title="About"
7590
link="/about"
76-
current={Astro.url.pathname === "/about"}
77-
/>
78-
<Tree {...guide}/>
79-
<Tree {...types}/>
80-
<Link
81-
title="QtQuick Types"
82-
link="https://doc.qt.io/qt-6/qtquick-qmlmodule.html"
83-
showIcon={true}
84-
/>
85-
<Link
86-
title="Quickshell Examples"
87-
link="https://git.outfoxxed.me/outfoxxed/quickshell-examples"
88-
showIcon={true}
91+
current={currentPath.length === 1 && currentPath[0] === "about"}
8992
/>
93+
{ versionedEntries && <Tree {...versionsTree as TreeEntry}/>}
94+
<hr/>
95+
{ versionedEntries && (
96+
<Tree {...versionedEntries.guide}/>
97+
<Tree {...versionedEntries.types}/>
98+
<Link
99+
title="QtQuick Types"
100+
link="https://doc.qt.io/qt-6/qtquick-qmlmodule.html"
101+
showIcon={true}
102+
/>
103+
<Link
104+
title="Quickshell Examples"
105+
link="https://git.outfoxxed.me/outfoxxed/quickshell-examples"
106+
showIcon={true}
107+
/>
108+
)}
109+
{ !versionedEntries && versions.versions.map(version => (
110+
<Link
111+
title={`Quickshell Documentation (${version.name})`}
112+
link={`/docs/${version.name}/guide`}
113+
/>
114+
))}
90115
</nav>

src/components/navigation/sidebars/nav/VersionSelector.astro

Lines changed: 0 additions & 48 deletions
This file was deleted.

src/components/type/Functions.astro

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ export interface Props {
1313
}
1414
1515
const { funcData } = Astro.props;
16+
const { version } = Astro.params;
1617
---
1718
<ul class="typedata typefuncs">
1819
{
1920
funcData.map(item => {
2021
const functionParams = item.params.length > 0 ? item.params.map((funcparam,index) => `${funcparam.name}${index !== item.params.length -1 ? ", ":""}`) : undefined
21-
const retTypeLink = getQMLTypeLink(item.ret as unknown as QMLTypeLinkObject)
22+
const retTypeLink = getQMLTypeLink(version!, item.ret as unknown as QMLTypeLinkObject)
2223
let genericType:string|undefined;
2324
let genericTypeLink:string|undefined;
2425
return (
@@ -37,7 +38,7 @@ const { funcData } = Astro.props;
3738
<p class="typedata-params typefunc-params">
3839
{
3940
item.params.map(param => {
40-
const paramTypeLink = getQMLTypeLink(param.type);
41+
const paramTypeLink = getQMLTypeLink(version!, param.type);
4142
return (
4243
<span class="typedata-param typefunc-param">
4344
<Tag client:idle/>

0 commit comments

Comments
 (0)