-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: profile edit 페이지 구현 (event 제외)
- Loading branch information
Showing
6 changed files
with
282 additions
and
21 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,78 @@ | ||
import { Component } from "../core/Component.js"; | ||
import { changeUrl } from "../core/router.js"; | ||
|
||
export class EditProfile extends Component { | ||
|
||
template () { | ||
this.user = { nickname: "seonjo", img_url: "../../소년명수.png"}; | ||
// api로 win, lose, rate 호출 | ||
this.win = 35; | ||
this.lose = 20; | ||
this.rate = (35 / 55) * 100; | ||
this.matches = [ | ||
{startTime: "7/5 18:05", playTime: "30 min", img_url: "../../소년명수.png", type: "win", myScore: 5, opScore: 3, opNick: "michang" }, | ||
{startTime: "7/3 18:25", playTime: "22 min", img_url: "../../소년명수.png", type: "lose", myScore: 3, opScore: 5, opNick: "jiko" }, | ||
{startTime: "7/1 21:15", playTime: "18 min", img_url: "../../소년명수.png", type: "win", myScore: 5, opScore: 2, opNick: "jaehejun" }, | ||
{startTime: "6/25 10:34", playTime: "22 min", img_url: "../../소년명수.png", type: "win", myScore: 5, opScore: 3, opNick: "seunan" }, | ||
{startTime: "6/18 22:53", playTime: "17 min", img_url: "../../소년명수.png", type: "lose", myScore: 1, opScore: 5, opNick: "michang" }, | ||
{startTime: "6/17 12:14", playTime: "50 min", img_url: "../../소년명수.png", type: "lose", myScore: 0, opScore: 5, opNick: "jaehejun" }, | ||
{startTime: "6/5 18:21", playTime: "43 min", img_url: "../../소년명수.png", type: "lose", myScore: 2, opScore: 5, opNick: "jiko" }, | ||
{startTime: "6/2 11:43", playTime: "23 min", img_url: "../../소년명수.png", type: "win", myScore: 5, opScore: 3, opNick: "seunan" }, | ||
]; | ||
console.log(this.props.nickname, this.user); | ||
this.nickname = "seonjo"; | ||
this.img_url = "/friends.png"; | ||
this.TwoFA = true; | ||
return ` | ||
<div id="edit-box"> | ||
<div id="editTitle"> | ||
Edit Profile | ||
</div> | ||
<div id="editContents"> | ||
<div id="prevProfile"> | ||
<div id="edit-nick"> | ||
<label for="nickname">Nickname:</label> | ||
<div id="presentNick">${this.nickname}</div> | ||
</div> | ||
<div id="edit-img"> | ||
<div id="image-preview"> | ||
<img id="presentImage" src="${this.img_url}" alt="Profile Image"></img> | ||
</div> | ||
</div> | ||
<div id="edit-2FA"> | ||
<label for="2fa-toggle">Enable 2FA:</label> | ||
${this.TwoFA ? `<input type="checkbox" id="2fa-toggle" checked disabled>` : `<input type="checkbox" id="2fa-toggle">`} | ||
</div> | ||
</div> | ||
<div id="Arrow"> | ||
<img id="arrowImg" src="/arrow.png"></img> | ||
</div> | ||
<div id="changedProfile"> | ||
<div id="edit-nick"> | ||
<label for="nickname">Nickname:</label> | ||
<input type="text" id="nickname" value="${this.nickname}"> | ||
</div> | ||
<div id="edit-img"> | ||
<div id="image-preview"> | ||
<img id="profile-image" src="${this.img_url}" alt="Profile Image"></img> | ||
</div> | ||
<div id="file-upload-wrapper"> | ||
<div id="custom-file-upload"> | ||
<span>Click to choose a file</span> | ||
</div> | ||
<input type="file" id="file-upload" accept="image/*"> | ||
</div> | ||
</div> | ||
<div id="edit-2FA"> | ||
<label for="2fa-toggle">Enable 2FA:</label> | ||
${this.TwoFA ? `<input type="checkbox" id="2fa-toggle" checked>` : `<input type="checkbox" id="2fa-toggle">`} | ||
</div> | ||
<button id="profileChange" type="submit">Save Changes</button> | ||
</div> | ||
</div> | ||
</div> | ||
`; | ||
} | ||
|
||
setEvent() { | ||
this.addEvent('click', '#goBack', (event) => { | ||
window.history.back(); | ||
}); | ||
|
||
this.addEvent('change', '#file-upload', (event) => { // ID를 #file-upload로 수정 | ||
const file = event.target.files[0]; | ||
if (file) { | ||
const reader = new FileReader(); | ||
reader.onload = function(e) { | ||
document.getElementById('profile-image').src = e.target.result; | ||
}; | ||
reader.readAsDataURL(file); | ||
} | ||
}); | ||
|
||
this.addEvent('') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import { Component } from "../core/Component.js"; | ||
|
||
export class FriendsInfo extends Component { | ||
|
||
template () { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters