text: import React, { useEffect } from 'react'
  import { CModal, CModalBody, CModalHeader, CInput, CRow, CCol, CLabel, CModalTitle, CButton, CModalFooter } from '@coreui/react'
  import { blueButton, grayButton, modalHeader } from 'src/assets/css/global'
  import firebase from '../../libraries/Firebase'
  
  const CreateAssembly = (props) => {
  
      const { state, dispatch } = props
  
      const create = () => {
  
          if (state.createModalText.length > 0) {
              console.log(checkIfAlreadyExist())
              if (!checkIfAlreadyExist()) {
                  const newRef = {}
                  newRef[state.createModalText] = {
                      active: false,
                      date: "",
                      state: "Pendiente"
                  }
                  firebase.database().ref("created_name_convention").update(newRef)
                  dispatch({ type: "[ModalCreate] setState", payload: false })
              }
          }
      }
  
      const checkIfAlreadyExist = () => {
          return state.assemblies.find(e => e.Asamblea === state.createModalText) === null || state.assemblies.find(e => e.Asamblea === state.createModalText) === undefined ? false : true
      }
  
      return (
          <CModal
              show={state.createModal}
              onClose={() => { dispatch({ type: "[ModalCreate] setState", payload: false }) }}
              size="xl"
              closeOnBackdrop={false}
          >
              <CModalHeader closeButton style={modalHeader}>
                  <CModalTitle>Nueva asamblea</CModalTitle>
              </CModalHeader>
              <CModalBody>
                  <CRow>
                      <CCol>
                          <CLabel>Nombre de la asamblea</CLabel>
                          <CInput placeholder="Escriba el nombre de la nueva asamblea" value={state.createModalText} onChange={({ target }) => { dispatch({ type: "[ModalCreate] setText", payload: target.value }) }} />
                      </CCol>
                  </CRow>
  
              </CModalBody>
              <CModalFooter>
                  <CButton shape="pill" style={blueButton} onClick={create} >Crear</CButton>
                  <CButton shape="pill" style={grayButton} onClick={() => { dispatch({ type: "[ModalCreate] setState", payload: false }) }}>Cancelar</CButton>
              </CModalFooter>
          </CModal>)
  }
  
  export default CreateAssembly