Skip to content

Commit d1e1d3c

Browse files
committed
added changelog and version dropdown
1 parent 9af300b commit d1e1d3c

File tree

9 files changed

+134
-27
lines changed

9 files changed

+134
-27
lines changed

src/components/Footer.astro

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,28 @@ interface Props {
1010
const props = Astro.props;
1111
---
1212
<footer class=`${props.class ?? ""}`>
13-
<section class="credits">
13+
<div class="credits">
1414
<p class="hint">Brought to you by:</p>
1515
<a href="https://outfoxxed.me" target="_blank">outfoxxed - <span class="hint">Lead Developer</span></a>
1616
<a href="https://xanazf.github.io" target="_blank">xanazf - <span class="hint">Website Developer / Designer</span></a>
1717
<a href="https://github.com/quickshell-mirror/quickshell/graphs/contributors" target="_blank">
1818
and our contributors
1919
</a>
20-
</section>
21-
<section class="socials">
22-
<a href="https://matrix.to/#/#quickshell:outfoxxed.me" target="_blank" aria-label="Join our matrix space">
23-
<Fragment set:html={matrixLogo}/>
24-
</a>
25-
<a href="https://discord.gg/UtZeT3xNyT" target="_blank" aria-label="Join our discord">
26-
<Fragment set:html={discordLogo}/>
27-
</a>
28-
<a href="https://git.outfoxxed.me/quickshell/quickshell" target="_blank" aria-label="Visit our git server">
29-
<Fragment set:html={gitLogo}/>
30-
</a>
31-
</section>
20+
</div>
21+
<div class="socials-changelog">
22+
<section class="socials">
23+
<a href="https://matrix.to/#/#quickshell:outfoxxed.me" target="_blank" aria-label="Join our matrix space">
24+
<Fragment set:html={matrixLogo}/>
25+
</a>
26+
<a href="https://discord.gg/UtZeT3xNyT" target="_blank" aria-label="Join our discord">
27+
<Fragment set:html={discordLogo}/>
28+
</a>
29+
<a href="https://git.outfoxxed.me/quickshell/quickshell" target="_blank" aria-label="Visit our git server">
30+
<Fragment set:html={gitLogo}/>
31+
</a>
32+
</section>
33+
<section class="changelog">
34+
<a href="/changelog">Changelog</a>
35+
</section>
36+
</div>
3237
</footer>

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

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { groupRoutes } from "@config/io/helpers";
1212
import type { TreeEntry } from "./Tree.astro";
1313
import Tree from "./Tree.astro";
1414
import Link from "./Link.astro";
15+
import VersionSelector from "./VersionSelector.astro"
1516
1617
const routes = await getTypeData();
1718
const groupedRoutes = groupRoutes(routes);
@@ -21,7 +22,7 @@ const guidePages = await getCollection("guide");
2122
2223
function genGuideNav(base: string): TreeEntry[] | undefined {
2324
const pages = guidePages
24-
.filter(page => page.id.match(`^${base}[^/]*$`) !== null && page.id != "index")
25+
.filter(page => page.id.match(`^${base}[^/]*$`) !== null && page.id !== "index")
2526
.sort((a, b) => a.data.index - b.data.index)
2627
.map(page => ({
2728
title: page.data.title,
@@ -30,7 +31,7 @@ function genGuideNav(base: string): TreeEntry[] | undefined {
3031
entries: genGuideNav(page.id + "/"),
3132
}));
3233
33-
return pages.length == 0 ? undefined : pages;
34+
return pages.length === 0 ? undefined : pages;
3435
}
3536
3637
const guide = {
@@ -58,20 +59,12 @@ const types = {
5859
),
5960
};
6061
61-
const masterBranch = import.meta.env.MASTER_BRANCH;
6262
---
6363
<nav class="navtree">
64-
{masterBranch && <Link
65-
title="Docs Version: Master Branch (Switch)"
66-
link=`https://quickshell.outfoxxed.me${Astro.url.pathname}`
67-
/>}
68-
{!masterBranch && <Link
69-
title="Docs Version: Release 0.1.0 (Switch)"
70-
link=`https://quickshell-master.outfoxxed.me${Astro.url.pathname}`
71-
/>}
64+
<VersionSelector title="Versions" link=`${Astro.currentLocale}` current/>
7265
<Link
7366
title="About Quickshell"
74-
link="/docs/about"
67+
link="/about"
7568
current={currentRoute === "about"}
7669
/>
7770
<Tree {...guide}/>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
import fs from 'node:fs';
3+
import path from 'node:path';
4+
5+
import Link from './Link.astro';
6+
import Accordion from "@components/Accordion.astro"
7+
8+
interface Props {
9+
title: string;
10+
link: string;
11+
current?: boolean;
12+
}
13+
interface VersionData {
14+
default: string;
15+
versions: {
16+
name: string;
17+
types: string;
18+
}[]
19+
}
20+
const versionFilePath = import.meta.env.VERSION_FILE_PATH;
21+
22+
if (!versionFilePath){
23+
throw new Error("no env var VERSION_FILE_PATH")
24+
}
25+
const absolutePath = path.resolve(process.cwd(), versionFilePath);
26+
const versionData:VersionData = JSON.parse(fs.readFileSync(absolutePath, 'utf-8'));
27+
28+
const { title, link, current } = Astro.props;
29+
---
30+
<Accordion class=`nav-component version-collapsible ${current ? "nav-current" : ""}` {...(!current ? { open: "_" } : {})}>
31+
<div slot="header">
32+
<span class="nav-component nav-item nav-link">
33+
versions
34+
</span>
35+
</div>
36+
<div class="version-select-menu">
37+
{versionData.versions.map((ver, _) => {
38+
return (
39+
<Link
40+
link={`${Astro.url.pathname}`}
41+
title=`${ver.name}`
42+
>
43+
{ver.name}
44+
</Link>
45+
)}
46+
)}
47+
</div>
48+
</Accordion>

src/content.config.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,12 @@ const guide = defineCollection({
88
index: z.number(),
99
}),
1010
});
11+
const version = defineCollection({
12+
loader: glob({ pattern: "**/*", base: "src/docs" }),
13+
schema: z.object({
14+
title: z.string(),
15+
index: z.number(),
16+
}),
17+
});
1118

12-
export const collections = { guide };
19+
export const collections = { guide, version };
File renamed without changes.

src/pages/changelog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
layout: "@layouts/GuideMdLayout.astro"
3+
title: Changelog
4+
---
5+
6+
## v0.2.0
7+
8+
## v0.1.0
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.version-collapsible {
2+
position: relative;
3+
overflow: hidden;
4+
& summary div {
5+
display: flex;
6+
justify-content: center;
7+
}
8+
& .nav-link {
9+
max-width: max-content;
10+
}
11+
&::before {
12+
content: "";
13+
position: absolute;
14+
inset: 0.118rem;
15+
border: 1px solid white;
16+
border-radius: 0.618rem;
17+
opacity: 0.15;
18+
}
19+
}
20+
.version-select-menu {
21+
display: flex;
22+
flex-direction: column;
23+
align-items: center;
24+
}

src/styles/global.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
@import "./docs/nav/nav.css";
1010
@import "./docs/toc/toc.css";
11+
@import "./docs/nav/version-select.css";
1112
@import "./docs/docs.css";
1213
@import "./docs/collapsible.css";
1314

@@ -223,8 +224,12 @@ footer {
223224
align-items: flex-start;
224225
font-size: 2.5rem;
225226

227+
}
228+
& .changelog {
229+
display: flex;
226230
& a {
227-
display: flex;
231+
text-decoration: none;
232+
margin-inline: auto;
228233
}
229234
}
230235
}

versions.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"default": "master",
3+
"versions": [
4+
{
5+
"name": "master",
6+
"types": "./modules"
7+
},
8+
{
9+
"name": "0.2.0",
10+
"types": "./modules"
11+
},
12+
{
13+
"name": "0.1.0",
14+
"types": "./modules"
15+
}
16+
]
17+
}

0 commit comments

Comments
 (0)