mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 15:36:02 +01:00
refactor(web/skillcheck): remove unused code and comments
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { Box, Center } from '@chakra-ui/react';
|
import { Box, Center } from '@chakra-ui/react';
|
||||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
import { useRef, useState } from 'react';
|
||||||
import { useNuiEvent } from '../../hooks/useNuiEvent';
|
import { useNuiEvent } from '../../hooks/useNuiEvent';
|
||||||
import { debugData } from '../../utils/debugData';
|
import { debugData } from '../../utils/debugData';
|
||||||
import Indicator from './indicator';
|
import Indicator from './indicator';
|
||||||
@@ -29,7 +29,7 @@ const difficultyOffsets = {
|
|||||||
debugData([
|
debugData([
|
||||||
{
|
{
|
||||||
action: 'startSkillCheck',
|
action: 'startSkillCheck',
|
||||||
data: [{ areaSize: 250, speedMultiplier: 2 }, 'easy'],
|
data: [{ areaSize: 250, speedMultiplier: 2 }, 'easy', 'hard'],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
import { useEffect, useRef, useState } from 'react';
|
import { useEffect, useRef, useState } from 'react';
|
||||||
import { useNuiEvent } from '../../hooks/useNuiEvent';
|
|
||||||
import { useKeyPress } from '../../hooks/useKeyPress';
|
import { useKeyPress } from '../../hooks/useKeyPress';
|
||||||
import { fetchNui } from '../../utils/fetchNui';
|
import { SkillCheckProps } from './index';
|
||||||
import skillcheck, { SkillCheckProps } from './index';
|
|
||||||
import { useInterval } from '@chakra-ui/react';
|
import { useInterval } from '@chakra-ui/react';
|
||||||
import { Simulate } from 'react-dom/test-utils';
|
|
||||||
import keyPress = Simulate.keyPress;
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
angle: number;
|
angle: number;
|
||||||
@@ -36,7 +32,6 @@ const Indicator: React.FC<Props> = ({ angle, offset, multiplier, handleComplete,
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (indicatorAngle + 90 >= 360) {
|
if (indicatorAngle + 90 >= 360) {
|
||||||
// fetchNui('skillCheckOver', { success: false });
|
|
||||||
setGameState(false);
|
setGameState(false);
|
||||||
handleComplete(false);
|
handleComplete(false);
|
||||||
}
|
}
|
||||||
@@ -44,18 +39,10 @@ const Indicator: React.FC<Props> = ({ angle, offset, multiplier, handleComplete,
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isKeyPressed) return;
|
if (!isKeyPressed) return;
|
||||||
//
|
|
||||||
|
|
||||||
setGameState(false);
|
setGameState(false);
|
||||||
if (isKeyPressed) {
|
if (indicatorAngle < angle || indicatorAngle > angle + (315 - offset)) handleComplete(false);
|
||||||
if (indicatorAngle < angle || indicatorAngle > angle + (315 - offset)) {
|
else handleComplete(true);
|
||||||
// fetchNui('skillCheckOver', { success: false });
|
|
||||||
handleComplete(false);
|
|
||||||
} else {
|
|
||||||
// fetchNui('skillCheckOver', { success: true });
|
|
||||||
handleComplete(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, [isKeyPressed]);
|
}, [isKeyPressed]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user