Merge pull request #78 from oobjectt/report-user-photos

Fix issue #11 - Report user photos
This commit is contained in:
Bill 2022-12-13 23:44:22 -05:00 committed by GitHub
commit 14f24bda07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 71 additions and 9 deletions

View File

@ -5,13 +5,15 @@ import { Base, Column, ColumnProps, Flex } from '..';
interface NitroCardHeaderViewProps extends ColumnProps
{
headerText: string;
isGalleryPhoto?: boolean;
noCloseButton?: boolean;
onReportPhoto?: (event: MouseEvent) => void;
onCloseClick: (event: MouseEvent) => void;
}
export const NitroCardHeaderView: FC<NitroCardHeaderViewProps> = props =>
{
const { headerText = null, noCloseButton = false, onCloseClick = null, justifyContent = 'center', alignItems = 'center', classNames = [], children = null, ...rest } = props;
const { headerText = null, isGalleryPhoto = false, noCloseButton = false, onReportPhoto = null, onCloseClick = null, justifyContent = 'center', alignItems = 'center', classNames = [], children = null, ...rest } = props;
const getClassNames = useMemo(() =>
{
@ -32,6 +34,11 @@ export const NitroCardHeaderView: FC<NitroCardHeaderViewProps> = props =>
<Column center position="relative" classNames={ getClassNames } { ...rest }>
<Flex fullWidth center>
<span className="nitro-card-header-text">{ headerText }</span>
{ isGalleryPhoto &&
<Base position="absolute" className="end-4 nitro-card-header-report-camera" onClick={ onReportPhoto }>
<FontAwesomeIcon icon="flag" />
</Base>
}
<Base position="absolute" className="end-2 nitro-card-header-close" onMouseDownCapture={ onMouseDown } onClick={ onCloseClick }>
<FontAwesomeIcon icon="times" />
</Base>

View File

@ -36,11 +36,34 @@ $nitro-card-tabs-height: 33px;
rgba(194, 48, 39, 1) 50%,
rgba(194, 48, 39, 1) 100%
);
&:hover {
filter: brightness(1.2);
}
&:active {
filter: brightness(0.8);
}
}
.nitro-card-header-report-camera {
cursor: pointer;
padding: 1px 3px;
line-height: 1;
border-radius: $border-radius;
box-shadow: 0 0 0 1.6px $white;
border: 2px solid #921911;
background: repeating-linear-gradient(
rgba(245, 80, 65, 1),
rgba(245, 80, 65, 1) 50%,
rgba(194, 48, 39, 1) 50%,
rgba(194, 48, 39, 1) 100%
);
&:hover {
filter: brightness(1.2);
}
&:active {
filter: brightness(0.8);
}
@ -101,7 +124,7 @@ $nitro-card-tabs-height: 33px;
width: 100%;
margin: 0;
padding-top:2px;
&:before {
position: absolute;
content: " ";
@ -137,7 +160,32 @@ $nitro-card-tabs-height: 33px;
&:hover {
filter: brightness(1.2);
}
&:active {
filter: brightness(0.8);
}
}
.nitro-card-header-report-camera {
cursor: pointer;
padding: 0px 2px;
margin-right: 4px;
line-height: 1;
@include font-size($h7-font-size);
border-radius: $border-radius;
box-shadow: 0 0 0 1.6px $white;
border: 2px solid #921911;
background: repeating-linear-gradient(
rgba(245, 80, 65, 1),
rgba(245, 80, 65, 1) 50%,
rgba(194, 48, 39, 1) 50%,
rgba(194, 48, 39, 1) 100%
);
&:hover {
filter: brightness(1.2);
}
&:active {
filter: brightness(0.8);
}

View File

@ -1,6 +1,6 @@
import { CallForHelpFromForumMessageMessageComposer, CallForHelpFromForumThreadMessageComposer, CallForHelpFromIMMessageComposer, CallForHelpFromPhotoMessageComposer, CallForHelpMessageComposer } from '@nitrots/nitro-renderer';
import { FC } from 'react';
import { GetSessionDataManager, LocalizeText, ReportType, SendMessageComposer } from '../../../api';
import { LocalizeText, ReportType, SendMessageComposer } from '../../../api';
import { Button, Column, Text } from '../../../common';
import { useHelp } from '../../../hooks';
@ -36,7 +36,7 @@ export const ReportSummaryView: FC<{}> = props =>
SendMessageComposer(new CallForHelpFromForumMessageMessageComposer(activeReport.groupId, activeReport.threadId, activeReport.messageId, activeReport.cfhTopic, activeReport.message));
break;
case ReportType.PHOTO:
SendMessageComposer(new CallForHelpFromPhotoMessageComposer(activeReport.extraData, activeReport.cfhTopic, activeReport.roomId, GetSessionDataManager().userId, activeReport.roomObjectId));
SendMessageComposer(new CallForHelpFromPhotoMessageComposer(activeReport.extraData, activeReport.roomId, activeReport.reportedUserId, activeReport.cfhTopic, activeReport.roomObjectId));
break;
}

View File

@ -1,17 +1,19 @@
import { GetSessionDataManager, ReportType } from 'api';
import { FC } from 'react';
import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../common';
import { useFurnitureExternalImageWidget } from '../../../../hooks';
import { useFurnitureExternalImageWidget, useHelp } from '../../../../hooks';
import { CameraWidgetShowPhotoView } from '../../../camera/views/CameraWidgetShowPhotoView';
export const FurnitureExternalImageView: FC<{}> = props =>
{
const { objectId = -1, currentPhotoIndex = -1, currentPhotos = null, onClose = null } = useFurnitureExternalImageWidget();
const { report = null } = useHelp();
if((objectId === -1) || (currentPhotoIndex === -1)) return null;
return (
<NitroCardView className="nitro-external-image-widget" theme="primary-slim">
<NitroCardHeaderView headerText="" onCloseClick={ onClose } />
<NitroCardHeaderView headerText="" isGalleryPhoto={ true } onReportPhoto={ () => report(ReportType.PHOTO, { extraData: currentPhotos[currentPhotoIndex].w, roomId: currentPhotos[currentPhotoIndex].s, reportedUserId: GetSessionDataManager().userId, roomObjectId: Number(currentPhotos[currentPhotoIndex].u) }) } onCloseClick={ onClose } />
<NitroCardContentView>
<CameraWidgetShowPhotoView currentIndex={ currentPhotoIndex } currentPhotos={ currentPhotos } />
</NitroCardContentView>

View File

@ -55,6 +55,11 @@ const useHelpState = () =>
newReport.currentStep = ReportState.SELECT_TOPICS;
break;
case ReportType.PHOTO:
newReport.extraData = options.extraData;
newReport.roomId = options.roomId;
newReport.reportedUserId = options.reportedUserId;
newReport.roomObjectId = options.roomObjectId;
newReport.currentStep = ReportState.SELECT_TOPICS;
break;
case ReportType.GUIDE:
break;