diff --git a/frontend-next-migration/src/app/[lng]/(helper)/collections/loading.tsx b/frontend-next-migration/src/app/[lng]/(helper)/collections/loading.tsx index b382aec34..d8da3227b 100644 --- a/frontend-next-migration/src/app/[lng]/(helper)/collections/loading.tsx +++ b/frontend-next-migration/src/app/[lng]/(helper)/collections/loading.tsx @@ -1 +1,12 @@ -export { PageLoader as default } from '@/widgets/PageLoader'; +export default function Loading() { + return ( +
+ Loading… +
+ ); +} diff --git a/frontend-next-migration/src/app/[lng]/(helper)/defense-gallery/[herogroup]/not-found.tsx b/frontend-next-migration/src/app/[lng]/(helper)/defense-gallery/[herogroup]/not-found.tsx index d71dd0b01..697b0482e 100644 --- a/frontend-next-migration/src/app/[lng]/(helper)/defense-gallery/[herogroup]/not-found.tsx +++ b/frontend-next-migration/src/app/[lng]/(helper)/defense-gallery/[herogroup]/not-found.tsx @@ -18,7 +18,10 @@ export default function NotFound() { }} >

{t('not-found-title')}

- + {t('not-found-check-heroes')} diff --git a/frontend-next-migration/src/app/[lng]/(helper)/heroes/[slug]/not-found.tsx b/frontend-next-migration/src/app/[lng]/(helper)/heroes/[slug]/not-found.tsx index d71dd0b01..697b0482e 100644 --- a/frontend-next-migration/src/app/[lng]/(helper)/heroes/[slug]/not-found.tsx +++ b/frontend-next-migration/src/app/[lng]/(helper)/heroes/[slug]/not-found.tsx @@ -18,7 +18,10 @@ export default function NotFound() { }} >

{t('not-found-title')}

- + {t('not-found-check-heroes')} diff --git a/frontend-next-migration/src/app/[lng]/(helper)/heroes/loading.tsx b/frontend-next-migration/src/app/[lng]/(helper)/heroes/loading.tsx index b382aec34..7d0efc1fe 100644 --- a/frontend-next-migration/src/app/[lng]/(helper)/heroes/loading.tsx +++ b/frontend-next-migration/src/app/[lng]/(helper)/heroes/loading.tsx @@ -1 +1,16 @@ -export { PageLoader as default } from '@/widgets/PageLoader'; +export default function Loading() { + return ( +
+ Loading… +
+ ); +} diff --git a/frontend-next-migration/src/app/[lng]/(home)/_getPage.ts b/frontend-next-migration/src/app/[lng]/(home)/_getPage.ts index 2dde0d6af..dfa6e41e5 100644 --- a/frontend-next-migration/src/app/[lng]/(home)/_getPage.ts +++ b/frontend-next-migration/src/app/[lng]/(home)/_getPage.ts @@ -1,7 +1,6 @@ import { MainPageProps } from '@/preparedPages/MainPage'; import { getServerTranslation } from '@/shared/i18n'; import { AppExternalLinks } from '@/shared/appLinks/appExternalLinks'; -import gameImg from '@/shared/assets/images/mainpage/HandGraphicWithBattle.png'; import iPhone16 from '@/shared/assets/images/mainpage/iPhone 16 Pro mockup natural titanium 1.png'; import { getRouteAllHeroesPage, @@ -95,7 +94,7 @@ export async function _getPage(lng: string) { AppExternalLinks.fbPost1, ], videoLink: AppExternalLinks.previewVideoYoutube, - gameImg: iPhone16.src, + gameImg: iPhone16, }, contactSection: { title: t('contact-title'), diff --git a/frontend-next-migration/src/entities/Furniture/model/data/sets/rakkaus.ts b/frontend-next-migration/src/entities/Furniture/model/data/sets/rakkaus.ts index f21ec3f97..233fc7c14 100644 --- a/frontend-next-migration/src/entities/Furniture/model/data/sets/rakkaus.ts +++ b/frontend-next-migration/src/entities/Furniture/model/data/sets/rakkaus.ts @@ -23,7 +23,7 @@ import { rarityList } from '../rarities'; export const rakkausSet: SetInfo = { id: 'rakkaus', path: 'RAKKAUSSET', - author: 'IV', + author: 'Ida Vesterinen', cover: rakkausCover, coverposition: FurnitureSetCoverPosition.MEDIUM, items: [ diff --git a/frontend-next-migration/src/entities/Gallery/ui/GalleryCategoriesWithModalSlider.tsx b/frontend-next-migration/src/entities/Gallery/ui/GalleryCategoriesWithModalSlider.tsx index 16d1451a2..207b62b32 100644 --- a/frontend-next-migration/src/entities/Gallery/ui/GalleryCategoriesWithModalSlider.tsx +++ b/frontend-next-migration/src/entities/Gallery/ui/GalleryCategoriesWithModalSlider.tsx @@ -83,7 +83,9 @@ export const GalleryCategoriesWithModalSlider = memo( width={250} height={292} className={cls.coverImage} + priority={true} alt={idx === 0 ? cover.name : `Page ${idx}`} + style={{ width: '100%', height: 'auto' }} /> @@ -112,6 +114,7 @@ export const GalleryCategoriesWithModalSlider = memo( width={20} height={20} alt="Zoom" + style={{ width: 'auto', height: 'auto' }} /> diff --git a/frontend-next-migration/src/entities/Hero/model/initializeHeroGroups.ts b/frontend-next-migration/src/entities/Hero/model/initializeHeroGroups.ts index 851303efa..d2cca1d77 100644 --- a/frontend-next-migration/src/entities/Hero/model/initializeHeroGroups.ts +++ b/frontend-next-migration/src/entities/Hero/model/initializeHeroGroups.ts @@ -1,4 +1,4 @@ -import { type GroupInfo, HeroGroup, HeroSlug } from '../types/hero'; +import { type GroupInfo, HeroGroup } from '../types/hero'; import { buildHeroGroups } from '@/entities/Hero/model/heroGroupsData'; export const initializeHeroGroups = (t: (key: string) => string): Record => { diff --git a/frontend-next-migration/src/entities/Hero/ui/AttributesPricing3/AttributesPricingV3.tsx b/frontend-next-migration/src/entities/Hero/ui/AttributesPricing3/AttributesPricingV3.tsx index d7d104d67..9c9d4fa3c 100644 --- a/frontend-next-migration/src/entities/Hero/ui/AttributesPricing3/AttributesPricingV3.tsx +++ b/frontend-next-migration/src/entities/Hero/ui/AttributesPricing3/AttributesPricingV3.tsx @@ -1,9 +1,8 @@ -import React, { useCallback, useMemo, Dispatch, SetStateAction } from 'react'; +'use client'; +import React, { useCallback, useMemo, useEffect, Dispatch, SetStateAction } from 'react'; import { useClientTranslation } from '@/shared/i18n'; import { AttributePricingHelper } from '../../model/stats/AttributesPricingHelper'; -import { statValue } from '../../model/stats/statsDataV2'; -import { statsPricingData } from '../../model/stats/statsPricingData'; -import { Stat } from '../../types/hero'; +import { statValue, statsPricingData, Stat } from '@/entities/Hero'; import cls from './AttributesPricing.module.scss'; // import { statsPricingData, Stat, statValue } from '@/entities/Hero'; @@ -42,11 +41,13 @@ export const AttributesPricing3 = ({ const { t } = useClientTranslation('heroes-stats-pricing'); const totalUpgraded = useMemo(() => { - const total = AttributePricingHelper.getTotalUpgraded(stats); - setUpgradePotential(10 - total); - return total; + return AttributePricingHelper.getTotalUpgraded(stats); }, [stats]); + useEffect(() => { + setUpgradePotential(10 - totalUpgraded); + }, [totalUpgraded, setUpgradePotential]); + const setDropdowns = useCallback( (statName: string) => { const [stat, level] = AttributePricingHelper.getStatAndLevel( @@ -62,8 +63,46 @@ export const AttributesPricing3 = ({ [stats, selectedStat], ); - //This fixes dropdown updates and out-of-range calculations in Storybook when editing Stats data. - const currentLevel = useMemo(() => setDropdowns(selectedStat.name), [stats, selectedStat]); + // Derive current level purely without causing side effects during render + const currentLevel = useMemo(() => { + const [, level] = AttributePricingHelper.getStatAndLevel( + selectedStat.name, + stats, + selectedStat, + ); + return level; + }, [stats, selectedStat]); + + // Keep dropdowns in sync if stats or selectedStat change (without causing render-time updates) + useEffect(() => { + if (!stats || stats.length === 0) return; + + // If current selected stat is not present in the provided stats, fallback to the first available + const found = stats.find((stat) => stat.name === selectedStat.name); + if (!found) { + const fallback = stats[0]; + const [, level] = AttributePricingHelper.getStatAndLevel( + fallback.name, + stats, + selectedStat, + ); + setSelectedStat(fallback); + setFromLevel(level); + setToLevel(level); + return; + } + + const [stat, level] = AttributePricingHelper.getStatAndLevel( + selectedStat.name, + stats, + selectedStat, + ); + if (stat.name !== selectedStat.name) { + setSelectedStat(stat); + } + setFromLevel((prev) => (prev !== level ? level : prev)); + setToLevel((prev) => (prev !== level ? level : prev)); + }, [stats, selectedStat, setSelectedStat, setFromLevel, setToLevel]); const getLevelRange = useCallback( () => AttributePricingHelper.getLevelRange(totalUpgraded, currentLevel), @@ -104,6 +143,17 @@ export const AttributesPricing3 = ({ [fromLevel, toLevel, selectedStat.rarityClass, selectedStat.defaultLevel], ); + // Ensure the select has a valid value on the very first render, even if selectedStat.name is not in stats yet + const selectedName = useMemo(() => { + const found = stats?.find((stat) => stat.name === selectedStat.name)?.name; + return found ?? stats?.[0]?.name ?? ''; + }, [stats, selectedStat.name]); + + const selectedColor = useMemo(() => { + const stat = stats?.find((stat) => stat.name === selectedName); + return stat?.color ?? selectedStat.color; + }, [stats, selectedName, selectedStat.color]); + if (!statsPricingData) { return

{t('Stat pricing data is unavailable')}

; } @@ -115,7 +165,8 @@ export const AttributesPricing3 = ({