bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/emoji-rain/container.jsx

28 lines
800 B
React
Raw Normal View History

2024-04-25 02:45:28 +08:00
import React, { useRef } from 'react';
import EmojiRain from './component';
2024-04-25 02:45:28 +08:00
import { getEmojisToRain } from './queries';
import useDeduplicatedSubscription from '../../core/hooks/useDeduplicatedSubscription';
2024-04-25 02:45:28 +08:00
const EmojiRainContainer = () => {
const nowDate = useRef(new Date().toUTCString());
2024-04-25 02:45:28 +08:00
const {
data: emojisToRainData,
} = useDeduplicatedSubscription(getEmojisToRain, {
2024-04-25 02:45:28 +08:00
variables: {
initialCursor: nowDate.current,
},
});
const emojisArray = emojisToRainData?.user_reaction_stream || [];
const reactions = emojisArray.length === 0 ? []
: emojisArray.map((reaction) => ({
reaction: reaction.reactionEmoji,
creationDate: new Date(reaction.createdAt),
}));
return <EmojiRain reactions={reactions} />;
};
export default EmojiRainContainer;