Skip to content

Commit

Permalink
Merge pull request #64 from Tekken-Supporter/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
betterb2etr authored Nov 29, 2023
2 parents 16f36d7 + d46f133 commit 1e0c151
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 14 deletions.
22 changes: 17 additions & 5 deletions challenge_result.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const itemsPerPage = 5;

// 대결 전적 정보 연결
document.addEventListener("DOMContentLoaded", loadName);
document.addEventListener("DOMContentLoaded", loadChallengeInfo);

function loadName() {
const userId = localStorage.getItem("userId");
Expand Down Expand Up @@ -45,7 +44,9 @@ function loadName() {

if (objects["status"] == "ok") {
userName = objects["name"];
console.log(userName);
console.log("계정주 이름:" + userName);
loadChallengeInfo();
updateList(1);
}
} catch (e) {
console.error("Error parsing response:", e);
Expand All @@ -57,6 +58,7 @@ function loadName() {
};
}


function loadChallengeInfo() {
const userId = localStorage.getItem("userId");
jwt = localStorage.getItem("jwt");
Expand Down Expand Up @@ -97,6 +99,12 @@ function loadChallengeInfo() {
}

function updateList(pageNumber) {
if (!userName) {
console.error("userName is not loaded yet");
return;
}
console.log("UserName in another function:", userName);

const startIndex = (pageNumber - 1) * itemsPerPage;
const endIndex = startIndex + itemsPerPage;
const paginatedItems = challengess.slice(startIndex, endIndex);
Expand All @@ -105,7 +113,11 @@ function updateList(pageNumber) {
listElement.innerHTML = "";

paginatedItems.forEach((challenge, index) => {
const nameToShow = (userName === challenge.challenger) ? challenge.challenger : challenge.contender;
let nameToShow;
if (userName === challenge.challenger)
nameToShow = challenge.contender;
if (userName === challenge.contender)
nameToShow = challenge.challenger;
console.log(nameToShow);
const challengeRow = document.createElement("div");
challengeRow.innerHTML = `
Expand Down Expand Up @@ -175,7 +187,7 @@ function result() {
console.log("대결 결과가 성공적으로 제출되었습니다.");
if (scoreContender > scoreChallenger) {
Swal.fire({
text: "대결에서 승리했습니다!",
text: contenderName + "님이 대결에서 승리했습니다!",
icon: "success",
confirmButtonText: "OK"
}).then((result) => { //확인 버튼 누르면
Expand All @@ -195,7 +207,7 @@ function result() {
});
} else {
Swal.fire({
text: "대결에서 패배했습니다!",
text: challengerName + "님이 대결에서 승리했습니다!",
icon: "success",
confirmButtonText: "OK"
}).then((result) => { //확인 버튼 누르면
Expand Down
11 changes: 7 additions & 4 deletions charinfo.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
}

.container {
width: 40%;
display: static;
width: 50%;
height: flex;
background-color: rgba(0, 0, 0, 0);
display: flex;
Expand Down Expand Up @@ -46,6 +47,7 @@ body {
background-repeat: no-repeat;
background-size: cover;
background-position: center;
padding: 10px;
}

header {
Expand Down Expand Up @@ -108,6 +110,7 @@ header {
margin-left: 40px;
transition: .5s;
}

#reviews-container{
position: static;
width: 25%;
Expand All @@ -125,6 +128,7 @@ header {
color: black;
background: linear-gradient(180deg, #D9D9D9 0%, rgba(217, 217, 217, 0.51) 0%);
}

button{
padding:5px 5px 5px 5px;
}
Expand Down Expand Up @@ -245,9 +249,8 @@ h3 {
.pagination-container {
position: static;
width: 25%;
margin-left: 50px;
margin-top: 20px;

margin: 20px;
padding: 20px;
}

.page-link {
Expand Down
8 changes: 4 additions & 4 deletions charinfo.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


<script defer src="./reviewsend.js"></script>

<script defer src="./charinfo.js"></script>

<script type="module" src="https://unpkg.com/[email protected]/dist/ionicons/ionicons.esm.js"></script>
Expand All @@ -29,8 +28,9 @@
</head>

<body>
<div id="reviews-container">
<form onsubmit="return submitReview" action="#">
<div class="reviews-container">
<h3>캐릭터 리뷰</h3><br><br>
<form onsubmit="return submitReview()" action="#">
<label >캐릭터 이름:</label>
<select class="input_champion" id="cName" name="c_name">
<option value="" disabled selected hidden>캐릭터를 선택하세요</option>
Expand Down Expand Up @@ -79,7 +79,7 @@
<label>리뷰 내용:</label>
<textarea id="reviewContent" name="reviewData" required></textarea><br>

<button id="submit" class="submit_btn" onclick="submitReview()" >리뷰 제출</button>
<button id="submit" class="submit_btn">리뷰 제출</button>
</form>
</div>

Expand Down
2 changes: 1 addition & 1 deletion reviewsend.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ function submitReview() {
const cName = document.getElementById("cName").value;
const userId = document.getElementById("userId").value;
const reviewContent = document.getElementById("reviewContent").value;

console.log(cName + userId + reviewContent);
// XMLHttpRequest 객체 생성
const xhr2 = new XMLHttpRequest();

Expand Down

0 comments on commit 1e0c151

Please sign in to comment.