From b707eec27c7ab1c3090a01ef7a3a702c581c8e37 Mon Sep 17 00:00:00 2001 From: AguzzTN54 Date: Mon, 13 Feb 2023 20:43:38 +0700 Subject: [PATCH] Older patches have no outfit in shop --- .../components/shop/CharacterOutfits.svelte | 2 +- src/lib/components/shop/ShopNavbar.svelte | 31 +++++++++++-------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/lib/components/shop/CharacterOutfits.svelte b/src/lib/components/shop/CharacterOutfits.svelte index 32a17bdb..e1b7f284 100644 --- a/src/lib/components/shop/CharacterOutfits.svelte +++ b/src/lib/components/shop/CharacterOutfits.svelte @@ -14,7 +14,7 @@ export let recentlyBuyIndex = -1; - const purchasableOutfit = outfits.filter(({ version }) => !!version); + const purchasableOutfit = outfits.filter(({ version }) => version <= parseFloat($patchVersion)); const outfitsData = [...purchasableOutfit].reverse().map((outfit) => { outfit.isOwned = localOutfits.check(outfit.name); const promo = outfit.promoPrice && outfit.promoPrice !== outfit.price; diff --git a/src/lib/components/shop/ShopNavbar.svelte b/src/lib/components/shop/ShopNavbar.svelte index c386eb12..3f43f295 100644 --- a/src/lib/components/shop/ShopNavbar.svelte +++ b/src/lib/components/shop/ShopNavbar.svelte @@ -10,8 +10,9 @@ export let show; let activeShop = 'genesis'; - $: check = outfits.filter(({ version }) => version?.toString() === $patchVersion); - $: outfitsPromo = check.length > 0; + const outfitList = outfits.filter(({ version }) => version <= parseFloat($patchVersion)); + const versionHasOutfit = outfitList.length > 0; + const outfitsPromo = outfitList.find(({ version }) => version === parseFloat($patchVersion)); const dispatch = createEventDispatcher(); const handleClick = (shop) => { @@ -43,17 +44,21 @@ {$t('shop.recomendedHeading')} - handleClick('outfits')} - > - {#if outfitsPromo} - - {/if} - {$t('outfit.heading')} - + + {#if versionHasOutfit} + handleClick('outfits')} + > + {#if outfitsPromo} + + {/if} + {$t('outfit.heading')} + + {/if} +