diff --git a/packages/pl-fe/src/components/announcements/announcement.tsx b/packages/pl-fe/src/components/announcements/announcement.tsx index f0536fec23..4f0d574bcb 100644 --- a/packages/pl-fe/src/components/announcements/announcement.tsx +++ b/packages/pl-fe/src/components/announcements/announcement.tsx @@ -9,12 +9,11 @@ import { getTextDirection } from 'pl-fe/utils/rtl'; import AnnouncementContent from './announcement-content'; import ReactionsBar from './reactions-bar'; -import type { Map as ImmutableMap } from 'immutable'; import type { Announcement as AnnouncementEntity, CustomEmoji } from 'pl-api'; interface IAnnouncement { announcement: AnnouncementEntity; - emojiMap: ImmutableMap; + emojiMap: Record; } const Announcement: React.FC = ({ announcement, emojiMap }) => { diff --git a/packages/pl-fe/src/components/announcements/announcements-panel.tsx b/packages/pl-fe/src/components/announcements/announcements-panel.tsx index 558b99a38f..ecbddd826d 100644 --- a/packages/pl-fe/src/components/announcements/announcements-panel.tsx +++ b/packages/pl-fe/src/components/announcements/announcements-panel.tsx @@ -1,5 +1,4 @@ import clsx from 'clsx'; -import { Map as ImmutableMap } from 'immutable'; import React, { useState } from 'react'; import { FormattedMessage } from 'react-intl'; import ReactSwipeableViews from 'react-swipeable-views'; @@ -16,7 +15,7 @@ import Announcement from './announcement'; import type { CustomEmoji } from 'pl-api'; import type { RootState } from 'pl-fe/store'; -const customEmojiMap = createSelector([(state: RootState) => state.custom_emojis], items => items.reduce((map, emoji) => map.set(emoji.shortcode, emoji), ImmutableMap())); +const customEmojiMap = createSelector([(state: RootState) => state.custom_emojis], items => items.reduce>((map, emoji) => (map[emoji.shortcode] = emoji, map), {})); const AnnouncementsPanel = () => { const emojiMap = useAppSelector(state => customEmojiMap(state)); diff --git a/packages/pl-fe/src/components/announcements/emoji.tsx b/packages/pl-fe/src/components/announcements/emoji.tsx index cc2de4f896..cf20170725 100644 --- a/packages/pl-fe/src/components/announcements/emoji.tsx +++ b/packages/pl-fe/src/components/announcements/emoji.tsx @@ -4,12 +4,11 @@ import unicodeMapping from 'pl-fe/features/emoji/mapping'; import { useSettings } from 'pl-fe/hooks/use-settings'; import { joinPublicPath } from 'pl-fe/utils/static'; -import type { Map as ImmutableMap } from 'immutable'; import type { CustomEmoji } from 'pl-api'; interface IEmoji { emoji: string; - emojiMap: ImmutableMap; + emojiMap: Record; hovered: boolean; } @@ -31,8 +30,8 @@ const Emoji: React.FC = ({ emoji, emojiMap, hovered }) => { src={joinPublicPath(`packs/emoji/${filename}.svg`)} /> ); - } else if (emojiMap.get(emoji)) { - const filename = (autoPlayGif || hovered) ? emojiMap.getIn([emoji, 'url']) : emojiMap.getIn([emoji, 'static_url']); + } else if (emojiMap[emoji]) { + const filename = (autoPlayGif || hovered) ? emojiMap[emoji].url : emojiMap[emoji].static_url; const shortCode = `:${emoji}:`; return ( diff --git a/packages/pl-fe/src/components/announcements/reaction.tsx b/packages/pl-fe/src/components/announcements/reaction.tsx index 983e774c58..99ba3b790a 100644 --- a/packages/pl-fe/src/components/announcements/reaction.tsx +++ b/packages/pl-fe/src/components/announcements/reaction.tsx @@ -7,13 +7,12 @@ import unicodeMapping from 'pl-fe/features/emoji/mapping'; import Emoji from './emoji'; -import type { Map as ImmutableMap } from 'immutable'; import type { AnnouncementReaction, CustomEmoji } from 'pl-api'; interface IReaction { announcementId: string; reaction: AnnouncementReaction; - emojiMap: ImmutableMap; + emojiMap: Record; style: React.CSSProperties; } diff --git a/packages/pl-fe/src/components/announcements/reactions-bar.tsx b/packages/pl-fe/src/components/announcements/reactions-bar.tsx index 36b6056267..c40d693514 100644 --- a/packages/pl-fe/src/components/announcements/reactions-bar.tsx +++ b/packages/pl-fe/src/components/announcements/reactions-bar.tsx @@ -8,14 +8,13 @@ import { useSettings } from 'pl-fe/hooks/use-settings'; import Reaction from './reaction'; -import type { Map as ImmutableMap } from 'immutable'; import type { AnnouncementReaction, CustomEmoji } from 'pl-api'; import type { Emoji, NativeEmoji } from 'pl-fe/features/emoji'; interface IReactionsBar { announcementId: string; reactions: Array; - emojiMap: ImmutableMap; + emojiMap: Record; } const ReactionsBar: React.FC = ({ announcementId, reactions, emojiMap }) => {