Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
Fixing undefined replacements and the prerequisite crashing
Browse files Browse the repository at this point in the history
  • Loading branch information
Dudás Bálint committed Oct 6, 2023
1 parent 2ea350b commit e091f6f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "payday-3-challenge-viewer",
"version": "1.1.4",
"version": "1.1.5",
"description": "Challenge viewer for Payday 3",
"main": "./out/main/index.js",
"author": "Elmoren",
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/src/components/challengeCard.components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ export default function ChallengeCard({
}

const sanitizedChallengeData: sanitizedChallengeData = $$(challenge.challenge.challengeId, language)
const challengeName = (sanitizedChallengeData.internalName !== "" ? sanitizedChallengeData.title : challenge.challenge.name).toUpperCase();
const challengeDesc = sanitizedChallengeData.internalName !== "" ? sanitizedChallengeData.desc : challenge.challenge.description;
const challengeName = ((sanitizedChallengeData.internalName !== "" && sanitizedChallengeData.title !== "undefined") ? sanitizedChallengeData.title : challenge.challenge.name).toUpperCase();
const challengeDesc = (sanitizedChallengeData.internalName !== "" && sanitizedChallengeData.desc !== "undefined") ? sanitizedChallengeData.desc : challenge.challenge.description;

let borderColor
switch (challenge.status) {
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/src/components/challenges.components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ export default function Challenges({ onLogout }) {
useEffect(() => {
const newFilteredChallenges = challenges.filter((ch) => {
const sanitizedChallengeData: sanitizedChallengeData = $$(ch.challenge.challengeId, language)
const name = (sanitizedChallengeData.internalName !== "" ? sanitizedChallengeData.title : ch.challenge.name).toLowerCase();
const name = ((sanitizedChallengeData.internalName !== "" && sanitizedChallengeData.title !== "undefined") ? sanitizedChallengeData.title : ch.challenge.name).toLowerCase();


//In case you want to reapply searching in descriptions also.
//const description = ((internalizedChallenge && internalizedChallenge.game && internalizedChallenge.game.desc) ? internalizedChallenge.game.desc : ch.challenge.description).toLowerCase()
Expand Down
6 changes: 4 additions & 2 deletions src/renderer/src/components/stringReplacer.components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ export const $$ = (resourceKey: StringResourceKey, language: string): sanitizedC
}
else return { internalName: "", title: "", desc: ""};

let languageData = resource[language];

let sanitizedValues: sanitizedChallengeData = {
internalName: resource["internalName"],
title: resource[language].title,
desc: resource[language].desc,
title: (languageData && languageData.title && languageData.title !== undefined) ? languageData.title : "undefined",
desc: (languageData && languageData.desc && languageData.desc !== undefined) ? languageData.desc : "undefined",
}

return sanitizedValues;
Expand Down

0 comments on commit e091f6f

Please sign in to comment.