fix: state fix and remake checking for overlap

This commit is contained in:
Moyasee
2025-09-30 01:18:44 +03:00
parent 9689c19863
commit 0f3d6ef76f
2 changed files with 14 additions and 10 deletions

View File

@@ -84,7 +84,10 @@ export function EditGameModal({
setDefaultUrls({
icon: shopDetails?.assets?.iconUrl || game.iconUrl || null,
logo: shopDetails?.assets?.logoImageUrl || game.logoImageUrl || null,
hero: shopDetails?.assets?.libraryHeroImageUrl || game.libraryHeroImageUrl || null,
hero:
shopDetails?.assets?.libraryHeroImageUrl ||
game.libraryHeroImageUrl ||
null,
});
},
[shopDetails]
@@ -119,11 +122,11 @@ export function EditGameModal({
};
const setAssetPath = (assetType: AssetType, path: string): void => {
setAssetPaths(prev => ({ ...prev, [assetType]: path }));
setAssetPaths((prev) => ({ ...prev, [assetType]: path }));
};
const setAssetDisplayPath = (assetType: AssetType, path: string): void => {
setAssetDisplayPaths(prev => ({ ...prev, [assetType]: path }));
setAssetDisplayPaths((prev) => ({ ...prev, [assetType]: path }));
};
const getDefaultUrl = (assetType: AssetType): string | null => {
@@ -293,7 +296,9 @@ export function EditGameModal({
// Helper function to prepare custom game assets
const prepareCustomGameAssets = (game: LibraryGame | Game) => {
const iconUrl = assetPaths.icon ? `local:${assetPaths.icon}` : game.iconUrl;
const logoImageUrl = assetPaths.logo ? `local:${assetPaths.logo}` : game.logoImageUrl;
const logoImageUrl = assetPaths.logo
? `local:${assetPaths.logo}`
: game.logoImageUrl;
const libraryHeroImageUrl = assetPaths.hero
? `local:${assetPaths.hero}`
: game.libraryHeroImageUrl;

View File

@@ -44,7 +44,6 @@ export function UserLibraryGameCard({
const [isTooltipHovered, setIsTooltipHovered] = useState(false);
const [isPinning, setIsPinning] = useState(false);
const getStatsItemCount = useCallback(() => {
let statsCount = 1;
if (game.achievementsPointsEarnedSum > 0) statsCount++;
@@ -91,15 +90,15 @@ export function UserLibraryGameCard({
const hours = minutes / 60;
const hoursKey = isShort ? "amount_hours_short" : "amount_hours";
const hoursAmount = isShort ? Math.floor(hours) : numberFormatter.format(hours);
const hoursAmount = isShort
? Math.floor(hours)
: numberFormatter.format(hours);
return t(hoursKey, { amount: hoursAmount });
},
[numberFormatter, t]
);
const toggleGamePinned = async () => {
setIsPinning(true);
@@ -162,7 +161,7 @@ export function UserLibraryGameCard({
)}
</div>
)}
<div
<div
className="user-library-game__playtime"
data-tooltip-place="top"
data-tooltip-content={