feat: add feature flag check for Nimbus preview on Repack Modal

This commit is contained in:
Zamitto
2025-04-13 13:29:44 -03:00
parent d1c40b061e
commit ff447c0ed3
2 changed files with 9 additions and 2 deletions

View File

@@ -4,6 +4,7 @@ enum Feature {
CheckDownloadWritePermission = "CHECK_DOWNLOAD_WRITE_PERMISSION",
Torbox = "TORBOX",
Nimbus = "NIMBUS",
NimbusPreview = "NIMBUS_PREVIEW",
}
export function useFeature() {

View File

@@ -14,7 +14,7 @@ import { DownloadSettingsModal } from "./download-settings-modal";
import { gameDetailsContext } from "@renderer/context";
import { Downloader } from "@shared";
import { orderBy } from "lodash-es";
import { useDate } from "@renderer/hooks";
import { useDate, useFeature } from "@renderer/hooks";
import "./repacks-modal.scss";
export interface RepacksModalProps {
@@ -58,7 +58,13 @@ export function RepacksModal({
return match ? match[1].toLowerCase() : null;
};
const { isFeatureEnabled, Feature } = useFeature();
useEffect(() => {
if (!isFeatureEnabled(Feature.NimbusPreview)) {
return;
}
const magnets = repacks.flatMap((repack) =>
repack.uris.filter((uri) => uri.startsWith("magnet:"))
);
@@ -66,7 +72,7 @@ export function RepacksModal({
window.electron.checkDebridAvailability(magnets).then((availableHashes) => {
setHashesInDebrid(availableHashes);
});
}, [repacks]);
}, [repacks, isFeatureEnabled, Feature]);
const sortedRepacks = useMemo(() => {
return orderBy(