diff --git a/src/components/DownloadButton.tsx b/src/components/DownloadButton.tsx deleted file mode 100644 index d1783ca..0000000 --- a/src/components/DownloadButton.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import { faFileArrowDown } from '@fortawesome/free-solid-svg-icons'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import React, { useState, useEffect } from 'react'; - -export const APIDownloadButton = ({ projectId, platformId, header }) => { - const [buildInfo, setBuildInfo] = useState({ buildNumber: '', versionString: '', date: '' }); - - useEffect(() => { - const fetchBuildInfo = async () => { - try { - const response = await fetch(`https://download.geysermc.org/v2/projects/${projectId}/versions/latest/builds/latest`); - if (!response.ok) { - throw new Error('Network response was not ok'); - } - const data = await response.json(); - const { build, version } = data; - - const response2 = await fetch(`https://download.geysermc.org/v2/projects/${projectId}/versions/${version}/builds/${build}`); - if (!response2.ok) { - throw new Error('Network response was not ok'); - } - const data2 = await response2.json(); - const { time } = data2; - - const formattedDate = new Date(time).toLocaleDateString(); - - setBuildInfo({ buildNumber: build, versionString: version, date: formattedDate }); - } catch (error) { - console.error('Failed to fetch build info:', error); - } - }; - - fetchBuildInfo(); - }, [projectId]); - - return ( - - - {header} - #{buildInfo.buildNumber} · {buildInfo.date} - - - ); -}; \ No newline at end of file diff --git a/src/components/Grid.tsx b/src/components/Grid.tsx new file mode 100644 index 0000000..72021aa --- /dev/null +++ b/src/components/Grid.tsx @@ -0,0 +1,25 @@ +import React from 'react'; + +interface GridProps { + children: React.ReactNode; + elementsPerRow: number; + gap?: string; +} + +export const Grid: React.FC = ({ children, elementsPerRow, gap }) => { + const gridStyle = { + display: 'grid', + gridTemplateColumns: `repeat(${elementsPerRow}, 1fr)`, + gap: gap || '0px' + }; + + return {children}; +}; + +interface GridItemProps { + children: React.ReactNode; +} + +export const GridItem: React.FC = ({ children }) => { + return {children}; +}; \ No newline at end of file diff --git a/src/components/ProjectDownload.tsx b/src/components/ProjectDownload.tsx new file mode 100644 index 0000000..dee20a9 --- /dev/null +++ b/src/components/ProjectDownload.tsx @@ -0,0 +1,133 @@ +import { faFileArrowDown, faBook } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import React, { useState, useEffect } from 'react'; +import { Downloads } from '../types/downloads'; +import { Column, Columns } from './Columns'; +import { Grid } from './Grid'; + +interface ProjectDownloadProps { + projectId: string; + description: string; + setup?: string; + downloadsInfo: { + [key: string]: string; + }; + gridColumns?: number; +} + +export const ProjectDownload: React.FC = ({ projectId, description, setup, downloadsInfo, gridColumns }) => { + const [platformInfo, setPlatformInfo] = useState({ + project_id: '', + project_name: '', + version: '', + builds: [] + }); + + const [latestBuild, setLatestBuild] = useState({ + project_id: '', + project_name: '', + version: '', + build: 0, + time: new Date().toLocaleDateString(), + channel: '', + promoted: false, + changes: [], + downloads: {} + }); + + const [changes, setChanges] = useState([]); + const [isLoaded, setIsLoaded] = useState(false); + + useEffect(() => { + const fetchPlatformInfo = async () => { + try { + const response = await fetch(new URL(`/v2/projects/${projectId}/versions/latest/builds`, 'https://download.geysermc.org')); + if (!response.ok) { + throw new Error('Network response was not ok'); + } + const data: Downloads.Builds = await response.json(); + + setPlatformInfo(data); + setLatestBuild(data.builds[data.builds.length - 1]); + + const allChanges: Downloads.BaseBuild['changes'] = []; + data.builds.forEach(build => { + allChanges.push(...build.changes); + }); + setChanges(allChanges.reverse().slice(0, 12)); + setIsLoaded(true); + } catch (error) { + console.error('Failed to fetch platform info:', error); + } + }; + + fetchPlatformInfo(); + }, [projectId]); + + const fadeInStyle = { + opacity: isLoaded ? 1 : 0, + transition: 'opacity 1s ease-in-out', + }; + + return ( + + {description} + + + Build #{latestBuild.build} · {new Date(latestBuild.time).toLocaleDateString()}: + + { setup && + + + Setup Instructions + + + + } + { + Object.keys(latestBuild.downloads).map((platformId, i) => { + return ( + + + {downloadsInfo[platformId]} + {latestBuild.downloads[platformId].name} + + + ) + }) + } + + + + Recent Changes: + + { + changes.map((change, i) => { + return ( + { + {change.commit.substring(0, 7)} + } · {} + ) + }) + } + + + + + ); +}; + +function LinkedCommitMessage({ message, repo }) { + const regex = /#(\d+)/g; + const parts = message.split(/(#\d+)/).filter((part: string) => part); + + const linked = parts.map((part, index) => { + if (part.match(regex)) { + const number = part.replace('#', ''); + return {part}; + } + return part; + }); + + return <>{linked}>; +} \ No newline at end of file diff --git a/src/css/custom.css b/src/css/custom.css index 676580a..6121f54 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -7,6 +7,7 @@ /* You can override the default Infima variables here. */ :root { --ifm-color-primary: #2e8555; + --ifm-color-secondary: #0097c5; --ifm-color-primary-dark: #29784c; --ifm-color-primary-darker: #277148; --ifm-color-primary-darkest: #205d3b; @@ -21,6 +22,7 @@ /* For readability concerns, you should choose a lighter palette in dark mode. */ [data-theme='dark'] { --ifm-color-primary: #25c2a0; + --ifm-color-secondary: #00d5ff; --ifm-color-primary-dark: #21af90; --ifm-color-primary-darker: #1fa588; --ifm-color-primary-darkest: #1a8870; @@ -112,7 +114,6 @@ transition: background-color 0.5s ease, color 0.5s ease; padding-top: 10px; padding-bottom: 10px; - margin-bottom: 10px; } .download-button:hover { @@ -182,6 +183,29 @@ font-size: 18px; } +.no-underline { + text-decoration: transparent !important; +} + +.setup-button { + width: 100%; + outline: 3px solid var(--ifm-color-secondary); + outline-offset: -3px; + border: 0; + border-radius: var(--ifm-global-radius); + text-align: center; + font-size: 18px; + transition: background-color 0.5s ease, color 0.5s ease; + padding-top: 10px; + padding-bottom: 10px; + color: var(--ifm-color-secondary); +} + +.setup-button:hover { + background-color: var(--ifm-color-secondary); + color: #fff; +} + .tabs { flex-wrap: wrap; border-bottom-color: var(--ifm-horizontal-line-color); diff --git a/src/pages/download/index.mdx b/src/pages/download/index.mdx index aeec445..8010b12 100644 --- a/src/pages/download/index.mdx +++ b/src/pages/download/index.mdx @@ -8,6 +8,9 @@ import Admonition from '@theme/Admonition'; import Tabs from "@theme/Tabs"; import TabItem from "@theme/TabItem"; +import { faTowerCell, faFileZipper } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; + import HeroBanner from '@site/src/components/HeroBanner'; import HeroBackground from '@site/static/img/site/split-background.png'; @@ -22,69 +25,73 @@ import PaperSpigotIcon from '@site/static/img/icons/paper.png'; import VelocityIcon from '@site/static/img/icons/velocity.png'; import WaterfallBungeeCordIcon from '@site/static/img/icons/waterfall.svg'; import FabricIcon from '@site/static/img/icons/fabric.png'; +import NeoForgeIcon from '@site/static/img/icons/neoforge.png'; +import ViaProxyIcon from '@site/static/img/icons/viaproxy.png'; import StandaloneIcon from '@site/static/img/icons/geyser.png'; import { Columns, Column } from '@site/src/components/Columns'; import { ProviderSelector } from '@site/src/components/Provider'; -import { APIDownloadButton } from '@site/src/components/DownloadButton'; +import { ProjectDownload } from '@site/src/components/ProjectDownload'; - } default> - - - - ## Geyser Installation Instructions - - Geyser allows Bedrock players to join your server, but also requires Floodgate if you wish to allow them to join with their Bedrock account. - - - - 1. Download Geyser using the download button. - 2. Place Geyser in the plugins folder. - 3. Start up your server and Geyser should be installed. - - Keep in mind that there may be additional steps involved, such as portforwarding. Please see the detailed setup options for more information. - - - - - - - - - - - - - - ## Floodgate Installation Instructions - - By using our Floodgate plugin, you can allow Xbox Live authenticated Bedrock clients to securely join your online-mode server without a Java Edition account. - - - - - Floodgate uses global linking by default, which allows Bedrock players to link and join as their Java ccount by connecting it to our global linking server. You can disable this or enable local linking in the Floodgate config. More info is available on the [wiki](/floodgate/linking). - - - + + , + fabric: , + neoforge: , + spigot: , + standalone: , + velocity: , + viaproxy: , + }} + /> - }> - Velocity + + , + spigot: , + velocity: , + }} + /> - }> - Waterfall Bungee - - }> - Fabric - - }> - Standalone + + + + GeyserConnect>, + }} + gridColumns={1} + /> + + + GeyserOptionalPack>, + }} + gridColumns={1} + /> + + \ No newline at end of file diff --git a/src/types/downloads.ts b/src/types/downloads.ts new file mode 100644 index 0000000..d41b976 --- /dev/null +++ b/src/types/downloads.ts @@ -0,0 +1,30 @@ +export namespace Downloads { + export interface Builds { + project_id: string; + project_name: string; + version: string; + builds: Build[]; + } + export interface BaseBuild { + build: number; + time: string; + channel: string; + promoted: boolean; + changes: { + commit: string; + summary: string; + message: string; + }[]; + downloads: { + [key: string]: { + name: string; + sha256: string; + }; + }; + } + export interface Build extends BaseBuild { + project_id: string; + project_name: string; + version: string; + } +} \ No newline at end of file diff --git a/static/img/icons/neoforge.png b/static/img/icons/neoforge.png new file mode 100644 index 0000000..55848a6 Binary files /dev/null and b/static/img/icons/neoforge.png differ
{description}