Skip to content

Commit

Permalink
hotfix: demo day에 생겼던 에러 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunkkkk committed Aug 19, 2024
1 parent 60c1f21 commit 738cbe3
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 25 deletions.
6 changes: 3 additions & 3 deletions Caecae/src/components/FindingGame/FindingGame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,12 @@ const FindingGame = () => {
});

const showingWrongElement = state.wrongAnswers.map((wrongAnswer) => {
console.log(wrongAnswer);
return (
<LottieContainer
key={wrongAnswer.id}
x={wrongAnswer.x * pictureWidth.current}
y={wrongAnswer.y * pictureHeight.current}
x={wrongAnswer.x}
y={wrongAnswer.y}
width={lottieWidth}
height={lottieHeight}
jsonFile={wrongLottie}
Expand All @@ -117,7 +118,6 @@ const FindingGame = () => {
// const showingHintElement = state.showingHint.map((hintAnswer) => {
// return <HintSpot y={hintAnswer.y} x={hintAnswer.x} />;
// });

return (
<div>
<PictureGameBoard
Expand Down
52 changes: 30 additions & 22 deletions Caecae/src/features/FindingGameLanding/OpenEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,29 +185,37 @@ const OpenEvent = forwardRef<HTMLDivElement, OpenEventProps>((props, ref) => {
});

function chechCurrentStuts(startTime: number[], endTime: number[]) {
const currentDate = new Date();
const currentTime = [
currentDate.getFullYear(),
currentDate.getMonth() + 1,
currentDate.getDate(),
currentDate.getHours(),
currentDate.getMinutes(),
];
const soonTime = [...startTime];
soonTime[3] = soonTime[3] - 1;
const eventStartTime = new Date(
startTime[0],
startTime[1],
startTime[2] - 1,
startTime[3],
startTime[4]
);
const currentTime = new Date();
const eventEndTime = new Date(
endTime[0],
endTime[1],
endTime[2] - 1,
endTime[3],
endTime[4]
);
const eventSoonTime = new Date(eventStartTime);
eventSoonTime.setHours(eventStartTime.getHours() - 1);

function isIn(startTime: number[], targetTime: number[], endTime: number[]) {
for (let i = 0; i < startTime.length; i++) {
if (startTime[i] === endTime[i] && startTime[i] === targetTime[i])
continue;
else if (startTime[i] <= targetTime[i] && targetTime[i] <= endTime[i])
return true;
else return false;
}
return false;
}
if (isIn(soonTime, currentTime, startTime)) return "soon";
else if (isIn(startTime, currentTime, endTime)) return "opened";
console.log("start", startTime);
console.log("end", endTime);

if (
eventSoonTime.getTime() <= currentTime.getTime() &&
currentTime.getTime() <= eventStartTime.getTime()
)
return "soon";
else if (
eventStartTime.getTime() <= currentTime.getTime() &&
currentTime.getTime() <= eventEndTime.getTime()
)
return "opened";
return "none";
}

Expand Down

0 comments on commit 738cbe3

Please sign in to comment.