forked from YARC-Official/YARC-Launcher
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored setlist releases to be more similar to YARG releases
- Loading branch information
1 parent
f03e474
commit 3b28efe
Showing
20 changed files
with
196 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { ButtonColor } from "../../Button"; | ||
import { CheckmarkIcon, InstallingIcon, UpdateIcon } from "@app/assets/Icons"; | ||
import { calculatePayloadPercentage } from "@app/tasks/payload"; | ||
import PayloadProgress from "../../PayloadProgress"; | ||
import Button from "@app/components/Button"; | ||
import { DropdownButton, DropdownItem } from "@app/components/DropdownButton"; | ||
import { SetlistStates, SetlistVersion } from "@app/hooks/useSetlistData"; | ||
|
||
interface SetlistButtonProps extends React.PropsWithChildren { | ||
version: SetlistVersion, | ||
style?: React.CSSProperties | ||
} | ||
|
||
export function SetlistButton(props: SetlistButtonProps) { | ||
const version = props.version; | ||
|
||
if (version.state === SetlistStates.NEW_UPDATE) { | ||
const buttonChildren = <> | ||
<UpdateIcon /> Update Setlist | ||
</>; | ||
|
||
return <Button | ||
style={props.style} | ||
color={ButtonColor.GREEN} | ||
onClick={() => version.download()}> | ||
|
||
{buttonChildren} | ||
</Button>; | ||
} | ||
|
||
if (version.state === SetlistStates.DOWNLOADING) { | ||
const buttonChildren = <> | ||
<InstallingIcon /> | ||
<PayloadProgress payload={version.payload} /> | ||
</>; | ||
|
||
return <Button | ||
style={props.style} | ||
progress={calculatePayloadPercentage(version.payload)} | ||
color={ButtonColor.YELLOW}> | ||
|
||
{buttonChildren} | ||
</Button>; | ||
} | ||
|
||
if (version.state === SetlistStates.AVAILABLE) { | ||
const buttonChildren = <> | ||
<CheckmarkIcon /> Downloaded | ||
</>; | ||
|
||
const dropdownChildren = <> | ||
<DropdownItem> | ||
Uninstall | ||
</DropdownItem> | ||
</>; | ||
|
||
return <DropdownButton | ||
style={props.style} | ||
color={ButtonColor.BLUE} | ||
dropdownChildren={dropdownChildren}> | ||
|
||
{buttonChildren} | ||
</DropdownButton>; | ||
} | ||
|
||
if (version.state === SetlistStates.ERROR) { | ||
const buttonChildren = <> | ||
Error! | ||
</>; | ||
|
||
return <Button | ||
color={ButtonColor.RED} | ||
style={props.style}> | ||
|
||
{buttonChildren} | ||
</Button>; | ||
} | ||
|
||
return <Button | ||
style={props.style}> | ||
Loading... | ||
</Button>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.