From 4c17f7b76861523aaff92679011f03592102867e Mon Sep 17 00:00:00 2001 From: applefrittr Date: Fri, 25 Oct 2024 15:07:49 -0400 Subject: [PATCH 1/9] Commented out CF Tunrstile and added profile json for testing --- src/pages/player/index.js | 796 +++++----- .../saved-profiles-issue#1000/empty.json | 681 +++++++++ .../saved-profiles-issue#1000/full.json | 1295 +++++++++++++++++ .../standard-armor-with-rig.json | 1034 +++++++++++++ .../standard-armoredRig.json | 931 ++++++++++++ 5 files changed, 4385 insertions(+), 352 deletions(-) create mode 100644 src/pages/player/saved-profiles-issue#1000/empty.json create mode 100644 src/pages/player/saved-profiles-issue#1000/full.json create mode 100644 src/pages/player/saved-profiles-issue#1000/standard-armor-with-rig.json create mode 100644 src/pages/player/saved-profiles-issue#1000/standard-armoredRig.json diff --git a/src/pages/player/index.js b/src/pages/player/index.js index 7a19c809..0b6a0272 100644 --- a/src/pages/player/index.js +++ b/src/pages/player/index.js @@ -1,7 +1,7 @@ import { useState, useMemo, useEffect, useCallback, useRef } from 'react'; import { useParams, Link, useNavigate } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; -import { Turnstile } from '@marsidev/react-turnstile' +//import { Turnstile } from '@marsidev/react-turnstile'; --------------------COMMENTED OUT CLOUDFLARE IS ANNOYING DURING DEV ISSUE #1000--------------------- import { Icon } from '@mdi/react'; import { mdiAccountDetails, @@ -39,30 +39,30 @@ function getDHMS(seconds) { // calculate (and subtract) whole days const secondsPerDay = 24 * 60 * 60; const days = Math.floor(seconds / secondsPerDay); - seconds -= (days * secondsPerDay); + seconds -= days * secondsPerDay; // calculate (and subtract) whole hours const secondsPerHour = secondsPerDay / 24; const hours = Math.floor(seconds / secondsPerHour) % 24; - seconds -= (hours * secondsPerHour); + seconds -= hours * secondsPerHour; // calculate (and subtract) whole minutes const minutes = Math.floor(seconds / 60) % 60; - seconds -= (minutes * 60); + seconds -= minutes * 60; return { days, hours, minutes, seconds, - } + }; } const raritySort = { - "common": 0, - "rare": 1, - "legendary": 2 -} + common: 0, + rare: 1, + legendary: 2, +}; const memberFlags = { Developer: 1, @@ -71,11 +71,11 @@ const memberFlags = { Sherpa: 256, Emissary: 512, Unheard: 1024, -} +}; function Player() { const turnstileRef = useRef(); - const inputFile = useRef() + const inputFile = useRef(); const { t } = useTranslation(); const params = useParams(); const navigate = useNavigate(); @@ -112,7 +112,7 @@ function Player() { const { data: metaData } = useMetaData(); const { data: achievements } = useAchievementsData(); const [turnstileToken, setTurnstileToken] = useState(); - const [ playerBanned, setPlayerBanned ] = useState(); + const [playerBanned, setPlayerBanned] = useState(); const bannedButtonRef = useRef(); const fetchProfile = useCallback(async () => { @@ -125,7 +125,11 @@ function Player() { } if (isNaN(accountId)) { try { - const searchResponse = await playerStats.searchPlayers(accountId, gameMode, turnstileToken); + const searchResponse = await playerStats.searchPlayers( + accountId, + gameMode, + turnstileToken, + ); if (turnstileRef.current?.reset) { turnstileRef.current.reset(); } @@ -149,7 +153,15 @@ function Player() { } catch (error) { setProfileError(error.message); } - }, [accountId, setPlayerData, setProfileError, navigate, turnstileToken, turnstileRef, gameMode]); + }, [ + accountId, + setPlayerData, + setProfileError, + navigate, + turnstileToken, + turnstileRef, + gameMode, + ]); const checkBanned = useCallback(async () => { const token = turnstileRef?.current?.getResponse(); @@ -160,7 +172,11 @@ function Player() { return; } try { - const searchResponse = await playerStats.searchPlayers(playerData.info.nickname, gameMode, turnstileToken); + const searchResponse = await playerStats.searchPlayers( + playerData.info.nickname, + gameMode, + turnstileToken, + ); if (turnstileRef.current?.reset) { turnstileRef.current.reset(); } @@ -172,7 +188,9 @@ function Player() { } setPlayerBanned(true); } catch (error) { - console.log(`Error checking banned status for ${playerData.info.nickname}: ${error.message}`); + console.log( + `Error checking banned status for ${playerData.info.nickname}: ${error.message}`, + ); } return false; }, [playerData, setPlayerBanned, turnstileToken, turnstileRef, gameMode]); @@ -182,29 +200,32 @@ function Player() { return; } const element = document.createElement('a'); - const file = new Blob([JSON.stringify(playerData, null, 4)], {type: 'application/json'}); + const file = new Blob([JSON.stringify(playerData, null, 4)], { type: 'application/json' }); element.href = URL.createObjectURL(file); element.download = `${playerData.aid}.json`; document.body.appendChild(element); // Required for this to work in FireFox element.click(); }, [playerData]); - const loadProfile = useCallback((e) => { - e.preventDefault() - const reader = new FileReader(); - reader.onload = async (e) => { - const text = (e.target.result); - try { - const data = JSON.parse(text); - data.saved = true; - setPlayerData(data); - window.history.replaceState(null, null, `/players/${gameMode}/${data.aid}`); - } catch(error) { - setProfileError('Error reading profile'); - } - }; - reader.readAsText(e.target.files[0]); - }, [setPlayerData, setProfileError, gameMode]); + const loadProfile = useCallback( + (e) => { + e.preventDefault(); + const reader = new FileReader(); + reader.onload = async (e) => { + const text = e.target.result; + try { + const data = JSON.parse(text); + data.saved = true; + setPlayerData(data); + window.history.replaceState(null, null, `/players/${gameMode}/${data.aid}`); + } catch (error) { + setProfileError('Error reading profile'); + } + }; + reader.readAsText(e.target.files[0]); + }, + [setPlayerData, setProfileError, gameMode], + ); const currentWipe = wipeDetails()[0]; @@ -222,7 +243,6 @@ function Player() { if (expTotal > playerData.info.experience) { return metaData.playerLevels[i - 1].level; } - } return metaData.playerLevels[metaData.playerLevels.length - 1].level; }, [playerData, metaData]); @@ -270,24 +290,26 @@ function Player() { if (latest === 0) { return ''; } - return
{t('Last active: {{date}}', {date: new Date(latest * 1000).toLocaleString()})}
; + return ( +
+ {t('Last active: {{date}}', { date: new Date(latest * 1000).toLocaleString() })} +
+ ); }, [playerData, t]); const achievementColumns = useMemo( () => [ { Header: () => ( -
- {t('Name')} -
), +
{t('Name')}
+ ), id: 'name', accessor: 'name', }, { Header: () => ( -
- {t('Description')} -
), +
{t('Description')}
+ ), id: 'description', accessor: 'description', }, @@ -296,11 +318,7 @@ function Player() { id: 'playersCompletedPercent', accessor: 'adjustedPlayersCompletedPercent', Cell: (props) => { - return ( -
- {props.value}% -
- ); + return
{props.value}%
; }, }, { @@ -309,7 +327,9 @@ function Player() { accessor: 'completionDate', Cell: (props) => { return ( -
currentWipe.start ? ' current-wipe-achievement' : ''}`}> +
currentWipe.start ? ' current-wipe-achievement' : ''}`} + > {new Date(props.value * 1000).toLocaleString()}
); @@ -330,7 +350,10 @@ function Player() { let rowAr = raritySort[rowA.original.normalizedRarity]; let rowBr = raritySort[rowB.original.normalizedRarity]; if (rowAr === rowBr) { - return rowB.original.playersCompletedPercent - rowA.original.playersCompletedPercent + return ( + rowB.original.playersCompletedPercent - + rowA.original.playersCompletedPercent + ); } return rowAr - rowBr; }, @@ -340,25 +363,25 @@ function Player() { ); const achievementsData = useMemo(() => { - return achievements?.map(a => { - if (!playerData.achievements[a.id]) { - return false; - } - return { - ...a, - completionDate: playerData.achievements[a.id], - } - }).filter(Boolean) || []; + return ( + achievements + ?.map((a) => { + if (!playerData.achievements[a.id]) { + return false; + } + return { + ...a, + completionDate: playerData.achievements[a.id], + }; + }) + .filter(Boolean) || [] + ); }, [achievements, playerData]); const raidsColumns = useMemo( () => [ { - Header: ( -
- {t('Side')} -
- ), + Header:
{t('Side')}
, id: 'side', accessor: 'side', Cell: (props) => { @@ -366,28 +389,20 @@ function Player() { }, }, { - Header: ( -
- {t('Raids')} -
- ), + Header:
{t('Raids')}
, id: 'raids', accessor: 'raids', }, { Header: ( -
- {t('Survived')} -
+
{t('Survived')}
), id: 'survived', accessor: 'survived', }, { Header: ( -
- {t('Runthrough')} -
+
{t('Runthrough')}
), id: 'runthrough', accessor: 'runthrough', @@ -396,11 +411,7 @@ function Player() { }, }, { - Header: ( -
- {t('MIA')} -
- ), + Header:
{t('MIA')}
, id: 'mia', accessor: 'mia', Cell: (props) => { @@ -408,11 +419,7 @@ function Player() { }, }, { - Header: ( -
- {t('KIA')} -
- ), + Header:
{t('KIA')}
, id: 'kia', accessor: 'kia', Cell: (props) => { @@ -420,11 +427,7 @@ function Player() { }, }, { - Header: ( -
- {t('Kills')} -
- ), + Header:
{t('Kills')}
, id: 'kills', accessor: 'kills', Cell: (props) => { @@ -445,9 +448,7 @@ function Player() { }, { Header: ( -
- {t('Win Streak')} -
+
{t('Win Streak')}
), id: 'streak', accessor: 'streak', @@ -463,7 +464,7 @@ function Player() { if (!playerData.pmcStats?.eft) { return []; } - const statSides = { 'scavStats': 'Scav', 'pmcStats': 'PMC' }; + const statSides = { scavStats: 'Scav', pmcStats: 'PMC' }; const statTypes = [ { name: 'raids', @@ -491,8 +492,8 @@ function Player() { }, { name: 'streak', - key: ['LongestWinStreak'] - } + key: ['LongestWinStreak'], + }, ]; const getStats = (side) => { return { @@ -500,7 +501,7 @@ function Player() { ...statTypes.reduce((all, s) => { all[s.name] = 0; return all; - }, {}) + }, {}), }; }; const totalStats = getStats('Total'); @@ -510,7 +511,9 @@ function Player() { const stats = playerData[sideKey].eft.overAllCounters.Items; const currentData = getStats(sideLabel); for (const st of statTypes) { - const foundStat = stats.find(s => !st.key.some(keyPart => !s.Key.includes(keyPart))); + const foundStat = stats.find( + (s) => !st.key.some((keyPart) => !s.Key.includes(keyPart)), + ); currentData[st.name] = foundStat?.Value || 0; totalStats[st.name] += currentData[st.name]; } @@ -522,11 +525,7 @@ function Player() { const skillsColumns = useMemo( () => [ { - Header: ( -
- {t('Skill')} -
- ), + Header:
{t('Skill')}
, id: 'skill', accessor: 'skill', Cell: (props) => { @@ -534,11 +533,7 @@ function Player() { }, }, { - Header: ( -
- {t('Level')} -
- ), + Header:
{t('Level')}
, id: 'progress', accessor: 'progress', Cell: (props) => { @@ -547,9 +542,7 @@ function Player() { }, { Header: ( -
- {t('Last Access')} -
+
{t('Last Access')}
), id: 'lastAccess', accessor: 'lastAccess', @@ -562,27 +555,26 @@ function Player() { ); const skillsData = useMemo(() => { - return playerData.skills?.Common?.map(s => { - if (!s.Progress || s.LastAccess <= 0) { - return false; - } - const skill = metaData.skills.find(skill => skill.id === s.Id); - return { - skill: skill?.name || s.Id, - progress: s.Progress, - lastAccess: s.LastAccess, - } - }).filter(Boolean) || []; + return ( + playerData.skills?.Common?.map((s) => { + if (!s.Progress || s.LastAccess <= 0) { + return false; + } + const skill = metaData.skills.find((skill) => skill.id === s.Id); + return { + skill: skill?.name || s.Id, + progress: s.Progress, + lastAccess: s.LastAccess, + }; + }).filter(Boolean) || [] + ); }, [playerData, metaData]); const masteringColumns = useMemo( () => [ { id: 'expander', - Header: ({ - getToggleAllRowsExpandedProps, - isAllRowsExpanded, - }) => + Header: ({ getToggleAllRowsExpandedProps, isAllRowsExpanded }) => // // {isAllRowsExpanded ? 'v' : '>'} // @@ -610,30 +602,19 @@ function Player() { ) : null, }, { - Header: ( -
- {t('Weapon')} -
- ), + Header:
{t('Weapon')}
, id: 'name', accessor: 'name', Cell: (props) => { if (props.row.original.shortName) { - return ( - - ); + return ; } return props.value; }, }, { Header: ( -
- {t('Progress')} -
+
{t('Progress')}
), id: 'Progress', accessor: 'Progress', @@ -658,37 +639,45 @@ function Player() { ); const masteringData = useMemo(() => { - return playerData.skills?.Mastering?.map(masteringProgress => { - const mastering = metaData.mastering.find(m => m.id === String(masteringProgress.Id)); - if (!mastering) { - return false; - } - let level = 1; - if (masteringProgress.Progress > mastering.level3) { - level = 3; - } else if (masteringProgress.Progress > mastering.level2) { - level = 2; - } - return { - ...masteringProgress, - name: masteringProgress.Id, - level, - subRows: mastering.weapons.map(w => { - const baseItem = items.find(i => i.id === w.id); - if (!baseItem) { - return false; - } - const preset = items.find (i => i.id === baseItem.properties.defaultPreset?.id); - return { - ...baseItem, - itemLink: `/item/${baseItem.normalizedName}`, - iconLink: preset ? preset.iconLink : baseItem.iconLink, - Progress: masteringProgress.Progress, - level, - }; - }).filter(Boolean), - }; - }).filter(Boolean) || []; + return ( + playerData.skills?.Mastering?.map((masteringProgress) => { + const mastering = metaData.mastering.find( + (m) => m.id === String(masteringProgress.Id), + ); + if (!mastering) { + return false; + } + let level = 1; + if (masteringProgress.Progress > mastering.level3) { + level = 3; + } else if (masteringProgress.Progress > mastering.level2) { + level = 2; + } + return { + ...masteringProgress, + name: masteringProgress.Id, + level, + subRows: mastering.weapons + .map((w) => { + const baseItem = items.find((i) => i.id === w.id); + if (!baseItem) { + return false; + } + const preset = items.find( + (i) => i.id === baseItem.properties.defaultPreset?.id, + ); + return { + ...baseItem, + itemLink: `/item/${baseItem.normalizedName}`, + iconLink: preset ? preset.iconLink : baseItem.iconLink, + Progress: masteringProgress.Progress, + level, + }; + }) + .filter(Boolean), + }; + }).filter(Boolean) || [] + ); }, [playerData, metaData, items]); const totalTimeInGame = useMemo(() => { @@ -701,175 +690,224 @@ function Player() { days, hours, minutes, - seconds + seconds, }); - return (

{`${t('Total account time in game')}: ${formattedTime}`}

); + return

{`${t('Total account time in game')}: ${formattedTime}`}

; }, [playerData, t]); - const getItemDisplay = useCallback((loadoutItem, imageOptions = {}) => { - let item = items.find(i => i.id === loadoutItem._tpl); - if (!item) { - return undefined; - } - if (item.properties?.defaultPreset) { - const preset = items.find(i => i.id === item.properties.defaultPreset.id); - item = { - ...item, - width: preset.width, - height: preset.height, - baseImageLink: preset.baseImageLink, - }; - } - let countLabel; + const getItemDisplay = useCallback( + (loadoutItem, imageOptions = {}) => { + let item = items.find((i) => i.id === loadoutItem._tpl); + if (!item) { + return undefined; + } + if (item.properties?.defaultPreset) { + const preset = items.find((i) => i.id === item.properties.defaultPreset.id); + item = { + ...item, + width: preset.width, + height: preset.height, + baseImageLink: preset.baseImageLink, + }; + } + let countLabel; - let label = ''; - if (loadoutItem.upd?.StackObjectsCount > 1) { - countLabel = loadoutItem.upd?.StackObjectsCount; - } - if (loadoutItem.upd?.Dogtag) { - const tag = loadoutItem.upd.Dogtag; - const weapon = items.find(i => i.id === tag.WeaponName?.split(' ')[0]); - countLabel = tag.Level; - let killerInfo = {tag.KillerName}; - if (tag.KillerAccountId) { - killerInfo = {tag.KillerName}; + let label = ''; + if (loadoutItem.upd?.StackObjectsCount > 1) { + countLabel = loadoutItem.upd?.StackObjectsCount; } - let victimInfo = ( - {tag.Nickname} - ); - if (tag.AccountId !== '0') { - victimInfo = ( - {tag.Nickname} + if (loadoutItem.upd?.Dogtag) { + const tag = loadoutItem.upd.Dogtag; + const weapon = items.find((i) => i.id === tag.WeaponName?.split(' ')[0]); + countLabel = tag.Level; + let killerInfo = {tag.KillerName}; + if (tag.KillerAccountId) { + killerInfo = ( + + {tag.KillerName} + + ); + } + let victimInfo = {tag.Nickname}; + if (tag.AccountId !== '0') { + victimInfo = ( + {tag.Nickname} + ); + } + label = ( + + {victimInfo} + {` ${t(tag.Status)} `} + {killerInfo} + {weapon !== undefined && [ + {` ${t('using')} `}, + + {weapon.shortName} + , + ]} +
{` ${new Date(tag.Time).toLocaleString()}`}
+
); } - label = ( - - {victimInfo} - {` ${t(tag.Status)} `} - {killerInfo} - {weapon !== undefined && [ - {` ${t('using')} `}, - {weapon.shortName} - ]} -
{` ${new Date(tag.Time).toLocaleString()}`}
-
- ); - } - if (loadoutItem.upd?.Key) { - const key = items.find(i => i.id === loadoutItem._tpl); - if (key) { - if (key.properties.uses) { - countLabel = `${key.properties.uses - loadoutItem.upd.Key.NumberOfUsages}/${key.properties.uses}`; - } else { - countLabel = loadoutItem.upd.Key.NumberOfUsages; + if (loadoutItem.upd?.Key) { + const key = items.find((i) => i.id === loadoutItem._tpl); + if (key) { + if (key.properties.uses) { + countLabel = `${key.properties.uses - loadoutItem.upd.Key.NumberOfUsages}/${key.properties.uses}`; + } else { + countLabel = loadoutItem.upd.Key.NumberOfUsages; + } } - } - } - if (loadoutItem.upd?.Repairable) { - countLabel = `${loadoutItem.upd.Repairable.Durability.toFixed(2)}/${loadoutItem.upd.Repairable.MaxDurability}` - } - if (loadoutItem.upd?.MedKit) { - const item = items.find(i => i.id === loadoutItem._tpl); - if (item?.properties?.uses || item?.properties?.hitpoints) { - countLabel = `${loadoutItem.upd.MedKit.HpResource}/${item.properties?.uses || item.properties?.hitpoints}`; + if (loadoutItem.upd?.Repairable) { + countLabel = `${loadoutItem.upd.Repairable.Durability.toFixed(2)}/${loadoutItem.upd.Repairable.MaxDurability}`; + } + if (loadoutItem.upd?.MedKit) { + const item = items.find((i) => i.id === loadoutItem._tpl); + if (item?.properties?.uses || item?.properties?.hitpoints) { + countLabel = `${loadoutItem.upd.MedKit.HpResource}/${item.properties?.uses || item.properties?.hitpoints}`; + } } - } - const itemImage = ( - - ); - return { image: itemImage, label }; - }, [items, t, gameMode]); + const itemImage = ( + + ); + return { image: itemImage, label }; + }, + [items, t, gameMode], + ); - const getLoadoutContents = useCallback((parentItem, itemType = 'loadout') => { - const itemSource = itemType === 'loadout' ? playerData?.equipment?.Items : playerData?.favoriteItems; - return itemSource?.reduce((contents, loadoutItem) => { - if (loadoutItem.parentId !== parentItem._id) { - return contents; - } - const itemDisplay = getItemDisplay(loadoutItem); - if (!itemDisplay) { + const getLoadoutContents = useCallback( + (parentItem, itemType = 'loadout') => { + const itemSource = + itemType === 'loadout' ? playerData?.equipment?.Items : playerData?.favoriteItems; + return itemSource?.reduce((contents, loadoutItem) => { + if (loadoutItem.parentId !== parentItem._id) { + return contents; + } + const itemDisplay = getItemDisplay(loadoutItem); + if (!itemDisplay) { + return contents; + } + contents.push( + { + return itemDisplay.image; + }, + }} + label={itemDisplay.label} + > + {getLoadoutContents(loadoutItem, itemType)} + , + ); return contents; - } - contents.push(( - { return itemDisplay.image}}} label={itemDisplay.label}> - {getLoadoutContents(loadoutItem, itemType)} - - )); - return contents; - }, []); - }, [playerData, getItemDisplay]); + }, []); + }, + [playerData, getItemDisplay], + ); - const getLoadoutInSlot = useCallback((slot) => { - if (playerData?.equipment?.Id === undefined) { - return "None"; - } + const getLoadoutInSlot = useCallback( + (slot) => { + if (playerData?.equipment?.Id === undefined) { + return 'None'; + } - let loadoutRoot = playerData.equipment.Items.find(i => i._id === playerData.equipment.Id); - let loadoutItem = playerData.equipment.Items.find(i => i.slotId === slot && i.parentId === loadoutRoot._id); + let loadoutRoot = playerData.equipment.Items.find( + (i) => i._id === playerData.equipment.Id, + ); + let loadoutItem = playerData.equipment.Items.find( + (i) => i.slotId === slot && i.parentId === loadoutRoot._id, + ); - if (loadoutItem === undefined) { - return "None"; - } + if (loadoutItem === undefined) { + return 'None'; + } - let itemImage = undefined; - let itemLabel = ''; - let contents = []; - let itemDisplay = getItemDisplay(loadoutItem); - if (itemDisplay) { - itemImage = itemDisplay.image; - } - else { - itemLabel = slot; - } - contents.push(( - { return itemImage}}} label={itemLabel}> - {getLoadoutContents(loadoutItem)} - - )); + let itemImage = undefined; + let itemLabel = ''; + let contents = []; + let itemDisplay = getItemDisplay(loadoutItem); + if (itemDisplay) { + itemImage = itemDisplay.image; + } else { + itemLabel = slot; + } + contents.push( + { + return itemImage; + }, + }} + label={itemLabel} + > + {getLoadoutContents(loadoutItem)} + , + ); - return - {contents} - - }, [playerData, getItemDisplay, getLoadoutContents]); + return {contents}; + }, + [playerData, getItemDisplay, getLoadoutContents], + ); const favoriteItemsContent = useMemo(() => { if (!playerData?.favoriteItems?.length) { return ''; } - return ([ -

{t('Favorite Items')}

, + return [ +

+ + {t('Favorite Items')} +

,
    - {playerData.favoriteItems.map(itemData => { - if (itemData.parentId) { - return false; - } + {playerData.favoriteItems + .map((itemData) => { + if (itemData.parentId) { + return false; + } - let itemImage = undefined; - let itemLabel = ''; - let itemDisplay = getItemDisplay(itemData); - if (itemDisplay) { - itemImage = itemDisplay.image; - itemLabel = itemDisplay.label; - } - return ( -
  • - - { return itemImage}}} label={itemLabel}> - {getLoadoutContents(itemData, 'favorite')} - - -
  • - ); - }).filter(Boolean)} -
- ]) + let itemImage = undefined; + let itemLabel = ''; + let itemDisplay = getItemDisplay(itemData); + if (itemDisplay) { + itemImage = itemDisplay.image; + itemLabel = itemDisplay.label; + } + return ( +
  • + + { + return itemImage; + }, + }} + label={itemLabel} + > + {getLoadoutContents(itemData, 'favorite')} + + +
  • + ); + }) + .filter(Boolean)} + , + ]; }, [playerData, getItemDisplay, getLoadoutContents, t]); useEffect(() => { @@ -882,19 +920,36 @@ function Player() { if (playerData.saved) { return; } - fetchProfile(); - }, [playerData, accountId, turnstileToken, fetchProfile]) + /* + *-----Commented out to prevent any unneccesary fetches to CloudFlare workers and/or Tarkov scanners, using the load profile feature to populate page ISSUE #1000 ------ + *fetchProfile(); + */ + }, [playerData, accountId, turnstileToken, fetchProfile]); const playerSearchDiv = (

    - {t('Search different player')} - - - + + + {t('Search different player')} + + + +

    @@ -923,10 +978,17 @@ function Player() { {pageTitle} {playerData.aid !== 0 && ( - - + + )} @@ -934,10 +996,16 @@ function Player() { {typeof playerBanned === 'undefined' && ( - + )} {playerBanned === false && ( @@ -949,42 +1017,49 @@ function Player() { )} - { // https://developers.cloudflare.com/turnstile/reference/client-side-errors#error-codes if (errorCode === '110200') { - setProfileError(`Turnstile error: ${window.location.hostname} is not a valid hostname`); + setProfileError( + `Turnstile error: ${window.location.hostname} is not a valid hostname`, + ); } else { setProfileError(`Turnstile error code ${errorCode}`); } }} - options={{appearance: 'interaction-only'}} - /> + options={{ appearance: 'interaction-only' }} + /> */}
    {accountCategories} {!!playerData.saved && ( -

    {t('Warning: Profiles loaded from files may contain edited information')}

    +

    + {t('Warning: Profiles loaded from files may contain edited information')} +

    )} {totalTimeInGame} {lastActiveDate} - {raidsData?.length > 0 && ( + {raidsData?.length > 0 && ( <> -

    {t('Raid Stats')}

    - +

    + + {t('Raid Stats')} +

    + )} - {achievementsData?.length > 0 && ( + {achievementsData?.length > 0 && ( <> -

    {t('Achievements')}

    +

    + + {t('Achievements')} +

    0 && ( <> -

    {t('Loadout')}

    +

    + + {t('Loadout')} +

    {getLoadoutInSlot('Earpiece')}
    @@ -1004,14 +1082,22 @@ function Player() {
    {getLoadoutInSlot('ArmBand')}
    {getLoadoutInSlot('ArmorVest')}
    {getLoadoutInSlot('Eyewear')}
    -
    {getLoadoutInSlot('FirstPrimaryWeapon')}
    +
    + {getLoadoutInSlot('FirstPrimaryWeapon')} +
    {getLoadoutInSlot('Holster')}
    -
    {getLoadoutInSlot('SecondPrimaryWeapon')}
    +
    + {getLoadoutInSlot('SecondPrimaryWeapon')} +
    {getLoadoutInSlot('Scabbard')}
    -
    {getLoadoutInSlot('TacticalVest')}
    -
    {getLoadoutInSlot('Pockets')}
    +
    + {getLoadoutInSlot('TacticalVest')} +
    +
    + {getLoadoutInSlot('Pockets')} +
    {getLoadoutInSlot('Backpack')}
    {getLoadoutInSlot('SecuredContainer')}
    @@ -1021,7 +1107,10 @@ function Player() { {favoriteItemsContent} {skillsData?.length > 0 && ( <> -

    {t('Skills')}

    +

    + + {t('Skills')} +

    0 && ( <> -

    {t('Mastering')}

    +

    + + {t('Mastering')} +

    Date: Sat, 26 Oct 2024 19:38:20 -0400 Subject: [PATCH 2/9] added 'inspectImageLink' field to fetched item data --- src/features/items/do-fetch-items.mjs | 94 +++++++++++++++------------ 1 file changed, 54 insertions(+), 40 deletions(-) diff --git a/src/features/items/do-fetch-items.mjs b/src/features/items/do-fetch-items.mjs index 3740c015..6829ffcd 100644 --- a/src/features/items/do-fetch-items.mjs +++ b/src/features/items/do-fetch-items.mjs @@ -1,4 +1,4 @@ -import fetch from 'cross-fetch'; +import fetch from 'cross-fetch'; import APIQuery from '../../modules/api-query.mjs'; import fleaMarketFee from '../../modules/flea-market-fee.mjs'; @@ -9,9 +9,9 @@ class ItemsQuery extends APIQuery { } async query(options) { - const { language, gameMode, prebuild} = options; + const { language, gameMode, prebuild } = options; const itemLimit = 20000; - const QueryBody = offset => { + const QueryBody = (offset) => { return `query TarkovDevItems { items(lang: ${language}, gameMode: ${gameMode}, limit: ${itemLimit}, offset: ${offset}) { id @@ -42,6 +42,7 @@ class ItemsQuery extends APIQuery { baseImageLink image512pxLink image8xLink + inspectImageLink updated sellFor { ...ItemPriceFragment @@ -411,13 +412,19 @@ class ItemsQuery extends APIQuery { if (itemBatch.data.items.length === 0) { break; } - retrievedItems.data.items = retrievedItems.data.items.concat(itemBatch.data.items); + retrievedItems.data.items = retrievedItems.data.items.concat( + itemBatch.data.items, + ); if (itemBatch.data.items.length < itemLimit) { break; } } if (!itemBatch.errors) { - if (!itemBatch.data || !itemBatch.data.items || !itemBatch.data.items.length) { + if ( + !itemBatch.data || + !itemBatch.data.items || + !itemBatch.data.items.length + ) { break; } } @@ -428,23 +435,27 @@ class ItemsQuery extends APIQuery { } resolve(retrievedItems); }), - this.graphqlRequest(`{ + this.graphqlRequest( + `{ fleaMarket { sellOfferFeeRate sellRequirementFeeRate } - }`.replace(/\s{2,}/g, ' ')), - new Promise(resolve => { + }`.replace(/\s{2,}/g, ' '), + ), + new Promise((resolve) => { if (prebuild) { return resolve({}); } - return resolve(fetch(`${process.env.PUBLIC_URL}/data/item-grids.min.json`).then( - (response) => response.json(), - )).catch(error => { + return resolve( + fetch(`${process.env.PUBLIC_URL}/data/item-grids.min.json`).then((response) => + response.json(), + ), + ).catch((error) => { console.log('Error retrieving item grids', error); return {}; }); - }) + }), ]); //console.timeEnd('items query'); if (itemData.errors) { @@ -463,15 +474,12 @@ class ItemsQuery extends APIQuery { } console.log(`Error in items API query: ${error.message}`, error.path); if (badItem) { - console.log(badItem) + console.log(badItem); } } } // only throw error if this is for prebuild or data wasn't returned - if ( - prebuild || !itemData.data || - !itemData.data.items || !itemData.data.items.length - ) { + if (prebuild || !itemData.data || !itemData.data.items || !itemData.data.items.length) { return Promise.reject(new Error(itemData.errors[0].message)); } } @@ -492,15 +500,12 @@ class ItemsQuery extends APIQuery { } console.log(`Error in items API query: ${error.message}`, error.path); if (badItem) { - console.log(badItem) + console.log(badItem); } } } // only throw error if this is for prebuild or data wasn't returned - if ( - prebuild || !miscData.data || - !miscData.data.fleaMarket - ) { + if (prebuild || !miscData.data || !miscData.data.fleaMarket) { return Promise.reject(new Error(miscData.errors[0].message)); } } @@ -516,14 +521,15 @@ class ItemsQuery extends APIQuery { let gridPockets = []; if (itemGrids[rawItem.id]) { gridPockets = itemGrids[rawItem.id]; - } - else if (rawItem.properties.grids.length === 1) { - gridPockets = [{ - row: 0, - col: 0, - width: rawItem.properties.grids[0].width, - height: rawItem.properties.grids[0].height, - }]; + } else if (rawItem.properties.grids.length === 1) { + gridPockets = [ + { + row: 0, + col: 0, + width: rawItem.properties.grids[0].width, + height: rawItem.properties.grids[0].height, + }, + ]; } if (gridPockets.length > 1) { @@ -533,12 +539,10 @@ class ItemsQuery extends APIQuery { grid.width = Math.max( ...gridPockets.map((pocket) => pocket.col + pocket.width), ); - } - else if (rawItem.properties.grids.length >= 1) { + } else if (rawItem.properties.grids.length >= 1) { grid.height = rawItem.properties.grids[0].height; grid.width = rawItem.properties.grids[0].width; - } - else { + } else { grid.height = rawItem.height; grid.width = rawItem.width; } @@ -547,20 +551,30 @@ class ItemsQuery extends APIQuery { rawItem.grid = grid; rawItem.properties = { - ...rawItem.properties + ...rawItem.properties, }; // calculate flea market fee - const fee = fleaMarketFee(rawItem.basePrice, rawItem.lastLowPrice, 1, flea.sellOfferFeeRate, flea.sellRequirementFeeRate); + const fee = fleaMarketFee( + rawItem.basePrice, + rawItem.lastLowPrice, + 1, + flea.sellOfferFeeRate, + flea.sellRequirementFeeRate, + ); rawItem.fee = fee; const container = rawItem.properties?.slots || rawItem.properties?.grids; if (container) { for (const slot of container) { - slot.filters.allowedCategories = slot.filters.allowedCategories.map(cat => cat.id); - slot.filters.allowedItems = slot.filters.allowedItems.map(it => it.id); - slot.filters.excludedCategories = slot.filters.excludedCategories.map(cat => cat.id); - slot.filters.excludedItems = slot.filters.excludedItems.map(it => it.id); + slot.filters.allowedCategories = slot.filters.allowedCategories.map( + (cat) => cat.id, + ); + slot.filters.allowedItems = slot.filters.allowedItems.map((it) => it.id); + slot.filters.excludedCategories = slot.filters.excludedCategories.map( + (cat) => cat.id, + ); + slot.filters.excludedItems = slot.filters.excludedItems.map((it) => it.id); } } From ba3ce202f6461faed9b260353d251474abba905e Mon Sep 17 00:00:00 2001 From: applefrittr Date: Sat, 26 Oct 2024 19:39:43 -0400 Subject: [PATCH 3/9] useResponsiveScaling created to scale imgs passed from Player page --- src/hooks/useResponsiveScaling.jsx | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/hooks/useResponsiveScaling.jsx diff --git a/src/hooks/useResponsiveScaling.jsx b/src/hooks/useResponsiveScaling.jsx new file mode 100644 index 00000000..c5f16340 --- /dev/null +++ b/src/hooks/useResponsiveScaling.jsx @@ -0,0 +1,26 @@ +import { useState, useEffect } from 'react'; + +const useResponsiveScaling = () => { + const [scaler, setScaler] = useState(1); + useEffect(() => { + const adjustScaler = () => { + const width = window.innerWidth; + console.log(width); + if (width >= 1000) { + setScaler(1); + } else if (width <= 500) { + setScaler(2); + } else setScaler(1.5); + }; + + adjustScaler(); + + window.addEventListener('resize', adjustScaler, false); + return () => { + window.removeEventListener('resize', adjustScaler); + }; + }, []); + return scaler; +}; + +export default useResponsiveScaling; From 90d4a9ef201543ab03b08db4ba3cc0424b82f56b Mon Sep 17 00:00:00 2001 From: applefrittr Date: Sat, 26 Oct 2024 19:41:53 -0400 Subject: [PATCH 4/9] refactor of Loudout element in Player page --- src/components/item-image/index.js | 322 +++++++++++++++++++---------- src/pages/player/index.css | 62 +++++- src/pages/player/index.js | 6 +- 3 files changed, 273 insertions(+), 117 deletions(-) diff --git a/src/components/item-image/index.js b/src/components/item-image/index.js index 1c358465..aa0b0d7e 100644 --- a/src/components/item-image/index.js +++ b/src/components/item-image/index.js @@ -1,32 +1,33 @@ import React, { useState, useEffect, useRef, useMemo, useCallback } from 'react'; -import {renderToStaticMarkup} from "react-dom/server"; -import { Link, useNavigate } from "react-router-dom"; +import { renderToStaticMarkup } from 'react-dom/server'; +import { Link, useNavigate } from 'react-router-dom'; import ImageViewer from 'react-simple-image-viewer'; import { useTranslation } from 'react-i18next'; import Tippy from '@tippyjs/react'; import 'tippy.js/dist/tippy.css'; import ResizeObserver from 'resize-observer-polyfill'; +import useResponsiveScaling from '../../hooks/useResponsiveScaling.jsx'; import './index.css'; const colors = { - black: {r: 0, g: 0, b: 0, alpha: 77/255}, - blue: {r: 28, g: 65, b: 86, alpha: 77/255}, - default: {r: 127, g: 127, b: 127, alpha: 77/255}, - green: {r: 21, g: 45, b: 0, alpha: 77/255}, - grey: {r: 29, g: 29, b: 29, alpha: 77/255}, - orange: {r: 60, g: 25, b: 0, alpha: 77/255}, - red: {r: 109, g: 36, b: 24, alpha: 77/255}, - violet: {r: 76, g: 42, b: 85, alpha: 77/255}, - yellow: {r: 104, g: 102, b: 40, alpha: 77/255}, + black: { r: 0, g: 0, b: 0, alpha: 77 / 255 }, + blue: { r: 28, g: 65, b: 86, alpha: 77 / 255 }, + default: { r: 127, g: 127, b: 127, alpha: 77 / 255 }, + green: { r: 21, g: 45, b: 0, alpha: 77 / 255 }, + grey: { r: 29, g: 29, b: 29, alpha: 77 / 255 }, + orange: { r: 60, g: 25, b: 0, alpha: 77 / 255 }, + red: { r: 109, g: 36, b: 24, alpha: 77 / 255 }, + violet: { r: 76, g: 42, b: 85, alpha: 77 / 255 }, + yellow: { r: 104, g: 102, b: 40, alpha: 77 / 255 }, }; -function ItemImage({ - item, - backgroundScale = 1, - imageField = 'baseImageLink', - nonFunctionalOverlay = false, - imageViewer = false, +function ItemImage({ + item, + backgroundScale = 1, + imageField = 'baseImageLink', + nonFunctionalOverlay = false, + imageViewer = false, children = '', attributes = [], count, @@ -57,7 +58,8 @@ function ItemImage({ }, []);*/ const refImage = useRef(); - const [imageDimensions, setImageDimensions] = useState({ width: 0, height: 0}); + const scaler = useResponsiveScaling(); + const [imageDimensions, setImageDimensions] = useState({ width: 0, height: 0 }); useEffect(() => { if (!refImage.current) { return; @@ -66,7 +68,10 @@ function ItemImage({ if (!refImage.current) { return; } - if (refImage.current.width === imageDimensions.width && refImage.current.height === imageDimensions.height) { + if ( + refImage.current.width === imageDimensions.width && + refImage.current.height === imageDimensions.height + ) { return; } setImageDimensions({ @@ -74,7 +79,7 @@ function ItemImage({ height: refImage.current.height, }); }); - const intersectionObserver = new IntersectionObserver(entries => { + const intersectionObserver = new IntersectionObserver((entries) => { if (!refImage.current) { return; } @@ -95,13 +100,11 @@ function ItemImage({ return <>; } const loadingStyle = { - WebkitMask:`url(${item[imageField]}) center/cover`, - mask:`url(${item[imageField]}) center/cover`, + WebkitMask: `url(${item[imageField]}) center/cover`, + mask: `url(${item[imageField]}) center/cover`, }; - - return ( -
    - ); + + return
    ; }, [item, imageField]); const [isViewerOpen, setIsViewerOpen] = useState(false); @@ -110,7 +113,7 @@ function ItemImage({ return; } setIsViewerOpen(true); - }, [imageViewer]); + }, [imageViewer]); const closeImageViewer = () => { setIsViewerOpen(false); }; @@ -130,20 +133,33 @@ function ItemImage({ imageStyle.cursor = 'zoom-in'; } //console.log(dimensions); - const img = {item.name}; + // issue #1000 conditionlly set dimensions on img el when imageField is inspectImageLink + if (imageField === 'inspectImageLink') { + imageStyle.maxWidth = `100%`; + imageStyle.maxHeight = `100%`; + } + + const img = ( + {item.name} + ); if (linkToItem && !item.types.includes('quest')) { - return - {img} - ; + return {img}; } return img; }, [item, refImage, imageField, openImageViewer, imageViewer, linkToItem]); const imageScale = useMemo(() => { - const w = imageDimensions.width || (item.width * 63) + 1 - return w / ((item.width * 63) + 1); + const w = imageDimensions.width || item.width * 63 + 1; + return w / (item.width * 63 + 1); }, [imageDimensions, item]); - + const textSize = useMemo(() => { return Math.min(12 * imageScale, 16); }, [imageScale]); @@ -158,32 +174,42 @@ function ItemImage({ }, [item]); const nonFunctionalElement = useMemo(() => { - if (!nonFunctionalOverlay || !item.types.includes('gun') || !item.properties?.defaultPreset) { + if ( + !nonFunctionalOverlay || + !item.types.includes('gun') || + !item.properties?.defaultPreset + ) { return <>; } const nonFunctionalStyle = { position: 'absolute', boxSizing: 'border-box', - top: `${1*backgroundScale}px`, - left: `${1*backgroundScale}px`, - height: `calc(100% - ${2*backgroundScale}px)`, - width: `calc(100% - ${2*backgroundScale}px)`, + top: `${1 * backgroundScale}px`, + left: `${1 * backgroundScale}px`, + height: `calc(100% - ${2 * backgroundScale}px)`, + width: `calc(100% - ${2 * backgroundScale}px)`, fallbacks: [ - {width: `-webkit-calc(100% - ${2*backgroundScale}px)`}, - {width: `-moz-calc(100% - ${2*backgroundScale}px)`}, - {height: `-webkit-calc(100% - ${2*backgroundScale}px)`}, - {height: `-moz-calc(100% - ${2*backgroundScale}px)`}, + { width: `-webkit-calc(100% - ${2 * backgroundScale}px)` }, + { width: `-moz-calc(100% - ${2 * backgroundScale}px)` }, + { height: `-webkit-calc(100% - ${2 * backgroundScale}px)` }, + { height: `-moz-calc(100% - ${2 * backgroundScale}px)` }, ], backgroundColor: '#4400004f', }; if (imageViewer) { nonFunctionalStyle.cursor = 'zoom-in'; } - return
    ; + return ( +
    + ); }, [item, nonFunctionalOverlay, backgroundScale, openImageViewer, imageViewer]); const toolOverride = useMemo(() => { - return isTool || attributes?.some(att => att.name === 'tool'); + return isTool || attributes?.some((att) => att.name === 'tool'); }, [attributes, isTool]); const borderColor = useMemo(() => { @@ -198,14 +224,12 @@ function ItemImage({ } return color; }, [item, toolOverride, nonFunctional]); - - const backgroundStyle = useMemo(() => { if (imageField === 'iconLink') { const iconStyle = { position: 'relative', maxHeight: `${imageDimensions.height || 64}px`, - maxWidth: `${imageDimensions.width || 64}px`, + maxWidth: `${imageDimensions.width || 64}px`, }; if (toolOverride || nonFunctional) { iconStyle.outline = `1px solid ${borderColor}`; @@ -215,55 +239,126 @@ function ItemImage({ } let sizeFactor = 1; if (imageField === 'image512pxLink') { - sizeFactor = 512 / ((item.width * 63) + 1); + sizeFactor = 512 / (item.width * 63 + 1); if (item.height > item.width) { - sizeFactor = 512 / ((item.height * 63) + 1); + sizeFactor = 512 / (item.height * 63 + 1); } } if (imageField === 'image8xLink') { sizeFactor = 8; } - let width = imageDimensions.width || (((item.width * 63) + 1) * sizeFactor); - let height = imageDimensions.height || (((item.height * 63) + 1) * sizeFactor); - const gridSvg = () => + //--------- add another if statement for inspectImageLink ------------ + if (imageField === 'inspectImageLink') { + console.log({ scaler }); + const loadOutImgStyle = { + maxHeight: `${imageDimensions.height || 175 / scaler}px`, + maxWidth: `${imageDimensions.width || 256 / scaler}px`, + }; + return loadOutImgStyle; + } + let width = imageDimensions.width || (item.width * 63 + 1) * sizeFactor; + let height = imageDimensions.height || (item.height * 63 + 1) * sizeFactor; + const gridSvg = () => ( - - - - - + + + + + - - - - + + + + - - - ; + + + + ); const backgroundStyle = { backgroundImage: `url('data:image/svg+xml,${encodeURIComponent(renderToStaticMarkup(gridSvg()))}')`, backgroundSize: `${gridPercentX}% ${gridPercentY}%`, position: 'relative', - outline: `${1*backgroundScale}px solid ${borderColor}`, - outlineOffset: `-${1*backgroundScale}px`, + outline: `${1 * backgroundScale}px solid ${borderColor}`, + outlineOffset: `-${1 * backgroundScale}px`, maxHeight: `${height}px`, - maxWidth: `${width}px`, + maxWidth: `${width}px`, }; return backgroundStyle; - }, [backgroundScale, borderColor, colorString, imageField, gridPercentX, gridPercentY, item, imageDimensions, toolOverride, nonFunctional]); + }, [ + backgroundScale, + borderColor, + colorString, + imageField, + gridPercentX, + gridPercentY, + item, + imageDimensions, + toolOverride, + nonFunctional, + scaler, + ]); const imageTextStyle = useMemo(() => { if (imageField === 'iconLink' || item.types.includes('loading')) { - return {display: 'none'}; + return { display: 'none' }; } const style = { position: 'absolute', top: `${Math.min(backgroundScale + imageScale, 4)}px`, - right: `${Math.min(backgroundScale + (1.5*imageScale), 7)}px`, + right: `${Math.min(backgroundScale + 1.5 * imageScale, 7)}px`, cursor: 'default', color: '#a4aeb4', fontWeight: 'bold', @@ -274,8 +369,11 @@ function ItemImage({ if (linkToItem) { style.cursor = 'pointer'; } + if (imageField === 'inspectImageLink') { + style.fontSize = `${Math.min(26 / scaler, 20)}px`; + } return style; - }, [imageField, imageScale, textSize, backgroundScale, item, linkToItem]); + }, [imageField, imageScale, textSize, backgroundScale, item, linkToItem, scaler]); const imageTextClick = useMemo(() => { if (!linkToItem) { @@ -287,11 +385,13 @@ function ItemImage({ }, [item, linkToItem, navigate]); const imageText = useMemo(() => { - let element =
    {item.shortName}
    ; - if (fullNameTooltip && imageTextStyle.dispolay !== 'none') { - element = - {element} - ; + let element = ( +
    + {item.shortName} +
    + ); + if (fullNameTooltip && imageTextStyle.display !== 'none') { + element = {element}; } return element; }, [fullNameTooltip, imageTextClick, imageTextStyle, item]); @@ -334,40 +434,52 @@ function ItemImage({ }, [imageScale, item]); return ( -
    +
    {loadingImage} {imageElement} {nonFunctionalElement} {imageText}
    - {isFIR && - - } + {isFIR && ( + + + + )} {count && {count}}
    - {trader &&
    - - - {trader.name} - - -
    } - {station &&
    - - - {station.name} - - -
    } + {trader && ( +
    + + + {trader.name} + + +
    + )} + {station && ( +
    + + + {station.name} + + +
    + )} {children} {isViewerOpen && ( div { - background-color: rgba(0, 0, 0, 0.4); +.grid-container > div { + background-color: rgba(0, 0, 0); text-align: center; font-size: 20px; } .weapon { grid-column: 1 / span 2; + justify-items: center; + align-items: center; } ul.favorite-item-list { @@ -51,7 +66,8 @@ ul.favorite-item-list li { color: #ffe084; } -.banned, .not-banned { +.banned, +.not-banned { margin-left: 1em; } @@ -68,7 +84,7 @@ ul.favorite-item-list li { } .profile-button { - padding: .2rem; + padding: 0.2rem; border-radius: 4px; vertical-align: middle; margin-left: 20px; @@ -77,3 +93,31 @@ ul.favorite-item-list li { .current-wipe-achievement { font-weight: bold; } + +@media screen and (max-width: 1000px) { + .grid-container.main { + grid-template-columns: repeat(3, minmax(187.7px, auto)); + grid-template-rows: repeat(4, minmax(122px, auto)); + } + + .grid-container.side { + grid-template-columns: minmax(187.7px, auto); + grid-template-rows: minmax(122px, auto) 32px repeat(2, minmax(122px, auto)); + } +} + +@media screen and (max-width: 500px) { + .grid-container.main { + grid-template-columns: repeat(3, minmax(140px, auto)); + grid-template-rows: repeat(4, minmax(91.5px, auto)); + } + + .grid-container.side { + grid-template-columns: minmax(140px, auto); + grid-template-rows: minmax(91.5px, auto) 32px repeat(2, minmax(91.5px, auto)); + } + + .inventory { + padding-bottom: 12px; + } +} diff --git a/src/pages/player/index.js b/src/pages/player/index.js index 0b6a0272..c5d0d018 100644 --- a/src/pages/player/index.js +++ b/src/pages/player/index.js @@ -707,7 +707,7 @@ function Player() { ...item, width: preset.width, height: preset.height, - baseImageLink: preset.baseImageLink, + inspectImageLink: preset.inspectImageLink, // issue #1000 orginal = baseImageLink }; } let countLabel; @@ -775,7 +775,7 @@ function Player() { const itemImage = ( @@ -837,7 +837,7 @@ function Player() { let itemImage = undefined; let itemLabel = ''; let contents = []; - let itemDisplay = getItemDisplay(loadoutItem); + let itemDisplay = getItemDisplay(loadoutItem); // <--------------------- This is where item img is retrieved, dimensions set if (itemDisplay) { itemImage = itemDisplay.image; } else { From e72dad3227b0d06fc456425f7c5af23be8f474bf Mon Sep 17 00:00:00 2001 From: applefrittr Date: Sat, 26 Oct 2024 20:22:41 -0400 Subject: [PATCH 5/9] fixed scaling issue in item-image component when rending louout imgs --- src/components/item-image/index.js | 6 ++---- src/hooks/useResponsiveScaling.jsx | 1 - src/pages/player/index.css | 5 +++++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/item-image/index.js b/src/components/item-image/index.js index aa0b0d7e..379a52a3 100644 --- a/src/components/item-image/index.js +++ b/src/components/item-image/index.js @@ -133,7 +133,6 @@ function ItemImage({ imageStyle.cursor = 'zoom-in'; } //console.log(dimensions); - // issue #1000 conditionlly set dimensions on img el when imageField is inspectImageLink if (imageField === 'inspectImageLink') { imageStyle.maxWidth = `100%`; imageStyle.maxHeight = `100%`; @@ -249,10 +248,9 @@ function ItemImage({ } //--------- add another if statement for inspectImageLink ------------ if (imageField === 'inspectImageLink') { - console.log({ scaler }); const loadOutImgStyle = { - maxHeight: `${imageDimensions.height || 175 / scaler}px`, - maxWidth: `${imageDimensions.width || 256 / scaler}px`, + maxHeight: `${175 / scaler}px`, + maxWidth: `${256 / scaler}px`, }; return loadOutImgStyle; } diff --git a/src/hooks/useResponsiveScaling.jsx b/src/hooks/useResponsiveScaling.jsx index c5f16340..6e85229b 100644 --- a/src/hooks/useResponsiveScaling.jsx +++ b/src/hooks/useResponsiveScaling.jsx @@ -5,7 +5,6 @@ const useResponsiveScaling = () => { useEffect(() => { const adjustScaler = () => { const width = window.innerWidth; - console.log(width); if (width >= 1000) { setScaler(1); } else if (width <= 500) { diff --git a/src/pages/player/index.css b/src/pages/player/index.css index 4841535d..94987dfc 100644 --- a/src/pages/player/index.css +++ b/src/pages/player/index.css @@ -18,6 +18,7 @@ gap: 10px; overflow-y: hidden; overflow-x: scroll; + justify-content: center; } .grid-container { @@ -104,6 +105,10 @@ ul.favorite-item-list li { grid-template-columns: minmax(187.7px, auto); grid-template-rows: minmax(122px, auto) 32px repeat(2, minmax(122px, auto)); } + + .inventory { + justify-content: flex-start; + } } @media screen and (max-width: 500px) { From 2538dd0ab1f5cfd859eb6db956ad4826ae8aa5cb Mon Sep 17 00:00:00 2001 From: applefrittr Date: Sat, 26 Oct 2024 21:29:47 -0400 Subject: [PATCH 6/9] slot labels added in Player page, styling adjustments --- src/pages/player/index.css | 31 ++++++++++++++++++++-- src/pages/player/index.js | 53 +++++++++++++++++++++++++++++++------- 2 files changed, 72 insertions(+), 12 deletions(-) diff --git a/src/pages/player/index.css b/src/pages/player/index.css index 94987dfc..b2a8e3d5 100644 --- a/src/pages/player/index.css +++ b/src/pages/player/index.css @@ -11,6 +11,8 @@ .MuiTreeItem-label { width: auto !important; + font-size: 16px !important; + font-weight: bold !important; } .inventory { @@ -19,6 +21,7 @@ overflow-y: hidden; overflow-x: scroll; justify-content: center; + padding-bottom: 12px; } .grid-container { @@ -41,12 +44,31 @@ background-color: rgba(0, 0, 0); text-align: center; font-size: 20px; + clip-path: polygon(0 0, 0 100%, 100% 100%, 100% 24px, 96% 0); + font-size: 16px; + font-weight: bold; +} + +.gear-slot-label { + background-image: linear-gradient(#474747, #000); + background-size: 101% 101%; + color: #fff; + padding: 0 0 5px 5px; + width: 100%; + text-align: left; + font-size: 16px; + font-weight: bold; } .weapon { grid-column: 1 / span 2; justify-items: center; align-items: center; + clip-path: polygon(0 0, 0 100%, 100% 100%, 100% 24px, 98% 0) !important; +} + +.pockets_and_special_slots { + clip-path: none !important; } ul.favorite-item-list { @@ -109,6 +131,11 @@ ul.favorite-item-list li { .inventory { justify-content: flex-start; } + + .gear-slot-label { + padding-bottom: 1px; + font-size: 14px; + } } @media screen and (max-width: 500px) { @@ -122,7 +149,7 @@ ul.favorite-item-list li { grid-template-rows: minmax(91.5px, auto) 32px repeat(2, minmax(91.5px, auto)); } - .inventory { - padding-bottom: 12px; + .gear-slot-label { + font-size: 12px; } } diff --git a/src/pages/player/index.js b/src/pages/player/index.js index c5d0d018..e939722b 100644 --- a/src/pages/player/index.js +++ b/src/pages/player/index.js @@ -1076,30 +1076,63 @@ function Player() {
    -
    {getLoadoutInSlot('Earpiece')}
    -
    {getLoadoutInSlot('Headwear')}
    -
    {getLoadoutInSlot('FaceCover')}
    -
    {getLoadoutInSlot('ArmBand')}
    -
    {getLoadoutInSlot('ArmorVest')}
    -
    {getLoadoutInSlot('Eyewear')}
    +
    +
    {'EARPIECE'}
    + {getLoadoutInSlot('Earpiece')} +
    +
    +
    {'HEADWEAR'}
    + {getLoadoutInSlot('Headwear')} +
    +
    +
    {'FACE COVER'}
    + {getLoadoutInSlot('FaceCover')} +
    +
    +
    {'ARMBAND'}
    + {getLoadoutInSlot('ArmBand')} +
    +
    +
    {'BODY ARMOR'}
    + {getLoadoutInSlot('ArmorVest')} +
    +
    +
    {'EYEWEAR'}
    + {getLoadoutInSlot('Eyewear')} +
    +
    {'ON SLING'}
    {getLoadoutInSlot('FirstPrimaryWeapon')}
    -
    {getLoadoutInSlot('Holster')}
    +
    +
    {'HOLSTER'}
    + {getLoadoutInSlot('Holster')} +
    +
    {'ON BACK'}
    {getLoadoutInSlot('SecondPrimaryWeapon')}
    -
    {getLoadoutInSlot('Scabbard')}
    +
    +
    {'SHEATH'}
    + {getLoadoutInSlot('Scabbard')} +
    +
    {'TATICAL RIG'}
    {getLoadoutInSlot('TacticalVest')}
    {getLoadoutInSlot('Pockets')}
    -
    {getLoadoutInSlot('Backpack')}
    -
    {getLoadoutInSlot('SecuredContainer')}
    +
    +
    {'BACKPACK'}
    + {getLoadoutInSlot('Backpack')} +
    +
    +
    {'POUCH'}
    + {getLoadoutInSlot('SecuredContainer')} +
    From 4b2a994499bddc5f9abc632f8689fa22bb464ad8 Mon Sep 17 00:00:00 2001 From: applefrittr Date: Sat, 26 Oct 2024 22:24:18 -0400 Subject: [PATCH 7/9] render bug fixed for Favorite Items element in Player page --- src/components/item-image/index.js | 1 + src/pages/player/index.css | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/components/item-image/index.js b/src/components/item-image/index.js index 379a52a3..566467f6 100644 --- a/src/components/item-image/index.js +++ b/src/components/item-image/index.js @@ -251,6 +251,7 @@ function ItemImage({ const loadOutImgStyle = { maxHeight: `${175 / scaler}px`, maxWidth: `${256 / scaler}px`, + position: 'relative', }; return loadOutImgStyle; } diff --git a/src/pages/player/index.css b/src/pages/player/index.css index b2a8e3d5..3fef7038 100644 --- a/src/pages/player/index.css +++ b/src/pages/player/index.css @@ -13,6 +13,7 @@ width: auto !important; font-size: 16px !important; font-weight: bold !important; + word-wrap: break-word; } .inventory { @@ -74,6 +75,8 @@ ul.favorite-item-list { list-style: none; padding: 0px; + display: flex; + flex-wrap: wrap; } ul.favorite-item-list li { From 3266fd7915c36a7aafee2cc106c1cd870035df77 Mon Sep 17 00:00:00 2001 From: applefrittr Date: Sat, 26 Oct 2024 22:27:32 -0400 Subject: [PATCH 8/9] test profile with favorite items loaded into issue#1000 folder --- .../standard-with-favorites.json | 1068 +++++++++++++++++ 1 file changed, 1068 insertions(+) create mode 100644 src/pages/player/saved-profiles-issue#1000/standard-with-favorites.json diff --git a/src/pages/player/saved-profiles-issue#1000/standard-with-favorites.json b/src/pages/player/saved-profiles-issue#1000/standard-with-favorites.json new file mode 100644 index 00000000..e25ab27d --- /dev/null +++ b/src/pages/player/saved-profiles-issue#1000/standard-with-favorites.json @@ -0,0 +1,1068 @@ +{ + "aid": 4119078, + "info": { + "nickname": "stankrat", + "side": "Bear", + "experience": 10780174, + "memberCategory": 1026, + "selectedMemberCategory": 1024 + }, + "customization": { + "head": "60a6aaad42fd2735e4589978", + "body": "5f5e401747344c2e4f6c42c5", + "feet": "5f5e40400bc58666c37e7819", + "hands": "5f5f3fa30bc58666c37e782e" + }, + "skills": { + "Common": [ + { + "Id": "BotReload", + "Progress": 0, + "PointsEarnedDuringSession": 0, + "LastAccess": -2147483648 + }, + { + "Id": "BotSound", + "Progress": 0, + "PointsEarnedDuringSession": 0, + "LastAccess": -2147483648 + }, + { + "Id": "Endurance", + "Progress": 3232.635, + "PointsEarnedDuringSession": 0, + "LastAccess": 1729316793 + }, + { + "Id": "Strength", + "Progress": 2579.65479, + "PointsEarnedDuringSession": 0, + "LastAccess": 1728956973 + }, + { + "Id": "Vitality", + "Progress": 2022.53662, + "PointsEarnedDuringSession": 0, + "LastAccess": 1729316797 + }, + { + "Id": "Health", + "Progress": 2887.24268, + "PointsEarnedDuringSession": 0, + "LastAccess": 1729316797 + }, + { + "Id": "StressResistance", + "Progress": 1509.837, + "PointsEarnedDuringSession": 0, + "LastAccess": 1728956979 + }, + { + "Id": "Metabolism", + "Progress": 5100, + "PointsEarnedDuringSession": 0, + "LastAccess": 1728697010 + }, + { + "Id": "Immunity", + "Progress": 693.2243, + "PointsEarnedDuringSession": 0, + "LastAccess": 1728192660 + }, + { + "Id": "Perception", + "Progress": 2110.51367, + "PointsEarnedDuringSession": 0, + "LastAccess": 1728956815 + }, + { + "Id": "Intellect", + "Progress": 141.54, + "PointsEarnedDuringSession": 0, + "LastAccess": 1728686861 + }, + { + "Id": "Attention", + "Progress": 1436.18823, + "PointsEarnedDuringSession": 0, + "LastAccess": 1728956821 + }, + { + "Id": "Charisma", + "Progress": 1358.71887, + "PointsEarnedDuringSession": 0, + "LastAccess": 1729315786 + }, + { + "Id": "Pistol", + "Progress": 497.734253, + "PointsEarnedDuringSession": 0, + "LastAccess": 1728432044 + }, + { + "Id": "Revolver", + "Progress": 6.5, + "PointsEarnedDuringSession": 0, + "LastAccess": 1725078304 + }, + { + "Id": "SMG", + "Progress": 589.051758, + "PointsEarnedDuringSession": 0, + "LastAccess": 1728191957 + }, + { + "Id": "Assault", + "Progress": 1054.41992, + "PointsEarnedDuringSession": 0, + "LastAccess": 1728956979 + }, + { + "Id": "Shotgun", + "Progress": 330.1277, + "PointsEarnedDuringSession": 0, + "LastAccess": 1728597007 + }, + { + "Id": "Sniper", + "Progress": 1267.60828, + "PointsEarnedDuringSession": 0, + "LastAccess": 1728696022 + }, + { + "Id": "LMG", + "Progress": 70.37499, + "PointsEarnedDuringSession": 0, + "LastAccess": 1727738421 + }, + { + "Id": "HMG", + "Progress": 52, + "PointsEarnedDuringSession": 0, + "LastAccess": 1725552926 + }, + { + "Id": "Launcher", + "Progress": 0, + "PointsEarnedDuringSession": 0, + "LastAccess": 0 + }, + { + "Id": "AttachedLauncher", + "Progress": 0, + "PointsEarnedDuringSession": 0, + "LastAccess": 0 + }, + { + "Id": "Throwing", + "Progress": 526.3234, + "PointsEarnedDuringSession": 0, + "LastAccess": 1728956957 + }, + { + "Id": "Melee", + "Progress": 2.6, + "PointsEarnedDuringSession": 0, + "LastAccess": 1726819164 + }, + { + "Id": "DMR", + "Progress": 744.8616, + "PointsEarnedDuringSession": 0, + "LastAccess": 1728185191 + }, + { + "Id": "AimDrills", + "Progress": 1254.29053, + "PointsEarnedDuringSession": 0, + "LastAccess": 1728597168 + }, + { + "Id": "TroubleShooting", + "Progress": 79, + "PointsEarnedDuringSession": 0, + "LastAccess": 1728185191 + }, + { + "Id": "Surgery", + "Progress": 1055.84155, + "PointsEarnedDuringSession": 0, + "LastAccess": 1728696348 + }, + { + "Id": "CovertMovement", + "Progress": 937.0098, + "PointsEarnedDuringSession": 0, + "LastAccess": 1729316793 + }, + { + "Id": "Search", + "Progress": 903.5081, + "PointsEarnedDuringSession": 0, + "LastAccess": 1728597334 + }, + { + "Id": "MagDrills", + "Progress": 530.5719, + "PointsEarnedDuringSession": 0, + "LastAccess": 1728597007 + }, + { + "Id": "FieldMedicine", + "Progress": 0, + "PointsEarnedDuringSession": 0, + "LastAccess": 0 + }, + { + "Id": "FirstAid", + "Progress": 0, + "PointsEarnedDuringSession": 0, + "LastAccess": 0 + }, + { + "Id": "LightVests", + "Progress": 683.693665, + "PointsEarnedDuringSession": 0, + "LastAccess": 1728956979 + }, + { + "Id": "HeavyVests", + "Progress": 864.7404, + "PointsEarnedDuringSession": 0, + "LastAccess": 1728956979 + }, + { + "Id": "NightOps", + "Progress": 0, + "PointsEarnedDuringSession": 0, + "LastAccess": 0 + }, + { + "Id": "SilentOps", + "Progress": 0, + "PointsEarnedDuringSession": 0, + "LastAccess": 0 + }, + { + "Id": "WeaponTreatment", + "Progress": 300, + "PointsEarnedDuringSession": 0, + "LastAccess": 1724196235 + }, + { + "Id": "Auctions", + "Progress": 0, + "PointsEarnedDuringSession": 0, + "LastAccess": 0 + }, + { + "Id": "Cleanoperations", + "Progress": 0, + "PointsEarnedDuringSession": 0, + "LastAccess": 0 + }, + { + "Id": "Shadowconnections", + "Progress": 0, + "PointsEarnedDuringSession": 0, + "LastAccess": 0 + }, + { + "Id": "Taskperformance", + "Progress": 0, + "PointsEarnedDuringSession": 0, + "LastAccess": 0 + }, + { + "Id": "Crafting", + "Progress": 463.88, + "PointsEarnedDuringSession": 0, + "LastAccess": 1728686861 + }, + { + "Id": "HideoutManagement", + "Progress": 2362.99, + "PointsEarnedDuringSession": 0, + "LastAccess": 1728954431 + } + ], + "Mastering": [ + { + "Id": "AKM", + "Progress": 105 + }, + { + "Id": "PP19", + "Progress": 141 + }, + { + "Id": "AK74", + "Progress": 347 + }, + { + "Id": "VPO_215", + "Progress": 115 + }, + { + "Id": "VPO101", + "Progress": 24 + }, + { + "Id": "AKSU", + "Progress": 205 + }, + { + "Id": "MP443", + "Progress": 43 + }, + { + "Id": "SR2", + "Progress": 623 + }, + { + "Id": "DEAGLE", + "Progress": 3 + }, + { + "Id": "mosin", + "Progress": 29 + }, + { + "Id": "M590", + "Progress": 2 + }, + { + "Id": "PP-91", + "Progress": 34 + }, + { + "Id": "PPSH", + "Progress": 13 + }, + { + "Id": "MP133", + "Progress": 9 + }, + { + "Id": "P226", + "Progress": 1 + }, + { + "Id": "m9", + "Progress": 2 + }, + { + "Id": "UZI", + "Progress": 154 + }, + { + "Id": "m1911", + "Progress": 14 + }, + { + "Id": "SKS", + "Progress": 26 + }, + { + "Id": "APS", + "Progress": 9 + }, + { + "Id": "SV98", + "Progress": 91 + }, + { + "Id": "STM-9", + "Progress": 116 + }, + { + "Id": "MP153", + "Progress": 500 + }, + { + "Id": "MP5", + "Progress": 220 + }, + { + "Id": "RSH12", + "Progress": 2 + }, + { + "Id": "r700", + "Progress": 55 + }, + { + "Id": "MDR", + "Progress": 39 + }, + { + "Id": "M4", + "Progress": 2946 + }, + { + "Id": "M870", + "Progress": 7 + }, + { + "Id": "MP-18", + "Progress": 3 + }, + { + "Id": "MR43", + "Progress": 82 + }, + { + "Id": "MTS", + "Progress": 3 + }, + { + "Id": "SA-58", + "Progress": 0 + }, + { + "Id": "SAIGA", + "Progress": 4 + }, + { + "Id": "SVT-40", + "Progress": 5 + }, + { + "Id": "TOZ106", + "Progress": 40 + }, + { + "Id": "UZI-PRO", + "Progress": 53 + }, + { + "Id": "MP9", + "Progress": 153 + }, + { + "Id": "M60", + "Progress": 1 + }, + { + "Id": 57, + "Progress": 1151 + }, + { + "Id": "M3S90", + "Progress": 78 + }, + { + "Id": "GLOCK17", + "Progress": 35 + }, + { + "Id": "UMP45", + "Progress": 13 + }, + { + "Id": "SVD", + "Progress": 164 + }, + { + "Id": "USP", + "Progress": 0 + }, + { + "Id": "VSS", + "Progress": 0 + }, + { + "Id": "MK47", + "Progress": 81 + }, + { + "Id": "AUG", + "Progress": 269 + }, + { + "Id": "SR25", + "Progress": 13 + }, + { + "Id": "DVL", + "Progress": 72 + }, + { + "Id": "G36", + "Progress": 189 + }, + { + "Id": "mp7", + "Progress": 190 + }, + { + "Id": "MPX", + "Progress": 9 + }, + { + "Id": "VECTOR", + "Progress": 253 + }, + { + "Id": "PM", + "Progress": 0 + }, + { + "Id": "R11SRASS", + "Progress": 2062 + }, + { + "Id": "M1A", + "Progress": 212 + }, + { + "Id": "T5000", + "Progress": 9 + }, + { + "Id": "ASH12", + "Progress": 3 + }, + { + "Id": "AXMC", + "Progress": 0 + }, + { + "Id": "SPEAR", + "Progress": 1484 + }, + { + "Id": "KS23", + "Progress": 16 + }, + { + "Id": "RFB", + "Progress": 5 + }, + { + "Id": "Mk17", + "Progress": 0 + }, + { + "Id": "MCX", + "Progress": 2 + }, + { + "Id": "G28", + "Progress": 24 + }, + { + "Id": "VSK94", + "Progress": 14 + }, + { + "Id": "P90", + "Progress": 68 + }, + { + "Id": "PB", + "Progress": 0 + } + ], + "Points": 0 + }, + "equipment": { + "Id": "66c5258bb984e098ff0c0d89", + "Items": [ + { + "_id": "66c5258bb984e098ff0c0d89", + "_tpl": "55d7217a4bdc2d86028b456d" + }, + { + "_id": "66d571bbcb9cb25c4401ac38", + "_tpl": "5c0126f40db834002a125382", + "parentId": "66c5258bb984e098ff0c0d89", + "slotId": "Scabbard", + "upd": { + "Repairable": { + "MaxDurability": 85, + "Durability": 85 + } + } + }, + { + "_id": "66c5258bb984e098ff0c0d79", + "_tpl": "665ee77ccf2d642e98220bca", + "parentId": "66c5258bb984e098ff0c0d89", + "slotId": "SecuredContainer" + }, + { + "_id": "66c5258bb984e098ff0c0d87", + "_tpl": "65e080be269cbd5c5005e529", + "parentId": "66c5258bb984e098ff0c0d89", + "slotId": "Pockets" + }, + { + "_id": "66ca610c30e9fe290d166c9d", + "_tpl": "60b0f988c4449e4cb624c1da", + "parentId": "66c5258bb984e098ff0c0d89", + "slotId": "ArmBand" + }, + { + "_id": "67021882235618134308b5ea", + "_tpl": "5839a40f24597726f856b511", + "parentId": "66c5258bb984e098ff0c0d89", + "slotId": "FirstPrimaryWeapon", + "upd": { + "Repairable": { + "MaxDurability": 98.35, + "Durability": 98.35 + }, + "Foldable": { + "Folded": false + }, + "FireMode": { + "FireMode": "fullauto" + } + } + }, + { + "_id": "670218b7779a814164035b80", + "_tpl": "628a664bccaab13006640e47", + "parentId": "67021882235618134308b5ea", + "slotId": "mod_pistol_grip" + }, + { + "_id": "670218b7779a814164035b7c", + "_tpl": "59ecc28286f7746d7a68aa8c", + "parentId": "67021882235618134308b5ea", + "slotId": "mod_stock" + }, + { + "_id": "670218b7779a814164035b84", + "_tpl": "59ecc3dd86f7746dc827481c", + "parentId": "670218b7779a814164035b7c", + "slotId": "mod_stock" + }, + { + "_id": "670218b7779a814164035b82", + "_tpl": "615d8f5dd92c473c770212ef", + "parentId": "67021882235618134308b5ea", + "slotId": "mod_muzzle" + }, + { + "_id": "670218c3eabf5832a3073a09", + "_tpl": "615d8f8567085e45ef1409ca", + "parentId": "670218b7779a814164035b82", + "slotId": "mod_muzzle" + }, + { + "_id": "670218b7779a814164035b7e", + "_tpl": "655cb6b5d680a544f30607fa", + "parentId": "67021882235618134308b5ea", + "slotId": "mod_reciever" + }, + { + "_id": "670218b7779a814164035b7d", + "_tpl": "57c69dd424597774c03b7bbc", + "parentId": "670218b7779a814164035b7e", + "slotId": "mod_scope" + }, + { + "_id": "670218b7779a814164035b86", + "_tpl": "618ba27d9008e4636a67f61d", + "parentId": "670218b7779a814164035b7d", + "slotId": "mod_scope", + "upd": { + "Sight": { + "ScopesCurrentCalibPointIndexes": [ + 0 + ], + "ScopesSelectedModes": [ + 0 + ], + "SelectedScope": 0, + "ScopeZoomValue": 0 + } + } + }, + { + "_id": "67021882235618134308b5f0", + "_tpl": "59d36a0086f7747e673f3946", + "parentId": "67021882235618134308b5ea", + "slotId": "mod_gas_block" + }, + { + "_id": "670218b7779a814164035b7f", + "_tpl": "57ffa9f4245977728561e844", + "parentId": "67021882235618134308b5f0", + "slotId": "mod_handguard" + }, + { + "_id": "670218b7779a814164035b83", + "_tpl": "56def37dd2720bec348b456a", + "parentId": "670218b7779a814164035b7f", + "slotId": "mod_tactical_000", + "upd": { + "Light": { + "IsActive": false, + "SelectedMode": 0 + } + } + }, + { + "_id": "66d85b3991e6584a2109979b", + "_tpl": "655df24fdf80b12750626d0a", + "parentId": "670218b7779a814164035b7f", + "slotId": "mod_foregrip" + }, + { + "_id": "67021ad40ae6022811000026", + "_tpl": "56dff061d2720bb5668b4567", + "parentId": "67021882235618134308b5ea", + "slotId": "patron_in_weapon" + }, + { + "_id": "66ec49ea5c1464b07f179627", + "_tpl": "55d482194bdc2d1d4e8b456b", + "parentId": "67021882235618134308b5ea", + "slotId": "mod_magazine", + "upd": { + "SpawnedInSession": true + } + }, + { + "_id": "67021126343452ec8e1754ba", + "_tpl": "628d0618d1ba6e4fa07ce5a4", + "parentId": "66c5258bb984e098ff0c0d89", + "slotId": "TacticalVest" + }, + { + "_id": "67021126343452ec8e1754d1", + "_tpl": "66b5f693acff495a294927e3", + "parentId": "66c5258bb984e098ff0c0d89", + "slotId": "Earpiece" + }, + { + "_id": "6707142cb27b7184b709d8a7", + "_tpl": "5ea17ca01412a1425304d1c0", + "parentId": "66c5258bb984e098ff0c0d89", + "slotId": "Headwear" + }, + { + "_id": "6707142cb27b7184b709d8a8", + "_tpl": "657f9a55c6679fefb3051e19", + "parentId": "6707142cb27b7184b709d8a7", + "slotId": "Helmet_top", + "upd": { + "Repairable": { + "MaxDurability": 24, + "Durability": 24 + } + } + }, + { + "_id": "6707142cb27b7184b709d8a9", + "_tpl": "657f9a94ada5fadd1f07a589", + "parentId": "6707142cb27b7184b709d8a7", + "slotId": "Helmet_back", + "upd": { + "Repairable": { + "MaxDurability": 24, + "Durability": 13.0961142 + } + } + }, + { + "_id": "6708542a965ad29a440526de", + "_tpl": "6570aead4d84f81fd002a033", + "parentId": "66c5258bb984e098ff0c0d89", + "slotId": "FaceCover", + "upd": { + "Repairable": { + "MaxDurability": 25.82, + "Durability": 20.284441 + } + } + } + ] + }, + "achievements": { + "65141c80ec10ff011f17cc3e": 1703730881, + "65141c30ec10ff011f17cc3b": 1703732083, + "65141e37cf2f1c285e606361": 1703829876, + "6527ee4a647c29201011defe": 1704094252, + "65141eb5c31fcb0e163577dd": 1704859020, + "65141b9859647d2cb3213ca2": 1705389868, + "6513eb6e0dc723592b0f9095": 1710020468, + "65141bdfcf2f1c285e606446": 1711400988, + "6512eb3ddfb0ae1ee75a0376": 1711937243, + "6513ee11a3dd9b6aa7159b4a": 1713135936, + "6513ed89cf2f1c285e606068": 1713558961, + "6513f0a10dc723592b0f90cf": 1713589806, + "65141cd2cf2f1c285e606449": 1713683143, + "651419eea3dd9b6aa7159ee5": 1713695800, + "664f23e44702fd5db50ee732": 1719642403, + "65141dd6303df252af1c72c9": 1720414128, + "6513efa1b49e3253755f47eb": 1723255424, + "66c328aca91e7d66fa1b0b7b": 1724873275, + "66c328de9dc78468f4040f35": 1724975933, + "66e2a7e5919bad697104f4b3": 1727388061 + }, + "favoriteItems": [ + { + "_id": "66d7b0ad620434ea3f0328e3", + "_tpl": "66572c82ad599021091c6118", + "upd": { + "SpawnedInSession": true, + "Resource": { + "Value": 0 + } + } + }, + { + "_id": "66d80c55e8dbb9ae1e1b0e08", + "_tpl": "655c669103999d3c810c025b", + "upd": { + "SpawnedInSession": true, + "Resource": { + "Value": 0 + } + } + }, + { + "_id": "66d65d6daef97674da0683f9", + "_tpl": "6662e9aca7e0b43baa3d5f74", + "upd": { + "SpawnedInSession": true, + "Resource": { + "Value": 0 + }, + "Dogtag": { + "AccountId": "6486079", + "ProfileId": "606f498321c1e07e342c3fb4", + "Nickname": "5368", + "Side": "Bear", + "Level": 21, + "Time": "2024-09-03T04:03:27.115+03:00", + "Status": "Killed by", + "KillerAccountId": "4119078", + "KillerProfileId": "5e6753e2ffb883068432ebe3", + "KillerName": "stankrat", + "WeaponName": "62e14904c2699c0ec93adc47 ShortName", + "CarriedByGroupMember": false + } + } + }, + { + "_id": "66deacca9be0fe92ea154895", + "_tpl": "6662e9aca7e0b43baa3d5f74", + "upd": { + "SpawnedInSession": true, + "Resource": { + "Value": 0 + }, + "Dogtag": { + "AccountId": "250", + "ProfileId": "5e6fb819a3bd294ce20cf5e9", + "Nickname": "Senpai_MooD", + "Side": "Bear", + "Level": 43, + "Time": "2024-09-09T11:14:22.371+03:00", + "Status": "Killed by", + "KillerAccountId": "10751489", + "KillerProfileId": "64d026b7990f3e82d6067393", + "KillerName": "LACKVILL", + "WeaponName": "5df8ce05b11454561e39243b ShortName", + "CarriedByGroupMember": false + } + } + }, + { + "_id": "66deacea02f11590080e0759", + "_tpl": "6662e9cda7e0b43baa3d5f76", + "upd": { + "SpawnedInSession": true, + "Resource": { + "Value": 0 + }, + "Dogtag": { + "AccountId": "11100673", + "ProfileId": "652a7644c3bace77520649e6", + "Nickname": "iip", + "Side": "Bear", + "Level": 52, + "Time": "2024-09-09T11:13:05.873+03:00", + "Status": "Killed by", + "KillerAccountId": "4119078", + "KillerProfileId": "5e6753e2ffb883068432ebe3", + "KillerName": "stankrat", + "WeaponName": "5e00903ae9dc277128008b87 ShortName", + "CarriedByGroupMember": false + } + } + }, + { + "_id": "66dd875de017bc70620cc40d", + "_tpl": "5d235a5986f77443f6329bc6", + "upd": { + "SpawnedInSession": true, + "StackObjectsCount": 1 + } + }, + { + "_id": "66dd875de017bc70620cc40e", + "_tpl": "5d235a5986f77443f6329bc6", + "upd": { + "SpawnedInSession": true, + "StackObjectsCount": 1 + } + } + ], + "pmcStats": { + "eft": { + "totalInGameTime": 14782357, + "overAllCounters": { + "Items": [ + { + "Key": [ + "Sessions", + "Pmc" + ], + "Value": 541 + }, + { + "Key": [ + "ExitStatus", + "Killed", + "Pmc" + ], + "Value": 243 + }, + { + "Key": [ + "Kills" + ], + "Value": 1255 + }, + { + "Key": [ + "Deaths" + ], + "Value": 247 + }, + { + "Key": [ + "ExitStatus", + "Survived", + "Pmc" + ], + "Value": 266 + }, + { + "Key": [ + "LongestWinStreak", + "Pmc" + ], + "Value": 12 + }, + { + "Key": [ + "ExitStatus", + "Left", + "Pmc" + ], + "Value": 4 + }, + { + "Key": [ + "ExitStatus", + "Runner", + "Pmc" + ], + "Value": 9 + }, + { + "Key": [ + "ExitStatus", + "Transit", + "Pmc" + ], + "Value": 17 + }, + { + "Key": [ + "ExitStatus", + "MissingInAction", + "Pmc" + ], + "Value": 2 + } + ] + } + } + }, + "scavStats": { + "eft": { + "totalInGameTime": 14782357, + "overAllCounters": { + "Items": [ + { + "Key": [ + "Sessions", + "Scav" + ], + "Value": 214 + }, + { + "Key": [ + "ExitStatus", + "Survived", + "Scav" + ], + "Value": 143 + }, + { + "Key": [ + "Kills" + ], + "Value": 121 + }, + { + "Key": [ + "Deaths" + ], + "Value": 69 + }, + { + "Key": [ + "LongestWinStreak", + "Scav" + ], + "Value": 13 + }, + { + "Key": [ + "ExitStatus", + "Left", + "Scav" + ], + "Value": 2 + }, + { + "Key": [ + "ExitStatus", + "Killed", + "Scav" + ], + "Value": 67 + }, + { + "Key": [ + "ExitStatus", + "MissingInAction", + "Scav" + ], + "Value": 2 + } + ] + } + } + }, + "updated": 1729994217951 +} \ No newline at end of file From 4692efdd3237e93ccab0200216d2962178a89bc5 Mon Sep 17 00:00:00 2001 From: applefrittr Date: Sat, 26 Oct 2024 23:14:01 -0400 Subject: [PATCH 9/9] comment cleanup from issue #1000 first round --- src/components/item-image/index.js | 1 - src/pages/player/index.js | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/item-image/index.js b/src/components/item-image/index.js index 566467f6..69318fac 100644 --- a/src/components/item-image/index.js +++ b/src/components/item-image/index.js @@ -246,7 +246,6 @@ function ItemImage({ if (imageField === 'image8xLink') { sizeFactor = 8; } - //--------- add another if statement for inspectImageLink ------------ if (imageField === 'inspectImageLink') { const loadOutImgStyle = { maxHeight: `${175 / scaler}px`, diff --git a/src/pages/player/index.js b/src/pages/player/index.js index e939722b..d634bd36 100644 --- a/src/pages/player/index.js +++ b/src/pages/player/index.js @@ -707,7 +707,7 @@ function Player() { ...item, width: preset.width, height: preset.height, - inspectImageLink: preset.inspectImageLink, // issue #1000 orginal = baseImageLink + inspectImageLink: preset.inspectImageLink, }; } let countLabel; @@ -837,7 +837,7 @@ function Player() { let itemImage = undefined; let itemLabel = ''; let contents = []; - let itemDisplay = getItemDisplay(loadoutItem); // <--------------------- This is where item img is retrieved, dimensions set + let itemDisplay = getItemDisplay(loadoutItem); if (itemDisplay) { itemImage = itemDisplay.image; } else {