diff --git a/src/renderer/src/components/shared/DatasetContentSelector/index.jsx b/src/renderer/src/components/shared/DatasetContentSelector/index.jsx
index c785061ad..1c8562cec 100644
--- a/src/renderer/src/components/shared/DatasetContentSelector/index.jsx
+++ b/src/renderer/src/components/shared/DatasetContentSelector/index.jsx
@@ -1,4 +1,6 @@
-import { Card, Stack, Text, Group, Tooltip, Checkbox } from "@mantine/core";
+import { useState, useCallback } from "react";
+import { Stack, Text, Group, Tooltip, Checkbox, Collapse, ActionIcon } from "@mantine/core";
+import { IconChevronDown, IconChevronUp } from "@tabler/icons-react";
import FullWidthContainer from "../../containers/FullWidthContainer";
import useGlobalStore from "../../../stores/globalStore";
import { toggleEntitySelection } from "../../../stores/slices/datasetContentSelectorSlice";
@@ -6,142 +8,163 @@ import { toggleEntitySelection } from "../../../stores/slices/datasetContentSele
const contentOptionsMap = {
subjects: {
label: "I collected data from subjects",
- description:
- "Subjects are individual entities, such as humans, animals, or other biological specimens from which data was collected during the study.",
- ml: "0px",
+ description: "Subjects are humans, animals, or other biological specimens.",
+ ml: 0,
},
samples: {
- label: "I collected data from samples",
+ label: "I collected samples from my subjects",
description:
- "Samples are biological or physical specimens collected from subjects, such as tissue samples, blood samples, or other biological materials.",
+ "Samples are biological or physical specimens like tissue or blood taken from subjects",
dependsOn: ["subjects"],
- ml: "20px",
+ dependsOnNotSatiatedMessage: "You must indicate that you collected data from subjects first.",
+ ml: 20,
},
sites: {
label: "I collected data from multiple distinct physical sites on subjects or samples.",
description:
"For example, if you collected data from multiple brain regions, different sections of a tissue sample, or distinct parts of an organ.",
dependsOn: ["subjects"],
- ml: "20px",
+ dependsOnNotSatiatedMessage: "You must indicate that you collected data from subjects first.",
+ ml: 20,
},
"subject-sites": {
- label: "I collected data from distinct physical sites of subjects.",
+ label: "I collected data from distinct physical sites on subjects.",
description:
"Select this option if the sites where data was collected correspond to specific locations or regions within the subjects, such as different anatomical regions or organs.",
dependsOn: ["subjects", "samples", "sites"],
- ml: "40px",
+ dependsOnNotSatiatedMessage:
+ "You must indicate that you collected data from subjects, samples, and sites first.",
+ ml: 40,
},
"sample-sites": {
- label: "I collected data from distinct physical sites of samples.",
+ label: "I collected data from distinct physical sites on samples.",
description:
"Select this option if the sites where data was collected correspond to specific regions within the samples, such as different sections of tissue or other biological materials.",
dependsOn: ["subjects", "samples", "sites"],
- ml: "40px",
+ dependsOnNotSatiatedMessage:
+ "You must indicate that you collected data from subjects, samples, and sites first.",
+ ml: 40,
},
performances: {
label: "I collected data from multiple performances of the same protocol.",
description:
- "Performances refer to the repeated execution of the same protocol or procedure during the study. This can involve tasks or experiments conducted multiple times on the subjects or samples.",
+ "Select this option if you repeated the same protocol or procedure multiple times (such as running repeated tests or experiments) and collected data from each repetition.",
dependsOn: ["subjects"],
- ml: "20px",
+ dependsOnNotSatiatedMessage: "You must indicate that you collected data from subjects first.",
+ ml: 20,
},
"performances-on-subjects": {
label: "The protocol performances were run on the subjects.",
description:
- "Select this option if the protocol performances (such as tasks, tests, or procedures) were conducted on subjects, such as humans or animals, and data was collected during those performances.",
+ "Choose this if tasks, tests, or procedures were performed directly on subjects (e.g., humans or animals) and data was collected during these sessions.",
dependsOn: ["subjects", "samples", "performances"],
- ml: "40px",
+ dependsOnNotSatiatedMessage:
+ "You must indicate that you collected data from subjects, samples, and performances first.",
+ ml: 40,
},
"performances-on-samples": {
label: "The protocol performances were run on the samples.",
description:
- "Select this option if the protocol performances (such as processing or testing procedures) were conducted on samples, like tissue or biological specimens, and data was collected during those procedures.",
+ "Choose this if tasks, tests, or procedures were performed directly on samples (e.g., tissues or blood) and data was collected during these sessions.",
dependsOn: ["subjects", "samples", "performances"],
- ml: "40px",
+ dependsOnNotSatiatedMessage:
+ "You must indicate that you collected data from subjects, samples, and performances first.",
+ ml: 40,
},
code: {
label: "I used code to generate or analyze the collected data",
description:
"Code includes scripts, computational models, analysis pipelines, or other software used to generate, process, or analyze the data.",
- ml: "0px",
+ ml: 0,
},
};
const DatasetContentSelector = () => {
const selectedEntities = useGlobalStore((state) => state.selectedEntities);
- const handleEntitySelection = (value) => {
- const isSelected = selectedEntities.includes(value);
+ // State to track which option descriptions are expanded.
+ const [expanded, setExpanded] = useState({});
+
+ const toggleExpanded = (key) => {
+ setExpanded((prev) => ({ ...prev, [key]: !prev[key] }));
+ };
+
+ const handleEntitySelection = useCallback(
+ (value) => {
+ const isSelected = selectedEntities.includes(value);
- if (isSelected) {
- Object.keys(contentOptionsMap).forEach((key) => {
- if (contentOptionsMap[key].dependsOn?.includes(value) && selectedEntities.includes(key)) {
- toggleEntitySelection(key);
- }
- });
- }
+ if (isSelected) {
+ Object.entries(contentOptionsMap).forEach(([key, option]) => {
+ if (option.dependsOn?.includes(value) && selectedEntities.includes(key)) {
+ toggleEntitySelection(key);
+ }
+ });
+ }
- toggleEntitySelection(value);
+ toggleEntitySelection(value);
+ },
+ [selectedEntities]
+ );
+
+ const renderOption = (key) => {
+ const option = contentOptionsMap[key];
+ const isDisabled = option.dependsOn?.some((dep) => !selectedEntities.includes(dep));
+ const isSelected = selectedEntities.includes(key) && !isDisabled;
+
+ return (
+
- Select all of the following that apply to the data you collected: + Check the boxes that apply to the data collected or generated during your study in + order to help SODA determine the optimal workflow to organize your dataset.