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"; +};