Fix Achievements (shut up harmony)

This commit is contained in:
MyNameIsBatman 2021-09-19 17:56:46 -03:00
parent 9e3dcc2271
commit e0b7acd368
2 changed files with 6 additions and 4 deletions

View File

@ -43,13 +43,15 @@ export const AchievementsReducer: Reducer<IAchievementsState, IAchievementsActio
const categories = (action.payload.categories || state.categories || null); const categories = (action.payload.categories || state.categories || null);
let selectedCategoryName = null; let selectedCategoryName = null;
let selectedAchievementId = null;
if(categories.length > 0) if(categories.length > 0)
{ {
selectedCategoryName = categories[0].name; selectedCategoryName = categories[0].name;
selectedAchievementId = categories[0].achievements[0].achievementId;
} }
return { ...state, categories, selectedCategoryName }; return { ...state, categories, selectedCategoryName, selectedAchievementId };
} }
case AchievementsActions.SET_SCORE: { case AchievementsActions.SET_SCORE: {
const score = (action.payload.score || state.score || null); const score = (action.payload.score || state.score || null);

View File

@ -58,7 +58,7 @@ export const AchievementCategoryView: FC<AchievementCategoryViewProps> = props =
<h5 className="m-0 me-2 w-100">{ LocalizeText('quests.' + selectedCategoryName + '.name') }</h5> <h5 className="m-0 me-2 w-100">{ LocalizeText('quests.' + selectedCategoryName + '.name') }</h5>
<div>IMAGE</div> <div>IMAGE</div>
</div> </div>
<div className="bg-secondary rounded p-2 mb-3 d-flex gap-2 align-items-center"> { selectedAchievement && <div className="bg-secondary rounded p-2 mb-3 d-flex gap-2 align-items-center">
<div className="achievement-image"> <div className="achievement-image">
<BadgeImageView badgeCode={ getAchievementImage(selectedAchievement) } /> <BadgeImageView badgeCode={ getAchievementImage(selectedAchievement) } />
</div> </div>
@ -66,7 +66,7 @@ export const AchievementCategoryView: FC<AchievementCategoryViewProps> = props =
<div>{ LocalizeBadgeName(selectedAchievement.badgeId) }</div> <div>{ LocalizeBadgeName(selectedAchievement.badgeId) }</div>
<div>{ LocalizeBadgeDescription(selectedAchievement.badgeId) }</div> <div>{ LocalizeBadgeDescription(selectedAchievement.badgeId) }</div>
</div> </div>
</div> </div> }
<div className="achievements"> <div className="achievements">
<div className="row row-cols-4"> <div className="row row-cols-4">
{ getSelectedCategory().achievements.map((achievement, index) => { getSelectedCategory().achievements.map((achievement, index) =>