mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-26 23:50:52 +01:00
Fix chat
This commit is contained in:
parent
d359862e1c
commit
e93c37efbb
@ -4,7 +4,8 @@ import { LocalizeText } from '../../../api';
|
||||
import { Button } from '../../../common/Button';
|
||||
import { Column } from '../../../common/Column';
|
||||
import { Text } from '../../../common/Text';
|
||||
import { SendMessageHook } from '../../../hooks';
|
||||
import { GuideToolEvent } from '../../../events/guide-tool/GuideToolEvent';
|
||||
import { dispatchUiEvent, SendMessageHook } from '../../../hooks';
|
||||
import { useHelpContext } from '../HelpContext';
|
||||
|
||||
export const HelpIndexView: FC<{}> = props =>
|
||||
@ -23,6 +24,11 @@ export const HelpIndexView: FC<{}> = props =>
|
||||
SendMessageHook(new GetCfhStatusMessageComposer(false));
|
||||
}, []);
|
||||
|
||||
const onNewHelpRequestClick = useCallback(() =>
|
||||
{
|
||||
dispatchUiEvent(new GuideToolEvent(GuideToolEvent.CREATE_HELP_REQUEST));
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Column gap={ 1 }>
|
||||
@ -31,7 +37,7 @@ export const HelpIndexView: FC<{}> = props =>
|
||||
</Column>
|
||||
<Column gap={ 1 }>
|
||||
<Button onClick={ onReportClick }>{ LocalizeText('help.main.bully.subtitle') }</Button>
|
||||
<Button disabled={ true }>{ LocalizeText('help.main.help.title') }</Button>
|
||||
<Button onClick={ onNewHelpRequestClick }>{ LocalizeText('help.main.help.title') }</Button>
|
||||
<Button disabled={ true }>{ LocalizeText('help.main.self.tips.title') }</Button>
|
||||
<Button variant="link" className="text-black" onClick={ onRequestMySanctionStatusClick }>{ LocalizeText('help.main.my.sanction.status') }</Button>
|
||||
</Column>
|
||||
|
@ -53,6 +53,11 @@ export const GuideToolOngoingView: FC<GuideToolOngoingViewProps> = props =>
|
||||
sendMessage();
|
||||
}, [ sendMessage ]);
|
||||
|
||||
const isOwnChat = useCallback((userId: number) =>
|
||||
{
|
||||
return userId === GetSessionDataManager().userId;
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<NitroCardContentView className="p-0">
|
||||
<div className="d-flex gap-2 align-items-center bg-secondary p-2 text-white">
|
||||
@ -71,22 +76,20 @@ export const GuideToolOngoingView: FC<GuideToolOngoingViewProps> = props =>
|
||||
{ messageGroups.map((group, index) =>
|
||||
{
|
||||
return (
|
||||
<NitroLayoutFlex className={ 'w-100 justify-content-' + (group.userId === 0 ? 'end' : 'start') } gap={ 2 }>
|
||||
{ (group.userId === userId) &&
|
||||
<NitroLayoutFlex className={ 'w-100 justify-content-' + (isOwnChat(group.userId) ? 'end' : 'start') } gap={ 2 }>
|
||||
<NitroLayoutBase className="message-avatar flex-shrink-0">
|
||||
{ (!isOwnChat(group.userId)) &&
|
||||
<AvatarImageView figure={ userFigure } direction={ 2 } />
|
||||
</NitroLayoutBase> }
|
||||
<NitroLayoutBase className={ 'bg-light text-black border-radius mb-2 rounded py-1 px-2 messages-group-' + (group.userId !== userId ? 'right' : 'left') }>
|
||||
{ group.messages.map((message, index) =>
|
||||
{
|
||||
return (
|
||||
<NitroLayoutBase key={ index } className="text-break">
|
||||
{ message.roomId > 0 ? LocalizeText('guide.help.request.user.ongoing.visit.guide.request.message', ['name', 'roomname'], [userName, message.message]) : message.message }
|
||||
}
|
||||
</NitroLayoutBase>
|
||||
);
|
||||
}) }
|
||||
<NitroLayoutBase className={ 'bg-light text-black border-radius mb-2 rounded py-1 px-2 messages-group-' + (isOwnChat(group.userId) ? 'right' : 'left') }>
|
||||
<NitroLayoutBase className='fw-bold'>
|
||||
{ (isOwnChat(group.userId)) && GetSessionDataManager().userName }
|
||||
{ (!isOwnChat(group.userId)) && userName }
|
||||
</NitroLayoutBase>
|
||||
{ (group.userId !== userId) &&
|
||||
{ group.messages.map((chat, index) =><NitroLayoutBase key={ index } className="text-break">{ chat.message }</NitroLayoutBase>) }
|
||||
</NitroLayoutBase>
|
||||
{ (isOwnChat(group.userId)) &&
|
||||
<NitroLayoutBase className="message-avatar flex-shrink-0">
|
||||
<AvatarImageView figure={ GetSessionDataManager().figure } direction={ 4 } />
|
||||
</NitroLayoutBase> }
|
||||
|
Loading…
Reference in New Issue
Block a user