diff --git a/server/app.js b/server/app.js index 300af9e..562dcfc 100644 --- a/server/app.js +++ b/server/app.js @@ -137,6 +137,7 @@ app.use('/', clowderRouter); app.use('/api/rctdb', rctdbRouter); app.use('/home',express.static('../dist')); +app.use('/preview',express.static('../dist')); app.use('/public',express.static('../dist/public')); app.use('/public', express.static('public')); diff --git a/src/app.config.js b/src/app.config.js index 5320aa5..c5b703e 100644 --- a/src/app.config.js +++ b/src/app.config.js @@ -15,7 +15,7 @@ config["pymupdf_extractor"] = "pymupdf-extractor"; // extractor name for SOffice extractor. Triggers on word files and converts them to pdf. config["soffice_extractor"] = "soffice-extractor"; // Add default statement type -config["statementType"] = "spirit"; +config["statementType"] = "consort"; // Add default user category config["userCategory"] = "author"; diff --git a/src/components/childComponents/CreateAndUpload.js b/src/components/childComponents/CreateAndUpload.js index d24f2c2..17c7c76 100644 --- a/src/components/childComponents/CreateAndUpload.js +++ b/src/components/childComponents/CreateAndUpload.js @@ -284,16 +284,16 @@ export default function CreateAndUpload() { Select Guideline } - label="SPIRIT" + value="consort" + control={} + label="CONSORT" style={{ fontFamily: theme.typography.fontFamily, margin: 0 }} disabled={loading} /> } - label="CONSORT" + value="spirit" + control={} + label="SPIRIT" style={{ fontFamily: theme.typography.fontFamily, margin: 0 }} disabled={loading} /> diff --git a/src/components/childComponents/Dropfile.js b/src/components/childComponents/Dropfile.js index aa1abf9..f6e07d3 100644 --- a/src/components/childComponents/Dropfile.js +++ b/src/components/childComponents/Dropfile.js @@ -1,24 +1,41 @@ // File drag and drop -import React, { useState } from "react"; +import React, { useRef, useState } from "react"; // Import the useDropzone hooks from react-dropzone import { useDropzone } from "react-dropzone"; import { theme } from "../../theme"; const Dropfile = ({ onDrop, accept, message }) => { const [files, setFiles] = useState([]); + const fileInputRef = useRef(null); + const isDisabled = !message || message.includes("Please select a statement type"); + const inputAccept = Object.entries(accept || {}) + .reduce((acceptTypes, [mimeType, extensions]) => acceptTypes.concat(mimeType, extensions), []) + .join(","); // Initializing useDropzone hooks with options - const { getRootProps, getInputProps, isDragActive, isDragAccept, isDragReject, open } = useDropzone({ + const { getRootProps, getInputProps, isDragActive, isDragAccept, isDragReject } = useDropzone({ accept, + noClick: true, // Disable dropping if there's no statement type selected - noClick: !message || message.includes("Please select a statement type"), - noDrop: !message || message.includes("Please select a statement type"), - onDrop: (acceptedFiles, rejectedFiles) => { + noDrop: isDisabled, + onDrop: (acceptedFiles) => { setFiles(acceptedFiles); } }); + const handleBrowseClick = (e) => { + e.stopPropagation(); + if (fileInputRef.current) { + fileInputRef.current.value = ""; + fileInputRef.current.click(); + } + }; + + const handleFileInputChange = (e) => { + setFiles(Array.from(e.target.files || [])); + }; + const handleSubmit = (e) => { e.preventDefault(); if (files.length > 0) { @@ -27,11 +44,16 @@ const Dropfile = ({ onDrop, accept, message }) => { } }; - const isDisabled = !message || message.includes("Please select a statement type"); - return (
-
e.preventDefault() })}> + +
{!isDragActive && (

{message || "Drag and drop some files here"}

)} @@ -45,7 +67,7 @@ const Dropfile = ({ onDrop, accept, message }) => {