Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Deploy] version 0.1.1 #70

Merged
merged 9 commits into from
Aug 23, 2024
72 changes: 45 additions & 27 deletions Caecae/src/components/RacingGame/RacingGame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,6 @@ const RacingGame: React.FC = () => {
}, fadeInterval);
};

const handleSpacebar = (event: KeyboardEvent) => {
if (event.code === "Space" && state.gameStatus === "playing" && !animationCompletedRef.current) {
// animationCompletedRef.current = true
event.preventDefault();
document.removeEventListener("keydown", handleSpacebar);

handleSmoothlyStop();
}
};

const handlePlayGame = () => {
stopingMusicReset();
playingMusicPlay();
Expand Down Expand Up @@ -160,25 +150,44 @@ const RacingGame: React.FC = () => {
const baseShareUrl = "http://www.caecae.kro.kr/a/"
const shareUrl = baseShareUrl + shortUrl;

navigator.clipboard.writeText(shareUrl)
.then(() => {
setShowMessage(true);

let textArea = document.createElement("textarea");
textArea.value = shareUrl;

textArea.style.position = "fixed";
textArea.style.left = "-9999px";
textArea.style.top = "-9999px";

document.body.appendChild(textArea);
textArea.select();

return new Promise((res, rej) => {
if (document.execCommand('copy')) {
res(shareUrl)
}else {
rej();
}
textArea.remove();
}).then(() => {
setShowMessage(true);

setTimeout(() => {
setAnimate(true);

setTimeout(() => {
setAnimate(true);
setAnimate(false);

setTimeout(() => {
setAnimate(false);

setTimeout(() => {
setShowMessage(false);
setIsAnimating(false);
}, 500);

}, 3000);
}, 10);
});
setShowMessage(false);
setIsAnimating(false);
}, 500);

}, 3000);

}, 10);
}).catch((error) => {
console.error("클립보드 복사 실패:", error);
setIsAnimating(false);
});
}catch(error) {
console.error("단축 Url api 호출 실패:", error);
}
Expand All @@ -187,6 +196,15 @@ const RacingGame: React.FC = () => {
fetchData();
}

const handleSpacebar = (event: KeyboardEvent) => {
if (event.code === "Space" && state.gameStatus === "playing" && !animationCompletedRef.current) {
event.preventDefault();
document.removeEventListener("keydown", handleSpacebar);

handleSmoothlyStop();
}
};

useEffect(() => {
const frontBackgroundImg = new Image();
frontBackgroundImg.src = frontBackground;
Expand Down
52 changes: 34 additions & 18 deletions Caecae/src/features/FindingGameLanding/LadingPageTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,48 @@ const LadingPageTitle = ({ onClick }: LadingPageTitleProps) => {
setIsAnimating(true);
const url: string = window.location.href;

navigator.clipboard
.writeText(url)
.then(() => {
setShowMessage(true);
let textArea = document.createElement("textarea");
textArea.value = url;

textArea.style.position = "fixed";
textArea.style.left = "-9999px";
textArea.style.top = "-9999px";

document.body.appendChild(textArea);
textArea.select();

return new Promise((res, rej) => {
if (document.execCommand('copy')) {
res(url)
}else {
rej();
}
textArea.remove();
}).then(() => {
setShowMessage(true);

setTimeout(() => {
setAnimate(true);

setTimeout(() => {
setAnimate(true);
setAnimate(false);

setTimeout(() => {
setAnimate(false);
setShowMessage(false);
setIsAnimating(false);
}, 500);

setTimeout(() => {
setShowMessage(false);
setIsAnimating(false);
}, 500);
}, 3000);
}, 10);
})
.catch((err: Error) => {
console.error("URL 복사에 실패했습니다.", err);
setIsAnimating(false);
});
}, 3000);

}, 10);
}).catch((err: Error) => {
console.error('URL 복사에 실패했습니다.', err);
setIsAnimating(false);
});
};
return (
<>
<div className="flex w-screen h-screen justify-center items-center relative overflow-hidden min-h-[950px]">
<div className="flex w-full h-screen justify-center items-center relative overflow-hidden min-h-[950px]">
<div className="absolute z-20 flex flex-col items-center h-screen justify-center min-h-[950px]">
<p className="text-[#CCCCCC] text-[20px]">
<span className="font-bold text-[white]">CASPER Electric</span> 신차
Expand Down
51 changes: 33 additions & 18 deletions Caecae/src/features/RacingGameLanding/EventIntro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,44 @@ const EventIntro: React.FC<EventIntroProps> = ({isEventOpen}) => {
setIsAnimating(true);
const url: string = window.location.href;

navigator.clipboard.writeText(url)
.then(() => {
setShowMessage(true);
let textArea = document.createElement("textarea");
textArea.value = url;

textArea.style.position = "fixed";
textArea.style.left = "-9999px";
textArea.style.top = "-9999px";

document.body.appendChild(textArea);
textArea.select();

return new Promise((res, rej) => {
if (document.execCommand('copy')) {
res(url)
}else {
rej();
}
textArea.remove();
}).then(() => {
setShowMessage(true);

setTimeout(() => {
setAnimate(true);

setTimeout(() => {
setAnimate(true);
setAnimate(false);

setTimeout(() => {
setAnimate(false);

setTimeout(() => {
setShowMessage(false);
setIsAnimating(false);
}, 500);
setShowMessage(false);
setIsAnimating(false);
}, 500);

}, 3000);

}, 10);
})
.catch((err: Error) => {
console.error('URL 복사에 실패했습니다.', err);
setIsAnimating(false);
});
}, 3000);

}, 10);
}).catch((err: Error) => {
console.error('URL 복사에 실패했습니다.', err);
setIsAnimating(false);
});
};

const checkEventOpen = () => {
Expand Down
Loading