From d1a7badeba51af5a708b94583dd93a30422792de Mon Sep 17 00:00:00 2001 From: Bill Date: Wed, 23 Mar 2022 03:05:44 -0400 Subject: [PATCH] Update achievements --- src/App.scss | 2 +- .../achievements}/AchievementCategory.ts | 0 .../achievements/GetAchievementBadgeCode.ts | 13 ++ .../achievements/GetAchievementHasStarted.ts | 10 + .../achievements/GetAchievementIsIgnored.ts | 15 ++ .../achievements}/GetAchievementLevel.ts | 0 src/api/achievements/index.ts | 5 + src/api/index.ts | 1 + .../achievements/AchievementsView.tsx | 182 +++++++++--------- .../common/AchievementUtilities.ts | 38 ---- .../common/GetScaledProgressPercent.ts | 8 - .../views/AchievementBadgeView.tsx | 19 ++ .../AchievementCategoryView.tsx | 10 +- .../AchievementDetailsView.tsx | 24 +-- .../AchievementBadgeView.tsx | 21 -- .../AchievementListItemView.tsx | 6 +- .../achievement-list/AchievementListView.tsx | 2 +- .../AchievementsCategoryListItemView.tsx | 7 +- .../AchievementsCategoryListView.tsx | 4 +- src/components/toolbar/ToolbarView.tsx | 4 +- 20 files changed, 182 insertions(+), 189 deletions(-) rename src/{components/achievements/common => api/achievements}/AchievementCategory.ts (100%) create mode 100644 src/api/achievements/GetAchievementBadgeCode.ts create mode 100644 src/api/achievements/GetAchievementHasStarted.ts create mode 100644 src/api/achievements/GetAchievementIsIgnored.ts rename src/{components/achievements/common => api/achievements}/GetAchievementLevel.ts (100%) create mode 100644 src/api/achievements/index.ts delete mode 100644 src/components/achievements/common/AchievementUtilities.ts delete mode 100644 src/components/achievements/common/GetScaledProgressPercent.ts create mode 100644 src/components/achievements/views/AchievementBadgeView.tsx rename src/components/achievements/views/{category => }/AchievementCategoryView.tsx (83%) rename src/components/achievements/views/{achievement-details => }/AchievementDetailsView.tsx (59%) delete mode 100644 src/components/achievements/views/achievement-badge/AchievementBadgeView.tsx diff --git a/src/App.scss b/src/App.scss index b73ed915..2057754a 100644 --- a/src/App.scss +++ b/src/App.scss @@ -19,7 +19,7 @@ $grid-active-border-color: $white; $toolbar-height: 55px; $achievement-width: 375px; -$achievement-height: 425px; +$achievement-height: 415px; $avatar-editor-width: 620px; $avatar-editor-height: 374px; diff --git a/src/components/achievements/common/AchievementCategory.ts b/src/api/achievements/AchievementCategory.ts similarity index 100% rename from src/components/achievements/common/AchievementCategory.ts rename to src/api/achievements/AchievementCategory.ts diff --git a/src/api/achievements/GetAchievementBadgeCode.ts b/src/api/achievements/GetAchievementBadgeCode.ts new file mode 100644 index 00000000..a9da2c88 --- /dev/null +++ b/src/api/achievements/GetAchievementBadgeCode.ts @@ -0,0 +1,13 @@ +import { AchievementData } from '@nitrots/nitro-renderer'; +import { GetLocalization } from '..'; + +export const GetAchievementBadgeCode = (achievement: AchievementData) => +{ + if(!achievement) return null; + + let badgeId = achievement.badgeId; + + if(!achievement.finalLevel) badgeId = GetLocalization().getPreviousLevelBadgeId(badgeId); + + return badgeId; +} diff --git a/src/api/achievements/GetAchievementHasStarted.ts b/src/api/achievements/GetAchievementHasStarted.ts new file mode 100644 index 00000000..c97d2fb8 --- /dev/null +++ b/src/api/achievements/GetAchievementHasStarted.ts @@ -0,0 +1,10 @@ +import { AchievementData } from '@nitrots/nitro-renderer'; + +export const GetAchievementHasStarted = (achievement: AchievementData) => +{ + if(!achievement) return false; + + if(achievement.finalLevel || ((achievement.level - 1) > 0)) return true; + + return false; +} diff --git a/src/api/achievements/GetAchievementIsIgnored.ts b/src/api/achievements/GetAchievementIsIgnored.ts new file mode 100644 index 00000000..3f03501a --- /dev/null +++ b/src/api/achievements/GetAchievementIsIgnored.ts @@ -0,0 +1,15 @@ +import { AchievementData } from '@nitrots/nitro-renderer'; +import { GetConfiguration } from '..'; + +export const GetAchievementIsIgnored = (achievement: AchievementData) => +{ + if(!achievement) return false; + + const ignored = GetConfiguration('achievements.unseen.ignored'); + const value = achievement.badgeId.replace(/[0-9]/g, ''); + const index = ignored.indexOf(value); + + if(index >= 0) return true; + + return false; +} diff --git a/src/components/achievements/common/GetAchievementLevel.ts b/src/api/achievements/GetAchievementLevel.ts similarity index 100% rename from src/components/achievements/common/GetAchievementLevel.ts rename to src/api/achievements/GetAchievementLevel.ts diff --git a/src/api/achievements/index.ts b/src/api/achievements/index.ts new file mode 100644 index 00000000..a15b38cf --- /dev/null +++ b/src/api/achievements/index.ts @@ -0,0 +1,5 @@ +export * from './AchievementCategory'; +export * from './GetAchievementBadgeCode'; +export * from './GetAchievementHasStarted'; +export * from './GetAchievementIsIgnored'; +export * from './GetAchievementLevel'; diff --git a/src/api/index.ts b/src/api/index.ts index 7c98b2c5..cba6bb8c 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,3 +1,4 @@ +export * from './achievements'; export * from './common'; export * from './core'; export * from './friends'; diff --git a/src/components/achievements/AchievementsView.tsx b/src/components/achievements/AchievementsView.tsx index 08521fb5..7dcebf76 100644 --- a/src/components/achievements/AchievementsView.tsx +++ b/src/components/achievements/AchievementsView.tsx @@ -1,13 +1,11 @@ -import { AchievementData, AchievementEvent, AchievementsEvent, AchievementsScoreEvent, RequestAchievementsMessageComposer } from '@nitrots/nitro-renderer'; +import { AchievementData, AchievementEvent, AchievementsEvent, AchievementsScoreEvent, ILinkEventTracker, RequestAchievementsMessageComposer } from '@nitrots/nitro-renderer'; import { FC, useCallback, useEffect, useMemo, useState } from 'react'; -import { GetConfiguration, LocalizeText, SendMessageComposer } from '../../api'; -import { Base, Column, Flex, NitroCardContentView, NitroCardHeaderView, NitroCardSubHeaderView, NitroCardView, Text } from '../../common'; -import { AchievementsUIEvent, AchievementsUIUnseenCountEvent } from '../../events'; -import { BatchUpdates, DispatchUiEvent, UseMessageEventHook, UseUiEvent } from '../../hooks'; -import { AchievementCategory } from './common/AchievementCategory'; -import { AchievementUtilities } from './common/AchievementUtilities'; +import { AchievementCategory, AddEventLinkTracker, GetAchievementIsIgnored, LocalizeText, RemoveLinkEventTracker, SendMessageComposer } from '../../api'; +import { Base, Column, LayoutProgressBar, NitroCardContentView, NitroCardHeaderView, NitroCardSubHeaderView, NitroCardView, Text } from '../../common'; +import { AchievementsUIUnseenCountEvent } from '../../events'; +import { BatchUpdates, DispatchUiEvent, UseMessageEventHook } from '../../hooks'; +import { AchievementCategoryView } from './views/AchievementCategoryView'; import { AchievementsCategoryListView } from './views/category-list/AchievementsCategoryListView'; -import { AchievementCategoryView } from './views/category/AchievementCategoryView'; export const AchievementsView: FC<{}> = props => { @@ -17,72 +15,56 @@ export const AchievementsView: FC<{}> = props => const [ selectedCategoryCode, setSelectedCategoryCode ] = useState(null); const [ achievementScore, setAchievementScore ] = useState(0); - const onAchievementsUIEvent = useCallback((event: AchievementsUIEvent) => - { - switch(event.type) - { - case AchievementsUIEvent.SHOW_ACHIEVEMENTS: - setIsVisible(true); - return; - case AchievementsUIEvent.HIDE_ACHIEVEMENTS: - setIsVisible(false); - return; - case AchievementsUIEvent.TOGGLE_ACHIEVEMENTS: - setIsVisible(value => !value); - return; - } - }, []); - - UseUiEvent(AchievementsUIEvent.SHOW_ACHIEVEMENTS, onAchievementsUIEvent); - UseUiEvent(AchievementsUIEvent.HIDE_ACHIEVEMENTS, onAchievementsUIEvent); - UseUiEvent(AchievementsUIEvent.TOGGLE_ACHIEVEMENTS, onAchievementsUIEvent); - const onAchievementEvent = useCallback((event: AchievementEvent) => { const parser = event.getParser(); const achievement = parser.achievement; - const newCategories = [ ...achievementCategories ]; const categoryName = achievement.category; - const categoryIndex = newCategories.findIndex(existing => (existing.code === categoryName)); - if(categoryIndex === -1) - { - const category = new AchievementCategory(categoryName); - - category.achievements.push(achievement); - - newCategories.push(category); - } - else - { - const category = newCategories[categoryIndex]; - const newAchievements = [ ...category.achievements ]; - const achievementIndex = newAchievements.findIndex(existing => (existing.achievementId === achievement.achievementId)); - let previousAchievement: AchievementData = null; - - if(achievementIndex === -1) + setAchievementCategories(prevValue => { - newAchievements.push(achievement); - } - else - { - previousAchievement = newAchievements[achievementIndex]; + const newValue = [ ...prevValue ]; + const categoryIndex = newValue.findIndex(existing => (existing.code === categoryName)); - newAchievements[achievementIndex] = achievement; - } + if(categoryIndex === -1) + { + const category = new AchievementCategory(categoryName); - if(!AchievementUtilities.isIgnoredAchievement(achievement)) - { - achievement.unseen++; + category.achievements.push(achievement); - if(previousAchievement) achievement.unseen += previousAchievement.unseen; - } + newValue.push(category); + } + else + { + const category = newValue[categoryIndex]; + const newAchievements = [ ...category.achievements ]; + const achievementIndex = newAchievements.findIndex(existing => (existing.achievementId === achievement.achievementId)); + let previousAchievement: AchievementData = null; - category.achievements = newAchievements; - } + if(achievementIndex === -1) + { + newAchievements.push(achievement); + } + else + { + previousAchievement = newAchievements[achievementIndex]; - setAchievementCategories(newCategories); - }, [ achievementCategories ]); + newAchievements[achievementIndex] = achievement; + } + + if(!GetAchievementIsIgnored(achievement)) + { + achievement.unseen++; + + if(previousAchievement) achievement.unseen += previousAchievement.unseen; + } + + category.achievements = newAchievements; + } + + return newValue; + }); + }, []); UseMessageEventHook(AchievementEvent, onAchievementEvent); @@ -95,6 +77,7 @@ export const AchievementsView: FC<{}> = props => for(const achievement of parser.achievements) { const categoryName = achievement.category; + let existing = categories.find(category => (category.code === categoryName)); if(!existing) @@ -167,33 +150,59 @@ export const AchievementsView: FC<{}> = props => return achievementCategories.find(existing => (existing.code === selectedCategoryCode)); }, [ achievementCategories, selectedCategoryCode ]); - const getCategoryIcon = useMemo(() => - { - if(!getSelectedCategory) return null; - - const imageUrl = GetConfiguration('achievements.images.url'); - - return imageUrl.replace('%image%', `achicon_${ getSelectedCategory.code }`); - }, [ getSelectedCategory ]); - const setAchievementSeen = useCallback((code: string, achievementId: number) => { - const newCategories = [ ...achievementCategories ]; - - for(const category of newCategories) - { - if(category.code !== code) continue; - - for(const achievement of category.achievements) + setAchievementCategories(prevValue => { - if(achievement.achievementId !== achievementId) continue; + const newValue = [ ...prevValue ]; - achievement.unseen = 0; - } + for(const category of newValue) + { + if(category.code !== code) continue; + + for(const achievement of category.achievements) + { + if(achievement.achievementId !== achievementId) continue; + + achievement.unseen = 0; + } + } + + return newValue; + }); + }, []); + + const linkReceived = useCallback((url: string) => + { + const parts = url.split('/'); + + if(parts.length < 2) return; + + switch(parts[1]) + { + case 'show': + setIsVisible(true); + return; + case 'hide': + setIsVisible(false); + return; + case 'toggle': + setIsVisible(prevValue => !prevValue); + return; } + }, []); - setAchievementCategories(newCategories); - }, [ achievementCategories ]); + useEffect(() => + { + const linkTracker: ILinkEventTracker = { + linkReceived, + eventUrlPrefix: 'achievements/' + }; + + AddEventLinkTracker(linkTracker); + + return () => RemoveLinkEventTracker(linkTracker); + }, [ linkReceived ]); useEffect(() => { @@ -220,15 +229,12 @@ export const AchievementsView: FC<{}> = props => { LocalizeText('achievements.details.categoryprogress', [ 'progress', 'limit' ], [ getSelectedCategory.getProgress().toString(), getSelectedCategory.getMaxProgress().toString() ]) } } - + { !getSelectedCategory && <> - - { LocalizeText('achievements.categories.totalprogress', [ 'progress', 'limit' ], [ getProgress.toString(), getMaxProgress.toString() ]) } - - + { LocalizeText('achievements.categories.score', [ 'score' ], [ achievementScore.toString() ]) } } diff --git a/src/components/achievements/common/AchievementUtilities.ts b/src/components/achievements/common/AchievementUtilities.ts deleted file mode 100644 index f6c18ac3..00000000 --- a/src/components/achievements/common/AchievementUtilities.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { AchievementData } from '@nitrots/nitro-renderer'; -import { GetConfiguration, GetLocalization } from '../../../api'; - -export class AchievementUtilities -{ - public static hasStarted(achievement: AchievementData): boolean - { - if(!achievement) return false; - - if(achievement.finalLevel || ((achievement.level - 1) > 0)) return true; - - return false; - } - - public static getBadgeCode(achievement: AchievementData): string - { - if(!achievement) return null; - - let badgeId = achievement.badgeId; - - if(!achievement.finalLevel) badgeId = GetLocalization().getPreviousLevelBadgeId(badgeId); - - return badgeId; - } - - public static isIgnoredAchievement(achievement: AchievementData): boolean - { - if(!achievement) return false; - - const ignored = GetConfiguration('achievements.unseen.ignored'); - const value = achievement.badgeId.replace(/[0-9]/g, ''); - const index = ignored.indexOf(value); - - if(index >= 0) return true; - - return false; - } -} diff --git a/src/components/achievements/common/GetScaledProgressPercent.ts b/src/components/achievements/common/GetScaledProgressPercent.ts deleted file mode 100644 index 8708a709..00000000 --- a/src/components/achievements/common/GetScaledProgressPercent.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { AchievementData } from '@nitrots/nitro-renderer'; - -export const GetScaledProgressPercent = (achievement: AchievementData) => -{ - if(!achievement) return 0; - - return ~~(((((achievement.currentPoints + achievement.scoreAtStartOfLevel) - 0) * (100 - 0)) / ((achievement.scoreLimit + achievement.scoreAtStartOfLevel) - 0)) + 0); -} diff --git a/src/components/achievements/views/AchievementBadgeView.tsx b/src/components/achievements/views/AchievementBadgeView.tsx new file mode 100644 index 00000000..ef79819a --- /dev/null +++ b/src/components/achievements/views/AchievementBadgeView.tsx @@ -0,0 +1,19 @@ +import { AchievementData } from '@nitrots/nitro-renderer'; +import { FC } from 'react'; +import { GetAchievementBadgeCode, GetAchievementHasStarted } from '../../../api'; +import { BaseProps, LayoutBadgeImageView } from '../../../common'; + +interface AchievementBadgeViewProps extends BaseProps +{ + achievement: AchievementData; + scale?: number; +} + +export const AchievementBadgeView: FC = props => +{ + const { achievement = null, scale = 1, ...rest } = props; + + if(!achievement) return null; + + return ; +} diff --git a/src/components/achievements/views/category/AchievementCategoryView.tsx b/src/components/achievements/views/AchievementCategoryView.tsx similarity index 83% rename from src/components/achievements/views/category/AchievementCategoryView.tsx rename to src/components/achievements/views/AchievementCategoryView.tsx index 5f535d2c..b493d55e 100644 --- a/src/components/achievements/views/category/AchievementCategoryView.tsx +++ b/src/components/achievements/views/AchievementCategoryView.tsx @@ -1,10 +1,10 @@ import { FC, useEffect, useMemo, useState } from 'react'; -import { Column } from '../../../../common/Column'; -import { AchievementCategory } from '../../common/AchievementCategory'; -import { AchievementDetailsView } from '../achievement-details/AchievementDetailsView'; -import { AchievementListView } from '../achievement-list/AchievementListView'; +import { AchievementCategory } from '../../../api'; +import { Column } from '../../../common'; +import { AchievementListView } from './achievement-list/AchievementListView'; +import { AchievementDetailsView } from './AchievementDetailsView'; -export class AchievementCategoryViewProps +interface AchievementCategoryViewProps { category: AchievementCategory; setAchievementSeen: (code: string, achievementId: number) => void; diff --git a/src/components/achievements/views/achievement-details/AchievementDetailsView.tsx b/src/components/achievements/views/AchievementDetailsView.tsx similarity index 59% rename from src/components/achievements/views/achievement-details/AchievementDetailsView.tsx rename to src/components/achievements/views/AchievementDetailsView.tsx index 6687214d..18bfc631 100644 --- a/src/components/achievements/views/achievement-details/AchievementDetailsView.tsx +++ b/src/components/achievements/views/AchievementDetailsView.tsx @@ -1,13 +1,11 @@ import { AchievementData } from '@nitrots/nitro-renderer'; import { FC } from 'react'; -import { LocalizeBadgeDescription, LocalizeBadgeName, LocalizeText } from '../../../../api'; -import { Base, Column, Flex, LayoutCurrencyIcon, Text } from '../../../../common'; -import { AchievementUtilities } from '../../common/AchievementUtilities'; -import { GetAchievementLevel } from '../../common/GetAchievementLevel'; -import { GetScaledProgressPercent } from '../../common/GetScaledProgressPercent'; -import { AchievementBadgeView } from '../achievement-badge/AchievementBadgeView'; +import { GetAchievementBadgeCode, LocalizeBadgeDescription, LocalizeBadgeName, LocalizeText } from '../../../api'; +import { GetAchievementLevel } from '../../../api/achievements/GetAchievementLevel'; +import { Column, Flex, LayoutCurrencyIcon, LayoutProgressBar, Text } from '../../../common'; +import { AchievementBadgeView } from './AchievementBadgeView'; -export interface AchievementDetailsViewProps +interface AchievementDetailsViewProps { achievement: AchievementData; } @@ -19,7 +17,6 @@ export const AchievementDetailsView: FC = props => if(!achievement) return null; const achievementLevel = GetAchievementLevel(achievement); - const scaledProgressPercent = GetScaledProgressPercent(achievement); return ( @@ -32,10 +29,10 @@ export const AchievementDetailsView: FC = props => - { LocalizeBadgeName(AchievementUtilities.getBadgeCode(achievement)) } + { LocalizeBadgeName(GetAchievementBadgeCode(achievement)) } - - { LocalizeBadgeDescription(AchievementUtilities.getBadgeCode(achievement)) } + + { LocalizeBadgeDescription(GetAchievementBadgeCode(achievement)) } { ((achievement.levelRewardPoints > 0) || (achievement.scoreLimit > 0)) && @@ -51,10 +48,7 @@ export const AchievementDetailsView: FC = props => } { (achievement.scoreLimit > 0) && - - { LocalizeText('achievements.details.progress', [ 'progress', 'limit' ], [ (achievement.currentPoints + achievement.scoreAtStartOfLevel).toString(), (achievement.scoreLimit + achievement.scoreAtStartOfLevel).toString() ]) } - - } + } } diff --git a/src/components/achievements/views/achievement-badge/AchievementBadgeView.tsx b/src/components/achievements/views/achievement-badge/AchievementBadgeView.tsx deleted file mode 100644 index 08de4de8..00000000 --- a/src/components/achievements/views/achievement-badge/AchievementBadgeView.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { AchievementData } from '@nitrots/nitro-renderer'; -import { FC } from 'react'; -import { BaseProps, LayoutBadgeImageView } from '../../../../common'; -import { AchievementUtilities } from '../../common/AchievementUtilities'; - -export interface AchievementBadgeViewProps extends BaseProps -{ - achievement: AchievementData; - scale?: number; -} - -export const AchievementBadgeView: FC = props => -{ - const { achievement = null, scale = 1, ...rest } = props; - - if(!achievement) return null; - - return ( - - ); -} diff --git a/src/components/achievements/views/achievement-list/AchievementListItemView.tsx b/src/components/achievements/views/achievement-list/AchievementListItemView.tsx index 74975759..0041783b 100644 --- a/src/components/achievements/views/achievement-list/AchievementListItemView.tsx +++ b/src/components/achievements/views/achievement-list/AchievementListItemView.tsx @@ -1,9 +1,9 @@ import { AchievementData } from '@nitrots/nitro-renderer'; import { FC } from 'react'; -import { LayoutGridItem, LayoutGridItemProps } from '../../../../common/layout/LayoutGridItem'; -import { AchievementBadgeView } from '../achievement-badge/AchievementBadgeView'; +import { LayoutGridItem, LayoutGridItemProps } from '../../../../common'; +import { AchievementBadgeView } from '../AchievementBadgeView'; -export interface AchievementListItemViewProps extends LayoutGridItemProps +interface AchievementListItemViewProps extends LayoutGridItemProps { achievement: AchievementData; } diff --git a/src/components/achievements/views/achievement-list/AchievementListView.tsx b/src/components/achievements/views/achievement-list/AchievementListView.tsx index d0441aad..a5c889b4 100644 --- a/src/components/achievements/views/achievement-list/AchievementListView.tsx +++ b/src/components/achievements/views/achievement-list/AchievementListView.tsx @@ -1,6 +1,6 @@ import { AchievementData } from '@nitrots/nitro-renderer'; import { Dispatch, FC, SetStateAction } from 'react'; -import { AutoGrid } from '../../../../common/AutoGrid'; +import { AutoGrid } from '../../../../common'; import { AchievementListItemView } from './AchievementListItemView'; export interface AchievementListViewProps diff --git a/src/components/achievements/views/category-list/AchievementsCategoryListItemView.tsx b/src/components/achievements/views/category-list/AchievementsCategoryListItemView.tsx index f9ccfcef..7fc9fa7a 100644 --- a/src/components/achievements/views/category-list/AchievementsCategoryListItemView.tsx +++ b/src/components/achievements/views/category-list/AchievementsCategoryListItemView.tsx @@ -1,9 +1,6 @@ import { FC, useCallback, useMemo } from 'react'; -import { GetConfiguration, LocalizeText } from '../../../../api'; -import { LayoutGridItem, LayoutGridItemProps } from '../../../../common/layout/LayoutGridItem'; -import { LayoutImage } from '../../../../common/layout/LayoutImage'; -import { Text } from '../../../../common/Text'; -import { AchievementCategory } from '../../common/AchievementCategory'; +import { AchievementCategory, GetConfiguration, LocalizeText } from '../../../../api'; +import { LayoutGridItem, LayoutGridItemProps, LayoutImage, Text } from '../../../../common'; export interface AchievementCategoryListItemViewProps extends LayoutGridItemProps { diff --git a/src/components/achievements/views/category-list/AchievementsCategoryListView.tsx b/src/components/achievements/views/category-list/AchievementsCategoryListView.tsx index bcd7adaf..ed0f49de 100644 --- a/src/components/achievements/views/category-list/AchievementsCategoryListView.tsx +++ b/src/components/achievements/views/category-list/AchievementsCategoryListView.tsx @@ -1,6 +1,6 @@ import { Dispatch, FC, SetStateAction } from 'react'; -import { AutoGrid } from '../../../../common/AutoGrid'; -import { AchievementCategory } from '../../common/AchievementCategory'; +import { AchievementCategory } from '../../../../api'; +import { AutoGrid } from '../../../../common'; import { AchievementsCategoryListItemView } from './AchievementsCategoryListItemView'; export interface AchievementsCategoryListViewProps diff --git a/src/components/toolbar/ToolbarView.tsx b/src/components/toolbar/ToolbarView.tsx index c8e102e7..815a4113 100644 --- a/src/components/toolbar/ToolbarView.tsx +++ b/src/components/toolbar/ToolbarView.tsx @@ -2,7 +2,7 @@ import { Dispose, DropBounce, EaseOut, FigureUpdateEvent, JumpBy, Motions, Nitro import { FC, useCallback, useState } from 'react'; import { CreateLinkEvent, GetSessionDataManager, GetUserProfile, OpenMessengerChat, VisitDesktop } from '../../api'; import { Base, Flex, LayoutAvatarImageView, LayoutItemCountView, TransitionAnimation, TransitionAnimationTypes } from '../../common'; -import { AchievementsUIEvent, AchievementsUIUnseenCountEvent, FriendsEvent, FriendsMessengerIconEvent, FriendsRequestCountEvent, GuideToolEvent, InventoryEvent, ModToolsEvent, UnseenItemTrackerUpdateEvent, UserSettingsUIEvent } from '../../events'; +import { AchievementsUIUnseenCountEvent, FriendsEvent, FriendsMessengerIconEvent, FriendsRequestCountEvent, GuideToolEvent, InventoryEvent, ModToolsEvent, UnseenItemTrackerUpdateEvent, UserSettingsUIEvent } from '../../events'; import { BatchUpdates, DispatchUiEvent, UseMessageEventHook, UseRoomEngineEvent, UseUiEvent } from '../../hooks'; import { ToolbarViewItems } from './common/ToolbarViewItems'; import { ToolbarMeView } from './ToolbarMeView'; @@ -157,7 +157,7 @@ export const ToolbarView: FC = props => DispatchUiEvent(new ModToolsEvent(ModToolsEvent.TOGGLE_MOD_TOOLS)); return; case ToolbarViewItems.ACHIEVEMENTS_ITEM: - DispatchUiEvent(new AchievementsUIEvent(AchievementsUIEvent.TOGGLE_ACHIEVEMENTS)); + CreateLinkEvent('achievements/toggle'); setMeExpanded(false); return; case ToolbarViewItems.PROFILE_ITEM: