2020-06-16 16:54:50 +02:00
|
|
|
import React, { useState } from 'react';
|
2020-08-27 17:21:34 +02:00
|
|
|
import { Room, Restriction } from '../Common/Api';
|
2020-06-16 16:54:50 +02:00
|
|
|
import EditRoomDialog from './EditRoomDialog';
|
|
|
|
|
|
|
|
type Props = {
|
2020-08-27 17:21:34 +02:00
|
|
|
room: Room;
|
|
|
|
restriction?: Restriction;
|
2021-01-22 19:12:55 +01:00
|
|
|
updateProperty: (key: string, value: string | boolean | number | null) => Promise<void>;
|
2020-06-16 16:54:50 +02:00
|
|
|
}
|
|
|
|
|
2020-08-27 17:21:34 +02:00
|
|
|
const EditRoom: React.FC<Props> = ({ room, restriction, updateProperty }) => {
|
2020-06-16 16:54:50 +02:00
|
|
|
const [open, setOpen] = useState<boolean>(false);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<a className="icon icon-edit icon-visible"
|
|
|
|
onClick={ev => { ev.preventDefault(), setOpen(true); }}
|
|
|
|
title={t('bbb', 'Edit')} />
|
|
|
|
|
2020-08-27 17:21:34 +02:00
|
|
|
<EditRoomDialog room={room} restriction={restriction} updateProperty={updateProperty} open={open} setOpen={setOpen} />
|
2020-06-16 16:54:50 +02:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2020-08-27 17:21:34 +02:00
|
|
|
export default EditRoom;
|