From 79c5b54eadc1c6c1506238f097265eccf1b86d96 Mon Sep 17 00:00:00 2001 From: powercas_gamer Date: Fri, 27 Dec 2024 00:27:48 +0000 Subject: [PATCH] link <1.21.4 github urls to archive repo --- src/components/data/SoftwareBuildChanges.tsx | 5 ++++- src/components/data/SoftwareBuilds.tsx | 6 +++++- src/components/data/SoftwareBuildsTable.tsx | 6 +++++- src/lib/service/github.ts | 18 ++++++++++++++++++ 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/components/data/SoftwareBuildChanges.tsx b/src/components/data/SoftwareBuildChanges.tsx index 232e978a..02ddc027 100644 --- a/src/components/data/SoftwareBuildChanges.tsx +++ b/src/components/data/SoftwareBuildChanges.tsx @@ -1,23 +1,26 @@ import type { ReactElement } from "react"; import { Fragment } from "react"; +import { getProjectRepository } from "@/lib/service/github"; import type { Build } from "@/lib/service/types"; import styles from "@/styles/components/data/SoftwareBuildChanges.module.css"; export interface SoftwareBuildChangesProps { project: string; build: Build; + version: string; } const SoftwareBuildChanges = ({ project, build, + version, }: SoftwareBuildChangesProps): ReactElement => ( <> {build.changes.map((change) => (

#{build.build}

- +
- + { export const useGitHubContributors = (): SWRInfiniteResponse => useSWRInfinite(getURL, fetcher, swrNoAutoUpdateSettings); + +export const getProjectRepository = ( + project: string, + version: string, +): string => { + if (project !== "paper") return `https://github.com/PaperMC/${project}`; + + const baseVersion = [21, 4]; // 1.21.4 is after the hardfork + const isBelowBaseVersion = version + .replace(/^1\./, "") + .split(".") + .map(Number) + .some((v, i) => v < (baseVersion[i] || 0)); + + return isBelowBaseVersion + ? "https://github.com/PaperMC/Paper-Archive" + : "https://github.com/PaperMC/Paper"; +};