Skip to content

Commit

Permalink
Don't allow installing if the user is offline
Browse files Browse the repository at this point in the history
  • Loading branch information
EliteAsian123 committed Sep 28, 2024
1 parent ff9ada6 commit 589fa8a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/routes/AppProfile/LaunchButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { localize } from "@app/utils/localized";
import { usePayload } from "@app/tasks/payload";
import PayloadProgress from "@app/components/PayloadProgress";
import { useEffect, useRef, useState } from "react";
import { useOfflineStatus } from "@app/hooks/useOfflineStatus";

interface Props {
profileState: ProfileState
Expand All @@ -21,6 +22,7 @@ export function LaunchButton({ profileState }: Props) {
launch,
} = profileState;

const offlineStatus = useOfflineStatus();
const payload = usePayload(currentTask?.taskUUID);

const [launching, setLaunching] = useState<boolean>(false);
Expand Down Expand Up @@ -63,6 +65,12 @@ export function LaunchButton({ profileState }: Props) {

// Update/install button
if (folderState === ProfileFolderState.UpdateRequired || folderState === ProfileFolderState.FirstDownload) {
if (offlineStatus.isOffline) {
return <Button color={ButtonColor.DARK} rounded border>
Offline
</Button>;
}

return <Button color={ButtonColor.GREEN} rounded border onClick={async () => await downloadAndInstall()}>
{folderState === ProfileFolderState.UpdateRequired &&
<>
Expand Down

0 comments on commit 589fa8a

Please sign in to comment.