Skip to content

Commit 80c14a4

Browse files
committed
Remove console.log statements and update debug logging
Eliminated unnecessary console.log statements from multiple components and utility files to clean up console output. Updated some log statements to use console.debug for improved log level consistency. Also fixed import path for utility functions in useLoadSaveFile hook and improved farmhand data structure handling.
1 parent 71cbdc5 commit 80c14a4

5 files changed

Lines changed: 16 additions & 17 deletions

File tree

src/Components/AchieveTabs/Crops/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import type { cropsShippedType } from 'types/displayDataTypes';
33

44

55
const Crops= ({poly_crops, mono_extras, achievements} : cropsShippedType) => {
6-
console.log(achievements)
76
return (
87
<div className="progress-container">
98
<br />

src/Components/Achievements/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ const Achievements = ({
4848
{img: TabQuests, alt: "Quests"},
4949
{img: TabGrandpa, alt: "Grandpa's evaluation"}
5050
];
51-
console.log("Achievements:", fishCaught);
52-
console.log("Professions in Achievements:", professions);
51+
5352
return (
5453
<div className="file-container">
5554
<img className="star" alt="star" src={Star}></img>

src/Utility/Parsers/parseCropItems.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ export const GetCropsAchievements = (allShipped: itemsType[]) : cropsShippedType
6161
`You have shipped at least 300 of ${maxMono.name}` :
6262
`You have shipped ${maxMono.shipped} out of 300 required for ${maxMono.name}, your most shipped crop`;
6363
}
64-
console.log('CropsAchievements', CropsAchievements);
6564
return {
6665
achievements: CropsAchievements,
6766
poly_crops,

src/Utility/index.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ const parseData = ({
106106
availableSpecialRequests
107107
}: getParsedUserDataType) : fullPlayerDataType => {
108108
//Not finished
109-
console.log("Parsing data for:", playerData)
110109
let fullPlayerData : fullPlayerDataType = {
111110
playerName: playerData.name || "Unknown",
112111
farmName: playerData.farmName, //TODO: Remove and make global if even needed
@@ -136,8 +135,8 @@ const parseData = ({
136135
: []
137136
}
138137

139-
console.log(`%c Grandpa's eval for ${playerData.name}`, 'color: #7289DA')
140-
console.log("Player Data", fullPlayerData)
138+
console.debug(`%c Grandpa's eval for ${playerData.name}`, 'color: #7289DA')
139+
console.debug("Player Data", fullPlayerData)
141140
return fullPlayerData;
142141
}
143142

@@ -170,7 +169,7 @@ const GetProfessionData = (professions: number[]): professionsType[] =>{
170169
}
171170
});
172171
}
173-
console.log('Profession Data:', data);
172+
console.debug('Profession Data:', data);
174173
return data;
175174
}
176175

src/hooks/useLoadSaveFile.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useCallback, useEffect, useState } from 'react';
22
import { XMLParser } from 'fast-xml-parser';
3-
import { GetDetailedInfo, GetFarmHands } from '@utility/Utility';
3+
import { GetDetailedInfo, GetFarmHands } from '@utility/index';
44
import type {
55
gameLocationType,
66
itemsType,
@@ -65,16 +65,22 @@ const useLoadSaveFile = (): UseLoadSaveFileResult => {
6565
let player = fileData.SaveGame.player;
6666
let farmHands: playerType[] = [];
6767
const gameVersion = fileData.SaveGame.gameVersion;
68-
const [major, minor] = gameVersion.split('.').map(Number);
69-
if (major && minor && (major < 1 || (major >= 1 && minor < 5))) {
68+
console.debug("Current game version:", gameVersion);
69+
const [major, minor, patch] = gameVersion.split('.').map(Number);
70+
if (major && minor && (major >= 1 && minor >= 5 )) {
71+
console.debug("Using New farmhand data structure");
7072
farmHands = GetFarmHands(fileData.SaveGame.locations.GameLocation);
7173
} else {
74+
console.debug("Farmhands data:", fileData.SaveGame.farmhands);
7275
if(Array.isArray(fileData.SaveGame.farmhands)){
7376
farmHands = [...fileData.SaveGame.farmhands.Farmers];
74-
} else {
75-
console.log("Legacy single farmhand detected")
76-
console.log(fileData.SaveGame.farmhands)
77+
} else if (fileData.SaveGame.farmhands && fileData.SaveGame.farmhands.Farmer) {
78+
console.debug("Legacy single farmhand detected")
79+
console.debug(fileData.SaveGame.farmhands)
7780
farmHands = [fileData.SaveGame.farmhands.Farmer];
81+
} else {
82+
console.debug("Using legacy farmhands data structure ???");
83+
farmHands = GetFarmHands(fileData.SaveGame.locations.GameLocation);
7884
}
7985
}
8086
let museumLocation: gameLocationType | undefined =
@@ -103,7 +109,6 @@ const useLoadSaveFile = (): UseLoadSaveFileResult => {
103109
})
104110
}
105111

106-
console.log("Players:", players)
107112
setPlayerData(players)
108113
}, [fileData])
109114

@@ -112,8 +117,6 @@ const useLoadSaveFile = (): UseLoadSaveFileResult => {
112117
if(collection.museumPieces.item && collection.museumPieces.item !== undefined && collection.museumPieces.item.length > 0){
113118
museumPieces = [...collection.museumPieces.item]
114119
}
115-
// console.log(museumPieces)
116-
117120
return (museumPieces.length > 0) ? [...museumPieces] : []
118121
}
119122

0 commit comments

Comments
 (0)