Skip to content

Commit f48acca

Browse files
eurunuelaclaude
andcommitted
feat: Add multi-run support with per-run data grouping and run selector (#126)
When a tedana output folder contains files from multiple BIDS runs (e.g. run-01, run-02), Rica now groups all per-run data into indexed arrays and shows a run selector bar above the tabs. - Add `parseRunLabel` / `deriveRunLabels` helpers to pathUtils.js - Refactor both loaders in IntroPopUp.js to detect BIDS run entities and accumulate per-run data (metrics, mixing matrix, NIfTIs, report, decision tree, etc.) into run-indexed arrays instead of scalars - Add `runs` / `selectedRunIndex` state to App (index.js); reset to 0 on every new dataset load - Split the `info` state into separate `reportText[]` and `dirPath[]` per-run arrays - Render a sticky run selector bar (only when runs.length > 1) that lets users switch between runs; all tabs reflect the selected run - Update Info.js to accept explicit `info` + `dirPath` string props - Add a useEffect in Plots.js to reset `selectedIndex` to 0 on run change, preventing out-of-range component selection - Carpets and QC Histograms/Time Series are unchanged — they already display all runs' SVGs via their accumulated flat arrays Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent a4fb707 commit f48acca

5 files changed

Lines changed: 311 additions & 173 deletions

File tree

src/Info/Info.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
33
import { faFolder } from "@fortawesome/free-solid-svg-icons";
44
import { getFolderName } from "../utils/pathUtils";
55

6-
function Info({ info, isDark }) {
6+
function Info({ info, dirPath, isDark }) {
77
const [showTooltip, setShowTooltip] = useState(false);
8-
if (!info?.length) {
8+
if (!info && !dirPath) {
99
return (
1010
<div style={{
1111
display: 'flex',
@@ -59,7 +59,7 @@ function Info({ info, isDark }) {
5959
onMouseEnter={() => setShowTooltip(true)}
6060
onMouseLeave={() => setShowTooltip(false)}
6161
>
62-
{getFolderName(info[1])}
62+
{getFolderName(dirPath)}
6363
{showTooltip && (
6464
<span
6565
style={{
@@ -78,7 +78,7 @@ function Info({ info, isDark }) {
7878
zIndex: 1000,
7979
}}
8080
>
81-
{info[1]}
81+
{dirPath}
8282
</span>
8383
)}
8484
</span>
@@ -100,7 +100,7 @@ function Info({ info, isDark }) {
100100
textAlign: 'left',
101101
margin: 0,
102102
}}>
103-
{info[0]}
103+
{info}
104104
</p>
105105
</div>
106106
</div>

src/Plots/Plots.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,11 @@ function Plots({ componentData, componentFigures, originalData, mixingMatrix, ni
174174
initializeData();
175175
}, [initializeData]);
176176

177+
// Reset to first component when the run changes
178+
useEffect(() => {
179+
setSelectedIndex(0);
180+
}, [componentData]);
181+
177182
// Find and display component image
178183
const findComponentImage = useCallback(
179184
(index, data) => {

0 commit comments

Comments
 (0)