mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-28 13:21:02 +00:00
fix: using for...of instead of forEach
This commit is contained in:
@@ -24,11 +24,11 @@ const removeGameFromLibrary = async (
|
|||||||
game.customHeroImageUrl,
|
game.customHeroImageUrl,
|
||||||
];
|
];
|
||||||
|
|
||||||
assetUrls.forEach((url) => {
|
for (const url of assetUrls) {
|
||||||
if (url?.startsWith("local:")) {
|
if (url?.startsWith("local:")) {
|
||||||
assetPathsToDelete.push(url.replace("local:", ""));
|
assetPathsToDelete.push(url.replace("local:", ""));
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
const updatedGame = {
|
const updatedGame = {
|
||||||
...game,
|
...game,
|
||||||
|
|||||||
@@ -19,18 +19,18 @@ const updateCustomGame = async (
|
|||||||
}
|
}
|
||||||
|
|
||||||
const oldAssetPaths: string[] = [];
|
const oldAssetPaths: string[] = [];
|
||||||
|
|
||||||
const assetPairs = [
|
const assetPairs = [
|
||||||
{ existing: existingGame.iconUrl, new: iconUrl },
|
{ existing: existingGame.iconUrl, new: iconUrl },
|
||||||
{ existing: existingGame.logoImageUrl, new: logoImageUrl },
|
{ existing: existingGame.logoImageUrl, new: logoImageUrl },
|
||||||
{ existing: existingGame.libraryHeroImageUrl, new: libraryHeroImageUrl }
|
{ existing: existingGame.libraryHeroImageUrl, new: libraryHeroImageUrl },
|
||||||
];
|
];
|
||||||
|
|
||||||
assetPairs.forEach(({ existing, new: newUrl }) => {
|
for (const { existing, new: newUrl } of assetPairs) {
|
||||||
if (existing?.startsWith("local:") && (!newUrl || existing !== newUrl)) {
|
if (existing?.startsWith("local:") && (!newUrl || existing !== newUrl)) {
|
||||||
oldAssetPaths.push(existing.replace("local:", ""));
|
oldAssetPaths.push(existing.replace("local:", ""));
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
const updatedGame = {
|
const updatedGame = {
|
||||||
...existingGame,
|
...existingGame,
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ const updateGameCustomAssets = async (
|
|||||||
{ existing: existingGame.customHeroImageUrl, new: customHeroImageUrl },
|
{ existing: existingGame.customHeroImageUrl, new: customHeroImageUrl },
|
||||||
];
|
];
|
||||||
|
|
||||||
assetPairs.forEach(({ existing, new: newUrl }) => {
|
for (const { existing, new: newUrl } of assetPairs) {
|
||||||
if (
|
if (
|
||||||
existing &&
|
existing &&
|
||||||
newUrl !== undefined &&
|
newUrl !== undefined &&
|
||||||
@@ -35,7 +35,7 @@ const updateGameCustomAssets = async (
|
|||||||
) {
|
) {
|
||||||
oldAssetPaths.push(existing.replace("local:", ""));
|
oldAssetPaths.push(existing.replace("local:", ""));
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
const updatedGame = {
|
const updatedGame = {
|
||||||
...existingGame,
|
...existingGame,
|
||||||
@@ -51,7 +51,7 @@ const updateGameCustomAssets = async (
|
|||||||
if (existingAssets) {
|
if (existingAssets) {
|
||||||
const updatedAssets = {
|
const updatedAssets = {
|
||||||
...existingAssets,
|
...existingAssets,
|
||||||
title,
|
title,
|
||||||
};
|
};
|
||||||
|
|
||||||
await gamesShopAssetsSublevel.put(gameKey, updatedAssets);
|
await gamesShopAssetsSublevel.put(gameKey, updatedAssets);
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ export function EditGameModal({
|
|||||||
setIconPath(extractLocalPath(game.iconUrl));
|
setIconPath(extractLocalPath(game.iconUrl));
|
||||||
setLogoPath(extractLocalPath(game.logoImageUrl));
|
setLogoPath(extractLocalPath(game.logoImageUrl));
|
||||||
setHeroPath(extractLocalPath(game.libraryHeroImageUrl));
|
setHeroPath(extractLocalPath(game.libraryHeroImageUrl));
|
||||||
// For existing assets, show the asset path as display path since we don't have the original
|
|
||||||
setIconDisplayPath(extractLocalPath(game.iconUrl));
|
setIconDisplayPath(extractLocalPath(game.iconUrl));
|
||||||
setLogoDisplayPath(extractLocalPath(game.logoImageUrl));
|
setLogoDisplayPath(extractLocalPath(game.logoImageUrl));
|
||||||
setHeroDisplayPath(extractLocalPath(game.libraryHeroImageUrl));
|
setHeroDisplayPath(extractLocalPath(game.libraryHeroImageUrl));
|
||||||
@@ -65,7 +64,6 @@ export function EditGameModal({
|
|||||||
setIconPath(extractLocalPath(game.customIconUrl));
|
setIconPath(extractLocalPath(game.customIconUrl));
|
||||||
setLogoPath(extractLocalPath(game.customLogoImageUrl));
|
setLogoPath(extractLocalPath(game.customLogoImageUrl));
|
||||||
setHeroPath(extractLocalPath(game.customHeroImageUrl));
|
setHeroPath(extractLocalPath(game.customHeroImageUrl));
|
||||||
// For existing assets, show the asset path as display path since we don't have the original
|
|
||||||
setIconDisplayPath(extractLocalPath(game.customIconUrl));
|
setIconDisplayPath(extractLocalPath(game.customIconUrl));
|
||||||
setLogoDisplayPath(extractLocalPath(game.customLogoImageUrl));
|
setLogoDisplayPath(extractLocalPath(game.customLogoImageUrl));
|
||||||
setHeroDisplayPath(extractLocalPath(game.customHeroImageUrl));
|
setHeroDisplayPath(extractLocalPath(game.customHeroImageUrl));
|
||||||
|
|||||||
Reference in New Issue
Block a user