Skip to content

Commit

Permalink
refactor(web/skillcheck): remove unused code and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeWasTakenn committed Oct 18, 2022
1 parent 6264bbc commit 3fcb994
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 18 deletions.
4 changes: 2 additions & 2 deletions web/src/features/skillcheck/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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 { debugData } from '../../utils/debugData';
import Indicator from './indicator';
Expand Down Expand Up @@ -29,7 +29,7 @@ const difficultyOffsets = {
debugData([
{
action: 'startSkillCheck',
data: [{ areaSize: 250, speedMultiplier: 2 }, 'easy'],
data: [{ areaSize: 250, speedMultiplier: 2 }, 'easy', 'hard'],
},
]);

Expand Down
19 changes: 3 additions & 16 deletions web/src/features/skillcheck/indicator.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { useEffect, useRef, useState } from 'react';
import { useNuiEvent } from '../../hooks/useNuiEvent';
import { useKeyPress } from '../../hooks/useKeyPress';
import { fetchNui } from '../../utils/fetchNui';
import skillcheck, { SkillCheckProps } from './index';
import { SkillCheckProps } from './index';
import { useInterval } from '@chakra-ui/react';
import { Simulate } from 'react-dom/test-utils';
import keyPress = Simulate.keyPress;

interface Props {
angle: number;
Expand Down Expand Up @@ -36,26 +32,17 @@ const Indicator: React.FC<Props> = ({ angle, offset, multiplier, handleComplete,

useEffect(() => {
if (indicatorAngle + 90 >= 360) {
// fetchNui('skillCheckOver', { success: false });
setGameState(false);
handleComplete(false);
}
}, [indicatorAngle]);

useEffect(() => {
if (!isKeyPressed) return;
//

setGameState(false);
if (isKeyPressed) {
if (indicatorAngle < angle || indicatorAngle > angle + (315 - offset)) {
// fetchNui('skillCheckOver', { success: false });
handleComplete(false);
} else {
// fetchNui('skillCheckOver', { success: true });
handleComplete(true);
}
}
if (indicatorAngle < angle || indicatorAngle > angle + (315 - offset)) handleComplete(false);
else handleComplete(true);
}, [isKeyPressed]);

return (
Expand Down

0 comments on commit 3fcb994

Please sign in to comment.