import React, { } from 'react'; import { Restriction } from '../Common/Api'; import EditableValue from '../Manager/EditableValue'; import EditableSelection from '../Common/EditableSelection'; import { AccessOptions } from '../Common/Translation'; type Props = { restriction: Restriction; updateRestriction: (restriction: Restriction) => Promise; deleteRestriction: (id: number) => void; } const RestrictionRoom: React.FC = (props) => { const restriction = props.restriction; function updateRestriction(key: string, value: string | boolean | number | string[]) { return props.updateRestriction({ ...props.restriction, [key]: value, }); } function deleteRow(ev: MouseEvent) { ev.preventDefault(); const groupName = restriction.groupName || restriction.groupId; OC.dialogs.confirm( t('bbb', 'Are you sure you want to delete the restrictions for group "{name}"? This operation cannot be undone.', { name: groupName }), t('bbb', 'Delete restrictions for "{name}"?', { name: groupName}), confirmed => { if (confirmed) { props.deleteRestriction(restriction.id); } }, true ); } function edit(field: string, type: 'text' | 'number' = 'text') { return ; } return ( {restriction.groupName || restriction.groupId || t('bbb', 'All users')} {edit('maxRooms', 'number')} {edit('maxParticipants', 'number')} updateRestriction('allowRecording', event.target.checked)} /> ); }; export default RestrictionRoom;