mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-23 14:40:50 +01:00
Eslint Fixes
This commit is contained in:
parent
d14117d70a
commit
9a55b57022
@ -11,7 +11,6 @@ export const AvatarEditorView: FC<AvatarEditorViewProps> = props =>
|
||||
{
|
||||
const [ isVisible, setIsVisible ] = useState(false);
|
||||
const [ avatarEditorState, dispatchAvatarEditorState ] = useReducer(AvatarEditorReducer, initialAvatarEditor);
|
||||
const { } = avatarEditorState;
|
||||
|
||||
const onAvatarEditorEvent = useCallback((event: AvatarEditorEvent) =>
|
||||
{
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-template-curly-in-string */
|
||||
import classNames from 'classnames';
|
||||
import { HabboClubLevelEnum, RoomCreateComposer } from 'nitro-renderer';
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
@ -35,7 +36,7 @@ export const NavigatorRoomCreatorView: FC<NavigatorRoomCreatorViewProps> = props
|
||||
setMaxVisitorsList(list);
|
||||
setVisitorsCount(list[0]);
|
||||
}
|
||||
}, []);
|
||||
}, [ maxVisitorsList ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
@ -116,7 +117,7 @@ export const NavigatorRoomCreatorView: FC<NavigatorRoomCreatorViewProps> = props
|
||||
NAVIGATOR_ROOM_MODELS.map(model =>
|
||||
{
|
||||
return (<div key={ model.name } onClick={ () => selectModel(model.name) } className={ 'h-100 cursor-pointer d-flex flex-column justify-content-center align-items-center p-1 me-2 rounded border border-2' + classNames({' active': selectedModelName === model.name, ' disabled': GetSessionDataManager().clubLevel < model.clubLevel}) }>
|
||||
<img src={ getRoomModelImage(model.name) } />
|
||||
<img alt="" src={ getRoomModelImage(model.name) } />
|
||||
<div>{ model.tileSize } { LocalizeText('navigator.createroom.tilesize') }</div>
|
||||
{ model.clubLevel > HabboClubLevelEnum.NO_CLUB && <CurrencyIcon type="hc" /> }
|
||||
</div>);
|
||||
|
@ -79,7 +79,7 @@ export const NotificationCenterView: FC<NotificationCenterViewProps> = props =>
|
||||
});
|
||||
return;
|
||||
}
|
||||
}, [ notificationCenterState, dispatchNotificationCenterState ]);
|
||||
}, [ dispatchNotificationCenterState ]);
|
||||
|
||||
const mapNotifications = useCallback((notifications: NitroNotification[], inTray: boolean) =>
|
||||
{
|
||||
|
@ -64,7 +64,7 @@ export const CameraWidgetView: FC<CameraWidgetViewProps> = props =>
|
||||
const parser = event.getParser();
|
||||
|
||||
setPrice({ credits: parser.credits, points: parser.points, pointsType: parser.pointsType });
|
||||
}, [ price ]);
|
||||
}, []);
|
||||
|
||||
CreateMessageHook(RoomWidgetCameraConfigurationEvent, onCameraConfigurationEvent);
|
||||
|
||||
|
@ -83,7 +83,7 @@ export const CameraWidgetCaptureView: FC<CameraWidgetCaptureViewProps> = props =
|
||||
</div>
|
||||
<div ref={ cameraFrameRef } className={'camera-frame ' + classNames({'bg': cameraWidgetContext.selectedPictureIndex > -1}) }>
|
||||
{ cameraWidgetContext.selectedPictureIndex > -1 && <div>
|
||||
<img src={ cameraWidgetContext.cameraRoll[cameraWidgetContext.selectedPictureIndex].src } />
|
||||
<img alt="" src={ cameraWidgetContext.cameraRoll[cameraWidgetContext.selectedPictureIndex].src } />
|
||||
<div className="camera-frame-preview-actions w-100 position-absolute bottom-0 py-2 text-center">
|
||||
<button className="btn btn-success me-3" title={ LocalizeText('camera.editor.button.tooltip') } onClick={ event => processAction('edit_picture') }>{ LocalizeText('camera.editor.button.text') }</button>
|
||||
<button className="btn btn-danger" onClick={ event => processAction('discard_picture') }>{ LocalizeText('camera.delete.button.text') }</button>
|
||||
@ -97,7 +97,7 @@ export const CameraWidgetCaptureView: FC<CameraWidgetCaptureViewProps> = props =
|
||||
{ cameraWidgetContext.cameraRoll.length > 0 && <div className="camera-roll d-flex justify-content-center py-2">
|
||||
{ cameraWidgetContext.cameraRoll.map((picture, index) =>
|
||||
{
|
||||
return <img key={ index } className={ (index < cameraWidgetContext.cameraRoll.length - 1 ? 'me-2' : '') } src={ picture.src } onClick={ event => processAction('preview_picture', index) } />;
|
||||
return <img alt="" key={ index } className={ (index < cameraWidgetContext.cameraRoll.length - 1 ? 'me-2' : '') } src={ picture.src } onClick={ event => processAction('preview_picture', index) } />;
|
||||
}) }
|
||||
</div> }
|
||||
</div>
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* eslint-disable jsx-a11y/anchor-is-valid */
|
||||
import { RoomWidgetCameraPublishComposer, RoomWidgetCameraPublishedEvent, RoomWidgetCameraPurchaseComposer, RoomWidgetCameraPurchaseSuccessfulEvent } from 'nitro-renderer';
|
||||
import { FC, useCallback, useState } from 'react';
|
||||
import { GetRoomCameraWidgetManager } from '../../../../../../api/nitro/camera/GetRoomCameraWidgetManager';
|
||||
@ -23,7 +24,7 @@ export const CameraWidgetCheckoutView: FC<CameraWidgetCheckoutViewProps> = props
|
||||
{
|
||||
setPicturesBought(value => value + 1);
|
||||
setIsWaiting(false);
|
||||
}, [ picturesBought ]);
|
||||
}, []);
|
||||
|
||||
const onRoomWidgetCameraPublishedEvent = useCallback((event: RoomWidgetCameraPublishedEvent) =>
|
||||
{
|
||||
@ -32,7 +33,7 @@ export const CameraWidgetCheckoutView: FC<CameraWidgetCheckoutViewProps> = props
|
||||
setPublishCooldown(parser.cooldownSeconds);
|
||||
setWasPicturePublished(parser.wasSuccessful);
|
||||
setIsWaiting(false);
|
||||
}, [ wasPicturePublished, publishCooldown ]);
|
||||
}, []);
|
||||
|
||||
CreateMessageHook(RoomWidgetCameraPurchaseSuccessfulEvent, onCameraPurchaseSuccessfulEvent);
|
||||
CreateMessageHook(RoomWidgetCameraPublishedEvent, onRoomWidgetCameraPublishedEvent);
|
||||
@ -40,7 +41,7 @@ export const CameraWidgetCheckoutView: FC<CameraWidgetCheckoutViewProps> = props
|
||||
const getCurrentPicture = useCallback(() =>
|
||||
{
|
||||
return GetRoomCameraWidgetManager().applyEffects(cameraWidgetContext.cameraRoll[cameraWidgetContext.selectedPictureIndex], cameraWidgetContext.selectedEffects, cameraWidgetContext.isZoomed);
|
||||
}, [ cameraWidgetContext.selectedEffects, cameraWidgetContext.isZoomed ]);
|
||||
}, [ cameraWidgetContext ]);
|
||||
|
||||
const processAction = useCallback((type: string, value: string | number = null) =>
|
||||
{
|
||||
@ -65,7 +66,7 @@ export const CameraWidgetCheckoutView: FC<CameraWidgetCheckoutViewProps> = props
|
||||
onCancelClick();
|
||||
return;
|
||||
}
|
||||
}, [ onCloseClick, onCancelClick ]);
|
||||
}, [onCloseClick, isWaiting, onCancelClick]);
|
||||
|
||||
if(!price) return null;
|
||||
|
||||
|
@ -29,7 +29,7 @@ export const CameraWidgetEditorView: FC<CameraWidgetEditorViewProps> = props =>
|
||||
}
|
||||
|
||||
setEffectsThumbnails(thumbnails);
|
||||
}, [ cameraWidgetContext.selectedPictureIndex, availableEffects ]);
|
||||
}, [ cameraWidgetContext, availableEffects ]);
|
||||
|
||||
const getEffectThumbnail = useCallback((effectName: string) =>
|
||||
{
|
||||
@ -55,7 +55,7 @@ export const CameraWidgetEditorView: FC<CameraWidgetEditorViewProps> = props =>
|
||||
const getCurrentPicture = useCallback(() =>
|
||||
{
|
||||
return GetRoomCameraWidgetManager().applyEffects(cameraWidgetContext.cameraRoll[cameraWidgetContext.selectedPictureIndex], cameraWidgetContext.selectedEffects, cameraWidgetContext.isZoomed);
|
||||
}, [ cameraWidgetContext.selectedEffects, cameraWidgetContext.isZoomed ]);
|
||||
}, [ cameraWidgetContext ]);
|
||||
|
||||
const getCurrentEffectAlpha = useCallback(() =>
|
||||
{
|
||||
@ -88,7 +88,7 @@ export const CameraWidgetEditorView: FC<CameraWidgetEditorViewProps> = props =>
|
||||
clone[selectedEffectIndex] = new RoomCameraWidgetSelectedEffect(selectedEffect.effect, newAlpha);
|
||||
|
||||
cameraWidgetContext.setSelectedEffects(clone);
|
||||
}, [ selectedEffectName, cameraWidgetContext.selectedEffects ]);
|
||||
}, [ selectedEffectName, getEffectIndex, cameraWidgetContext ]);
|
||||
|
||||
const processAction = useCallback((type: string, value: string | number = null) =>
|
||||
{
|
||||
@ -169,7 +169,7 @@ export const CameraWidgetEditorView: FC<CameraWidgetEditorViewProps> = props =>
|
||||
cameraWidgetContext.setIsZoomed(!cameraWidgetContext.isZoomed);
|
||||
return;
|
||||
}
|
||||
}, [ onCloseClick, onCancelClick, availableEffects, cameraWidgetContext.selectedEffects, selectedEffectName ]);
|
||||
}, [onCloseClick, onCancelClick, onCheckoutClick, cameraWidgetContext, getCurrentPicture, myLevel, selectedEffectName, getEffectIndex, availableEffects]);
|
||||
|
||||
return (
|
||||
<NitroCardView className="nitro-camera-editor">
|
||||
|
@ -13,10 +13,6 @@ import { RoomWidgetRoomObjectUpdateEvent } from '../../../events';
|
||||
import { FurnitureMannequinData } from './FurnitureMannequinData';
|
||||
import { FurnitureMannequinViewMode, FurnitureMannequinViewProps } from './FurnitureMannequinView.types';
|
||||
|
||||
export const FurnitureMannequinView: FC<FurnitureMannequinViewProps> = props =>
|
||||
{
|
||||
const { eventDispatcher = null, widgetHandler = null } = useRoomContext();
|
||||
|
||||
const parts = [
|
||||
AvatarFigurePartType.CHEST_ACCESSORY,
|
||||
AvatarFigurePartType.COAT_CHEST,
|
||||
@ -27,9 +23,28 @@ export const FurnitureMannequinView: FC<FurnitureMannequinViewProps> = props =>
|
||||
];
|
||||
const baseAvatar = ['hd', 99999, 99998];
|
||||
|
||||
export const FurnitureMannequinView: FC<FurnitureMannequinViewProps> = props =>
|
||||
{
|
||||
const { eventDispatcher = null } = useRoomContext();
|
||||
|
||||
const [ mannequinData, setMannequinData ] = useState<FurnitureMannequinData>(null);
|
||||
const [ viewMode, setViewMode ] = useState('');
|
||||
|
||||
const loadMannequinFigure = useCallback((figureContainer: IAvatarFigureContainer) =>
|
||||
{
|
||||
for(const item of figureContainer.getPartTypeIds())
|
||||
{
|
||||
if(parts.indexOf(item) === -1)
|
||||
{
|
||||
figureContainer.removePart(item);
|
||||
}
|
||||
}
|
||||
|
||||
figureContainer.updatePart(baseAvatar[0].toString(), Number(baseAvatar[1]), [ Number(baseAvatar[2]) ]);
|
||||
|
||||
setMannequinData(mannequinData => new FurnitureMannequinData(mannequinData.objectId, mannequinData.category, mannequinData.name, mannequinData.figure, mannequinData.gender, mannequinData.clubLevel, figureContainer.getFigureString()));
|
||||
}, []);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
if(mannequinData && !mannequinData.renderedFigure)
|
||||
@ -37,7 +52,38 @@ export const FurnitureMannequinView: FC<FurnitureMannequinViewProps> = props =>
|
||||
const figureContainer = Nitro.instance.avatar.createFigureContainer(mannequinData.figure);
|
||||
loadMannequinFigure(figureContainer);
|
||||
}
|
||||
}, [ mannequinData ]);
|
||||
}, [loadMannequinFigure, mannequinData]);
|
||||
|
||||
const loadViewMode = useCallback((mannequinData: FurnitureMannequinData) =>
|
||||
{
|
||||
if(!mannequinData) return;
|
||||
|
||||
const userCanEdit = (GetRoomSession().isRoomOwner || GetSessionDataManager().isModerator);
|
||||
const userGender = Nitro.instance.sessionDataManager.gender;
|
||||
const userClubLevel = Nitro.instance.sessionDataManager.clubLevel;
|
||||
|
||||
if(userCanEdit)
|
||||
{
|
||||
setViewMode(FurnitureMannequinViewMode.EDIT);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!mannequinData.figure || mannequinData.figure.length <= 1) return;
|
||||
|
||||
if(userGender.toUpperCase() !== mannequinData.gender.toUpperCase())
|
||||
{
|
||||
setViewMode(FurnitureMannequinViewMode.INCOMPATIBLE_GENDER);
|
||||
}
|
||||
else if(userClubLevel < mannequinData.clubLevel)
|
||||
{
|
||||
setViewMode(FurnitureMannequinViewMode.CLUB);
|
||||
}
|
||||
else
|
||||
{
|
||||
setViewMode(FurnitureMannequinViewMode.DEFAULT);
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
|
||||
const onNitroEvent = useCallback((event: NitroEvent) =>
|
||||
{
|
||||
@ -75,57 +121,11 @@ export const FurnitureMannequinView: FC<FurnitureMannequinViewProps> = props =>
|
||||
return;
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
}, [loadViewMode]);
|
||||
|
||||
useRoomEngineEvent(RoomEngineTriggerWidgetEvent.REQUEST_MANNEQUIN, onNitroEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED, eventDispatcher, onNitroEvent);
|
||||
|
||||
const loadMannequinFigure = useCallback((figureContainer: IAvatarFigureContainer) =>
|
||||
{
|
||||
for(const item of figureContainer.getPartTypeIds())
|
||||
{
|
||||
if(parts.indexOf(item) === -1)
|
||||
{
|
||||
figureContainer.removePart(item);
|
||||
}
|
||||
}
|
||||
|
||||
figureContainer.updatePart(baseAvatar[0].toString(), Number(baseAvatar[1]), [ Number(baseAvatar[2]) ]);
|
||||
|
||||
setMannequinData(mannequinData => new FurnitureMannequinData(mannequinData.objectId, mannequinData.category, mannequinData.name, mannequinData.figure, mannequinData.gender, mannequinData.clubLevel, figureContainer.getFigureString()));
|
||||
}, []);
|
||||
|
||||
const loadViewMode = useCallback((mannequinData: FurnitureMannequinData) =>
|
||||
{
|
||||
if(!mannequinData) return;
|
||||
|
||||
const userCanEdit = (GetRoomSession().isRoomOwner || GetSessionDataManager().isModerator);
|
||||
const userGender = Nitro.instance.sessionDataManager.gender;
|
||||
const userClubLevel = Nitro.instance.sessionDataManager.clubLevel;
|
||||
|
||||
if(userCanEdit)
|
||||
{
|
||||
setViewMode(FurnitureMannequinViewMode.EDIT);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!mannequinData.figure || mannequinData.figure.length <= 1) return;
|
||||
|
||||
if(userGender.toUpperCase() !== mannequinData.gender.toUpperCase())
|
||||
{
|
||||
setViewMode(FurnitureMannequinViewMode.INCOMPATIBLE_GENDER);
|
||||
}
|
||||
else if(userClubLevel < mannequinData.clubLevel)
|
||||
{
|
||||
setViewMode(FurnitureMannequinViewMode.CLUB);
|
||||
}
|
||||
else
|
||||
{
|
||||
setViewMode(FurnitureMannequinViewMode.DEFAULT);
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
|
||||
const processAction = useCallback((type: string, value: string = null) =>
|
||||
{
|
||||
switch(type)
|
||||
@ -157,7 +157,7 @@ export const FurnitureMannequinView: FC<FurnitureMannequinViewProps> = props =>
|
||||
processAction('close');
|
||||
return;
|
||||
}
|
||||
}, [ mannequinData ]);
|
||||
}, [ loadMannequinFigure, mannequinData ]);
|
||||
|
||||
const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) =>
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user