diff --git a/src/views/room/widgets/doorbell/DoorbellWidgetView.tsx b/src/views/room/widgets/doorbell/DoorbellWidgetView.tsx index 7dad34dd..b4ac0512 100644 --- a/src/views/room/widgets/doorbell/DoorbellWidgetView.tsx +++ b/src/views/room/widgets/doorbell/DoorbellWidgetView.tsx @@ -5,6 +5,7 @@ import { LocalizeText } from '../../../../utils'; import { useRoomContext } from '../../context/RoomContext'; import { RoomWidgetDoorbellEvent } from '../../events'; import { RoomWidgetLetUserInMessage } from '../../messages'; +import { DoorbellWidgetItemView } from './doorbell-item/DoorbellWidgetItemView'; export const DoorbellWidgetView: FC<{}> = props => { @@ -62,7 +63,7 @@ export const DoorbellWidgetView: FC<{}> = props => removeUser(userName); }, [ widgetHandler, removeUser ]); - if(!users.length) return null; + if(!isVisible) return null; return ( @@ -71,15 +72,7 @@ export const DoorbellWidgetView: FC<{}> = props =>
{ (users.length > 0) && users.map(userName => { - return ( -
- { userName } -
- - -
-
- ); + return answer(userName, true) } deny={ () => answer(userName, false) } />; }) }
diff --git a/src/views/room/widgets/doorbell/doorbell-item/DoorbellWidgetItemView.tsx b/src/views/room/widgets/doorbell/doorbell-item/DoorbellWidgetItemView.tsx new file mode 100644 index 00000000..dcd90189 --- /dev/null +++ b/src/views/room/widgets/doorbell/doorbell-item/DoorbellWidgetItemView.tsx @@ -0,0 +1,21 @@ +import { FC } from 'react'; +import { DoorbellWidgetItemViewProps } from './DoorbellWidgetItemView.types'; + +export const DoorbellWidgetItemView: FC = props => +{ + const { userName = '', accept = null, deny = null } = props; + + return ( +
+ { userName } +
+ + +
+
+ ); +} diff --git a/src/views/room/widgets/doorbell/doorbell-item/DoorbellWidgetItemView.types.ts b/src/views/room/widgets/doorbell/doorbell-item/DoorbellWidgetItemView.types.ts new file mode 100644 index 00000000..a0ba4caa --- /dev/null +++ b/src/views/room/widgets/doorbell/doorbell-item/DoorbellWidgetItemView.types.ts @@ -0,0 +1,6 @@ +export interface DoorbellWidgetItemViewProps +{ + userName: string; + accept: () => void; + deny: () => void; +}