Free Motion Capture for Everyone πβ¨
TypeScript
clean up sidebar and add combo view
jonmatthis3d5cd0ad6b1a
diff --git a/freemocap-ui/src/components/camera-view-settings-overlay/CamerasViewSettingsOverlay.tsx b/freemocap-ui/src/components/camera-view-settings-overlay/CamerasViewSettingsOverlay.tsxindex e4b55044..bf23fed3 100644--- a/freemocap-ui/src/components/camera-view-settings-overlay/CamerasViewSettingsOverlay.tsx+++ b/freemocap-ui/src/components/camera-view-settings-overlay/CamerasViewSettingsOverlay.tsx@@ -1,30 +1,43 @@import React, { useState } from 'react';-import { Box, Button, IconButton, Paper, TextField, Checkbox, FormControlLabel, Tooltip } from '@mui/material';+import {+ Box,+ IconButton,+ Paper,+ TextField,+ Checkbox,+ FormControlLabel,+ Tooltip,+ Divider,+ ToggleButton,+ ToggleButtonGroup,+ Switch,+} from '@mui/material';import SettingsIcon from '@mui/icons-material/Settings';import CloseIcon from '@mui/icons-material/Close';import GridViewIcon from '@mui/icons-material/GridView';-import RestartAltIcon from '@mui/icons-material/RestartAlt';+import ViewSidebarIcon from '@mui/icons-material/ViewSidebar';+import SplitscreenIcon from '@mui/icons-material/Splitscreen';+import ViewAgendaIcon from '@mui/icons-material/ViewAgenda';import { useServer } from '@/services/server/ServerContextProvider';import { useTranslation } from 'react-i18next';--interface CameraSettings {- columns: number | null;-}+import type { CameraSettings, LayoutDirection } from '@/pages/CamerasPage';interface CamerasViewSettingsOverlayProps {- onSettingsChange: (settings: CameraSettings) => void;+ settings: CameraSettings;+ onSettingsChange: (partial: Partial<CameraSettings>) => void;onResetLayout: () => void;}export const CamerasViewSettingsOverlay: React.FC<CamerasViewSettingsOverlayProps> = ({- onSettingsChange,- onResetLayout,- }) => {+ settings,+ onSettingsChange,+ onResetLayout,+}) => {const { connectedCameraIds } = useServer();const { t } = useTranslation();const [isOpen, setIsOpen] = useState<boolean>(false);- const [isAuto, setIsAuto] = useState<boolean>(true);- const [manualColumns, setManualColumns] = useState<number>(2);+ const [isAuto, setIsAuto] = useState<boolean>(settings.columns === null);+ const [manualColumns, setManualColumns] = useState<number>(settings.columns ?? 2);const getAutoColumns = (total: number): number => {if (total <= 1) return 1;@@ -45,33 +58,35 @@ export const CamerasViewSettingsOverlay: React.FC<CamerasViewSettingsOverlayPropconst value = parseInt(event.target.value);if (!isNaN(value) && value > 0) {setManualColumns(value);- if (isAuto) {- setIsAuto(false);- }+ if (isAuto) setIsAuto(false);onSettingsChange({ columns: value });}};+ const handle3dViewToggle = (event: React.ChangeEvent<HTMLInputElement>) => {+ onSettingsChange({ show3dView: event.target.checked });+ };++ const handleLayoutDirectionChange = (+ _event: React.MouseEvent<HTMLElement>,+ newDirection: LayoutDirection | null,+ ) => {+ if (newDirection !== null) {+ onSettingsChange({ layoutDirection: newDirection });+ }+ };+return (<>- {/* Settings Button */}- <Box- sx={{- position: 'absolute',- top: 16,- right: 16,- zIndex: 1000,- }}- >- <Tooltip title={isOpen ? t("closeSettings") : t("gridSettings")}>+ {/* Settings toggle button */}+ <Box sx={{ position: 'absolute', top: 16, right: 16, zIndex: 1000 }}>+ <Tooltip title={isOpen ? t('closeSettings') : t('gridSettings')}><IconButtononClick={() => setIsOpen(!isOpen)}sx={{backgroundColor: 'background.paper',boxShadow: 2,- '&:hover': {- backgroundColor: 'action.hover',- },+ '&:hover': { backgroundColor: 'action.hover' },}}>{isOpen ? <CloseIcon /> : <SettingsIcon />}@@ -79,7 +94,7 @@ export const CamerasViewSettingsOverlay: React.FC<CamerasViewSettingsOverlayProp</Tooltip></Box>- {/* Settings Panel */}+ {/* Settings panel */}{isOpen && (<Paperelevation={8}@@ -89,44 +104,107 @@ export const CamerasViewSettingsOverlay: React.FC<CamerasViewSettingsOverlayPropright: 16,zIndex: 999,padding: 2,- minWidth: 250,+ minWidth: 260,+ display: 'flex',+ flexDirection: 'column',+ gap: 2,}}>- <Box sx={{ display: 'flex', alignItems: 'center', gap: 1, mb: 2 }}>- <GridViewIcon fontSize="small" />- <Box sx={{ fontWeight: 600 }}>{t("gridColumns")}</Box>+ {/* ββ Grid columns ββββββββββββββββββββββββββββ */}+ <Box>+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 1, mb: 1.5 }}>+ <GridViewIcon fontSize="small" />+ <Box sx={{ fontWeight: 600, fontSize: '0.875rem' }}>{t('gridColumns')}</Box>+ </Box>++ <Box sx={{ display: 'flex', alignItems: 'flex-start', gap: 1 }}>+ <FormControlLabel+ control={+ <Checkbox+ checked={isAuto}+ onChange={handleAutoChange}+ sx={{ '&.Mui-checked': { color: 'text.primary' } }}+ />+ }+ label={t('auto')}+ />+ <TextField+ type="number"+ label={t('columns')}+ value={isAuto ? autoColumns : manualColumns}+ onChange={handleColumnsChange}+ fullWidth+ inputProps={{ min: 1, step: 1 }}+ helperText={+ isAuto+ ? `Auto-detected: ${autoColumns}`+ : 'Enter any positive number'+ }+ />+ </Box></Box>- <Box sx={{ display: 'flex', alignItems: 'flex-start', gap: 1, mb: 2 }}>+ <Divider />++ {/* ββ 3D viewport toggle ββββββββββββββββββββββ */}+ <Box>+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 1, mb: 0.5 }}>+ <ViewSidebarIcon fontSize="small" />+ <Box sx={{ fontWeight: 600, fontSize: '0.875rem' }}>3D Viewport</Box>+ </Box>+<FormControlLabelcontrol={- <Checkbox- checked={isAuto}- onChange={handleAutoChange}- sx={{- '&.Mui-checked': {- color: 'text.primary',- },- }}+ <Switch+ checked={settings.show3dView}+ onChange={handle3dViewToggle}+ size="small"/>}- label={t("auto")}- />-- <TextField- type="number"- label={t("columns")}- value={isAuto ? autoColumns : manualColumns}- onChange={handleColumnsChange}- fullWidth- inputProps={{- min: 1,- step: 1,- }}- helperText={isAuto ? `Auto-detected: ${autoColumns}` : "Enter any positive number"}+ label={settings.show3dView ? 'Visible' : 'Hidden'}+ sx={{ ml: 0 }}/></Box>+ {/* ββ Layout direction (only when 3D is on) βββ */}+ {settings.show3dView && (+ <>+ <Divider />++ <Box>+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 1, mb: 1 }}>+ <SplitscreenIcon fontSize="small" />+ <Box sx={{ fontWeight: 600, fontSize: '0.875rem' }}>Layout</Box>+ </Box>++ <ToggleButtonGroup+ value={settings.layoutDirection}+ exclusive+ onChange={handleLayoutDirectionChange}+ size="small"+ fullWidth+ >+ <ToggleButton value="horizontal" aria-label="side by side">+ <Tooltip title="Side by side">+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 0.5 }}>+ {/* Two vertical panels icon */}+ <ViewSidebarIcon fontSize="small" />+ <Box sx={{ fontSize: '0.75rem' }}>Side by side</Box>+ </Box>+ </Tooltip>+ </ToggleButton>+ <ToggleButton value="vertical" aria-label="stacked">+ <Tooltip title="Stacked">+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 0.5 }}>+ <ViewAgendaIcon fontSize="small" />+ <Box sx={{ fontSize: '0.75rem' }}>Stacked</Box>+ </Box>+ </Tooltip>+ </ToggleButton>+ </ToggleButtonGroup>+ </Box>+ </>+ )}</Paper>)}</>diff --git a/freemocap-ui/src/components/pipeline-config/CalibrationTomlPicker.tsx b/freemocap-ui/src/components/pipeline-config/CalibrationTomlPicker.tsxnew file mode 100644index 00000000..a5ec5c9c--- /dev/null+++ b/freemocap-ui/src/components/pipeline-config/CalibrationTomlPicker.tsx@@ -0,0 +1,116 @@+import React from "react";+import {Box, Button, Chip, Tooltip, Typography, useTheme} from "@mui/material";+import CheckCircleIcon from "@mui/icons-material/CheckCircle";+import ErrorIcon from "@mui/icons-material/Error";+import WarningAmberIcon from "@mui/icons-material/WarningAmber";+import FolderOpenIcon from "@mui/icons-material/FolderOpen";+import AutorenewIcon from "@mui/icons-material/Autorenew";++export type CalibrationTomlSource = "auto" | "calibration-panel" | "manual";++interface CalibrationTomlPickerProps {+ tomlPath: string | null;+ source: CalibrationTomlSource;+ onSelect: () => void;+ onUseAutoDetected: () => void;+ disabled?: boolean;+}++const SOURCE_LABELS: Record<CalibrationTomlSource, string> = {+ auto: "Auto-detected",+ "calibration-panel": "From calibration panel",+ manual: "Manually selected",+};++export const CalibrationTomlPicker: React.FC<CalibrationTomlPickerProps> = ({+ tomlPath,+ source,+ onSelect,+ onUseAutoDetected,+ disabled = false,+}) => {+ const theme = useTheme();++ const statusIcon = tomlPath ? (+ <CheckCircleIcon sx={{fontSize: 18, color: "#00e5ff"}} />+ ) : (+ <ErrorIcon sx={{fontSize: 18, color: theme.palette.error.main}} />+ );++ return (+ <Box+ sx={{+ display: "flex",+ alignItems: "center",+ gap: 1,+ p: 1,+ borderRadius: 1,+ border: `1px solid ${theme.palette.divider}`,+ minHeight: 36,+ }}+ >+ {statusIcon}++ <Box sx={{flex: 1, minWidth: 0}}>+ {tomlPath ? (+ <>+ <Chip+ label={SOURCE_LABELS[source]}+ size="small"+ sx={{+ height: 16,+ fontSize: 9,+ "& .MuiChip-label": {px: 0.5},+ mb: 0.25,+ }}+ />+ <Tooltip title={tomlPath} arrow>+ <Typography+ variant="caption"+ sx={{+ fontFamily: "monospace",+ fontSize: 10,+ display: "block",+ color: "success.main",+ overflow: "hidden",+ textOverflow: "ellipsis",+ whiteSpace: "nowrap",+ }}+ >+ {tomlPath}+ </Typography>+ </Tooltip>+ </>+ ) : (+ <Typography variant="caption" color="text.secondary">+ No calibration TOML found+ </Typography>+ )}+ </Box>++ {source !== "auto" && tomlPath && (+ <Tooltip title="Use auto-detected calibration" arrow>+ <Button+ size="small"+ onClick={onUseAutoDetected}+ disabled={disabled}+ sx={{minWidth: 0, p: 0.5}}+ >+ <AutorenewIcon fontSize="small" />+ </Button>+ </Tooltip>+ )}++ <Button+ size="small"+ variant="outlined"+ onClick={onSelect}+ disabled={disabled}+ startIcon={<FolderOpenIcon />}+ sx={{flexShrink: 0, textTransform: "none", fontSize: 11}}+ >+ Browse+ </Button>+ </Box>+ );+};diff --git a/freemocap-ui/src/components/pipeline-config/PipelineConfigTree.tsx b/freemocap-ui/src/components/pipeline-config/PipelineConfigTree.tsxnew file mode 100644index 00000000..7463499e--- /dev/null+++ b/freemocap-ui/src/components/pipeline-config/PipelineConfigTree.tsx@@ -0,0 +1,192 @@+import React, {useState} from "react";+import {Box, Typography, useTheme} from "@mui/material";+import {SimpleTreeView} from "@mui/x-tree-view/SimpleTreeView";+import ExpandMore from "@mui/icons-material/ExpandMore";+import ChevronRight from "@mui/icons-material/ChevronRight";++import {PipelineStageTreeItem} from "./PipelineStageTreeItem";+import {MediapipeConfigPanel} from "@/components/mocap-control-panel/MediapipeConfigPanel";+import {SkeletonFilterConfigPanel} from "@/components/mocap-control-panel/SkeletonFilterConfigPanel";++export type PipelineContext = "realtime" | "posthoc";++interface PipelineConfigTreeProps {+ context: PipelineContext;+ // 2D Tracking stage toggles+ charucoEnabled: boolean;+ onCharucoToggle: (checked: boolean) => void;+ skeletonEnabled: boolean;+ onSkeletonToggle: (checked: boolean) => void;+ // 3D Reconstruction stage toggles+ triangulateEnabled: boolean;+ onTriangulateToggle: (checked: boolean) => void;+ filterEnabled: boolean;+ onFilterToggle: (checked: boolean) => void;+ rigidBodyEnabled: boolean;+ onRigidBodyToggle: (checked: boolean) => void;+ // Disable all controls (e.g. pipeline not connected)+ disabled?: boolean;+ disabledReason?: string;+}++export const PipelineConfigTree: React.FC<PipelineConfigTreeProps> = ({+ context,+ charucoEnabled,+ onCharucoToggle,+ skeletonEnabled,+ onSkeletonToggle,+ triangulateEnabled,+ onTriangulateToggle,+ filterEnabled,+ onFilterToggle,+ rigidBodyEnabled,+ onRigidBodyToggle,+ disabled = false,+ disabledReason,+}) => {+ const theme = useTheme();+ const [expandedItems, setExpandedItems] = useState<string[]>([]);++ const isExpanded = (id: string) => expandedItems.includes(id);++ // Derive parent-level checked state+ const tracking2dEnabled = charucoEnabled || skeletonEnabled;+ const reconstruction3dEnabled = triangulateEnabled || filterEnabled || rigidBodyEnabled;++ const handleToggle2dTracking = (checked: boolean) => {+ onCharucoToggle(checked);+ onSkeletonToggle(checked);+ };++ const handleToggle3dReconstruction = (checked: boolean) => {+ onTriangulateToggle(checked);+ onFilterToggle(checked);+ onRigidBodyToggle(checked);+ };++ return (+ <SimpleTreeView+ expandedItems={expandedItems}+ onExpandedItemsChange={(_, items) => setExpandedItems(items)}+ slots={{+ collapseIcon: ExpandMore,+ expandIcon: ChevronRight,+ }}+ >+ {/* ββ 2D Tracking ββ */}+ <PipelineStageTreeItem+ itemId="2d-tracking"+ label="2D Tracking"+ checked={tracking2dEnabled}+ onToggle={handleToggle2dTracking}+ disabled={disabled}+ disabledReason={disabledReason}+ isExpanded={isExpanded("2d-tracking")}+ summaryWhenCollapsed={+ [charucoEnabled && "Charuco", skeletonEnabled && "Skeleton"]+ .filter(Boolean)+ .join(" + ") || "Off"+ }+ >+ {/* Charuco */}+ <PipelineStageTreeItem+ itemId="2d-charuco"+ label="Charuco"+ checked={charucoEnabled}+ onToggle={onCharucoToggle}+ disabled={disabled}+ disabledReason={disabledReason}+ isExpanded={isExpanded("2d-charuco")}+ >+ <Box sx={{p: 1, pl: 2}}>+ <Typography variant="caption" color="text.secondary">+ Charuco board detection settings (uses calibration config)+ </Typography>+ </Box>+ </PipelineStageTreeItem>++ {/* Skeleton (MediaPipe) */}+ <PipelineStageTreeItem+ itemId="2d-skeleton"+ label="Skeleton"+ checked={skeletonEnabled}+ onToggle={onSkeletonToggle}+ disabled={disabled}+ disabledReason={disabledReason}+ isExpanded={isExpanded("2d-skeleton")}+ summaryWhenCollapsed={context === "realtime" ? "Realtime preset" : "Posthoc preset"}+ >+ <Box sx={{p: 1, pl: 2, borderLeft: `2px solid ${theme.palette.divider}`}}>+ <MediapipeConfigPanel />+ </Box>+ </PipelineStageTreeItem>+ </PipelineStageTreeItem>++ {/* ββ 3D Reconstruction ββ */}+ <PipelineStageTreeItem+ itemId="3d-reconstruction"+ label="3D Reconstruction"+ checked={reconstruction3dEnabled}+ onToggle={handleToggle3dReconstruction}+ disabled={disabled}+ disabledReason={disabledReason}+ isExpanded={isExpanded("3d-reconstruction")}+ summaryWhenCollapsed={+ [triangulateEnabled && "Triangulate", filterEnabled && "Filter", rigidBodyEnabled && "Skeleton"]+ .filter(Boolean)+ .join(" + ") || "Off"+ }+ >+ {/* Triangulate */}+ <PipelineStageTreeItem+ itemId="3d-triangulate"+ label="Triangulate"+ checked={triangulateEnabled}+ onToggle={onTriangulateToggle}+ disabled={disabled}+ disabledReason={disabledReason}+ isExpanded={isExpanded("3d-triangulate")}+ >+ <Box sx={{p: 1, pl: 2}}>+ <Typography variant="caption" color="text.secondary">+ Triangulation settings β calibration TOML picker and parameters (placeholder)+ </Typography>+ </Box>+ </PipelineStageTreeItem>++ {/* Filter */}+ <PipelineStageTreeItem+ itemId="3d-filter"+ label="Filter"+ checked={filterEnabled}+ onToggle={onFilterToggle}+ disabled={disabled}+ disabledReason={disabledReason}+ isExpanded={isExpanded("3d-filter")}+ summaryWhenCollapsed="One Euro, FABRIK"+ >+ <Box sx={{p: 1, pl: 2, borderLeft: `2px solid ${theme.palette.divider}`}}>+ <SkeletonFilterConfigPanel />+ </Box>+ </PipelineStageTreeItem>++ {/* Skeleton (rigid body) */}+ <PipelineStageTreeItem+ itemId="3d-skeleton"+ label="Skeleton"+ checked={rigidBodyEnabled}+ onToggle={onRigidBodyToggle}+ disabled={disabled}+ disabledReason={disabledReason}+ isExpanded={isExpanded("3d-skeleton")}+ >+ <Box sx={{p: 1, pl: 2}}>+ <Typography variant="caption" color="text.secondary">+ Rigid body and skeleton reconstruction parameters (placeholder)+ </Typography>+ </Box>+ </PipelineStageTreeItem>+ </PipelineStageTreeItem>+ </SimpleTreeView>+ );+};diff --git a/freemocap-ui/src/components/pipeline-config/PipelineStageTreeItem.tsx b/freemocap-ui/src/components/pipeline-config/PipelineStageTreeItem.tsxnew file mode 100644index 00000000..32b2c621--- /dev/null+++ b/freemocap-ui/src/components/pipeline-config/PipelineStageTreeItem.tsx@@ -0,0 +1,100 @@+import React from "react";+import {Box, Checkbox, Chip, Tooltip, Typography, useTheme} from "@mui/material";+import {TreeItem} from "@mui/x-tree-view/TreeItem";++interface PipelineStageTreeItemProps {+ itemId: string;+ label: string;+ checked: boolean;+ onToggle: (checked: boolean) => void;+ disabled?: boolean;+ disabledReason?: string;+ summaryWhenCollapsed?: string;+ isExpanded?: boolean;+ children?: React.ReactNode;+}++export const PipelineStageTreeItem: React.FC<PipelineStageTreeItemProps> = ({+ itemId,+ label,+ checked,+ onToggle,+ disabled = false,+ disabledReason,+ summaryWhenCollapsed,+ isExpanded = false,+ children,+}) => {+ const theme = useTheme();++ const handleCheckboxClick = (e: React.MouseEvent) => {+ e.stopPropagation();+ if (!disabled) {+ onToggle(!checked);+ }+ };++ const checkbox = (+ <Checkbox+ size="small"+ checked={checked}+ disabled={disabled}+ onClick={handleCheckboxClick}+ sx={{p: 0.5, flexShrink: 0}}+ />+ );++ const labelContent = (+ <Box+ sx={{+ display: "flex",+ alignItems: "center",+ py: 0.25,+ minHeight: 32,+ gap: 0.5,+ }}+ >+ {disabled && disabledReason ? (+ <Tooltip title={disabledReason} arrow>+ <span>{checkbox}</span>+ </Tooltip>+ ) : (+ checkbox+ )}++ <Typography+ variant="body2"+ sx={{+ flexShrink: 0,+ color: disabled+ ? theme.palette.text.disabled+ : theme.palette.text.primary,+ }}+ >+ {label}+ </Typography>++ {!isExpanded && summaryWhenCollapsed && (+ <Chip+ label={summaryWhenCollapsed}+ size="small"+ variant="outlined"+ sx={{+ ml: 0.5,+ height: 18,+ fontSize: 10,+ "& .MuiChip-label": {px: 0.75},+ borderColor: theme.palette.divider,+ color: theme.palette.text.secondary,+ }}+ />+ )}+ </Box>+ );++ return (+ <TreeItem itemId={itemId} label={labelContent}>+ {children}+ </TreeItem>+ );+};diff --git a/freemocap-ui/src/components/post-processing-panel/CalibrationSubsection.tsx b/freemocap-ui/src/components/post-processing-panel/CalibrationSubsection.tsxnew file mode 100644index 00000000..a8da8bcf--- /dev/null+++ b/freemocap-ui/src/components/post-processing-panel/CalibrationSubsection.tsx@@ -0,0 +1,397 @@+import React, {useCallback, useEffect, useMemo, useState} from "react";+import {+ Accordion,+ AccordionDetails,+ AccordionSummary,+ Alert,+ Box,+ Button,+ Checkbox,+ Chip,+ CircularProgress,+ FormControl,+ FormControlLabel,+ IconButton,+ InputAdornment,+ InputLabel,+ MenuItem,+ Select,+ Stack,+ TextField,+ Tooltip,+ Typography,+ useTheme,+} from "@mui/material";+import ExpandMoreIcon from "@mui/icons-material/ExpandMore";+import SquareFootIcon from "@mui/icons-material/SquareFoot";+import PlayArrowIcon from "@mui/icons-material/PlayArrow";+import StopIcon from "@mui/icons-material/Stop";+import FolderOpenIcon from "@mui/icons-material/FolderOpen";+import ClearIcon from "@mui/icons-material/Clear";+import CheckCircleIcon from "@mui/icons-material/CheckCircle";+import FiberManualRecordIcon from "@mui/icons-material/FiberManualRecord";+import RefreshIcon from "@mui/icons-material/Refresh";+import WarningAmberIcon from "@mui/icons-material/WarningAmber";+import CancelIcon from "@mui/icons-material/Cancel";+import {DirectoryStatusPanel} from "@/components/common/DirectoryStatusPanel";+import {useCalibration} from "@/hooks/useCalibration";+import {useDirectoryWatcher} from "@/hooks/useDirectoryWatcher";+import {useElectronIPC} from "@/services";+import {CalibrationSolverSection} from "@/components/calibration-control-panel/CalibrationSolverSection";++type BoardPreset = "5x3" | "7x5" | "custom";++interface BoardPresetConfig {+ xSquares: number;+ ySquares: number;+}++const BOARD_PRESETS: Record<Exclude<BoardPreset, "custom">, BoardPresetConfig> = {+ "5x3": {xSquares: 5, ySquares: 3},+ "7x5": {xSquares: 7, ySquares: 5},+};++export const CalibrationSubsection: React.FC = () => {+ const theme = useTheme();+ const [localError, setLocalError] = useState<string | null>(null);+ const {api} = useElectronIPC();++ const {+ config,+ error,+ isLoading,+ isRecording,+ recordingProgress,+ canStartRecording,+ canCalibrate,+ calibrationRecordingPath,+ directoryInfo,+ isUsingManualPath,+ updateCalibrationConfig,+ dispatchStopCalibrationRecording,+ dispatchStartCalibrationRecording,+ setManualRecordingPath,+ clearManualRecordingPath,+ validateDirectory,+ calibrateSelectedRecording,+ clearError,+ } = useCalibration();++ // Auto-poll directory status instead of requiring manual refresh+ const {triggerRefresh, isWatching} = useDirectoryWatcher(+ calibrationRecordingPath,+ validateDirectory,+ 3000,+ );++ const currentPreset = useMemo<BoardPreset>(() => {+ for (const [preset, presetConfig] of Object.entries(BOARD_PRESETS)) {+ if (+ presetConfig.xSquares === config.charucoBoardXSquares &&+ presetConfig.ySquares === config.charucoBoardYSquares+ ) {+ return preset as BoardPreset;+ }+ }+ return "custom";+ }, [config.charucoBoardXSquares, config.charucoBoardYSquares]);++ const handleClearError = useCallback((): void => {+ clearError();+ setLocalError(null);+ }, [clearError]);++ const handlePresetChange = useCallback(+ (preset: BoardPreset): void => {+ if (preset === "custom") return;+ const presetConfig = BOARD_PRESETS[preset];+ updateCalibrationConfig({+ charucoBoardXSquares: presetConfig.xSquares,+ charucoBoardYSquares: presetConfig.ySquares,+ });+ },+ [updateCalibrationConfig],+ );++ const handleSelectDirectory = async (): Promise<void> => {+ if (!api) return;+ try {+ const result: string | null = await api.fileSystem.selectDirectory.mutate();+ if (result) {+ await setManualRecordingPath(result);+ }+ } catch (err) {+ console.error("Failed to select directory:", err);+ setLocalError("Failed to select directory");+ }+ };++ const handlePathInputChange = async (+ e: React.ChangeEvent<HTMLInputElement>,+ ): Promise<void> => {+ const newPath: string = e.target.value;+ if (newPath.includes("~") && api) {+ try {+ const home: string = await api.fileSystem.getHomeDirectory.query();+ const expanded: string = newPath.replace(/^~([/\\])?/, home ? `${home}$1` : "");+ await setManualRecordingPath(expanded);+ } catch {+ await setManualRecordingPath(newPath);+ }+ } else {+ await setManualRecordingPath(newPath);+ }+ };++ const calibStatus: "ok" | "none" | "bad" = useMemo(() => {+ if (directoryInfo?.cameraCalibrationTomlPath) return "ok";+ if (!calibrationRecordingPath || !directoryInfo) return "none";+ return "bad";+ }, [directoryInfo, calibrationRecordingPath]);++ const displayError = error || localError || directoryInfo?.errorMessage;++ const statusLabel = isRecording+ ? `Recording ${recordingProgress.toFixed(0)}%`+ : isLoading+ ? "Processing..."+ : directoryInfo?.cameraCalibrationTomlPath+ ? "Calibrated"+ : "Idle";++ const statusColor = isRecording+ ? theme.palette.error.main+ : isLoading+ ? theme.palette.warning.main+ : directoryInfo?.cameraCalibrationTomlPath+ ? theme.palette.success.main+ : theme.palette.grey[600];++ return (+ <Accordion defaultExpanded={false} disableGutters>+ <AccordionSummary+ expandIcon={<ExpandMoreIcon />}+ sx={{+ minHeight: 40,+ "& .MuiAccordionSummary-content": {+ alignItems: "center",+ gap: 1,+ my: 0.5,+ },+ }}+ >+ <SquareFootIcon fontSize="small" sx={{color: theme.palette.text.secondary}} />+ <Typography variant="subtitle2">Capture Volume Calibration</Typography>+ <Chip+ label={statusLabel}+ size="small"+ sx={{+ ml: "auto",+ height: 20,+ fontSize: 11,+ fontWeight: 600,+ backgroundColor: statusColor,+ color: theme.palette.getContrastText(statusColor),+ }}+ />+ </AccordionSummary>+ <AccordionDetails sx={{p: 2}}>+ <Stack spacing={2}>+ {displayError && (+ <Alert severity="error" onClose={handleClearError}>+ {displayError}+ </Alert>+ )}++ <FormControlLabel+ control={+ <Checkbox+ checked={config.liveTrackCharuco}+ onChange={(e) =>+ updateCalibrationConfig({liveTrackCharuco: e.target.checked})+ }+ disabled={isLoading}+ />+ }+ label="Live Track Charuco Board"+ />++ {/* Recording Controls */}+ <Stack direction="row" spacing={2}>+ <Button+ variant="contained"+ color="primary"+ startIcon={<PlayArrowIcon />}+ onClick={dispatchStartCalibrationRecording}+ disabled={!canStartRecording || isLoading}+ fullWidth+ >+ Start Calibration Recording+ </Button>+ {isRecording && (+ <Button+ variant="contained"+ color="error"+ startIcon={<StopIcon />}+ onClick={dispatchStopCalibrationRecording}+ disabled={isLoading}+ fullWidth+ >+ Stop Recording+ </Button>+ )}+ </Stack>++ {/* Recording Path Input */}+ <TextField+ label="Calibration Recording Path"+ value={calibrationRecordingPath}+ onChange={handlePathInputChange}+ fullWidth+ size="small"+ helperText={isUsingManualPath ? "Using custom path" : "Using default recording directory"}+ InputProps={{+ endAdornment: (+ <InputAdornment position="end">+ {isUsingManualPath && (+ <Tooltip title="Clear manual path (revert to default)">+ <IconButton onClick={clearManualRecordingPath} edge="end" size="small">+ <ClearIcon fontSize="small" />+ </IconButton>+ </Tooltip>+ )}+ <Tooltip title="Re-check calibration folder">+ <span>+ <IconButton+ onClick={triggerRefresh}+ edge="end"+ size="small"+ disabled={!calibrationRecordingPath || isLoading}+ >+ <RefreshIcon fontSize="small" />+ </IconButton>+ </span>+ </Tooltip>+ <Tooltip title="Select directory">+ <IconButton onClick={handleSelectDirectory} edge="end">+ <FolderOpenIcon />+ </IconButton>+ </Tooltip>+ </InputAdornment>+ ),+ }}+ />++ {/* Directory Status (auto-refreshing via useDirectoryWatcher) */}+ <DirectoryStatusPanel+ title="Calibration Folder Status"+ tomlLabel="Has calibration TOML"+ directoryInfo={directoryInfo ? {+ ...directoryInfo,+ tomlPath: directoryInfo.cameraCalibrationTomlPath,+ } : null}+ status={calibStatus}+ onRefresh={triggerRefresh}+ refreshDisabled={!calibrationRecordingPath || isLoading}+ isRefreshing={false}+ />++ {/* Board Size Configuration */}+ <Stack direction="row" spacing={2}>+ <FormControl size="small" sx={{minWidth: 140}}>+ <InputLabel id="board-preset-label">Preset</InputLabel>+ <Select+ labelId="board-preset-label"+ value={currentPreset}+ label="Preset"+ onChange={(e) => handlePresetChange(e.target.value as BoardPreset)}+ disabled={isLoading}+ >+ <MenuItem value="5x3">5Γ3</MenuItem>+ <MenuItem value="7x5">7Γ5</MenuItem>+ <MenuItem value="custom">Custom</MenuItem>+ </Select>+ </FormControl>+ <TextField+ label="X Squares"+ type="number"+ value={config.charucoBoardXSquares}+ onChange={(e) => {+ const v = parseInt(e.target.value, 10);+ if (!isNaN(v) && v > 0) updateCalibrationConfig({charucoBoardXSquares: v});+ }}+ disabled={isLoading}+ size="small"+ sx={{flex: 1}}+ inputProps={{min: 2, max: 20}}+ />+ <TextField+ label="Y Squares"+ type="number"+ value={config.charucoBoardYSquares}+ onChange={(e) => {+ const v = parseInt(e.target.value, 10);+ if (!isNaN(v) && v > 0) updateCalibrationConfig({charucoBoardYSquares: v});+ }}+ disabled={isLoading}+ size="small"+ sx={{flex: 1}}+ inputProps={{min: 2, max: 20}}+ />+ </Stack>++ <TextField+ label="Square Length (mm)"+ type="number"+ value={config.charucoSquareLength}+ onChange={(e) =>+ updateCalibrationConfig({charucoSquareLength: parseFloat(e.target.value) || 0})+ }+ disabled={isLoading}+ size="small"+ fullWidth+ inputProps={{min: 1, step: 0.1}}+ />++ <CalibrationSolverSection />++ {isRecording && (+ <Box sx={{width: "100%"}}>+ <Typography variant="caption" color="text.secondary" gutterBottom>+ Recording in Progress: {recordingProgress.toFixed(0)}%+ </Typography>+ <Box+ sx={{+ width: "100%",+ height: 8,+ bgcolor: "grey.300",+ borderRadius: 1,+ overflow: "hidden",+ }}+ >+ <Box+ sx={{+ width: `${recordingProgress}%`,+ height: "100%",+ bgcolor: theme.palette.primary.main,+ transition: "width 0.3s",+ }}+ />+ </Box>+ </Box>+ )}++ <Button+ variant="contained"+ color="secondary"+ onClick={calibrateSelectedRecording}+ disabled={!canCalibrate || isLoading}+ fullWidth+ >+ Calibrate Selected Recording+ </Button>+ </Stack>+ </AccordionDetails>+ </Accordion>+ );+};diff --git a/freemocap-ui/src/components/post-processing-panel/MocapSubsection.tsx b/freemocap-ui/src/components/post-processing-panel/MocapSubsection.tsxnew file mode 100644index 00000000..6e5aee66--- /dev/null+++ b/freemocap-ui/src/components/post-processing-panel/MocapSubsection.tsx@@ -0,0 +1,368 @@+import React, {useCallback, useMemo, useState} from "react";+import {+ Accordion,+ AccordionDetails,+ AccordionSummary,+ Alert,+ Box,+ Button,+ Chip,+ IconButton,+ InputAdornment,+ Stack,+ TextField,+ Tooltip,+ Typography,+ useTheme,+} from "@mui/material";+import ExpandMoreIcon from "@mui/icons-material/ExpandMore";+import DirectionsRunIcon from "@mui/icons-material/DirectionsRun";+import PlayArrowIcon from "@mui/icons-material/PlayArrow";+import StopIcon from "@mui/icons-material/Stop";+import FolderOpenIcon from "@mui/icons-material/FolderOpen";+import ClearIcon from "@mui/icons-material/Clear";+import RefreshIcon from "@mui/icons-material/Refresh";+import {DirectoryStatusPanel} from "@/components/common/DirectoryStatusPanel";+import {CalibrationTomlPicker} from "@/components/pipeline-config/CalibrationTomlPicker";+import {PipelineConfigTree} from "@/components/pipeline-config/PipelineConfigTree";+import {useMocap} from "@/hooks/useMocap";+import {useCalibration} from "@/hooks/useCalibration";+import {useDirectoryWatcher} from "@/hooks/useDirectoryWatcher";+import {useElectronIPC} from "@/services";++export const MocapSubsection: React.FC = () => {+ const theme = useTheme();+ const [localError, setLocalError] = useState<string | null>(null);+ const {api, isElectron} = useElectronIPC();++ const {+ error,+ isLoading,+ isRecording,+ recordingProgress,+ canStartRecording,+ canProcessMocapRecording,+ mocapRecordingPath,+ directoryInfo,+ isUsingManualPath,+ dispatchStopMocapRecording,+ dispatchStartMocapRecording,+ setManualRecordingPath,+ clearManualRecordingPath,+ dispatchProcessMocapRecording,+ validateDirectory,+ calibrationTomlPath,+ setCalibrationTomlPath,+ clearCalibrationTomlPath,+ clearError,+ } = useMocap();++ const {+ directoryInfo: calibrationDirectoryInfo,+ } = useCalibration();++ // Auto-poll directory status+ const {triggerRefresh} = useDirectoryWatcher(+ mocapRecordingPath,+ validateDirectory,+ 3000,+ );++ // Pipeline stage toggles (local state β posthoc pipeline stages)+ const [charucoEnabled, setCharucoEnabled] = useState(false);+ const [skeletonEnabled, setSkeletonEnabled] = useState(true);+ const [triangulateEnabled, setTriangulateEnabled] = useState(true);+ const [filterEnabled, setFilterEnabled] = useState(true);+ const [rigidBodyEnabled, setRigidBodyEnabled] = useState(true);++ const handleClearError = useCallback((): void => {+ clearError();+ setLocalError(null);+ }, [clearError]);++ const handleSelectDirectory = async (): Promise<void> => {+ if (!isElectron || !api) return;+ try {+ const result: string | null = await api.fileSystem.selectDirectory.mutate();+ if (result) {+ await setManualRecordingPath(result);+ }+ } catch (err) {+ console.error("Failed to select directory:", err);+ setLocalError("Failed to select directory");+ }+ };++ const handlePathInputChange = async (+ e: React.ChangeEvent<HTMLInputElement>,+ ): Promise<void> => {+ const newPath: string = e.target.value;+ if (newPath.includes("~") && isElectron && api) {+ try {+ const home: string = await api.fileSystem.getHomeDirectory.query();+ const expanded: string = newPath.replace(/^~([/\\])?/, home ? `${home}$1` : "");+ await setManualRecordingPath(expanded);+ } catch {+ await setManualRecordingPath(newPath);+ }+ } else {+ await setManualRecordingPath(newPath);+ }+ };++ const handleSelectCalibrationToml = async (): Promise<void> => {+ if (!isElectron || !api) return;+ try {+ const result: string | null = await api.fileSystem.selectTomlFile.mutate();+ if (result) {+ setCalibrationTomlPath(result);+ }+ } catch (err) {+ console.error("Failed to select TOML file:", err);+ setLocalError("Failed to select TOML file");+ }+ };++ const effectiveCalibrationTomlPath = useMemo(() => {+ if (calibrationTomlPath) return calibrationTomlPath;+ if (directoryInfo?.cameraMocapTomlPath) return directoryInfo.cameraMocapTomlPath;+ if (calibrationDirectoryInfo?.cameraCalibrationTomlPath) return calibrationDirectoryInfo.cameraCalibrationTomlPath;+ return null;+ }, [calibrationTomlPath, directoryInfo?.cameraMocapTomlPath, calibrationDirectoryInfo?.cameraCalibrationTomlPath]);++ const tomlSource = useMemo(() => {+ if (calibrationTomlPath) return "manual" as const;+ if (directoryInfo?.cameraMocapTomlPath) return "auto" as const;+ if (calibrationDirectoryInfo?.cameraCalibrationTomlPath) return "calibration-panel" as const;+ return "auto" as const;+ }, [calibrationTomlPath, directoryInfo?.cameraMocapTomlPath, calibrationDirectoryInfo?.cameraCalibrationTomlPath]);++ const mocapStatus: "ok" | "none" | "bad" = useMemo(() => {+ if (effectiveCalibrationTomlPath) return "ok";+ if (!mocapRecordingPath || !directoryInfo) return "none";+ return "bad";+ }, [effectiveCalibrationTomlPath, mocapRecordingPath, directoryInfo]);++ const displayError = error || localError || directoryInfo?.errorMessage;++ // Derive recording ID from path (last folder name)+ const recordingId = useMemo(() => {+ if (!mocapRecordingPath) return null;+ const parts = mocapRecordingPath.replace(/[/\\]+$/, "").split(/[/\\]/);+ return parts[parts.length - 1] || null;+ }, [mocapRecordingPath]);++ const statusLabel = isRecording+ ? `Recording ${recordingProgress.toFixed(0)}%`+ : isLoading+ ? "Processing..."+ : effectiveCalibrationTomlPath+ ? "Ready"+ : "Idle";++ const statusColor = isRecording+ ? theme.palette.error.main+ : isLoading+ ? theme.palette.warning.main+ : effectiveCalibrationTomlPath+ ? theme.palette.success.main+ : theme.palette.grey[600];++ return (+ <Accordion defaultExpanded={false} disableGutters>+ <AccordionSummary+ expandIcon={<ExpandMoreIcon />}+ sx={{+ minHeight: 40,+ "& .MuiAccordionSummary-content": {+ alignItems: "center",+ gap: 1,+ my: 0.5,+ },+ }}+ >+ <DirectionsRunIcon fontSize="small" sx={{color: theme.palette.text.secondary}} />+ <Typography variant="subtitle2">Motion Capture</Typography>+ <Chip+ label={statusLabel}+ size="small"+ sx={{+ ml: "auto",+ height: 20,+ fontSize: 11,+ fontWeight: 600,+ backgroundColor: statusColor,+ color: theme.palette.getContrastText(statusColor),+ }}+ />+ </AccordionSummary>+ <AccordionDetails sx={{p: 2}}>+ <Stack spacing={2}>+ {/* Process button at TOP per requirements */}+ <Button+ variant="contained"+ color="secondary"+ onClick={dispatchProcessMocapRecording}+ disabled={!canProcessMocapRecording || isLoading}+ fullWidth+ >+ Process Selected Recording+ </Button>++ {displayError && (+ <Alert severity="error" onClose={handleClearError}>+ {displayError}+ </Alert>+ )}++ {/* Recording ID β prominent at top level */}+ {recordingId && (+ <Box sx={{+ p: 1,+ borderRadius: 1,+ bgcolor: theme.palette.action.hover,+ }}>+ <Typography variant="caption" color="text.secondary">+ Recording ID+ </Typography>+ <Typography variant="body2" sx={{fontFamily: "monospace", fontWeight: 600}}>+ {recordingId}+ </Typography>+ </Box>+ )}++ {/* Recording Controls */}+ <Stack direction="row" spacing={2}>+ <Button+ variant="contained"+ color="primary"+ startIcon={<PlayArrowIcon />}+ onClick={dispatchStartMocapRecording}+ disabled={!canStartRecording || isLoading}+ fullWidth+ >+ Start Mocap Recording+ </Button>+ {isRecording && (+ <Button+ variant="contained"+ color="error"+ startIcon={<StopIcon />}+ onClick={dispatchStopMocapRecording}+ disabled={isLoading}+ fullWidth+ >+ Stop Recording+ </Button>+ )}+ </Stack>++ {/* Recording Path Input */}+ <TextField+ label="Mocap Recording Path"+ value={mocapRecordingPath}+ onChange={handlePathInputChange}+ fullWidth+ size="small"+ helperText={isUsingManualPath ? "Using custom path" : "Using default recording directory"}+ InputProps={{+ endAdornment: (+ <InputAdornment position="end">+ {isUsingManualPath && (+ <Tooltip title="Clear manual path (revert to default)">+ <IconButton onClick={clearManualRecordingPath} edge="end" size="small">+ <ClearIcon fontSize="small" />+ </IconButton>+ </Tooltip>+ )}+ <Tooltip title="Re-check folder">+ <span>+ <IconButton+ onClick={triggerRefresh}+ edge="end"+ size="small"+ disabled={!mocapRecordingPath || isLoading}+ >+ <RefreshIcon fontSize="small" />+ </IconButton>+ </span>+ </Tooltip>+ <Tooltip title="Select directory">+ <IconButton onClick={handleSelectDirectory} edge="end" disabled={!isElectron}>+ <FolderOpenIcon />+ </IconButton>+ </Tooltip>+ </InputAdornment>+ ),+ }}+ />++ {/* Directory Status (auto-refreshing) */}+ <DirectoryStatusPanel+ title="Mocap Folder Status"+ tomlLabel="Has calibration TOML"+ directoryInfo={directoryInfo ? {+ ...directoryInfo,+ tomlPath: directoryInfo.cameraMocapTomlPath,+ } : null}+ status={mocapStatus}+ onRefresh={triggerRefresh}+ refreshDisabled={!mocapRecordingPath || isLoading}+ isRefreshing={false}+ />++ {/* Calibration TOML β redesigned compact picker */}+ <CalibrationTomlPicker+ tomlPath={effectiveCalibrationTomlPath}+ source={tomlSource}+ onSelect={handleSelectCalibrationToml}+ onUseAutoDetected={clearCalibrationTomlPath}+ disabled={!isElectron}+ />++ {/* Recording Progress */}+ {isRecording && (+ <Box sx={{width: "100%"}}>+ <Typography variant="caption" color="text.secondary" gutterBottom>+ Recording in Progress: {recordingProgress.toFixed(0)}%+ </Typography>+ <Box+ sx={{+ width: "100%",+ height: 8,+ bgcolor: "grey.300",+ borderRadius: 1,+ overflow: "hidden",+ }}+ >+ <Box+ sx={{+ width: `${recordingProgress}%`,+ height: "100%",+ bgcolor: theme.palette.primary.main,+ transition: "width 0.3s",+ }}+ />+ </Box>+ </Box>+ )}++ {/* Hierarchical pipeline config (replaces flat MediapipeConfigPanel + SkeletonFilterConfigPanel) */}+ <PipelineConfigTree+ context="posthoc"+ charucoEnabled={charucoEnabled}+ onCharucoToggle={setCharucoEnabled}+ skeletonEnabled={skeletonEnabled}+ onSkeletonToggle={setSkeletonEnabled}+ triangulateEnabled={triangulateEnabled}+ onTriangulateToggle={setTriangulateEnabled}+ filterEnabled={filterEnabled}+ onFilterToggle={setFilterEnabled}+ rigidBodyEnabled={rigidBodyEnabled}+ onRigidBodyToggle={setRigidBodyEnabled}+ />+ </Stack>+ </AccordionDetails>+ </Accordion>+ );+};diff --git a/freemocap-ui/src/components/post-processing-panel/PostProcessingPanel.tsx b/freemocap-ui/src/components/post-processing-panel/PostProcessingPanel.tsxnew file mode 100644index 00000000..f0185b90--- /dev/null+++ b/freemocap-ui/src/components/post-processing-panel/PostProcessingPanel.tsx@@ -0,0 +1,21 @@+import React from "react";+import {Box} from "@mui/material";+import BuildIcon from "@mui/icons-material/Build";+import {CollapsibleSidebarSection} from "@/components/common/CollapsibleSidebarSection";+import {CalibrationSubsection} from "@/components/post-processing-panel/CalibrationSubsection";+import {MocapSubsection} from "@/components/post-processing-panel/MocapSubsection";++export const PostProcessingPanel: React.FC = () => {+ return (+ <CollapsibleSidebarSection+ icon={<BuildIcon sx={{color: "inherit"}} />}+ title="Post Processing"+ defaultExpanded={false}+ >+ <Box sx={{p: 1}}>+ <CalibrationSubsection />+ <MocapSubsection />+ </Box>+ </CollapsibleSidebarSection>+ );+};diff --git a/freemocap-ui/src/components/processing-pipeline-panel/ProcessingPipelinePanel.tsx b/freemocap-ui/src/components/processing-pipeline-panel/ProcessingPipelinePanel.tsxindex 60250ec7..0bc5e19e 100644--- a/freemocap-ui/src/components/processing-pipeline-panel/ProcessingPipelinePanel.tsx+++ b/freemocap-ui/src/components/processing-pipeline-panel/ProcessingPipelinePanel.tsx@@ -1,17 +1,15 @@-import React from "react";-import {Box, FormControlLabel, Stack, Switch, Typography, useTheme} from "@mui/material";+import React, {useState} from "react";+import {Box, Typography} from "@mui/material";import LanIcon from "@mui/icons-material/Lan";import {CollapsibleSidebarSection} from "@/components/common/CollapsibleSidebarSection";import {PipelineConnectionToggle} from "@/components/processing-pipeline-panel/PipelineConnectionToggle";import {PipelineSummary} from "@/components/processing-pipeline-panel/PipelineSummary";import {useAppSelector} from "@/store/hooks";import {selectBackendPipeline} from "@/store/slices/settings";-import {MediapipeConfigPanel} from "@/components/mocap-control-panel/MediapipeConfigPanel";-import {SkeletonFilterConfigPanel} from "@/components/mocap-control-panel/SkeletonFilterConfigPanel";+import {PipelineConfigTree} from "@/components/pipeline-config/PipelineConfigTree";import {useServer} from "@/services";export const ProcessingPipelinePanel: React.FC = () => {- const theme = useTheme();const {send, isConnected} = useServer();const backendPipeline = useAppSelector(selectBackendPipeline);@@ -19,29 +17,15 @@ export const ProcessingPipelinePanel: React.FC = () => {const isPipelineConnected = backendPipeline?.is_connected ?? false;const canToggle = isConnected && isPipelineConnected;- const handleToggleCalibrationDetection = (_: React.ChangeEvent, checked: boolean) => {- send({- message_type: "settings/patch",- patch: {- pipeline: {- config: {- calibration_detection_enabled: checked,- },- },- },- });- };+ // 3D Reconstruction toggles β local state until backend support is added+ const [triangulateEnabled, setTriangulateEnabled] = useState(false);+ const [filterEnabled, setFilterEnabled] = useState(false);+ const [rigidBodyEnabled, setRigidBodyEnabled] = useState(false);- const handleToggleMocapDetection = (_: React.ChangeEvent, checked: boolean) => {+ const patchPipelineConfig = (patch: Record<string, unknown>) => {send({message_type: "settings/patch",- patch: {- pipeline: {- config: {- mocap_detection_enabled: checked,- },- },- },+ patch: {pipeline: {config: patch}},});};@@ -54,60 +38,26 @@ export const ProcessingPipelinePanel: React.FC = () => {defaultExpanded={false}><Box sx={{p: 2}}>- <Stack spacing={2}>- {/* Detection toggles β always visible, disabled when pipeline not connected */}- <Typography- variant="subtitle2"- sx={{color: theme.palette.text.secondary, fontWeight: 600}}- >- Detection Stages+ {!isPipelineConnected && (+ <Typography variant="caption" color="text.secondary" sx={{fontStyle: "italic", mb: 1, display: "block"}}>+ Connect a pipeline to enable detection toggles.</Typography>- {!isPipelineConnected && (- <Typography variant="caption" color="text.secondary" sx={{fontStyle: "italic"}}>- Connect a pipeline to enable detection toggles.- </Typography>- )}- <FormControlLabel- control={- <Switch- size="small"- checked={pipelineConfig?.calibration_detection_enabled ?? true}- onChange={handleToggleCalibrationDetection}- disabled={!canToggle}- />- }- label={- <Typography variant="body2">- Charuco Detection (Calibration)- </Typography>- }- />- <FormControlLabel- control={- <Switch- size="small"- checked={pipelineConfig?.mocap_detection_enabled ?? true}- onChange={handleToggleMocapDetection}- disabled={!canToggle}- />- }- label={- <Typography variant="body2">- MediaPipe Detection (MoCap)- </Typography>- }- />-- {/* MediaPipe config β always visible */}- <Box sx={{mt: 1, pl: 1, borderLeft: `2px solid ${theme.palette.divider}`}}>- <MediapipeConfigPanel />- </Box>-- {/* Skeleton filter config β always visible */}- <Box sx={{mt: 1, pl: 1, borderLeft: `2px solid ${theme.palette.divider}`}}>- <SkeletonFilterConfigPanel />- </Box>- </Stack>+ )}+ <PipelineConfigTree+ context="realtime"+ charucoEnabled={pipelineConfig?.calibration_detection_enabled ?? true}+ onCharucoToggle={(v) => patchPipelineConfig({calibration_detection_enabled: v})}+ skeletonEnabled={pipelineConfig?.mocap_detection_enabled ?? true}+ onSkeletonToggle={(v) => patchPipelineConfig({mocap_detection_enabled: v})}+ triangulateEnabled={triangulateEnabled}+ onTriangulateToggle={setTriangulateEnabled}+ filterEnabled={filterEnabled}+ onFilterToggle={setFilterEnabled}+ rigidBodyEnabled={rigidBodyEnabled}+ onRigidBodyToggle={setRigidBodyEnabled}+ disabled={!canToggle}+ disabledReason="Connect a pipeline to enable detection toggles"+ /></Box></CollapsibleSidebarSection>);diff --git a/freemocap-ui/src/components/ui-components/LeftSidePanelContent.tsx b/freemocap-ui/src/components/ui-components/LeftSidePanelContent.tsxindex bc5a3560..4ac6ad9e 100644--- a/freemocap-ui/src/components/ui-components/LeftSidePanelContent.tsx+++ b/freemocap-ui/src/components/ui-components/LeftSidePanelContent.tsx@@ -28,8 +28,7 @@ import { SortableSectionWrapper } from '@/components/common/SortableSectionWrappimport { ServerConnectionStatus } from '@/components/ServerConnectionStatus';import { ProcessingPipelinePanel } from '@/components/processing-pipeline-panel/ProcessingPipelinePanel';import { CameraConfigTreeView } from '@/components/camera-config-tree-view/CameraConfigTreeView';-import { CalibrationControlPanel } from '@/components/calibration-control-panel/CalibrationControlPanel';-import { MocapTaskTreeItem } from '@/components/mocap-control-panel/MocapTaskTreeItem';+import { PostProcessingPanel } from '@/components/post-processing-panel/PostProcessingPanel';import {RecordingInfoPanel} from "@/components/recording-info-panel/RecordingInfoPanel";const STORAGE_KEY = 'freemocap-sidebar-section-order';@@ -39,8 +38,7 @@ const DEFAULT_SECTION_ORDER = ['cameras','recording','pipeline',- 'calibration',- 'mocap',+ 'postprocessing',] as const;type SectionId = (typeof DEFAULT_SECTION_ORDER)[number];@@ -50,8 +48,7 @@ const SECTION_COMPONENTS: Record<SectionId, React.FC> = {pipeline: ProcessingPipelinePanel,cameras: CameraConfigTreeView,recording: RecordingInfoPanel,- calibration: CalibrationControlPanel,- mocap: MocapTaskTreeItem,+ postprocessing: PostProcessingPanel,};function loadSectionOrder(): SectionId[] {diff --git a/freemocap-ui/src/components/viewport3d/SkeletonRenderer.tsx b/freemocap-ui/src/components/viewport3d/SkeletonRenderer.tsxindex f5b0f899..58c6c611 100644--- a/freemocap-ui/src/components/viewport3d/SkeletonRenderer.tsx+++ b/freemocap-ui/src/components/viewport3d/SkeletonRenderer.tsx@@ -35,10 +35,9 @@ const FAR_AWAY = new Vector3(10000, 10000, 10000);*/export function SkeletonRenderer() {const { subscribeToTrackedPoints } = useServer();+ // Mutable refs for frame-loop access without triggering React re-rendersconst instancedMeshRef = useRef<InstancedMesh>(null);const lineSegmentsRef = useRef<LineSegments>(null);-- // Mutable refs for frame-loop access without triggering React re-rendersconst trackedPointsRef = useRef<Map<string, Point3d>>(new Map());const pointNameToIndexRef = useRef<Map<string, number>>(new Map());const indexToPointNameRef = useRef<Map<number, string>>(new Map());diff --git a/freemocap-ui/src/components/viewport3d/Viewport3dPage.tsx b/freemocap-ui/src/components/viewport3d/Viewport3dPage.tsxdeleted file mode 100644index b5964d1e..00000000--- a/freemocap-ui/src/components/viewport3d/Viewport3dPage.tsx+++ /dev/null@@ -1,13 +0,0 @@-import {Box} from "@mui/material";-import React from "react";-import {ThreeJsCanvas} from "@/components/viewport3d/ThreeJsCanvas";-import {VMCPanel} from "@/components/viewport3d/VMCPanel";--export const Viewport3dPage = () => {- return (- <Box sx={{width: '100%', height: '100%', position: 'relative'}}>- <ThreeJsCanvas/>- <VMCPanel/>- </Box>- );-}diff --git a/freemocap-ui/src/hooks/useDirectoryWatcher.ts b/freemocap-ui/src/hooks/useDirectoryWatcher.tsnew file mode 100644index 00000000..d95d4daa--- /dev/null+++ b/freemocap-ui/src/hooks/useDirectoryWatcher.ts@@ -0,0 +1,54 @@+import {useCallback, useEffect, useRef, useState} from "react";++interface UseDirectoryWatcherResult {+ isWatching: boolean;+ lastChecked: Date | null;+ triggerRefresh: () => void;+}++/**+ * Polls a directory validation function on an interval.+ * Replaces manual "click refresh" patterns with automatic watching.+ */+export function useDirectoryWatcher(+ path: string | null,+ validateFn: (path: string) => Promise<void>,+ intervalMs = 3000,+): UseDirectoryWatcherResult {+ const [lastChecked, setLastChecked] = useState<Date | null>(null);+ const intervalRef = useRef<ReturnType<typeof setInterval> | null>(null);++ const doValidate = useCallback(async () => {+ if (!path) return;+ await validateFn(path);+ setLastChecked(new Date());+ }, [path, validateFn]);++ useEffect(() => {+ if (!path) {+ if (intervalRef.current) {+ clearInterval(intervalRef.current);+ intervalRef.current = null;+ }+ return;+ }++ // Initial check+ doValidate();++ intervalRef.current = setInterval(doValidate, intervalMs);++ return () => {+ if (intervalRef.current) {+ clearInterval(intervalRef.current);+ intervalRef.current = null;+ }+ };+ }, [path, intervalMs, doValidate]);++ return {+ isWatching: !!path,+ lastChecked,+ triggerRefresh: doValidate,+ };+}diff --git a/freemocap-ui/src/pages/CamerasPage.tsx b/freemocap-ui/src/pages/CamerasPage.tsxindex 45fa3cce..12b68723 100644--- a/freemocap-ui/src/pages/CamerasPage.tsx+++ b/freemocap-ui/src/pages/CamerasPage.tsx@@ -1,24 +1,40 @@-import React, { useState, useCallback } from 'react';+import React, {useState, useCallback} from 'react';import Box from "@mui/material/Box";import ErrorBoundary from "@/components/common/ErrorBoundary";-import { Footer } from "@/components/ui-components/Footer";-import { useTheme } from "@mui/material/styles";-import { CameraViewsGrid } from "@/components/camera-views/CameraViewsGrid";-import { CamerasViewSettingsOverlay } from "@/components/camera-view-settings-overlay/CamerasViewSettingsOverlay";+import {Footer} from "@/components/ui-components/Footer";+import {useTheme} from "@mui/material/styles";+import {CameraViewsGrid} from "@/components/camera-views/CameraViewsGrid";+import {CamerasViewSettingsOverlay} from "@/components/camera-view-settings-overlay/CamerasViewSettingsOverlay";+import {Panel, PanelGroup, PanelResizeHandle} from "react-resizable-panels";+import {ThreeJsCanvas} from "@/components/viewport3d/ThreeJsCanvas";++export type LayoutDirection = 'vertical' | 'horizontal';++export interface CameraSettings {+ columns: number | null;+ show3dView: boolean;+ layoutDirection: LayoutDirection;+}export const CamerasPage = () => {const theme = useTheme();- const [manualColumns, setManualColumns] = useState<number | null>(null);const [resetKey, setResetKey] = useState<number>(0);+ const [settings, setSettings] = useState<CameraSettings>({+ columns: null,+ show3dView: true,+ layoutDirection: 'horizontal',+ });- const handleSettingsChange = useCallback((settings: { columns: number | null }) => {- setManualColumns(settings.columns);+ const handleSettingsChange = useCallback((partial: Partial<CameraSettings>) => {+ setSettings((prev) => ({...prev, ...partial}));}, []);const handleResetLayout = useCallback(() => {setResetKey((v) => v + 1);}, []);+ const isHorizontal = settings.layoutDirection === 'horizontal';+return (<React.Fragment><Box sx={{@@ -36,20 +52,83 @@ export const CamerasPage = () => {position: 'relative',}}><CamerasViewSettingsOverlay+ settings={settings}onSettingsChange={handleSettingsChange}onResetLayout={handleResetLayout}/>- <Box sx={{ flex: 1, position: 'relative', overflow: 'hidden' }}>- <ErrorBoundary>- <CameraViewsGrid- manualColumns={manualColumns}- resetKey={resetKey}- />- </ErrorBoundary>+ <Box sx={{flex: 1, overflow: 'hidden'}}>+ {settings.show3dView ? (+ <PanelGroup+ key={`main-panels-${resetKey}-${settings.layoutDirection}`}+ direction={settings.layoutDirection}+ >+ {/* Camera Grid View Panel */}+ <Panel defaultSize={75} minSize={20}>+ <Box sx={{height: '100%', overflow: 'auto'}}>+ <ErrorBoundary>+ <CameraViewsGrid manualColumns={settings.columns} resetKey={resetKey}/>+ </ErrorBoundary>+ </Box>+ </Panel>++ {/* Resize Handle β direction-aware sizing and drag indicator */}+ <PanelResizeHandle>+ <Box+ sx={{+ display: 'flex',+ alignItems: 'center',+ justifyContent: 'center',+ backgroundColor: theme.palette.divider,+ transition: 'background-color 0.15s ease',+ cursor: isHorizontal ? 'col-resize' : 'row-resize',+ ...(isHorizontal+ ? {width: '6px', height: '100%', flexDirection: 'column'}+ : {height: '6px', width: '100%', flexDirection: 'row'}+ ),+ '&:hover': {+ backgroundColor: theme.palette.primary.main,+ },+ '&:active': {+ backgroundColor: theme.palette.primary.dark,+ },+ }}+ >+ {/* Drag grip dots */}+ {[0, 1, 2].map((i) => (+ <Box+ key={i}+ sx={{+ width: isHorizontal ? 4 : 4,+ height: isHorizontal ? 4 : 4,+ borderRadius: '50%',+ backgroundColor: theme.palette.text.disabled,+ m: isHorizontal ? '2px 0' : '0 2px',+ flexShrink: 0,+ }}+ />+ ))}+ </Box>+ </PanelResizeHandle>++ {/* 3D View Panel */}+ <Panel defaultSize={25} minSize={10}>+ <Box sx={{height: '100%'}}>+ <ThreeJsCanvas/>+ </Box>+ </Panel>+ </PanelGroup>+ ) : (+ <Box sx={{height: '100%', overflow: 'auto'}}>+ <ErrorBoundary>+ <CameraViewsGrid manualColumns={settings.columns} resetKey={resetKey}/>+ </ErrorBoundary>+ </Box>+ )}</Box>- <Box component="footer" sx={{ p: 1, flexShrink: 0 }}>- <Footer />++ <Box component="footer" sx={{p: 1, flexShrink: 0}}>+ <Footer/></Box></Box></React.Fragment>diff --git a/freemocap/core/calibration/calibration_task.py b/freemocap/core/calibration/calibration_task.pyindex 715566a8..dd83f5dd 100644--- a/freemocap/core/calibration/calibration_task.py+++ b/freemocap/core/calibration/calibration_task.py@@ -257,7 +257,8 @@ def run_calibration_task()# Save observations so comparison tools can run board reconstruction tests- observations_json_path = Path(recording_info.full_recording_path) / "charuco_observations.json"+ observations_json_path = Path(recording_info.full_recording_path) / "output_data"/"charuco_observations.json"+ observations_json_path.parent.mkdir(parents=True, exist_ok=True)observations_json_path.write_text(json.dumps([numpy_to_python(obs.model_dump()) for obs in all_observations], indent=4))diff --git a/notes/.claude/settings.local.json b/notes/.claude/settings.local.jsonnew file mode 100644index 00000000..3f582e9a--- /dev/null+++ b/notes/.claude/settings.local.json@@ -0,0 +1,7 @@+{+ "permissions": {+ "allow": [+ "Bash(npx tsc:*)"+ ]+ }+}diff --git a/notes/left-ui-outline.md b/notes/left-ui-outline.mdnew file mode 100644index 00000000..f73d6bdd--- /dev/null+++ b/notes/left-ui-outline.md@@ -0,0 +1,349 @@+Outline for the realtime left UI++Each part is a checkbox with collapsible tree veiew for the parameters underneath it.+Sections are closed by default, and the user can click to expand them.+When it makes sense the collapsed header should show a summary of the settings, similar to the camera config panel.+Anything that can be disabled should offer at tooltip explaining WHY it is disabled++# > Real time Pipeline+This is a turn-on/turn-off-able long running pipeline that processes images from the cameras (2d tracking) and optionally combines the 2d views to do 3d keypoint triangulation and skeleton reconstruction (using pipelines expecting incoming data streams vs the completed post-hoc piplines in the other setction)+- [ ] 2d Tracking+ - [ ] Charuco (w/ settings collapsed by default)+ - [ ] Skeleton ( w/ mediapipe settings collapsed by default. use Realtime preset)+- [ ] 3d Reconstruction+ - [ ] Triangulate (w/ settings, just use plaecholders for now. Also include a picker for the caliberation toml we should use for the triangulation. Follow conventions currently in the Calibration panel)+ - [ ] Filter (showing parameters for filtering, Fabrik, One Euro etc)+ - [ ] Skeleton (showing paramters for skeleton, such a rigid body stuff, etc)++# > Cameras+- For camera controls. Current form is pretty good!++# > Recording+- For recording videos+- Current form is pretty good, BUT shoudl include something to allow users target calibration or mocap videos (i.e. some top level option to target videos as 'calibration' or 'mocap' videos, to be auto-processed with the currently specified post-hoc calbration, mocap (or both) posthoc pipeline. I guess it should show a checkbox for each pipeline we should put the resulting recording through. This feature should have the same effects as the 'record calibration videos' and 'record mocap videos' buttons in the assocaited post-processing pipeline+-+# > Post Processing Pipeline(s) (post hoc pipelines)+This panel is to trigger more fire-and-forget style pipelines to processing calibration or mocap videosets. It creates similarly structured pipelines to the realtime pipeline (camera/video nodes feeding into an aggregation node), but rather than operating on the basis of incoming data, these are for pre-recorded datasets. Eventually this will be part of a batch processing method that spawn multiple processing pipelines. we should have some sense of a progress reporting component showing the progress of a triggered pipeline (tagged by pipeline id returned from the endpoint)+- > Capture Volume Calibration+ - Similar to the current Calibration panel.+ - Folder status checker should have a watcher that checkes the selected directory ever few seconds, rather than requiring manual re-checks to get updates+ -+- > Motion Capture+ - Form should copy similar structures to the realtime pipeline, but can hold different values. Default settings are Posthoc+ - Must have the concept of a 'recording id' baked in at a high level. The recording id is the same as the recording name is the same as the name of the recording folder+ - Calibration toml selector is a good idea, but ugly and clunky and not self-explaining. Way too many top level settings, should have heirarcical nested settings (similar in structure to the realtime pipeline, but there will be different options, e.g. butterworth filtering options that cant be done on a realtime stream bc they require the full data set avbailable)+ - Process selected recording should be a the TOP not the bottom++---++# Implementation Plan++Phased plan to implement the above changes. Phases 2 and 3 can be done in parallel after Phase 1.++## Phase 1: Shared Pipeline Config Components (Foundation)++Create reusable tree components consumed by both realtime and posthoc pipelines.++### New directory: `freemocap-ui/src/components/pipeline-config/`++#### 1.1 `PipelineStageTreeItem.tsx`+A generic checkbox + collapsible tree node. Follows the pattern in `camera-config-tree-view/CameraTreeItem.tsx`.++```+Props:+ label: string+ checked: boolean+ onToggle: (checked: boolean) => void+ disabled?: boolean+ disabledReason?: string // tooltip shown when disabled+ summaryWhenCollapsed?: string // shown in header when collapsed+ children: ReactNode // settings content+```++Uses MUI X `TreeItem` with a custom content slot containing the checkbox. When `disabled`, wraps in a `Tooltip` with `disabledReason` explaining WHY (per outline requirement).++#### 1.2 `PipelineConfigTree.tsx`+Renders the hierarchical pipeline structure using `SimpleTreeView` + `PipelineStageTreeItem`:++```+Props:+ context: "realtime" | "posthoc"+ detectorConfig: MediapipeDetectorConfig // from settings-types.ts+ filterConfig: SkeletonFilterConfig+ onDetectorChange: (patch: Partial<MediapipeDetectorConfig>) => void+ onFilterChange: (patch: Partial<SkeletonFilterConfig>) => void+ calibrationTomlPath?: string+ onCalibrationTomlChange?: (path: string) => void+ // Per-stage enable/disable:+ charucoEnabled: boolean+ onCharucoToggle: (v: boolean) => void+ skeletonEnabled: boolean+ onSkeletonToggle: (v: boolean) => void+ triangulateEnabled: boolean+ onTriangulateToggle: (v: boolean) => void+ filterEnabled: boolean+ onFilterToggle: (v: boolean) => void+ rigidBodyEnabled: boolean+ onRigidBodyToggle: (v: boolean) => void+```++Tree structure:+```+[ ] 2D Tracking+ [ ] Charuco β board size params (extracted from CalibrationControlPanel.tsx lines 484-520)+ [ ] Skeleton β MediapipeConfigPanel (default preset: Realtime if context="realtime", Posthoc if context="posthoc")+[ ] 3D Reconstruction+ [ ] Triangulate β CalibrationTomlPicker + placeholder settings+ [ ] Filter β SkeletonFilterConfigPanel (show butterworth section only when context="posthoc")+ [ ] Skeleton β rigid body params (placeholder UI for now)+```++When collapsed, each section header shows a summary of its settings (e.g. "MediaPipe Heavy, conf 0.5" or "One Euro Ξ²=0.5, FABRIK 50 iters").++#### 1.3 `CalibrationTomlPicker.tsx`+Redesigned from `MocapTaskTreeItem.tsx` lines 401-452. Current version is described as "ugly and clunky."++New design β single compact row:+```+[StatusIcon] [Source label] [Truncated path (monospace)] [Browse button]+```++Source labels: "Auto-detected", "From calibration panel", "Manually selected"++```+Props:+ tomlPath: string | null+ source: "auto" | "calibration-panel" | "manual"+ onSelect: (path: string) => void+ onUseAutoDetected: () => void+```++Uses `useElectronIPC().openFileDialog()` for the Browse button.++### Files to create:+- `freemocap-ui/src/components/pipeline-config/PipelineStageTreeItem.tsx`+- `freemocap-ui/src/components/pipeline-config/PipelineConfigTree.tsx`+- `freemocap-ui/src/components/pipeline-config/CalibrationTomlPicker.tsx`++---++## Phase 2: Restructure Realtime Pipeline Panel++### 2.1 Rewrite `ProcessingPipelinePanel.tsx`+**File:** `freemocap-ui/src/components/processing-pipeline-panel/ProcessingPipelinePanel.tsx`++Replace the flat `FormControlLabel` switches (lines ~56-112) and embedded `MediapipeConfigPanel` / `SkeletonFilterConfigPanel` with:+```tsx+<PipelineConfigTree+ context="realtime"+ detectorConfig={backendPipeline.mediapipeDetectorConfig}+ filterConfig={backendPipeline.skeletonFilterConfig}+ onDetectorChange={(patch) => sendSettingsPatch('pipeline.detector', patch)}+ onFilterChange={(patch) => sendSettingsPatch('pipeline.filter', patch)}+ charucoEnabled={backendPipeline.calibration_detection_enabled}+ onCharucoToggle={(v) => sendSettingsPatch('pipeline.calibration_detection_enabled', v)}+ skeletonEnabled={backendPipeline.mocap_detection_enabled}+ onSkeletonToggle={(v) => sendSettingsPatch('pipeline.mocap_detection_enabled', v)}+ // 3D toggles β local state until backend support added:+ triangulateEnabled={localTriangulate}+ onTriangulateToggle={setLocalTriangulate}+ ...+/>+```++Keep `PipelineConnectionToggle`, `PipelineSummary`, and `PipelineConnectionStatus` unchanged.++### Files to modify:+- `freemocap-ui/src/components/processing-pipeline-panel/ProcessingPipelinePanel.tsx`++---++## Phase 3: Merge Calibration + MoCap into Post Processing Panel++### 3.1 Create `useDirectoryWatcher.ts`+**File:** `freemocap-ui/src/hooks/useDirectoryWatcher.ts`++```+Hook: useDirectoryWatcher(path: string | null, validateFn: () => Promise<void>, intervalMs = 3000)+Returns: { isWatching: boolean, lastChecked: Date | null, triggerRefresh: () => void }+```++Runs `setInterval` calling `validateFn()` when `path` is truthy. Cleans up on unmount or path change. Replaces the manual "click refresh to check folder status" pattern in `CalibrationControlPanel.tsx` (lines 174-183) and `MocapTaskTreeItem.tsx`.++### 3.2 Create `CalibrationSubsection.tsx`+**File:** `freemocap-ui/src/components/post-processing-panel/CalibrationSubsection.tsx`++Migrate from `CalibrationControlPanel.tsx` (589 lines) with these changes:+- Wrap in a collapsible `Accordion` or nested tree item (not a top-level `CollapsibleSidebarSection`)+- Use `useDirectoryWatcher` for automatic folder status polling (keep manual refresh as override)+- All existing functionality preserved: board config, solver section (`CalibrationSolverSection.tsx`), recording controls, path input, `DirectoryStatusPanel`, calibrate button++### 3.3 Create `MocapSubsection.tsx`+**File:** `freemocap-ui/src/components/post-processing-panel/MocapSubsection.tsx`++Migrate from `MocapTaskTreeItem.tsx` (506 lines) with these changes:+- **"Process Selected Recording" button at TOP** (currently at bottom, line ~492)+- Recording path/ID selector at top level β `recording_id` concept baked in prominently+- Replace flat `MediapipeConfigPanel` + `SkeletonFilterConfigPanel` with `<PipelineConfigTree context="posthoc" />`+- Use redesigned `CalibrationTomlPicker` from Phase 1+- Use `useDirectoryWatcher` for auto-refresh+- Hierarchical nesting for all settings (no more flat top-level params)++### 3.4 Create `PostProcessingPanel.tsx`+**File:** `freemocap-ui/src/components/post-processing-panel/PostProcessingPanel.tsx`++Single `CollapsibleSidebarSection` titled "Post Processing Pipeline(s)" containing:+```+> Capture Volume Calibration β CalibrationSubsection+> Motion Capture β MocapSubsection+```++Both subsections closed by default. Each subsection header shows a summary chip when collapsed.++### 3.5 Update `LeftSidePanelContent.tsx`+**File:** `freemocap-ui/src/components/ui-components/LeftSidePanelContent.tsx`++- Change `DEFAULT_SECTION_ORDER` from `['connection', 'cameras', 'recording', 'pipeline', 'calibration', 'mocap']` to `['connection', 'cameras', 'recording', 'pipeline', 'postprocessing']`+- Add `postprocessing` entry in `SECTION_COMPONENTS` mapping to `PostProcessingPanel`+- Remove `calibration` and `mocap` entries+- The existing `loadSectionOrder()` validation (lines ~57-75) already resets to defaults when stored IDs don't match, so localStorage migration happens automatically++### Files to create:+- `freemocap-ui/src/hooks/useDirectoryWatcher.ts`+- `freemocap-ui/src/components/post-processing-panel/PostProcessingPanel.tsx`+- `freemocap-ui/src/components/post-processing-panel/CalibrationSubsection.tsx`+- `freemocap-ui/src/components/post-processing-panel/MocapSubsection.tsx`++### Files to modify:+- `freemocap-ui/src/components/ui-components/LeftSidePanelContent.tsx`++---++## Phase 4: Recording Panel β Pipeline Tagging++### 4.1 Add recording tag state+**File:** Recording Redux slice (locate via `freemocap-ui/src/store/slices/recording/`)++Add to state:+```ts+runCalibrationPipeline: boolean // default false+runMocapPipeline: boolean // default false+```++Add reducers: `setRunCalibrationPipeline`, `setRunMocapPipeline`++### 4.2 Update `RecordingInfoPanel.tsx`+**File:** `freemocap-ui/src/components/recording-info-panel/RecordingInfoPanel.tsx`++Add a "Post-recording pipelines" section (after recording settings, before or after MicrophoneSelector):+```+[ ] Run Calibration Pipeline after recording+[ ] Run MoCap Pipeline after recording+```++These checkboxes mirror the "record calibration videos" / "record mocap videos" buttons in the calibration/mocap panels. When checked, stopping a recording auto-triggers the corresponding post-hoc pipeline.++### 4.3 Wire stop-recording to pipeline dispatch+**File:** `freemocap-ui/src/components/recording-info-panel/RecordingCompleteDialog.tsx` (or the stop recording handler)++On recording stop, if `runCalibrationPipeline` is true, dispatch the calibration processing action with the completed recording path. Same for `runMocapPipeline`.++### Files to modify:+- Recording Redux slice+- `freemocap-ui/src/components/recording-info-panel/RecordingInfoPanel.tsx`+- `freemocap-ui/src/components/recording-info-panel/RecordingCompleteDialog.tsx`++---++## Phase 5: Polish & Context-Aware Config++### 5.1 Context-aware `MediapipeConfigPanel.tsx`+**File:** `freemocap-ui/src/components/mocap-control-panel/MediapipeConfigPanel.tsx`++Add prop: `defaultPreset?: "realtime" | "posthoc"` β controls which preset chip is selected by default. Currently hardcoded.++### 5.2 Context-aware `SkeletonFilterConfigPanel.tsx`+**File:** `freemocap-ui/src/components/mocap-control-panel/SkeletonFilterConfigPanel.tsx`++Add prop: `context?: "realtime" | "posthoc"`. When `context === "posthoc"`, show additional **Butterworth filter** section (low-pass filter params that require the full dataset β not available in realtime).++### 5.3 Disabled-state tooltips+Audit all checkboxes/toggles across the new components. Anywhere something can be disabled (e.g., 3D Reconstruction disabled when pipeline not connected, smooth segmentation disabled when segmentation off), add a `Tooltip` with `disabledReason` explaining WHY it's disabled.++### 5.4 Collapsed summary headers+Ensure every collapsible section shows a meaningful summary when collapsed:+- 2D Tracking: "Charuco + MediaPipe Heavy"+- 3D Reconstruction: "Triangulate + One Euro + FABRIK"+- Calibration subsection: "Calibrated" / "No calibration"+- MoCap subsection: "Ready" / "Processing 45%"++### 5.5 Cleanup+- Remove unused imports from `LeftSidePanelContent.tsx`+- Verify drag-reorder works with 5 sections instead of 6+- Run `npm run build` to catch type errors+- Manual test: expand/collapse all sections, check summaries, check tooltips++---++## Dependency Graph++```+Phase 1 (Foundation)+ βββ> Phase 2 (Realtime Pipeline) βββ+ βββ> Phase 3 (Post Processing) βββββΌββ> Phase 5 (Polish)+ βββ> Phase 4 (Recording Tagging)+```++## Files Summary++### New files (10):+- `freemocap-ui/src/components/pipeline-config/PipelineStageTreeItem.tsx`+- `freemocap-ui/src/components/pipeline-config/PipelineConfigTree.tsx`+- `freemocap-ui/src/components/pipeline-config/CalibrationTomlPicker.tsx`+- `freemocap-ui/src/components/post-processing-panel/PostProcessingPanel.tsx`+- `freemocap-ui/src/components/post-processing-panel/CalibrationSubsection.tsx`+- `freemocap-ui/src/components/post-processing-panel/MocapSubsection.tsx`+- `freemocap-ui/src/hooks/useDirectoryWatcher.ts`++### Modified files (7):+- `freemocap-ui/src/components/processing-pipeline-panel/ProcessingPipelinePanel.tsx`+- `freemocap-ui/src/components/ui-components/LeftSidePanelContent.tsx`+- `freemocap-ui/src/components/mocap-control-panel/MediapipeConfigPanel.tsx`+- `freemocap-ui/src/components/mocap-control-panel/SkeletonFilterConfigPanel.tsx`+- `freemocap-ui/src/components/recording-info-panel/RecordingInfoPanel.tsx`+- `freemocap-ui/src/components/recording-info-panel/RecordingCompleteDialog.tsx`+- Recording Redux slice (path TBD)++---++# Progress Log++## Phase 1: Shared Pipeline Config Components β COMPLETE+- [x] `PipelineStageTreeItem.tsx` β generic checkbox + collapsible tree node with disabled tooltip support+- [x] `PipelineConfigTree.tsx` β hierarchical 2D Tracking / 3D Reconstruction tree using the stage items, embeds MediapipeConfigPanel and SkeletonFilterConfigPanel+- [x] `CalibrationTomlPicker.tsx` β compact single-row redesign (status icon + source label + truncated path + browse button)+- All three files created in `freemocap-ui/src/components/pipeline-config/`+- TypeScript compiles clean (no errors)++## Phase 2: Restructure Realtime Pipeline Panel β COMPLETE+- [x] Rewrote `ProcessingPipelinePanel.tsx` β replaced flat FormControlLabel switches + embedded MediapipeConfigPanel/SkeletonFilterConfigPanel with `PipelineConfigTree context="realtime"`+- 2D toggles (Charuco/Skeleton) wired to backend via `settings/patch` WebSocket messages+- 3D toggles (Triangulate/Filter/Skeleton) use local state until backend support added+- Disabled state + tooltip reason passed through when pipeline not connected+- TypeScript compiles clean++## Phase 3: Merge Calibration + MoCap into Post Processing Panel β COMPLETE+- [x] `useDirectoryWatcher.ts` β polls directory validation on interval (3s default), replaces manual refresh+- [x] `CalibrationSubsection.tsx` β migrated from CalibrationControlPanel into Accordion, uses useDirectoryWatcher+- [x] `MocapSubsection.tsx` β migrated from MocapTaskTreeItem with key changes:+ - Process button moved to TOP+ - Recording ID displayed prominently+ - CalibrationTomlPicker replaces old ugly two-button layout+ - PipelineConfigTree replaces flat MediapipeConfigPanel + SkeletonFilterConfigPanel+ - useDirectoryWatcher for auto-refresh+- [x] `PostProcessingPanel.tsx` β CollapsibleSidebarSection wrapping both subsections+- [x] `LeftSidePanelContent.tsx` β updated to 5 sections (removed calibration + mocap, added postprocessing)+- TypeScript compiles clean++## Phase 4: Recording Panel β Pipeline Tagging β NOT STARTED+## Phase 5: Polish β NOT STARTED