diff --git a/src/views/room/widgets/infostand/views/bot/InfoStandWidgetBotView.tsx b/src/views/room/widgets/infostand/views/bot/InfoStandWidgetBotView.tsx index 435d5472..25e5e61c 100644 --- a/src/views/room/widgets/infostand/views/bot/InfoStandWidgetBotView.tsx +++ b/src/views/room/widgets/infostand/views/bot/InfoStandWidgetBotView.tsx @@ -1,9 +1,62 @@ -import { FC } from 'react'; +import { RoomControllerLevel } from 'nitro-renderer'; +import { FC, useCallback, useEffect, useState } from 'react'; +import { LocalizeText } from '../../../../../../utils/LocalizeText'; +import { AvatarImageView } from '../../../../../avatar-image/AvatarImageView'; +import { BadgeImageView } from '../../../../../badge-image/BadgeImageView'; import { InfoStandWidgetBotViewProps } from './InfoStandWidgetBotView.types'; export const InfoStandWidgetBotView: FC = props => { const { botData = null, close = null } = props; - return null; + const [ canPickup, setCanPickup ] = useState(false); + + useEffect(() => + { + setCanPickup(false); + + if(botData.amIOwner || botData.amIAnyRoomController || botData.roomControllerLevel >= RoomControllerLevel.MODERATOR) + setCanPickup(true); + + }, [ botData ]); + + const processButtonAction = useCallback((action: string) => + { + if(!action || (action === '')) return; + + }, []); + + if(!botData) return null; + + return ( + <> +
+
+
+
{ botData.name }
+ +
+
+
+
+ +
+
+ +
+
+
+
+
{ botData.motto }
+
+
+
+ { canPickup &&
+ +
} + + ); } diff --git a/src/views/room/widgets/infostand/views/rentable-bot/InfoStandWidgetRentableBotView.tsx b/src/views/room/widgets/infostand/views/rentable-bot/InfoStandWidgetRentableBotView.tsx index 6540969c..cb17a3e5 100644 --- a/src/views/room/widgets/infostand/views/rentable-bot/InfoStandWidgetRentableBotView.tsx +++ b/src/views/room/widgets/infostand/views/rentable-bot/InfoStandWidgetRentableBotView.tsx @@ -1,9 +1,62 @@ -import { FC } from 'react'; +import { RoomControllerLevel } from 'nitro-renderer'; +import { FC, useCallback, useEffect, useState } from 'react'; +import { LocalizeText } from '../../../../../../utils/LocalizeText'; +import { AvatarImageView } from '../../../../../avatar-image/AvatarImageView'; +import { BadgeImageView } from '../../../../../badge-image/BadgeImageView'; import { InfoStandWidgetRentableBotViewProps } from './InfoStandWidgetRentableBotView.types'; export const InfoStandWidgetRentableBotView: FC = props => { const { rentableBotData = null, close = null } = props; - return null; + const [ canPickup, setCanPickup ] = useState(false); + + useEffect(() => + { + setCanPickup(false); + + if(rentableBotData.amIOwner || rentableBotData.amIAnyRoomController || rentableBotData.roomControllerLevel >= RoomControllerLevel.MODERATOR) + setCanPickup(true); + + }, [ rentableBotData ]); + + const processButtonAction = useCallback((action: string) => + { + if(!action || (action === '')) return; + + }, []); + + if(!rentableBotData) return; + + return ( + <> +
+
+
+
{ rentableBotData.name }
+ +
+
+
+
+ +
+
+ +
+
+
+
{ rentableBotData.motto }
+
+
{ LocalizeText('infostand.text.botowner', ['name'], [ rentableBotData.ownerName ]) }
+
+
+ { canPickup &&
+ +
} + + ); } diff --git a/src/views/room/widgets/infostand/views/user/InfoStandWidgetUserView.tsx b/src/views/room/widgets/infostand/views/user/InfoStandWidgetUserView.tsx index fe4a0b35..96190c3d 100644 --- a/src/views/room/widgets/infostand/views/user/InfoStandWidgetUserView.tsx +++ b/src/views/room/widgets/infostand/views/user/InfoStandWidgetUserView.tsx @@ -51,6 +51,8 @@ export const InfoStandWidgetUserView: FC = props = }, []); + if(!userData) return null; + return ( <>