Skip to content

Commit

Permalink
Merge pull request #6 from go-vela/fix/version-numbers
Browse files Browse the repository at this point in the history
fix: use accurate version numbers
  • Loading branch information
KillEdgier authored Dec 16, 2024
2 parents c4bcf25 + 6c1fdf5 commit 5cea58c
Show file tree
Hide file tree
Showing 69 changed files with 133 additions and 9 deletions.
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
},
"dependencies": {
"@docusaurus/core": "3.6.3",
"@docusaurus/plugin-content-docs": "^3.6.3",
"@docusaurus/preset-classic": "3.6.3",
"@fortawesome/fontawesome-svg-core": "^6.7.1",
"@fortawesome/free-brands-svg-icons": "^6.7.1",
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions src/pages/markdown-page.md

This file was deleted.

126 changes: 126 additions & 0 deletions src/pages/versions.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
import React, { ReactNode } from 'react';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import Link from '@docusaurus/Link';
import {
useVersions,
useLatestVersion,
} from '@docusaurus/plugin-content-docs/client';
import Layout from '@theme/Layout';
import Heading from '@theme/Heading';

const docsPluginId = undefined;

const VersionsArchived = {
"0.25": "/usage/quickstart",
"0.24": "/0.24.x/usage/quickstart",
};

const VersionsArchivedList = Object.entries(VersionsArchived);

function DocumentationLabel() {
return (
<span>Documentation</span>
);
}

function ReleaseNotesLabel() {
return (
<span>
Release Notes
</span>
);
}

export default function Version(): ReactNode {
const {
siteConfig: { organizationName, projectName },
} = useDocusaurusContext();
const versions = useVersions(docsPluginId);
const latestVersion = useLatestVersion(docsPluginId);
const currentVersion = versions.find(
(version) => version.name === 'current',
)!;
const pastVersions = versions.filter(
(version) => version !== latestVersion && version.name !== 'current',
);
const repoUrl = `https://github.com/go-vela/community`;

return (
<Layout
title="Versions"
description="Vela Versions page listing all versions">
<main className="container margin-vert--lg">
<h1>
<span>
Vela versions
</span>
</h1>

<div className="margin-bottom--lg">
<Heading as="h3" id="next">
<span>
Current version
</span>
</Heading>
<p>
<span>
Here you can find the documentation for the latest release.
</span>
</p>
<table>
<tbody>
<tr>
<th>{latestVersion.label}</th>
<td>
<Link to={latestVersion.path}>
<DocumentationLabel />
</Link>
</td>
<td>
<Link to={`${repoUrl}/blob/main/releases/v${latestVersion.name}.md`}>
<ReleaseNotesLabel />
</Link>
</td>
</tr>
</tbody>
</table>
</div>

{(pastVersions.length > 0 || VersionsArchivedList.length > 0) && (
<div className="margin-bottom--lg">
<Heading as="h3" id="archive">
<span>
Previous versions (Not maintained anymore)
</span>
</Heading>
<p>
<span>
Here you can find documentation for past releases.
</span>
</p>
<table>
<tbody>
{VersionsArchivedList.map(([versionName, versionUrl]) => (
latestVersion.label !== versionName ?
<tr key={versionName}>
<th>{versionName}</th>
<td>
<Link to={versionUrl}>
<DocumentationLabel />
</Link>
</td>
<td>
<Link href={`${repoUrl}/blob/main/releases/v${versionName}.md`}>
<ReleaseNotesLabel />
</Link>
</td>
</tr> : <></>
))}
</tbody>
</table>
</div>
)}
</main>
</Layout>
);
}
4 changes: 2 additions & 2 deletions versions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[
"1.1",
"1.0"
"0.25",
"0.24"
]

0 comments on commit 5cea58c

Please sign in to comment.