import React, { useState, forwardRef, useRef } from 'react'; import Toast from 'components/Toast'; import Dropdown from 'components/Dropdown'; import { useDispatch } from 'react-redux'; import { createCollection } from 'providers/ReduxStore/slices/collections'; import { IconDots } from '@tabler/icons'; import CreateCollection from '../CreateCollection'; import StyledWrapper from './StyledWrapper'; const TitleBar = () => { const [modalOpen, setModalOpen] = useState(false); const [showToast, setShowToast] = useState({show: false}); const dispatch = useDispatch(); const menuDropdownTippyRef = useRef(); const onMenuDropdownCreate = (ref) => menuDropdownTippyRef.current = ref; const MenuIcon = forwardRef((props, ref) => { return (
); }); const handleCancel = () => setModalOpen(false); const handleCloseToast = () => setShowToast({show: false}); const handleConfirm = (values) => { setModalOpen(false); dispatch(createCollection(values.collectionName)) }; return ( {showToast.show && } {modalOpen ? ( ) : null}
Collections
} placement='bottom-start'>
{ menuDropdownTippyRef.current.hide(); setModalOpen(true); }}> Create Collection
{ menuDropdownTippyRef.current.hide(); }}> Import Collection
{ menuDropdownTippyRef.current.hide(); }}> Settings
) }; export default TitleBar;