Files
MyTube/frontend/src/components/Settings/VideoDefaultSettings.tsx
2025-12-29 16:42:35 -05:00

42 lines
1.5 KiB
TypeScript

import { Box, FormControlLabel, Switch, Typography } from '@mui/material';
import React from 'react';
import { useLanguage } from '../../contexts/LanguageContext';
import { Settings } from '../../types';
interface VideoDefaultSettingsProps {
settings: Settings;
onChange: (field: keyof Settings, value: any) => void;
}
const VideoDefaultSettings: React.FC<VideoDefaultSettingsProps> = ({ settings, onChange }) => {
const { t } = useLanguage();
return (
<Box>
<Typography variant="h6" gutterBottom>{t('videoDefaults')}</Typography>
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 1 }}>
<FormControlLabel
control={
<Switch
checked={settings.defaultAutoPlay}
onChange={(e) => onChange('defaultAutoPlay', e.target.checked)}
/>
}
label={t('autoPlay')}
/>
<FormControlLabel
control={
<Switch
checked={settings.pauseOnFocusLoss || false}
onChange={(e) => onChange('pauseOnFocusLoss', e.target.checked)}
/>
}
label={t('pauseOnFocusLoss') || "Pause video when window loses focus"}
/>
</Box>
</Box>
);
};
export default VideoDefaultSettings;