Spaces:
Running
Running
Download src/components/FaceTrackingControlCard.tsx from Awakey/reachy-home-camera: direct link, hf CLI and curl.
- Browser
- Download file 2.17 kB
-
https://huggingface.co/spaces/Awakey/reachy-home-camera/resolve/main/src/components/FaceTrackingControlCard.tsx
- Command line
-
hf download hf://spaces/Awakey/reachy-home-camera/src/components/FaceTrackingControlCard.tsx
-
curl -L -o FaceTrackingControlCard.tsx https://huggingface.co/spaces/Awakey/reachy-home-camera/resolve/main/src/components/FaceTrackingControlCard.tsx
2.17 kB
| import { | |
| Alert, | |
| Button, | |
| Paper, | |
| Stack, | |
| Typography, | |
| useTheme, | |
| } from '@mui/material'; | |
| interface FaceTrackingControlCardProps { | |
| trackingRequested: boolean | null; | |
| disabled: boolean; | |
| feedback: { | |
| severity: 'error' | 'info' | 'success'; | |
| message: string; | |
| } | null; | |
| onToggle(): void; | |
| onManualControl(): void; | |
| } | |
| export default function FaceTrackingControlCard({ | |
| trackingRequested, | |
| disabled, | |
| feedback, | |
| onToggle, | |
| onManualControl, | |
| }: FaceTrackingControlCardProps) { | |
| const theme = useTheme(); | |
| return ( | |
| <Paper | |
| elevation={0} | |
| sx={{ | |
| p: 1.75, | |
| display: 'flex', | |
| flexDirection: 'column', | |
| gap: 1, | |
| borderRadius: 1, | |
| border: `1px solid ${theme.palette.divider}`, | |
| boxShadow: 'none', | |
| backgroundColor: theme.palette.background.paper, | |
| }} | |
| > | |
| <Stack | |
| direction={{ xs: 'column', sm: 'row' }} | |
| spacing={1.25} | |
| sx={{ | |
| alignItems: { xs: 'stretch', sm: 'center' }, | |
| justifyContent: 'space-between', | |
| }} | |
| > | |
| <Stack spacing={0.25}> | |
| <Typography variant="subtitle2" sx={{ fontWeight: 700 }}> | |
| Face tracking | |
| </Typography> | |
| <Typography variant="caption" color="text.secondary"> | |
| Following can continue after disconnecting on a keep-awake robot. | |
| </Typography> | |
| </Stack> | |
| <Button | |
| variant={trackingRequested ? 'outlined' : 'contained'} | |
| onClick={onToggle} | |
| disabled={disabled} | |
| sx={{ minHeight: 48, minWidth: { xs: '100%', sm: 152 }, flexShrink: 0 }} | |
| > | |
| {trackingRequested ? 'Stop tracking' : 'Start tracking'} | |
| </Button> | |
| {trackingRequested === null && ( | |
| <Button | |
| variant="outlined" | |
| onClick={onManualControl} | |
| disabled={disabled} | |
| sx={{ minHeight: 48, flexShrink: 0 }} | |
| > | |
| Manual control | |
| </Button> | |
| )} | |
| </Stack> | |
| {feedback && ( | |
| <Alert severity={feedback.severity} sx={{ py: 0 }}> | |
| {feedback.message} | |
| </Alert> | |
| )} | |
| </Paper> | |
| ); | |
| } | |