Skip to content

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

TypeScript

weeee'll clean it up later lol

jonmatthisbe4d4d18027e
diff --git a/freemocap-ui/src/components/WebsocketConnectionStatus.tsx b/freemocap-ui/src/components/WebsocketConnectionStatus.tsx
new file mode 100644
index 00000000..c5aac008
--- /dev/null
+++ b/freemocap-ui/src/components/WebsocketConnectionStatus.tsx
@@ -0,0 +1,15 @@
+import React from 'react';
+import {Box} from '@mui/material';
+import {useWebSocketContext} from '@/context/WebSocketContext';
+
+const WebsocketConnectionStatus = () => {
+ const {isConnected} = useWebSocketContext();
+
+ return (
+ <Box sx={{display: 'flex', flexDirection: 'column', color: '#dadada'}}>
+ Websocket: {isConnected ? 'connected' : 'disconnected'}
+ </Box>
+ );
+};
+
+export default WebsocketConnectionStatus
diff --git a/freemocap-ui/src/layout/Sidebar.tsx b/freemocap-ui/src/layout/Sidebar.tsx
index f3c63d72..ee4654a5 100644
--- a/freemocap-ui/src/layout/Sidebar.tsx
+++ b/freemocap-ui/src/layout/Sidebar.tsx
@@ -9,88 +9,87 @@ import ListItemIcon from '@mui/material/ListItemIcon';
import ListItemText from '@mui/material/ListItemText';
import HomeIcon from '@mui/icons-material/Home';
import {useNavigate} from "react-router";
+import WebsocketConnectionStatus from "@/components/WebsocketConnectionStatus";
-const categories = [
- {
- id: 'Build',
- children: [
- {
- id: 'Python Cameras',
- route: "/show_cameras"
- },
- {
- id: 'JS Camera',
- route: '/jontestplayground'
- },
- {
- id: 'Websocket',
- route: '/websocketConnection'
- },
- // {
- // id: "Board Detection",
- // route: "/charuco_board_detection"
- // },
- // {
- // id: "Skeleton Detection",
- // route: "/skeleton_detection"
- // },
- {
- id: "JS Detected Cameras",
- route: "/config"
- }
- ],
- },
+const sidebarItems = [
+ {
+ id: 'Views',
+ children: [
+ {
+ id: 'Camera Views',
+ route: "/show_cameras"
+ },
+ // {
+ // id: 'JS Camera',
+ // route: '/jontestplayground'
+ // },
+ // {
+ // id: "Board Detection",
+ // route: "/charuco_board_detection"
+ // },
+ // {
+ // id: "Skeleton Detection",
+ // route: "/skeleton_detection"
+ // },
+ {
+ id: "JS Detected Cameras",
+ route: "/config"
+ }
+ ],
+ },
];
const item = {
- py: '2px',
- px: 3,
- color: 'rgba(255, 255, 255, 0.7)',
- '&:hover, &:focus': {
- bgcolor: 'rgba(255, 255, 255, 0.08)',
- },
+ py: '2px',
+ px: 3,
+ color: 'rgba(255, 255, 255, 0.7)',
+ '&:hover, &:focus': {
+ bgcolor: 'rgba(255, 255, 255, 0.08)',
+ },
};
const itemCategory = {
- boxShadow: '0 -1px 0 rgb(255,255,255,0.1) inset',
- py: 1.5,
- px: 3,
+ boxShadow: '0 -1px 0 rgb(255,255,255,0.1) inset',
+ py: 1.5,
+ px: 3,
};
export const Sidebar = function (props: DrawerProps) {
- const {...other} = props;
- const navigate = useNavigate();
- return (
- <Drawer variant="permanent" {...other}>
- <List disablePadding>
- <ListItem sx={{...item, ...itemCategory, fontSize: 22, color: '#fff'}}>
- SkellyCam
- </ListItem>
- <ListItem sx={{...item, ...itemCategory}}>
- <ListItemIcon>
- <HomeIcon />
- </ListItemIcon>
- <ListItemText>Home</ListItemText>
- </ListItem>
- {categories.map(({id, children}) => (
- <Box key={id} sx={{bgcolor: '#101F33'}}>
- <ListItem sx={{py: 2, px: 3}}>
- <ListItemText sx={{color: '#fff'}}>{id}</ListItemText>
- </ListItem>
- {children.map(({id: childId, route}) => (
- <ListItem disablePadding key={childId}>
- <ListItemButton selected={false} sx={item} onClick={() => {
- navigate(route)
- }}>
- {/*<ListItemIcon>{icon}</ListItemIcon>*/}
- <ListItemText>{childId}</ListItemText>
- </ListItemButton>
- </ListItem>
- ))}
- <Divider sx={{mt: 2}} />
- </Box>
- ))}
- </List>
- </Drawer>
- );
+ const {...other} = props;
+ const navigate = useNavigate();
+ return (
+ <Drawer variant="permanent" {...other}>
+ <List disablePadding>
+ <ListItem sx={{...item, ...itemCategory, fontSize: 22, color: '#fff'}}>
+ FreeMoCap πŸ’€βœ¨
+ </ListItem>
+ {/*<ListItem sx={{...item, ...itemCategory}}>*/}
+ {/* <ListItemIcon>*/}
+ {/* <HomeIcon/>*/}
+ {/* </ListItemIcon>*/}
+ {/* <ListItemText>Home</ListItemText>*/}
+ {/*</ListItem>*/}
+ {sidebarItems.map(({id, children}) => (
+ <Box key={id} sx={{bgcolor: '#101F33'}}>
+ <ListItem sx={{py: 2, px: 3}}>
+ <ListItemText sx={{color: '#fff'}}>{id}</ListItemText>
+ </ListItem>
+ {children.map(({id: childId, route}) => (
+ <ListItem disablePadding key={childId}>
+ <ListItemButton selected={false} sx={item} onClick={() => {
+ navigate(route)
+ }}>
+ {/*<ListItemIcon>{icon}</ListItemIcon>*/}
+ <ListItemText>{childId}</ListItemText>
+ </ListItemButton>
+ </ListItem>
+ ))}
+ <Divider sx={{mt: 2}}/>
+ </Box>
+ ))}
+ </List>
+ <WebsocketConnectionStatus/>
+ </Drawer>
+)
+ ;
}
diff --git a/freemocap-ui/src/layout/content/BaseContent.tsx b/freemocap-ui/src/layout/content/BaseContent.tsx
index dfc834a8..92ea8804 100644
--- a/freemocap-ui/src/layout/content/BaseContent.tsx
+++ b/freemocap-ui/src/layout/content/BaseContent.tsx
@@ -6,7 +6,7 @@ import {Router} from "../routing/router";
export const BaseContent = () => {
return (
<React.Fragment>
- <Header title="FreeeeMoCap " onDrawerToggle={() => {}}/>
+ {/*<Header title="FreeeeMoCap " onDrawerToggle={() => {}}/>*/}
<Box sx={{py: 6, px: 4, flex: 1, bgcolor: '#9008c6', border: '5px solid black'}}>
<Router/>
</Box>
diff --git a/freemocap-ui/src/layout/routing/router.tsx b/freemocap-ui/src/layout/routing/router.tsx
index c43255a9..7a4d5e2d 100644
--- a/freemocap-ui/src/layout/routing/router.tsx
+++ b/freemocap-ui/src/layout/routing/router.tsx
@@ -5,18 +5,18 @@ import {BrowserCamerasView} from "@/views/BrowserCamerasView";
import {PythonToJsTest} from "@/views/PythonToJsTest";
import {PythonCamerasView} from "@/views/PythonCamerasView";
import {DefaultView} from "@/views/Default";
-import WebsocketConnection from "@/views/WebsocketConnection";
+import WebsocketConnectionStatus from "@/components/WebsocketConnectionStatus";
export const Router = () => {
return (
<Routes>
- <Route path={'/'} element={<React.Fragment/>}/>
- <Route path={'/default'} element={<DefaultView/>}/>
+ {/*<Route path={'/'} element={<React.Fragment/>}/>*/}
+ {/*<Route path={'/default'} element={<DefaultView/>}/>*/}
<Route path={'/config'} element={<ConfigView/>}/>
- <Route path={'/jontestplayground'} element={<BrowserCamerasView/>}/>
- <Route path={'/pythonToJs'} element={<PythonToJsTest/>}/>
+ {/*<Route path={'/jontestplayground'} element={<BrowserCamerasView/>}/>*/}
+ {/*<Route path={'/pythonToJs'} element={<PythonToJsTest/>}/>*/}
<Route path={'/show_cameras'} element={<PythonCamerasView/>}/>
- <Route path={'/websocketConnection'} element={<WebsocketConnection/>}/>
+ <Route path={'/websocketConnection'} element={<WebsocketConnectionStatus/>}/>
</Routes>
)
}
diff --git a/freemocap-ui/src/views/WebsocketConnection.tsx b/freemocap-ui/src/views/WebsocketConnection.tsx
deleted file mode 100644
index 47a6666f..00000000
--- a/freemocap-ui/src/views/WebsocketConnection.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-import React from 'react';
-import {Box} from '@mui/material';
-import {useWebSocketContext} from '@/context/WebSocketContext';
-
-const WebsocketConnection = () => {
- const {isConnected} = useWebSocketContext();
-
- return (
- <Box sx={{display: 'flex', flexDirection: 'column'}}>
- Websocket status: {isConnected ? 'connected' : 'disconnected'}
- </Box>
- );
-};
-
-export default WebsocketConnection