Skip to content

Free Motion Capture for Everyone πŸ’€βœ¨

TypeScript

chkpt

jonmatthis15e3204d4483
diff --git a/freemocap-ui/src/components/camera-config-tree-view/CameraConfigTreeView.tsx b/freemocap-ui/src/components/camera-config-tree-view/CameraConfigTreeView.tsx
index f74737f0..a727accd 100644
--- a/freemocap-ui/src/components/camera-config-tree-view/CameraConfigTreeView.tsx
+++ b/freemocap-ui/src/components/camera-config-tree-view/CameraConfigTreeView.tsx
@@ -77,9 +77,14 @@ export const CameraConfigTreeView: React.FC = () => {
return (
<CollapsibleSidebarSection
icon={<VideoCameraFrontIcon sx={{transform: "", color: "inherit"}}/>}
- title="Cameras"
+ title="" //Cameras - need update header def
summaryContent={<PipelineSummary/>}
- primaryControl={<PipelineConnectionToggle/>}
+ primaryControl={ <CameraConfigTreeViewHeader
+ cameraCount={cameras.length}
+ isLoading={isLoading}
+ isPaused={isPaused}
+ hasSelectedCameras={hasSelectedCameras}
+ />}
defaultExpanded={false}
>
<Paper
diff --git a/freemocap-ui/src/components/camera-config-tree-view/CameraConfigTreeViewHeader.tsx b/freemocap-ui/src/components/camera-config-tree-view/CameraConfigTreeViewHeader.tsx
index ba08a5fb..6fe79e75 100644
--- a/freemocap-ui/src/components/camera-config-tree-view/CameraConfigTreeViewHeader.tsx
+++ b/freemocap-ui/src/components/camera-config-tree-view/CameraConfigTreeViewHeader.tsx
@@ -148,7 +148,7 @@ export const CameraConfigTreeViewHeader: React.FC<CameraConfigTreeViewHeaderProp
/>
</Box>
-
+
</IconButton>
</span>
</Tooltip>
diff --git a/freemocap-ui/src/components/recording-info-panel/RecordingInfoPanel.tsx b/freemocap-ui/src/components/recording-info-panel/RecordingInfoPanel.tsx
index a908ea66..ddb87293 100644
--- a/freemocap-ui/src/components/recording-info-panel/RecordingInfoPanel.tsx
+++ b/freemocap-ui/src/components/recording-info-panel/RecordingInfoPanel.tsx
@@ -18,6 +18,9 @@ import {electronIpc, useElectronIPC} from "@/services/electron-ipc/electron-ipc"
import {useServer} from "@/services/server/ServerContextProvider";
import {getTimestampString} from "@/components/recording-info-panel/getTimestampString";
import {RecordingCompleteDialog} from "@/components/recording-info-panel/RecordingCompleteDialog";
+import {PipelineSummary} from "@/components/processing-pipeline-panel/PipelineSummary";
+import {PipelineConnectionToggle} from "@/components/processing-pipeline-panel/PipelineConnectionToggle";
+import {CollapsibleSidebarSection} from "@/components/common/CollapsibleSidebarSection";
interface RecordingOperation {
type: 'start' | 'stop';
@@ -157,7 +160,7 @@ export const RecordingInfoPanel: React.FC = () => {
}
// Set pending state before dispatching
- setPendingOperation({ type: 'start', timestamp: Date.now() });
+ setPendingOperation({type: 'start', timestamp: Date.now()});
try {
await dispatch(
@@ -182,7 +185,7 @@ export const RecordingInfoPanel: React.FC = () => {
if (recordingInfo.isRecording) {
console.log("Stopping recording...");
- setPendingOperation({ type: 'stop', timestamp: Date.now() });
+ setPendingOperation({type: 'stop', timestamp: Date.now()});
try {
await dispatch(stopRecording()).unwrap();
@@ -205,100 +208,117 @@ export const RecordingInfoPanel: React.FC = () => {
: undefined;
return (
- <Box
- sx={{
- color: "text.primary",
- backgroundColor: theme.palette.primary.dark,
- borderRadius: 1,
- mx: 1,
- my: 0.5,
- }}
+ <CollapsibleSidebarSection
+ icon={<VideocamIcon sx={{transform: "", color: "inherit"}}/>}
+ title="Recording"
+ // TODO - Integrate this button more aesthetically, update Summary to better represent recording
+ summaryContent={<PipelineSummary/>}
+ primaryControl={<StartStopRecordingButton
+ isRecording={recordingInfo.isRecording}
+ isPending={pendingOperation !== null}
+ countdown={countdown}
+ recordingStartTime={recordingStartTime}
+ disabled={noCamerasConnected && !recordingInfo.isRecording}
+ onClick={handleRecordButtonClick}
+ />}
+ defaultExpanded={false}
>
- <SimpleTreeView
- defaultExpandedItems={["recording-main"]}
- slots={{
- collapseIcon: ExpandMoreIcon,
- expandIcon: ChevronRightIcon,
- }}
+ <Box
sx={{
- flexGrow: 1,
- '& .MuiTreeItem-content': {
- padding: '2px 4px',
- margin: '1px 0',
- },
- '& .MuiTreeItem-label': {
- fontSize: 13,
- padding: '1px 0',
- },
+ color: "text.primary",
+ backgroundColor: theme.palette.primary.dark,
+ borderRadius: 1,
+ mx: 1,
+ my: 0.5,
}}
>
- <TreeItem
- itemId="recording-main"
- label={
- <Box
- sx={{
- display: "flex",
- alignItems: "center",
- width: "100%",
- py: 0.25,
- }}
- >
- <VideocamIcon sx={{ fontSize: 16, mr: 0.5 }} />
- <Typography sx={{ flexGrow: 1, fontSize: 13, fontWeight: 500 }}>
- Record
- </Typography>
-
- <Box onClick={(e) => e.stopPropagation()} onMouseDown={(e) => e.stopPropagation()} sx={{ flexGrow: 1, ml: 1.5 }}>
- <StartStopRecordingButton
- isRecording={recordingInfo.isRecording}
- isPending={pendingOperation !== null}
- countdown={countdown}
- recordingStartTime={recordingStartTime}
- disabled={noCamerasConnected && !recordingInfo.isRecording}
- onClick={handleRecordButtonClick}
- />
- </Box>
- </Box>
- }
- >{/* Microphone selector */}
+ <SimpleTreeView
+ defaultExpandedItems={["recording-main"]}
+ slots={{
+ collapseIcon: ExpandMoreIcon,
+ expandIcon: ChevronRightIcon,
+ }}
+ sx={{
+ flexGrow: 1,
+ '& .MuiTreeItem-content': {
+ padding: '2px 4px',
+ margin: '1px 0',
+ },
+ '& .MuiTreeItem-label': {
+ fontSize: 13,
+ padding: '1px 0',
+ },
+ }}
+ >
<TreeItem
- itemId="recording-mic"
+ itemId="recording-main"
label={
- <MicrophoneSelector
- selectedMicIndex={micDeviceIndex}
- onMicSelected={setMicDeviceIndex}
- disabled={recordingInfo.isRecording}
- />
+ <Box
+ sx={{
+ display: "flex",
+ alignItems: "center",
+ width: "100%",
+ py: 0.25,
+ }}
+ >
+ <VideocamIcon sx={{fontSize: 16, mr: 0.5}}/>
+ <Typography sx={{flexGrow: 1, fontSize: 13, fontWeight: 500}}>
+ Record
+ </Typography>
+
+ <Box onClick={(e) => e.stopPropagation()} onMouseDown={(e) => e.stopPropagation()}
+ sx={{flexGrow: 1, ml: 1.5}}>
+ <StartStopRecordingButton
+ isRecording={recordingInfo.isRecording}
+ isPending={pendingOperation !== null}
+ countdown={countdown}
+ recordingStartTime={recordingStartTime}
+ disabled={noCamerasConnected && !recordingInfo.isRecording}
+ onClick={handleRecordButtonClick}
+ />
+ </Box>
+ </Box>
}
- />
- <RecordingPathTreeItem
- recordingDirectory={recordingInfo.recordingDirectory}
- recordingName={recordingName}
- subfolder={subfolderName}
- countdown={countdown}
- recordingTag={recordingTag}
- useDelayStart={useDelayStart}
- delaySeconds={delaySeconds}
- useTimestamp={useTimestamp}
- baseName={baseName}
- useIncrement={useIncrement}
- currentIncrement={currentIncrement}
- createSubfolder={createSubfolder}
- customSubfolderName={customSubfolderName}
- isRecording={recordingInfo.isRecording}
- onDelayToggle={setUseDelayStart}
- onDelayChange={setDelaySeconds}
- onTagChange={handleRecordingTagChange}
- onUseTimestampChange={setUseTimestamp}
- onBaseNameChange={setBaseName}
- onUseIncrementChange={setUseIncrement}
- onIncrementChange={setCurrentIncrement}
- onCreateSubfolderChange={setCreateSubfolder}
- onCustomSubfolderNameChange={setCustomSubfolderName}
- />
- </TreeItem>
- </SimpleTreeView>
- <RecordingCompleteDialog />
- </Box>
+ >{/* Microphone selector */}
+ <TreeItem
+ itemId="recording-mic"
+ label={
+ <MicrophoneSelector
+ selectedMicIndex={micDeviceIndex}
+ onMicSelected={setMicDeviceIndex}
+ disabled={recordingInfo.isRecording}
+ />
+ }
+ />
+ <RecordingPathTreeItem
+ recordingDirectory={recordingInfo.recordingDirectory}
+ recordingName={recordingName}
+ subfolder={subfolderName}
+ countdown={countdown}
+ recordingTag={recordingTag}
+ useDelayStart={useDelayStart}
+ delaySeconds={delaySeconds}
+ useTimestamp={useTimestamp}
+ baseName={baseName}
+ useIncrement={useIncrement}
+ currentIncrement={currentIncrement}
+ createSubfolder={createSubfolder}
+ customSubfolderName={customSubfolderName}
+ isRecording={recordingInfo.isRecording}
+ onDelayToggle={setUseDelayStart}
+ onDelayChange={setDelaySeconds}
+ onTagChange={handleRecordingTagChange}
+ onUseTimestampChange={setUseTimestamp}
+ onBaseNameChange={setBaseName}
+ onUseIncrementChange={setUseIncrement}
+ onIncrementChange={setCurrentIncrement}
+ onCreateSubfolderChange={setCreateSubfolder}
+ onCustomSubfolderNameChange={setCustomSubfolderName}
+ />
+ </TreeItem>
+ </SimpleTreeView>
+ <RecordingCompleteDialog/>
+ </Box>
+ </CollapsibleSidebarSection>
);
};
diff --git a/freemocap-ui/src/components/recording-info-panel/recording-subcomponents/MicrophoneSelector.tsx b/freemocap-ui/src/components/recording-info-panel/recording-subcomponents/MicrophoneSelector.tsx
index 8e8bf485..0065457b 100644
--- a/freemocap-ui/src/components/recording-info-panel/recording-subcomponents/MicrophoneSelector.tsx
+++ b/freemocap-ui/src/components/recording-info-panel/recording-subcomponents/MicrophoneSelector.tsx
@@ -34,7 +34,7 @@ export const MicrophoneSelector: React.FC<MicrophoneSelectorProps> = ({
setLoading(true);
setError(null);
try {
- const response = await fetch(useAppUrls.getHttpEndpointUrls.detectMicrophones);
+ const response = await fetch(serverUrls.endpoints.detectMicrophones);
if (!response.ok) {
throw new Error(`Failed to detect microphones: ${response.statusText}`);
}
diff --git a/freemocap-ui/src/components/ui-components/LeftSidePanelContent.tsx b/freemocap-ui/src/components/ui-components/LeftSidePanelContent.tsx
index 78de7c17..7105dd4e 100644
--- a/freemocap-ui/src/components/ui-components/LeftSidePanelContent.tsx
+++ b/freemocap-ui/src/components/ui-components/LeftSidePanelContent.tsx
@@ -30,13 +30,15 @@ import { ProcessingPipelinePanel } from '@/components/processing-pipeline-panel/
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 {RecordingInfoPanel} from "@/components/recording-info-panel/RecordingInfoPanel";
const STORAGE_KEY = 'freemocap-sidebar-section-order';
const DEFAULT_SECTION_ORDER = [
'connection',
- 'pipeline',
'cameras',
+ 'recording',
+ 'pipeline',
'calibration',
'mocap',
] as const;
@@ -47,6 +49,7 @@ const SECTION_COMPONENTS: Record<SectionId, React.FC> = {
connection: ServerConnectionStatus,
pipeline: ProcessingPipelinePanel,
cameras: CameraConfigTreeView,
+ recording: RecordingInfoPanel,
calibration: CalibrationControlPanel,
mocap: MocapTaskTreeItem,
};
diff --git a/freemocap-ui/src/layout/BasePanelLayout.tsx b/freemocap-ui/src/layout/BasePanelLayout.tsx
index a3400a5a..6e2a18e2 100644
--- a/freemocap-ui/src/layout/BasePanelLayout.tsx
+++ b/freemocap-ui/src/layout/BasePanelLayout.tsx
@@ -57,8 +57,8 @@ export const BasePanelLayout = ({children}: { children: React.ReactNode }) => {
onExpand={handlePanelExpand}
>
<LeftSidePanelContent
- isCollapsed={isCollapsed}
- onToggleCollapse={handleToggleCollapse}
+ // isCollapsed={isCollapsed}
+ // onToggleCollapse={handleToggleCollapse}
/>
</Panel>
{/* Horizontal Resize Handle */}
diff --git a/freemocap-ui/src/pages/WelcomePage.tsx b/freemocap-ui/src/pages/WelcomePage.tsx
index b546042b..ad9e1ee1 100644
--- a/freemocap-ui/src/pages/WelcomePage.tsx
+++ b/freemocap-ui/src/pages/WelcomePage.tsx
@@ -1,7 +1,7 @@
import React, {useEffect, useState, useRef, useCallback} from 'react';
import {
Box, Button, Checkbox, CircularProgress, Container,
- darken, Divider, Fade, FormControlLabel, Grow, Paper, Stack, Typography
+ darken, Divider, Fade, FormControlLabel, Grow, Paper, Stack, Typography, Link as MuiLink
} from '@mui/material';
import {useNavigate} from 'react-router-dom';
import {useTheme} from '@mui/material/styles';
@@ -144,7 +144,7 @@ const WelcomePage: React.FC = () => {
}}/>
{/* ── HERO SECTION ── */}
- <Box sx={{ display: 'flex', flexDirection: 'column', alignItems: 'center', mb: 2 }}>
+ <Box sx={{display: 'flex', flexDirection: 'column', alignItems: 'center', mb: 2}}>
<Grow in={true} timeout={1000}>
<Box
sx={{
@@ -211,13 +211,13 @@ const WelcomePage: React.FC = () => {
</Box>
{/* ── PRIMARY CTA ── */}
- <Box sx={{ width: '100%', display: 'flex', justifyContent: 'center', mb: 2 }}>
+ <Box sx={{width: '100%', display: 'flex', justifyContent: 'center', mb: 2}}>
<Button
variant="contained"
size="large"
startIcon={isConnecting
- ? <CircularProgress size={24} color="inherit" />
- : <VideocamIcon sx={{ fontSize: 28 }} />
+ ? <CircularProgress size={24} color="inherit"/>
+ : <VideocamIcon sx={{fontSize: 28}}/>
}
onClick={handleConnectCameras}
disabled={isConnecting}
@@ -239,7 +239,7 @@ const WelcomePage: React.FC = () => {
border: `4px solid ${theme.palette.secondary.main}`,
boxShadow: `0 4px 20px rgba(245, 0, 87, 0.25)`,
'&:hover': {
- background: theme.palette.info.dark,
+ background: theme.palette.info.dark,
boxShadow: `0 6px 28px rgba(245, 0, 87, 0.4)`,
transform: 'translateY(-1px)',
border: `4px solid ${theme.palette.secondary.light}`,
@@ -252,41 +252,10 @@ const WelcomePage: React.FC = () => {
</Button>
</Box>
- {/* ── SECONDARY LINKS ── */}
- <Stack direction="row" spacing={2} sx={{ mb: 2 }}>
- <Button
- variant="text"
- size="small"
- color="inherit"
- endIcon={<OpenInNewIcon sx={{fontSize: 14}} />}
- onClick={() => window.open(EXTERNAL_URLS.DOCS, '_blank')}
- sx={{
- textTransform: 'none',
- color: theme.palette.info.light,
- '&:hover': { color: theme.palette.info.main },
- }}
- >
- {t('documentation')}
- </Button>
- <Button
- variant="text"
- size="small"
- color="inherit"
- endIcon={<OpenInNewIcon sx={{fontSize: 14}} />}
- onClick={() => window.open(EXTERNAL_URLS.ROADMAP, '_blank')}
- sx={{
- textTransform: 'none',
- color: theme.palette.info.light,
- '&:hover': { color: theme.palette.info.main },
- }}
- >
- {t('roadmap')}
- </Button>
- </Stack>
{/* ── SETTINGS AREA ── */}
- <Divider sx={{ width: '60%', my: 1.5 }} />
- <Box sx={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 1, mb: 2 }}>
+ <Divider sx={{width: '60%', my: 1.5}}/>
+ <Box sx={{display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 1, mb: 2}}>
<LanguageSwitcher/>
{telemetryLoaded && (
<Fade in={true} timeout={600}>
@@ -306,15 +275,123 @@ const WelcomePage: React.FC = () => {
/>
</Fade>
)}
- <VersionChip variant="compact" />
+ <VersionChip variant="compact"/>
</Box>
{/* ── FOOTER ── */}
- <Box sx={{ textAlign: 'center' }}>
+ <Box sx={{textAlign: 'center'}}>
<Footer/>
</Box>
</Paper>
</Fade>
+ {/* ── SECONDARY LINKS ── */}
+ <Stack direction="row" spacing={2} sx={{mb: 2}}>
+ <Button
+ variant="text"
+ size="small"
+ color="inherit"
+ endIcon={<OpenInNewIcon sx={{fontSize: 14}}/>}
+ onClick={() => window.open(EXTERNAL_URLS.DOCS, '_blank')}
+ sx={{
+ textTransform: 'none',
+ color: theme.palette.info.light,
+ '&:hover': {color: theme.palette.info.main},
+ }}
+ >
+ {t('documentation')}
+ </Button>
+ <Button
+ variant="text"
+ size="small"
+ color="inherit"
+ endIcon={<OpenInNewIcon sx={{fontSize: 14}}/>}
+ onClick={() => window.open(EXTERNAL_URLS.ROADMAP, '_blank')}
+ sx={{
+ textTransform: 'none',
+ color: theme.palette.info.light,
+ '&:hover': {color: theme.palette.info.main},
+ }}
+ >
+ {t('roadmap')}
+ </Button>
+ </Stack>
+
+
+ {/* Research Tool Disclaimer - Outside main clickable area */}
+ <Paper
+ elevation={1}
+ sx={{
+ p: 2.5,
+ width: '100%',
+ backgroundColor: theme.palette.mode === 'dark'
+ ? 'rgba(255, 255, 255, 0.03)'
+ : 'rgba(0, 0, 0, 0.02)',
+ borderRadius: 2,
+ }}
+ >
+ <Typography
+ variant="body2"
+ color="text.secondary"
+ sx={{
+ fontSize: '0.85rem',
+ lineHeight: 1.8,
+ '& a': {
+ color: theme.palette.mode === 'dark'
+ ? theme.palette.primary.light
+ : theme.palette.primary.main,
+ textDecoration: 'none',
+ fontWeight: 500,
+ transition: 'all 0.2s',
+ '&:hover': {
+ textDecoration: 'underline',
+ color: theme.palette.mode === 'dark'
+ ? theme.palette.primary.main
+ : theme.palette.primary.dark
+ }
+ }
+ }}
+ >
+ FreeMoCap is currently a research and educational tool, not cleared by the FDA for clinical use.
+ Motion capture devices are regulated under{' '}
+ <MuiLink
+ href="https://www.ecfr.gov/current/title-21/chapter-I/subchapter-H/part-890"
+ target="_blank"
+ rel="noopener noreferrer"
+ onClick={(e: React.MouseEvent) => e.stopPropagation()}
+ >
+ 21 CFR Part 890 (Physical Medicine Devices)
+ </MuiLink>
+ {' '}and require{' '}
+ <MuiLink
+ href="https://www.fda.gov/medical-devices/premarket-submissions-selecting-and-preparing-correct-submission/premarket-notification-510k"
+ target="_blank"
+ rel="noopener noreferrer"
+ onClick={(e: React.MouseEvent) => e.stopPropagation()}
+ >
+ 510(k) clearance
+ </MuiLink>
+ {' '}for clinical applications.
+ <br/>
+ <br/>
+ <MuiLink
+ href="https://aaroncherian.github.io/freemocap_validation/"
+ target="_blank"
+ rel="noopener noreferrer"
+ onClick={(e: React.MouseEvent) => e.stopPropagation()}
+ >
+ - View our validation studies
+ </MuiLink>
+ <br/>
+ <MuiLink
+ href="https://github.com/freemocap/freemocap_foundation/issues/32"
+ target="_blank"
+ rel="noopener noreferrer"
+ onClick={(e: React.MouseEvent) => e.stopPropagation()}
+ >
+ - Join our journey towards FDA certification
+ </MuiLink>
+ </Typography>
+ </Paper>
</Container>
);
};
diff --git a/freemocap-ui/src/services/server/server-helpers/websocket-connection.ts b/freemocap-ui/src/services/server/server-helpers/websocket-connection.ts
index 2fcbed7d..f8c3b307 100644
--- a/freemocap-ui/src/services/server/server-helpers/websocket-connection.ts
+++ b/freemocap-ui/src/services/server/server-helpers/websocket-connection.ts
@@ -18,7 +18,7 @@ type EventCallback = (...args: any[]) => void;
export class WebSocketConnection {
private ws: WebSocket | null = null;
private config: Required<WebSocketConfig>;
- private reconnectAttempts: number = 0;
+ private reconnectAttempts: number = 1;
private reconnectTimer: number | null = null;
private heartbeatTimer: number | null = null;
private state: ConnectionState = ConnectionState.DISCONNECTED;
diff --git a/freemocap-ui/src/store/slices/recording/recording-slice.ts b/freemocap-ui/src/store/slices/recording/recording-slice.ts
index 255dd726..9a003c8a 100644
--- a/freemocap-ui/src/store/slices/recording/recording-slice.ts
+++ b/freemocap-ui/src/store/slices/recording/recording-slice.ts
@@ -70,6 +70,7 @@ const initialState: RecordingInfo = {
recordingName: null,
startedAt: null,
duration: 0,
+ completionData: null,
config: {
useDelayStart: false,
delaySeconds: 3,
@@ -159,6 +160,9 @@ export const recordingSlice = createSlice({
pathRecomputed: (state) => {
state.computed = computeRecordingPath(state.recordingDirectory, state.config);
},
+ recordingCompletionDismissed: (state) => {
+ state.completionData = null;
+ },
},
extraReducers: (builder) => {
builder
@@ -194,4 +198,5 @@ export const {
createSubfolderToggled,
customSubfolderNameChanged,
pathRecomputed,
+ recordingCompletionDismissed
} = recordingSlice.actions;
diff --git a/freemocap-ui/src/store/slices/recording/recording-types.ts b/freemocap-ui/src/store/slices/recording/recording-types.ts
index 84e77e38..ac6187a0 100644
--- a/freemocap-ui/src/store/slices/recording/recording-types.ts
+++ b/freemocap-ui/src/store/slices/recording/recording-types.ts
@@ -55,6 +55,7 @@ export const RecordingInfoSchema = z.object({
duration: z.number().nullable(),
config: RecordingConfigSchema,
computed: ComputedRecordingPathSchema,
+ completionData: StopRecordingResponseSchema.nullable(),
});
export type RecordingConfig = z.infer<typeof RecordingConfigSchema>;