Skip to content

Commit 556aa81

Browse files
committed
[FIX]: 오류 수정
1 parent d5c9a48 commit 556aa81

File tree

5 files changed

+57
-9
lines changed

5 files changed

+57
-9
lines changed

client/.pnp.cjs

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"license": "MIT",
66
"dependencies": {
77
"@reduxjs/toolkit": "^1.8.6",
8+
"lodash": "^4.17.21",
89
"react": "18.2.0",
910
"react-cookie": "^7.1.4",
1011
"react-dom": "18.2.0",

client/src/App.js

+31-9
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { useState, useEffect } from "react";
99
import { Provider } from "react-redux";
1010
import store from "./redux/store";
1111
import Draggable from "react-draggable";
12+
import _debounce from "lodash/debounce";
1213

1314
function App() {
1415
const [section, setSection] = useState("1");
@@ -17,6 +18,7 @@ function App() {
1718
const [position, setPosition] = useState({ x: 0, y: 0 });
1819
const [daynight, setdaynight] = useState(1);
1920
const [finishTrigger, setFinishTrigger] = useState(-1);
21+
const [amountIncrease, setAmountIncrease] = useState(0); // 클릭 수
2022
const [scale, setScale] = useState(
2123
Math.min(window.innerWidth / 1400, window.innerHeight / 900)
2224
);
@@ -39,21 +41,23 @@ function App() {
3941
console.error("Failed to fetch counter value:", error);
4042
}
4143
};
42-
43-
const increaseCounter = async (amount) => {
44+
const increaseCounter = async () => {
4445
try {
45-
const response = await fetch(`/counter?amount=${amount}`, {
46+
const response = await fetch(`/counter?amount=${amountIncrease}`, {
4647
method: "POST",
4748
});
4849
if (!response.ok) {
4950
throw new Error("Failed to increase counter value");
5051
}
51-
setCounterValue((prevValue) => prevValue + amount);
52+
setCounterValue((prevValue) => prevValue + amountIncrease);
53+
setAmountIncrease(0);
5254
} catch (error) {
5355
console.error("Failed to increase counter value:", error);
5456
}
5557
};
5658

59+
const increaseCounterDebounced = _debounce(increaseCounter, 1000); // 1000ms 디바운스 지연
60+
5761
const handleResize = () => {
5862
setScale(Math.min(window.innerWidth / 1400, window.innerHeight / 900));
5963
};
@@ -70,7 +74,7 @@ function App() {
7074
};
7175

7276
function easteregg() {
73-
alert("안녕하세요!");
77+
alert("Remove the window");
7478
}
7579

7680
return (
@@ -85,14 +89,32 @@ function App() {
8589
display: "flex",
8690
justifyContent: "space-around",
8791
alignItems: "center",
88-
height: "70px",
92+
height: "100px",
8993
width: "300px",
90-
backgroundColor: "#f0f0f0",
94+
backgroundColor: "var(--topbar-background-color)",
9195
borderRadius: "10px",
96+
transition: "background-color 0.3s",
97+
flexDirection: "column",
9298
}}
9399
>
94-
<h1 style={{ position: "static" }}>Counter Value: {counterValue}</h1>
95-
<button onClick={() => increaseCounter(1)}>Increase by 1</button>
100+
<h1 style={{ position: "static" }}>
101+
Number of clicks: {counterValue.toLocaleString("ko-KR")}
102+
</h1>
103+
<button
104+
onClick={() => {
105+
setAmountIncrease((prevAmount) => prevAmount + 1);
106+
increaseCounterDebounced();
107+
}}
108+
className="sidebarsection-list"
109+
style={{
110+
width: "120px",
111+
height: "40px",
112+
border: "0.8px solid darkgray",
113+
borderRadius: "10px",
114+
}}
115+
>
116+
Can you press it?
117+
</button>
96118
</div>
97119
<div className="scale-wrapper" style={{ transform: `scale(${scale})` }}>
98120
<Draggable onDrag={(e, data) => trackPos(data)}>

client/src/utils/egg.js

+22
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,26 @@ export default function egg() {
2828
"color:#99FFED",
2929
"color:#FFFFFF"
3030
);
31+
console.log(
32+
`%c
33+
34+
If you find a vulnerability that
35+
can manipulate speed, please report
36+
it using the method below!!
37+
38+
%c
39+
속도를 조작할 수 있는 취약점을 발견하면,
40+
아래 방법으로 제보해주세요!!
41+
42+
43+
Issue: https://bit.ly/3Jc8PCZ
44+
45+
%c
46+
47+
`,
48+
"color: #fff530; background-color: #212121; font-size: 11px;",
49+
"color: balck; font-size: 11px; font-weight: bold;",
50+
"color: balck; font-size: 10px;",
51+
"color: #fff530; background-color: #212121; font-size: 11px;"
52+
);
3153
}

client/yarn.lock

+1
Original file line numberDiff line numberDiff line change
@@ -11078,6 +11078,7 @@ __metadata:
1107811078
eslint: latest
1107911079
eslint-plugin-react: latest
1108011080
eslint-plugin-react-hooks: latest
11081+
lodash: ^4.17.21
1108111082
react: 18.2.0
1108211083
react-cookie: ^7.1.4
1108311084
react-dom: 18.2.0

0 commit comments

Comments
 (0)