diff --git a/src/views/room/widgets/room-tools/RoomToolsWidgetView.scss b/src/views/room/widgets/room-tools/RoomToolsWidgetView.scss index 7f313a8c..33313ed6 100644 --- a/src/views/room/widgets/room-tools/RoomToolsWidgetView.scss +++ b/src/views/room/widgets/room-tools/RoomToolsWidgetView.scss @@ -31,5 +31,9 @@ border-bottom: none; padding-bottom: 8px; } + + &.disabled { + opacity: .5; + } } } diff --git a/src/views/room/widgets/room-tools/RoomToolsWidgetView.tsx b/src/views/room/widgets/room-tools/RoomToolsWidgetView.tsx index fb800bfe..0ce23306 100644 --- a/src/views/room/widgets/room-tools/RoomToolsWidgetView.tsx +++ b/src/views/room/widgets/room-tools/RoomToolsWidgetView.tsx @@ -1,5 +1,7 @@ import classNames from 'classnames'; +import { RoomLikeRoomComposer } from 'nitro-renderer'; import { FC, useCallback, useState } from 'react'; +import { SendMessageHook } from '../../../../hooks/messages'; import { LocalizeText } from '../../../../utils/LocalizeText'; import { useRoomContext } from '../../context/RoomContext'; import { RoomWidgetZoomToggleMessage } from '../../messages'; @@ -11,6 +13,7 @@ export const RoomToolsWidgetView: FC = props => const [ isExpended, setIsExpanded ] = useState(false); const [ isZoomedIn, setIsZoomedIn ] = useState(false); + const [ liked, setLiked ] = useState(false); const handleToolClick = useCallback((action: string) => { @@ -25,11 +28,15 @@ export const RoomToolsWidgetView: FC = props => case 'chat_history': return; case 'like_room': + if(liked) return; + + SendMessageHook(new RoomLikeRoomComposer(1)); + setLiked(true); return; case 'room_link': return; } - }, [ isZoomedIn, widgetHandler ]); + }, [ isZoomedIn, liked, widgetHandler ]); return (
@@ -43,7 +50,7 @@ export const RoomToolsWidgetView: FC = props =>
handleToolClick('chat_history') }> { LocalizeText('room.chathistory.button.text') }
-
handleToolClick('like_room') }> +
handleToolClick('like_room') }> { LocalizeText('room.like.button.text') }
handleToolClick('room_link') }>