mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-18 08:43:57 +00:00
fix: merge with ci
This commit is contained in:
@@ -138,6 +138,7 @@ export function App() {
|
||||
}, [fetchUserDetails, updateUserDetails, dispatch]);
|
||||
|
||||
const syncDownloadSources = useCallback(async () => {
|
||||
console.log("SYNC CALLED");
|
||||
const downloadSources = await window.electron.getDownloadSources();
|
||||
|
||||
const existingDownloadSources: DownloadSource[] =
|
||||
|
||||
@@ -15,12 +15,14 @@ import type {
|
||||
StartGameDownloadPayload,
|
||||
} from "@types";
|
||||
import { useDate } from "./use-date";
|
||||
import { formatBytes } from "@shared";
|
||||
import { formatBytes, formatBytesToMbps } from "@shared";
|
||||
|
||||
export function useDownload() {
|
||||
const { updateLibrary } = useLibrary();
|
||||
const { formatDistance } = useDate();
|
||||
|
||||
const userPrefs = useAppSelector((state) => state.userPreferences.value);
|
||||
|
||||
const { lastPacket, gamesWithDeletionInProgress } = useAppSelector(
|
||||
(state) => state.download
|
||||
);
|
||||
@@ -99,8 +101,14 @@ export function useDownload() {
|
||||
return gamesWithDeletionInProgress.includes(objectId);
|
||||
};
|
||||
|
||||
const formatDownloadSpeed = (downloadSpeed: number): string => {
|
||||
return userPrefs?.showDownloadSpeedInMegabits
|
||||
? `${formatBytes(downloadSpeed)}/s`
|
||||
: formatBytesToMbps(downloadSpeed);
|
||||
};
|
||||
|
||||
return {
|
||||
downloadSpeed: `${formatBytes(lastPacket?.downloadSpeed ?? 0)}/s`,
|
||||
downloadSpeed: formatDownloadSpeed(lastPacket?.downloadSpeed ?? 0),
|
||||
progress: formatDownloadProgress(lastPacket?.progress ?? 0),
|
||||
lastPacket,
|
||||
eta: calculateETA(),
|
||||
|
||||
@@ -23,6 +23,7 @@ export function SettingsBehavior() {
|
||||
enableAutoInstall: false,
|
||||
seedAfterDownloadComplete: false,
|
||||
showHiddenAchievementsDescription: false,
|
||||
showDownloadSpeedInMegabits: false,
|
||||
});
|
||||
|
||||
const { t } = useTranslation("settings");
|
||||
@@ -40,6 +41,8 @@ export function SettingsBehavior() {
|
||||
userPreferences.seedAfterDownloadComplete ?? false,
|
||||
showHiddenAchievementsDescription:
|
||||
userPreferences.showHiddenAchievementsDescription ?? false,
|
||||
showDownloadSpeedInMegabits:
|
||||
userPreferences.showDownloadSpeedInMegabits ?? false,
|
||||
});
|
||||
}
|
||||
}, [userPreferences]);
|
||||
@@ -139,6 +142,16 @@ export function SettingsBehavior() {
|
||||
})
|
||||
}
|
||||
/>
|
||||
|
||||
<CheckboxField
|
||||
label={t("show_download_speed_in_megabits")}
|
||||
checked={form.showDownloadSpeedInMegabits}
|
||||
onChange={() =>
|
||||
handleChange({
|
||||
showDownloadSpeedInMegabits: !form.showDownloadSpeedInMegabits,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user