diff --git a/src/common/types/ColorVariantType.ts b/src/common/types/ColorVariantType.ts index a4e42e69..1ff6f60b 100644 --- a/src/common/types/ColorVariantType.ts +++ b/src/common/types/ColorVariantType.ts @@ -1 +1 @@ -export type ColorVariantType = 'primary' | 'success' | 'danger' | 'secondary' | 'link' | 'black' | 'white' | 'dark' | 'warning' | 'muted'; +export type ColorVariantType = 'primary' | 'success' | 'danger' | 'secondary' | 'link' | 'black' | 'white' | 'dark' | 'warning' | 'muted' | 'light'; diff --git a/src/components/guide-tool/GuideToolView.scss b/src/components/guide-tool/GuideToolView.scss index 62104ce9..e9b06a29 100644 --- a/src/components/guide-tool/GuideToolView.scss +++ b/src/components/guide-tool/GuideToolView.scss @@ -1,13 +1,6 @@ .nitro-guide-tool { width: 250px; - .duty-status { - border-radius: 0.25rem; - border-color: #B6BEC5 !important; - background-color: #CDD3D9; - border: 2px solid; - } - .duty-switch { width: 38px; height: 21px; @@ -26,9 +19,6 @@ } .chat-messages { - height: 200px; - min-height: 200px; - overflow-y: auto; .message-avatar { position: relative; diff --git a/src/components/guide-tool/GuideToolView.tsx b/src/components/guide-tool/GuideToolView.tsx index be6b973b..8525daac 100644 --- a/src/components/guide-tool/GuideToolView.tsx +++ b/src/components/guide-tool/GuideToolView.tsx @@ -3,9 +3,10 @@ import { FC, useCallback, useEffect, useState } from 'react'; import { AddEventLinkTracker, GetConfiguration, GetSessionDataManager, LocalizeText, RemoveLinkEventTracker } from '../../api'; import { GuideToolEvent, NotificationAlertEvent } from '../../events'; import { CreateMessageHook, dispatchUiEvent, SendMessageHook, useUiEvent } from '../../hooks'; -import { NitroCardHeaderView, NitroCardView } from '../../layout'; -import { GuideSessionState, GuideToolMessageGroup } from './common'; +import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../layout'; +import { GuideSessionState } from './common/GuideSessionState'; import { GuideToolMessage } from './common/GuideToolMessage'; +import { GuideToolMessageGroup } from './common/GuideToolMessageGroup'; import { GuideToolAcceptView } from './views/GuideToolAcceptView'; import { GuideToolMenuView } from './views/GuideToolMenuView'; import { GuideToolOngoingView } from './views/GuideToolOngoingView'; @@ -319,46 +320,24 @@ export const GuideToolView: FC<{}> = props => if(!isVisible) return null; return ( - - processAction('close') } noCloseButton={ noCloseButton } /> - - { sessionState === GuideSessionState.GUIDE_TOOL_MENU && - } - - { sessionState === GuideSessionState.GUIDE_ACCEPT && - } - - { [ GuideSessionState.GUIDE_ONGOING, GuideSessionState.USER_ONGOING ].includes(sessionState) && - } - - { sessionState === GuideSessionState.USER_CREATE && - } - - { sessionState === GuideSessionState.USER_PENDING && - } - - { sessionState === GuideSessionState.USER_FEEDBACK && - } - - { sessionState === GuideSessionState.USER_THANKS && - } + + processAction('close') } noCloseButton={ noCloseButton } /> + + { (sessionState === GuideSessionState.GUIDE_TOOL_MENU) && + } + { (sessionState === GuideSessionState.GUIDE_ACCEPT) && + } + { [ GuideSessionState.GUIDE_ONGOING, GuideSessionState.USER_ONGOING ].includes(sessionState) && + } + { (sessionState === GuideSessionState.USER_CREATE) && + } + { (sessionState === GuideSessionState.USER_PENDING) && + } + { (sessionState === GuideSessionState.USER_FEEDBACK) && + } + { (sessionState === GuideSessionState.USER_THANKS) && + } + ); }; diff --git a/src/components/guide-tool/common/index.ts b/src/components/guide-tool/common/index.ts deleted file mode 100644 index 8ec193c9..00000000 --- a/src/components/guide-tool/common/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './GuideSessionState'; -export * from './GuideToolMessageGroup'; diff --git a/src/components/guide-tool/views/GuideToolAcceptView.tsx b/src/components/guide-tool/views/GuideToolAcceptView.tsx index c76a0d2e..21368ebd 100644 --- a/src/components/guide-tool/views/GuideToolAcceptView.tsx +++ b/src/components/guide-tool/views/GuideToolAcceptView.tsx @@ -1,8 +1,8 @@ import { GuideSessionGuideDecidesMessageComposer } from '@nitrots/nitro-renderer'; -import { FC, useCallback } from 'react'; +import { FC } from 'react'; import { LocalizeText } from '../../../api'; +import { Button, Column, Text } from '../../../common'; import { SendMessageHook } from '../../../hooks'; -import { NitroCardContentView } from '../../../layout'; interface GuideToolAcceptViewProps { @@ -14,22 +14,23 @@ export const GuideToolAcceptView: FC = props => { const { helpRequestDescription = null, helpRequestAverageTime = 0 } = props; - const answerRequest = useCallback((response: boolean) => - { - SendMessageHook(new GuideSessionGuideDecidesMessageComposer(response)); - }, []); + const answerRequest = (response: boolean) => SendMessageHook(new GuideSessionGuideDecidesMessageComposer(response)); return ( - -
-
{ LocalizeText('guide.help.request.guide.accept.request.title') }
-
{ LocalizeText('guide.help.request.type.1') }
-
{ helpRequestDescription }
-
-
- - -
-
+ + + { LocalizeText('guide.help.request.guide.accept.request.title') } + { LocalizeText('guide.help.request.type.1') } + { helpRequestDescription } + + + + + + ); }; diff --git a/src/components/guide-tool/views/GuideToolMenuView.tsx b/src/components/guide-tool/views/GuideToolMenuView.tsx index 9efbb618..07888835 100644 --- a/src/components/guide-tool/views/GuideToolMenuView.tsx +++ b/src/components/guide-tool/views/GuideToolMenuView.tsx @@ -1,6 +1,6 @@ import { FC } from 'react'; import { LocalizeText } from '../../../api'; -import { NitroCardContentView } from '../../../layout'; +import { Base, Button, Column, Flex, Text } from '../../../common'; interface GuideToolMenuViewProps { @@ -34,47 +34,43 @@ export const GuideToolMenuView: FC = props => } = props; return ( - <> - -
-
-
processAction('toggle_duty') } /> -
-
-
{ LocalizeText('guide.help.guide.tool.yourstatus') }
-
{ LocalizeText(`guide.help.guide.tool.duty.${(isOnDuty ? 'on' : 'off')}`) }
-
-
-
-
{ LocalizeText('guide.help.guide.tool.tickettypeselection.caption') }
-
- { setIsHandlingGuideRequests(e.target.checked) } } /> - -
-
- { setIsHandlingHelpRequests(e.target.checked) } } /> - -
-
- { setIsHandlingBullyReports(e.target.checked) } } /> - -
-
-
-
-
-
-
-
-
-
-
-
-
- - -
- - + + + processAction('toggle_duty') } /> + + { LocalizeText('guide.help.guide.tool.yourstatus') } + { LocalizeText(`guide.help.guide.tool.duty.${ (isOnDuty ? 'on' : 'off') }`) } + + + + { LocalizeText('guide.help.guide.tool.tickettypeselection.caption') } + + setIsHandlingGuideRequests(event.target.checked) } /> + { LocalizeText('guide.help.guide.tool.tickettypeselection.guiderequests') } + + + setIsHandlingHelpRequests(event.target.checked) } /> + { LocalizeText('guide.help.guide.tool.tickettypeselection.onlyhelprequests') } + + + setIsHandlingBullyReports(event.target.checked) } /> + { LocalizeText('guide.help.guide.tool.tickettypeselection.bullyreports') } + + +
+ + + + + + + + +
+ + + + +
); } diff --git a/src/components/guide-tool/views/GuideToolOngoingView.tsx b/src/components/guide-tool/views/GuideToolOngoingView.tsx index 649ff19d..833c79c4 100644 --- a/src/components/guide-tool/views/GuideToolOngoingView.tsx +++ b/src/components/guide-tool/views/GuideToolOngoingView.tsx @@ -2,11 +2,11 @@ import { GuideSessionGetRequesterRoomMessageComposer, GuideSessionInviteRequeste import { GuideSessionMessageMessageComposer } from '@nitrots/nitro-renderer/src'; import { FC, KeyboardEvent, useCallback, useState } from 'react'; import { GetSessionDataManager, LocalizeText, TryVisitRoom } from '../../../api'; +import { Base, Button, ButtonGroup, Column, Flex, Text } from '../../../common'; import { CreateMessageHook, SendMessageHook } from '../../../hooks'; -import { NitroCardContentView, NitroLayoutButton, NitroLayoutFlex } from '../../../layout'; import { NitroLayoutBase } from '../../../layout/base'; import { AvatarImageView } from '../../../views/shared/avatar-image/AvatarImageView'; -import { GuideToolMessageGroup } from '../common'; +import { GuideToolMessageGroup } from '../common/GuideToolMessageGroup'; interface GuideToolOngoingViewProps { @@ -69,56 +69,59 @@ export const GuideToolOngoingView: FC = props => }, []); return ( - -
- { isGuide &&
- - -
} - { !isGuide &&
-
{ userName }
-
{ LocalizeText('guide.help.request.user.ongoing.guide.desc') }
-
} -
{ LocalizeText('guide.help.common.report.link') }
-
-
-
+ + + { isGuide && + + + + } + { !isGuide && + + { userName } + { LocalizeText('guide.help.request.user.ongoing.guide.desc') } + } + + + + { messageGroups.map((group, index) => - { - return ( - - - { (!isOwnChat(group.userId)) && - - } - - - - { (isOwnChat(group.userId)) && GetSessionDataManager().userName } - { (!isOwnChat(group.userId)) && userName } - - { group.messages.map((chat, index) =>{ chat.message }) } - - { (isOwnChat(group.userId)) && - - - } - - ); - }) } -
- { isTyping &&
{ LocalizeText('guide.help.common.typing') }
} - + { + return ( + + + { (!isOwnChat(group.userId)) && + } + + + + { (isOwnChat(group.userId)) && GetSessionDataManager().userName } + { (!isOwnChat(group.userId)) && userName } + + { group.messages.map((chat, index) => { chat.message }) } + + { (isOwnChat(group.userId)) && + + + } + + ); + }) } + + + + setMessageText(event.target.value) } onKeyDown={ onKeyDown } /> - +
-
-
-
{ LocalizeText('guide.help.request.' + (isGuide ? 'guide' : 'user') + '.ongoing.close.link') }
-
-
+ + + { isTyping && + { LocalizeText('guide.help.common.typing') } } + + + ); }; diff --git a/src/components/guide-tool/views/GuideToolUserCreateRequestView.tsx b/src/components/guide-tool/views/GuideToolUserCreateRequestView.tsx index 55a6a236..c910a8b7 100644 --- a/src/components/guide-tool/views/GuideToolUserCreateRequestView.tsx +++ b/src/components/guide-tool/views/GuideToolUserCreateRequestView.tsx @@ -1,8 +1,8 @@ import { GuideSessionCreateMessageComposer } from '@nitrots/nitro-renderer'; -import { FC, useCallback, useState } from 'react'; +import { FC, useState } from 'react'; import { LocalizeText } from '../../../api'; +import { Button, Column, Text } from '../../../common'; import { SendMessageHook } from '../../../hooks'; -import { NitroCardContentView } from '../../../layout'; interface GuideToolUserCreateRequestViewProps { @@ -15,20 +15,19 @@ const MIN_REQUEST_LENGTH: number = 15; export const GuideToolUserCreateRequestView: FC = props => { const { userRequest = '', setUserRequest = null } = props; - const [ isPending, setIsPending ] = useState(false); - const sendRequest = useCallback(() => + const sendRequest = () => { setIsPending(true); SendMessageHook(new GuideSessionCreateMessageComposer(1, userRequest)); - }, [ userRequest ]); + } return ( - -
{ LocalizeText('guide.help.request.user.create.help') }
- - -
+ + { LocalizeText('guide.help.request.user.create.help') } + + + ); }; diff --git a/src/components/guide-tool/views/GuideToolUserFeedbackView.tsx b/src/components/guide-tool/views/GuideToolUserFeedbackView.tsx index ff1c76a2..20a64ed2 100644 --- a/src/components/guide-tool/views/GuideToolUserFeedbackView.tsx +++ b/src/components/guide-tool/views/GuideToolUserFeedbackView.tsx @@ -1,8 +1,8 @@ import { GuideSessionFeedbackMessageComposer } from '@nitrots/nitro-renderer'; import { FC, useCallback } from 'react'; import { LocalizeText } from '../../../api'; +import { Button, Column, Flex, Text } from '../../../common'; import { SendMessageHook } from '../../../hooks'; -import { NitroCardContentView } from '../../../layout'; interface GuideToolUserFeedbackViewProps { @@ -19,26 +19,26 @@ export const GuideToolUserFeedbackView: FC = pro }, []); return ( - -
-
-
{ userName }
-
{ LocalizeText('guide.help.request.user.feedback.guide.desc') }
-
-
{ LocalizeText('guide.help.common.report.link') }
-
-
-
-
{ LocalizeText('guide.help.request.user.feedback.closed.title') }
-
{ LocalizeText('guide.help.request.user.feedback.closed.desc') }
-
-
-
{ LocalizeText('guide.help.request.user.feedback.question') }
-
-
giveFeedback(true) }>{ LocalizeText('guide.help.request.user.feedback.positive.button') }
-
giveFeedback(false) }>{ LocalizeText('guide.help.request.user.feedback.negative.button') }
-
-
-
+ + + + { userName } + { LocalizeText('guide.help.request.user.feedback.guide.desc') } + + + + + { LocalizeText('guide.help.request.user.feedback.closed.title') } + { LocalizeText('guide.help.request.user.feedback.closed.desc') } + +
+ + { LocalizeText('guide.help.request.user.feedback.question') } + + + + + +
); }; diff --git a/src/components/guide-tool/views/GuideToolUserPendingView.tsx b/src/components/guide-tool/views/GuideToolUserPendingView.tsx index 304b1e06..49959a4d 100644 --- a/src/components/guide-tool/views/GuideToolUserPendingView.tsx +++ b/src/components/guide-tool/views/GuideToolUserPendingView.tsx @@ -1,8 +1,8 @@ import { GuideSessionRequesterCancelsMessageComposer } from '@nitrots/nitro-renderer'; -import { FC, useCallback } from 'react'; +import { FC } from 'react'; import { LocalizeText } from '../../../api'; +import { Button, Column, Text } from '../../../common'; import { SendMessageHook } from '../../../hooks'; -import { NitroCardContentView } from '../../../layout'; interface GuideToolUserPendingViewProps { @@ -14,24 +14,21 @@ export const GuideToolUserPendingView: FC = props { const { helpRequestDescription = null, helpRequestAverageTime = 0 } = props; - const cancelRequest = useCallback(() => - { - SendMessageHook(new GuideSessionRequesterCancelsMessageComposer()); - }, []); + const cancelRequest = () => SendMessageHook(new GuideSessionRequesterCancelsMessageComposer()); return ( - -
-
{ LocalizeText('guide.help.request.guide.accept.request.title') }
-
{ LocalizeText('guide.help.request.type.1') }
-
{ helpRequestDescription }
-
-
-
{ LocalizeText('guide.help.request.user.pending.info.title') }
-
{ LocalizeText('guide.help.request.user.pending.info.message') }
-
{ LocalizeText('guide.help.request.user.pending.info.waiting', ['waitingtime'], [helpRequestAverageTime.toString()]) }
-
- -
+ + + { LocalizeText('guide.help.request.guide.accept.request.title') } + { LocalizeText('guide.help.request.type.1') } + { helpRequestDescription } + + + { LocalizeText('guide.help.request.user.pending.info.title') } + { LocalizeText('guide.help.request.user.pending.info.message') } + { LocalizeText('guide.help.request.user.pending.info.waiting', [ 'waitingtime' ], [ helpRequestAverageTime.toString() ]) } + + + ); }; diff --git a/src/components/guide-tool/views/GuideToolUserThanksView.tsx b/src/components/guide-tool/views/GuideToolUserThanksView.tsx index f2ab6d6a..4953b0fc 100644 --- a/src/components/guide-tool/views/GuideToolUserThanksView.tsx +++ b/src/components/guide-tool/views/GuideToolUserThanksView.tsx @@ -1,13 +1,13 @@ import { FC } from 'react'; import { LocalizeText } from '../../../api'; -import { NitroCardContentView } from '../../../layout'; +import { Column, Text } from '../../../common'; export const GuideToolUserThanksView: FC<{}> = props => { return ( - -
{ LocalizeText('guide.help.request.user.thanks.info.title') }
-
{ LocalizeText('guide.help.request.user.thanks.info.desc') }
-
+ + { LocalizeText('guide.help.request.user.thanks.info.title') } + { LocalizeText('guide.help.request.user.thanks.info.desc') } + ); }; diff --git a/src/layout/card/header/NitroCardHeaderView.tsx b/src/layout/card/header/NitroCardHeaderView.tsx index bf40be1c..c84d6014 100644 --- a/src/layout/card/header/NitroCardHeaderView.tsx +++ b/src/layout/card/header/NitroCardHeaderView.tsx @@ -5,7 +5,7 @@ import { NitroCardHeaderViewProps } from './NitroCardHeaderView.types'; export const NitroCardHeaderView: FC = props => { - const { headerText = null, onCloseClick = null } = props; + const { headerText = null, noCloseButton = false, onCloseClick = null } = props; const { theme = 'primary', simple = false } = useNitroCardContext(); const onMouseDown = useCallback((event: MouseEvent) =>