Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 1 addition & 27 deletions src/components/layout/SoftwareHeader.astro
Original file line number Diff line number Diff line change
Expand Up @@ -43,35 +43,9 @@ const { id, name, icon, github, eol } = Astro.props;
{github ? "GitHub" : "Downloads"}
</Button>
<Button variant="outlined" href={`https://docs.papermc.io/${id}`} external> Documentation </Button>
<Button variant="outlined" href="#loading" className="jd-link-btn hidden md:block" external> Javadoc </Button>
<Button variant="outlined" href={`https://jd.papermc.io/${id}`} className="hidden md:block" external> Javadoc </Button>
</div>
</div>
<div class="hidden flex-1 justify-end lg:flex"></div>
</header>
</software-header>

<script>
import { getProject } from "@/utils/fill";
import { getLatestVersion } from "@/utils/versions";

class SoftwareHeader extends HTMLElement {
async connectedCallback() {
const { software } = this.dataset;
if (!software) {
return;
}

const button = this.querySelector(".jd-link-btn");
if (!button) {
return;
}

const { versions } = await getProject(software);
const latest = getLatestVersion(versions);

button.setAttribute("href", `https://jd.papermc.io/${software}/${latest}`);
}
}

customElements.define("software-header", SoftwareHeader);
</script>
46 changes: 0 additions & 46 deletions src/utils/versions.ts

This file was deleted.

Loading