Skip to content

Commit

Permalink
feature/complete: complete 화면
Browse files Browse the repository at this point in the history
dust를 모두 잡았을 때 컴플리트 창 띄우기
#15
  • Loading branch information
hongSso committed Sep 28, 2022
1 parent 567935d commit 45732fd
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
27 changes: 25 additions & 2 deletions pages/map/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,32 @@ export default function Map() {
const router = useRouter();
const [dusts, setDusts] = useState([]);

//API호출 (getDustAPI)
const [isCatchSuccess, setIsCatchSuccess] = useState(false);

let count = 0;
const onCatchChange = () => {
setIsCatchSuccess((prev) => !prev);
};

const getDustsAPI = async () => {
const response = await getDusts("SSU");
console.log(response);

if (response.status == 200) {
if (response.data.code == 200) {
setDusts(response.data.result.dustInfo);
}
}

console.log(response);
for (let i = 0; i < 5; i++) {
if (response.data.result.dustInfo[i].caught == true) {
count++;
}
}
if (count == 5) {
onCatchChange();
console.log(count);
}
};

const startTimerAPI = async () => {
Expand Down Expand Up @@ -49,6 +65,13 @@ export default function Map() {

return (
<>
{isCatchSuccess && (
<div className={styles.complete}>
미션
<br />
컴플릿뜨
</div>
)}
<KakaoAPIMap dusts={dusts} />

<div className={styles.stardust_container}>
Expand Down
17 changes: 17 additions & 0 deletions styles/Map.module.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
.complete {
font-family: "NeoDunggeunmo";
font-size: 30px;
z-index: 3;
text-align: center;
justify-content: center;
align-items: center;
width: 100vw;
height: 100vh;
color: #ffffff;
background: rgba(45, 45, 45, 0.3);
position: absolute;
display: flex;
justify-content: center;
align-items: center;
}

.map {
min-height: 100vh;
max-width: 100vh;
Expand Down

0 comments on commit 45732fd

Please sign in to comment.