Skip to content

Commit

Permalink
Added "newEngine" channel
Browse files Browse the repository at this point in the history
  • Loading branch information
EliteAsian123 committed Aug 10, 2023
1 parent 367e037 commit 5414839
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 4 deletions.
Binary file added src/assets/DevYARGIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/components/Sidebar/Versions/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const VersionsList: React.FC = () => {
</VersionSeparator>
<YARGVersion channel="stable" />
<YARGVersion channel="nightly" />
<YARGVersion channel="newEngine" />
<VersionSeparator name="Songs">
<AddIcon className={styles.add} />
</VersionSeparator>
Expand Down
7 changes: 6 additions & 1 deletion src/components/Sidebar/Versions/YARG.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import { YARGStates, useYARGVersion } from "@app/hooks/useYARGVersion";
import BaseVersion from "./Base";
import NightlyYARGIcon from "@app/assets/NightlyYARGIcon.png";
import StableYARGIcon from "@app/assets/StableYARGIcon.png";
import DevYARGIcon from "@app/assets/DevYARGIcon.png";
import { NavLink } from "react-router-dom";

interface Props {
channel: "stable" | "nightly";
channel: "stable" | "nightly" | "newEngine";
}

const YARGVersion: React.FC<Props> = ({ channel }: Props) => {
Expand All @@ -19,6 +20,8 @@ const YARGVersion: React.FC<Props> = ({ channel }: Props) => {
return StableYARGIcon;
case "nightly":
return NightlyYARGIcon;
case "newEngine":
return DevYARGIcon;
}
}

Expand All @@ -28,6 +31,8 @@ const YARGVersion: React.FC<Props> = ({ channel }: Props) => {
return "Stable";
case "nightly":
return "Nightly";
case "newEngine":
return "New Engine";
}
}

Expand Down
7 changes: 4 additions & 3 deletions src/hooks/useYARGRelease.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useQuery } from "@tanstack/react-query";
import { Endpoints } from "@octokit/types";
import { invoke } from "@tauri-apps/api/tauri";

export type YARGChannels = "stable"|"nightly";
export type YARGChannels = "stable" | "nightly" | "newEngine";

type ReleaseData = Endpoints["GET /repos/{owner}/{repo}/releases/latest"]["response"]["data"];
export type ExtendedReleaseData = ReleaseData & {
Expand All @@ -12,15 +12,16 @@ export type ExtendedReleaseData = ReleaseData & {
export const useYARGRelease = (channel: YARGChannels) => {
const repositoryName = {
"stable": "YARG",
"nightly": "YARG-BleedingEdge"
"nightly": "YARG-BleedingEdge",
"newEngine": "YARG-NewEngine"
};

return useQuery({
queryKey: ["YARG", channel],
queryFn: async (): Promise<ReleaseData> => await fetch(
`https://api.github.com/repos/YARC-Official/${repositoryName[channel]}/releases/latest`)
.then(res => res.json()),
select: (data): ExtendedReleaseData => ({...data, channel: channel})
select: (data): ExtendedReleaseData => ({ ...data, channel: channel })
}).data as ExtendedReleaseData;
};

Expand Down
22 changes: 22 additions & 0 deletions src/routes/YARG/NewEngine.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import LaunchPage from "@app/components/Launch/LaunchPage";
import { useYARGRelease } from "@app/hooks/useYARGRelease";
import { useYARGVersion } from "@app/hooks/useYARGVersion";
import DevYARGIcon from "@app/assets/DevYARGIcon.png";

function StableYARGPage() {
const releaseData = useYARGRelease("newEngine");
const yargVersion = useYARGVersion(releaseData, "newEngine");

return (<>
<LaunchPage version={yargVersion} releaseTag={releaseData?.tag_name} playName="NEW ENGINE" description={<>
This is the YARG v0.12 test channel! v0.12 is a massive update that will completely revamp the hit
engine, add profiles, add practice mode, add replays, and a lot more!
<strong>
This version does not represent the final product of v0.12, and is incomplete. Expect lots of bugs
and incomplete features.
</strong>
</>} websiteUrl="https://github.com/YARC-Official/YARG-NewEngine" icon={DevYARGIcon} />
</>);
}

export default StableYARGPage;
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions src/routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Home from "@app/routes/Home";
import Settings from "@app/routes/Settings";
import StableYARGPage from "./YARG/Stable";
import NightlyYARGPage from "./YARG/Nightly";
import NewEngineYARGPage from "./YARG/NewEngine";
import Queue from "@app/routes/Queue";
import SetlistPage from "./Setlist";
import NewsPage from "./NewsPage";
Expand Down Expand Up @@ -39,6 +40,11 @@ const Router = createBrowserRouter([
element: <NightlyYARGPage />
},

{
path: "/yarg/newEngine",
element: <NewEngineYARGPage />
},

{
path: "/setlist/official",
element: <SetlistPage setlistId="official" />
Expand Down

0 comments on commit 5414839

Please sign in to comment.