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 (
|
|
|
|
<>
|
2021-01-23 11:36:59 +01:00
|
|
|
<button onClick={ev => { ev.preventDefault(), setOpen(true); }}
|
|
|
|
title={t('bbb', 'Edit')} className="action-item">
|
2021-08-04 16:42:59 +02:00
|
|
|
<span className="icon icon-settings-dark icon-visible"></span>
|
2021-01-23 11:36:59 +01:00
|
|
|
</button>
|
2020-06-16 16:54:50 +02:00
|
|
|
|
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;
|