Skip to content

Commit

Permalink
Merge pull request #49 from Tekken-Supporter/feature/seohyun
Browse files Browse the repository at this point in the history
Feature/seohyun
  • Loading branch information
betterb2etr authored Nov 29, 2023
2 parents f3c70cc + 5343cc4 commit ef426ad
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 35 deletions.
11 changes: 3 additions & 8 deletions charinfo.css
Original file line number Diff line number Diff line change
Expand Up @@ -199,19 +199,14 @@ img {

.contitle {
position: absolute;
left: 68px;
left: 100px;
height: 60px;
top: 58px;

top: 64px;
font-family: 'Inter';
font-style: normal;
font-weight: 90;
font-size: 12px;
line-height: 20px;
text-transform: uppercase;
text-align: left;
text-transform: uppercase;
color: white;

}

h3 {
Expand Down
18 changes: 7 additions & 11 deletions charinfo.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@


<div id="reviews-container">
<form id="reviewForm">
<form onsubmit="return submitReview" action="#">
<label for="cName">캐릭터 이름:</label>
<input type="text" id="cName" name="c_name" required><br>
<input type="text" id="cName" name="c_name"></input><br>

<label for="userId">사용자 ID:</label>
<input type="text" id="userId" name="id" required><br>
<input type="text" id="userId" name="id"></input><br>

<label for="reviewContent">리뷰 내용:</label>
<textarea id="reviewContent" name="reviewData" required></textarea><br>

<button id="button" >리뷰 제출</button>
</form>

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

<div id="pagination-container" class="pagination-container">
<form onsubmit="return updateReview()" action="#"></form>
<div id="reviewList" class="review-list"></div>
</div>

Expand All @@ -55,7 +55,7 @@
<header>
<h2 class="logo">Tekken Supporter</h2>
<div class="contitle">
<h2>Tips & Reviews <br> about Characters</h2>
<p >Tips & Reviews about Characters</p>
</div>
<nav class="navigation">
<a href="myinfo.html" class="myinfo">계정 정보</a>
Expand All @@ -66,12 +66,9 @@ <h2>Tips & Reviews <br> about Characters</h2>
</nav>
</header>



<div class="content">

<div class="characterlist">

<p class="character-link" data-character="character1">캐릭터1 정보</p>
<p class="character-link" data-character="character2">캐릭터2 정보</p>
<p class="character-link" data-character="character3">캐릭터3 정보</p>
Expand All @@ -85,7 +82,6 @@ <h2>Tips & Reviews <br> about Characters</h2>
</div>
<button id="btn-all-close">Close Information</button>
<ul type="none"></ul>

<div class="linkposition">
<ul type="none">
<li><a href="https://namu.wiki/w/%EC%B2%A0%EA%B6%8C%207#s-3.1">나무위키 철권 7</a></li>
Expand Down
34 changes: 20 additions & 14 deletions charinfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ let currentPage = 1;

window.onload=()=>{

var submitButton = document.getElementById("button");
var submitButton = document.getElementById("submit");
// 이벤트 리스너를 추가하기 전에 엘리먼트가 존재하는지 확인
if (submitButton) {
submitButton.addEventListener("click", submitReview);
Expand All @@ -15,10 +15,10 @@ if (submitButton) {

//1 submit , POST
function submitReview() {
console.log("come in submit Review");
var cName = document.getElementById("cName").value;
var userId = document.getElementById("userId").value;
var reviewContent = document.getElementById("reviewContent").value;

const cName = document.getElementById("cName").value;
const userId = document.getElementById("userId").value;
const reviewContent = document.getElementById("reviewContent").value;

var currentTime = new Date();
var creationTime = currentTime.toISOString();
Expand Down Expand Up @@ -49,6 +49,7 @@ function submitReview() {
if (response.status === "success") {
// 리뷰가 성공적으로 등록된 경우에 처리할 내용 추가
displayReview(response.data);
console.log(response.data);
} else {
// 리뷰 등록이 실패한 경우에 처리할 내용 추가
console.error("리뷰 등록 실패:", response.message);
Expand All @@ -59,12 +60,20 @@ function submitReview() {
}
};
// 데이터를 JSON 형식으로 변환하여 전송
xhr2.send(JSON.stringify(data));
xhr2.send(JSON.stringify({
c_name: cName,
id: userId,
reviewData: reviewContent,
CreationTime: creationTime,
modifiedTime: modifiedTime,

}));

loadReviews(currentPage);
loadPageNumbers();//index of lists

//loadReviews(currentPage);
//loadPageNumbers();//index of lists
}

/////////////
function getReviews() {
var xhr1 = new XMLHttpRequest();
var url = "http://34.127.90.191:3000/character/review";
Expand Down Expand Up @@ -154,7 +163,6 @@ function updateReviewList() {
reviewListContainer.innerHTML = "";

// 각 리뷰에 대해 HTML 엘리먼트를 생성하여 추가

reviews.forEach(function (review) {
var reviewElement = document.createElement("div");
reviewElement.classList.add("review");
Expand All @@ -169,7 +177,6 @@ function updateReviewList() {
`;
reviewListContainer.appendChild(reviewElement);
});

}

var deleteButtons = document.querySelectorAll(".deleteButton");
Expand Down Expand Up @@ -233,7 +240,6 @@ function resetCharacterContainers() {
function showCharacterInfo(event) {
// 클릭한 캐릭터의 데이터 얻기
const characterId = event.target.getAttribute('data-character');

// 모든 캐릭터 컨테이너 숨기기
const characterContainers = document.querySelectorAll('.character-container');
characterContainers.forEach(container => {
Expand Down Expand Up @@ -287,8 +293,8 @@ function displayReviews(reviews) {
<p>사용자 ID: ${review.id || "알 수 없음"}</p>
<p>리뷰 내용: ${review.reviewData || "리뷰 없음"}</p>
<p>작성 시간: ${review.Creationtime || "알 수 없음"}</p>
<button onclick="updateReview(${review.number})">수정</button>
<button onclick="deleteReview(${review.number})">삭제</button>
<button type="updateReview(${review.number})">수정</button>
<button type="deleteReview(${review.number})">삭제</button>
`;
reviewListContainer.appendChild(reviewElement);
});
Expand Down
2 changes: 1 addition & 1 deletion ranking.css
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ header {

.character-image {
object-fit:cover;
height: 120px;
height: 90%;
width: 100px;
border-radius: 12px;
}
Expand Down
2 changes: 1 addition & 1 deletion ranking.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ xhttp2.send();
// 이미지 URL을 동적으로 가져오는 함수 추가
function getChampionImageDynamic(championName) {
const lowercaseChampionName = championName.toLowerCase();
return `https://github.com/Tekken-Supporter/Frontend/blob/main/image/${lowercaseChampionName}`+ `.png?raw=true`;
return `https://github.com/Tekken-Supporter/Frontend/blob/main/image/${championName}`+ `.png?raw=true`;
}

//개별 사람 > 1st~ 10th
Expand Down

0 comments on commit ef426ad

Please sign in to comment.