InfoStand updates

This commit is contained in:
MyNameIsBatman 2021-06-20 13:52:21 -03:00
parent 6148839754
commit 7a13f78fa4
3 changed files with 112 additions and 4 deletions

View File

@ -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<InfoStandWidgetBotViewProps> = 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 (
<>
<div className="d-flex flex-column bg-dark nitro-card nitro-infostand rounded nitro-infostand-user">
<div className="container-fluid content-area">
<div className="d-flex justify-content-between align-items-center">
<div>{ botData.name }</div>
<i className="fas fa-times cursor-pointer" onClick={ close }></i>
</div>
<hr className="m-0 my-1"/>
<div className="d-flex">
<div className="body-image bot w-100">
<AvatarImageView figure={ botData.figure } direction={ 4 } />
</div>
<div className="w-100 d-flex justify-content-center align-items-center">
<BadgeImageView badgeCode="BOT" />
</div>
</div>
<hr className="m-0 my-1"/>
<div className="bg-secondary rounded py-1 px-2 small">
<div className="motto-content">{ botData.motto }</div>
</div>
</div>
</div>
{ canPickup && <div className="button-container mt-2">
<button type="button" className="btn btn-sm btn-danger ms-1" onClick={event => processButtonAction('pickup')}>
<i className="me-1 fas fa-eject"></i>
{LocalizeText('infostand.button.pickup')}
</button>
</div> }
</>
);
}

View File

@ -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<InfoStandWidgetRentableBotViewProps> = 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 (
<>
<div className="d-flex flex-column bg-dark nitro-card nitro-infostand rounded nitro-infostand-user">
<div className="container-fluid content-area">
<div className="d-flex justify-content-between align-items-center">
<div>{ rentableBotData.name }</div>
<i className="fas fa-times cursor-pointer" onClick={ close }></i>
</div>
<hr className="m-0 my-1"/>
<div className="d-flex">
<div className="body-image bot w-100">
<AvatarImageView figure={ rentableBotData.figure } direction={ 4 } />
</div>
<div className="w-100 d-flex justify-content-center align-items-center">
<BadgeImageView badgeCode="BOT" />
</div>
</div>
<hr className="m-0 my-1"/>
<div className="w-100 text-center">{ rentableBotData.motto }</div>
<hr className="m-0 my-1"/>
<div className="w-100 text-center">{ LocalizeText('infostand.text.botowner', ['name'], [ rentableBotData.ownerName ]) }</div>
</div>
</div>
{ canPickup && <div className="button-container mt-2">
<button type="button" className="btn btn-sm btn-danger ms-1" onClick={event => processButtonAction('pickup')}>
<i className="me-1 fas fa-eject"></i>
{LocalizeText('infostand.button.pickup')}
</button>
</div> }
</>
);
}

View File

@ -51,6 +51,8 @@ export const InfoStandWidgetUserView: FC<InfoStandWidgetUserViewProps> = props =
}, []);
if(!userData) return null;
return (
<>
<div className="d-flex flex-column bg-dark nitro-card nitro-infostand rounded nitro-infostand-user">