stream-chat-react
Version:
React components to create chat conversations or livestream style chat
23 lines (22 loc) • 850 B
JavaScript
import { useMessageComposer } from './useMessageComposer';
import { useStateStore } from '../../../store';
const attachmentManagerStateSelector = (state) => ({
attachments: state.attachments,
});
const pollComposerStateSelector = (state) => ({
poll: state.data,
});
const locationComposerStateSelector = (state) => ({
location: state.location,
});
export const useAttachmentsForPreview = () => {
const { attachmentManager, locationComposer, pollComposer } = useMessageComposer();
const { attachments } = useStateStore(attachmentManager.state, attachmentManagerStateSelector);
const { poll } = useStateStore(pollComposer.state, pollComposerStateSelector);
const { location } = useStateStore(locationComposer.state, locationComposerStateSelector);
return {
attachments,
location,
poll,
};
};