diff --git a/src/renderer/src/components/shared/DatasetContentSelector/index.jsx b/src/renderer/src/components/shared/DatasetContentSelector/index.jsx index 21e5f9719..628c489bb 100644 --- a/src/renderer/src/components/shared/DatasetContentSelector/index.jsx +++ b/src/renderer/src/components/shared/DatasetContentSelector/index.jsx @@ -1,9 +1,10 @@ -import { useState } from "react"; -import { Table, Checkbox, Text } from "@mantine/core"; +import { Card, Stack, Text, Group } from "@mantine/core"; import FullWidthContainer from "../../containers/FullWidthContainer"; +import useGlobalStore from "../../../stores/globalStore"; +import { toggleComponent } from "../../../stores/slices/datasetContentSelectorSlice"; const DatasetContentSelector = () => { - const [selectedComponents, setSelectedComponents] = useState([]); + const selectedComponents = useGlobalStore((state) => state.selectedComponents); const options = [ { @@ -23,62 +24,67 @@ const DatasetContentSelector = () => { value: "sites", label: "Sites", description: - "Specific locations in the body, environment, or experimental setup where data or samples were collected.", + "Specific locations in the body, environment, or experimental setup where data or samples were collected. Conditionally required if data were gathered from multiple distinct locations or experimental setups for the same subject or sample.", dependsOn: "subjects", }, { value: "performances", label: "Performances", - description: "Repeated experimental runs or iterations conducted as part of the study.", + description: + "Multiple distinct performances of one type of experimental protocol on the same subject or same sample (i.e. multiple visits, runs, sessions, or execution).", dependsOn: "subjects", }, { value: "code", label: "Code", description: - "Scripts, computational models, or analysis pipelines used in or generated by the study.", + "Scripts, computational models, analysis pipelines, or other code/tools used in the study.", }, ]; + const toggleSelection = (value) => { - setSelectedComponents((prev) => - prev.includes(value) ? prev.filter((item) => item !== value) : [...prev, value] - ); + toggleComponent(value); }; return ( - - Select all of the following that apply to the data you collected: - - - - - - - My dataset contains - Description - - - - {options.map((option) => { - const isDisabled = option.dependsOn && !selectedComponents.includes(option.dependsOn); + + {options.map((option) => { + const isDisabled = option.dependsOn && !selectedComponents.includes(option.dependsOn); + const isSelected = selectedComponents.includes(option.value); - return ( - - - toggleSelection(option.value)} - disabled={isDisabled} - /> - - {option.label} - {option.description} - - ); - })} - -
+ return ( + { + if (!isDisabled) { + toggleSelection(option.value); + } + }} + > + + + {option.label} + + + + {option.description} + + + ); + })} +
); }; diff --git a/src/renderer/src/scripts/guided-mode/guided-curate-dataset.js b/src/renderer/src/scripts/guided-mode/guided-curate-dataset.js index d80133e7b..10b0cda49 100644 --- a/src/renderer/src/scripts/guided-mode/guided-curate-dataset.js +++ b/src/renderer/src/scripts/guided-mode/guided-curate-dataset.js @@ -399,6 +399,7 @@ const guidedCheckHighLevelFoldersForImproperFiles = (datasetStructure) => { return [invalidFolders, invalidFiles]; }; +/* document.getElementById("guided-button-dataset-contains-code").addEventListener("click", () => { const codeFolder = window.datasetStructureJSONObj["folders"]["code"]; if (codeFolder) { @@ -409,6 +410,7 @@ document.getElementById("guided-button-dataset-contains-code").addEventListener( } } }); +*/ const checkIfChangesMetadataPageShouldBeShown = async (pennsieveDatasetID) => { try { @@ -5043,6 +5045,7 @@ window.openPage = async (targetPageID) => { } if (targetPageID === "guided-prepare-dataset-structure-tab") { + /* // If the user has already added subjects, disallow them from selecting no (they have to go to the subject // page to delete subjects but this would be a very strange case anyways) const [subjectsInPools, subjectsOutsidePools] = window.sodaJSONObj.getAllSubjects(); @@ -5055,7 +5058,7 @@ window.openPage = async (targetPageID) => { } else { subjectQuerySectioin.classList.remove("section-disabled"); infoText.classList.add("hidden"); - } + }*/ } if (targetPageID === "guided-prepare-helpers-tab") { diff --git a/src/renderer/src/sections/guided_mode/guided_curate_dataset.html b/src/renderer/src/sections/guided_mode/guided_curate_dataset.html index 12685dc9b..4ab977711 100644 --- a/src/renderer/src/sections/guided_mode/guided_curate_dataset.html +++ b/src/renderer/src/sections/guided_mode/guided_curate_dataset.html @@ -720,265 +720,10 @@

Before getting started

Describe the content of your dataset

- Several resources are required to curate and share a SPARC dataset. They are listed - below so you can make sure you can have access to them before getting started. + Select all dataset entities relevant to your study based on the data you collected.

-
- -
-

What are subjects/samples?

- -
-
-

- Subjects are experimental units that are being studied. A subject can be a - living human, animal, or a biological specimen. -

-

- Samples are a portion of a subject's tissue, fluid, or other biological - materal that data is collected from. -

-

- For example: If a study is being done on liver tissue, a subject could be a - human donor, and a sample could be a piece of liver tissue that was collected for - analysis. -

-
-
- - -
-

- Subjects have already been added to your dataset. If you would like to - add/edit/delete subjects, you may do so in the "Subject addition" tab. -

-
- -
- -
- - -
-
- -
-
- -
-

- Learn more about experimental versus computational datasets -

- -
-
-

- Experimental datasets are datasets that have a primary purpose of - collecting and sharing data obtained from physical experiments. -

-

- Computational datasets consist of computational models, visualization - scripts, or other code that is used to analyze or visualize experimental data. -

-
-
- - -
-
-
-

- Click " to begin the experimental dataset - curation process. -

-
-
-

- Click "" to begin the computational dataset - curation process. -

-
-
-

Unable to determine dataset type

-

- The dataset type was not able to be determined as the dataset does not contain data - collected from subjects or any code for computational modeling, visualization - scripts etc. If your code does not contain either of the above, please contact the - SPARC team at - curation@sparc.science. -

-
-
-
-
-
-
-
-
-
-
-
-
- Importing dataset type from Pennsieve... -
-
({}); +export const datasetContentSelectorSlice = (set) => ({ + selectedDatasetContent: [], +}); + +export const toggleComponent = (value) => { + useGlobalStore.setState( + produce((state) => { + if (state.selectedComponents.includes(value)) { + state.selectedComponents = state.selectedComponents.filter((item) => item !== value); + } else { + state.selectedComponents.push(value); + } + }) + ); +}; + +export const resetSelection = () => { + useGlobalStore.setState( + produce((state) => { + state.selectedComponents = []; + }) + ); +};