All Downloads are FREE. Search and download functionalities are using the official Maven repository.

components.render.RenderFiles.js Maven / Gradle / Ivy

import { Box, Link }           from '@mui/material';
import RenderValue             from 'components/render/RenderValue';
import FileTiles               from 'components/tile/FileTiles';
import { useContentOnClick } from 'hooks/content';
import { useNotifier }         from 'hooks/notification';
import { useRenderContext }    from 'hooks/render';
import { useState }            from 'react';

const RenderFiles = ({attachments}) => {
  const {context, parent} = useRenderContext()
  
  if (parent == "table" && context != "group" && context != "step")
    return 
  else 
    return 
}

const RenderFilesList = ({attachments}) => {
  return (
    
      {attachments.map((attachment, index) => )}
    
  )
}

const RenderFilesListRow = ({attachment}) => {
  const contentType                = attachment?.__typename == "Document" ? "document" : 'content'
  const {downloadOnClick, loading} = useContentOnClick({id: attachment.__id, filename: attachment.filename, mimeType: attachment.contentType, type: contentType})
  const [cursor, setCursor]        = useState('pointer')
  const notifier                   = useNotifier()

  const handleOnClick = (e) => {
    e.preventDefault()
    e.stopPropagation()

    if (loading)
      notifier.info("We are currently processing your download request")
    else {
      setCursor('progress')
      downloadOnClick(e)
        .finally(() => setCursor("pointer"))
    }
  }

  return (
    
      
        
      
    
  )
}

export default RenderFiles




© 2015 - 2024 Weber Informatics LLC | Privacy Policy