parent
8985bf48a4
commit
03f8a9a30a
7 changed files with 82 additions and 9 deletions
@ -0,0 +1,19 @@ |
||||
#modal_profile |
||||
{ |
||||
padding: 0; |
||||
color: rgb(0, 17, 255); |
||||
background-color: rgb(0, 17, 255); |
||||
} |
||||
|
||||
.profile-modal |
||||
{ |
||||
margin: 20px; |
||||
color: white; |
||||
display: flex; |
||||
flex-direction: column; |
||||
} |
||||
|
||||
.profile-footer button |
||||
{ |
||||
background-color: red; |
||||
} |
@ -1,3 +1,20 @@ |
||||
<div> |
||||
<p class="title">Profile</p> |
||||
</div> |
||||
<div class="profile-modal"> |
||||
<div class="profile-header"> |
||||
<h1>Profile</h1> |
||||
</div> |
||||
|
||||
<div class="profile-content"> |
||||
<hr> |
||||
<p id="name">Name: </p> |
||||
<p id="faction">Faction: </p> |
||||
<p id="credit">Credit: </p> |
||||
<p id="hq">Headquarters: </p> |
||||
<p id="shipcount">Ship count: </p> |
||||
<p id="token">Token: <button id="btn-token">COPY</button></p> |
||||
<hr> |
||||
</div> |
||||
|
||||
<div class="profile-footer"> |
||||
<button id="btn-logout">Logout</button> |
||||
</div> |
||||
</div> |
@ -1,9 +1,29 @@ |
||||
import { Modal } from "../skama_code/ui/modal.js" |
||||
import { Auth } from "../skama_code/auth/auth.js" |
||||
import { My } from "../skama_code/commun/my.js" |
||||
import login from "./login.js"; |
||||
|
||||
export default function profile(temp_engine) { |
||||
let modal = new Modal("profile-modal", temp_engine); |
||||
modal.load("templates/modal_profile.html"); |
||||
modal.after_load((temp_engine) => { |
||||
let modal = new Modal("modal_profile", temp_engine); |
||||
modal.after_load(() => { |
||||
modal.show(); |
||||
$('#name').append(My.agent.name); |
||||
$('#faction').append(My.agent.faction); |
||||
$('#credit').append(My.agent.credit); |
||||
$('#hq').append(My.agent.hq); |
||||
$('#shipcount').append(My.agent.ships_cpt); |
||||
|
||||
$('#btn-token').on('click', () => { |
||||
navigator.clipboard.writeText(My.agent.token); |
||||
alert('Token copied !'); |
||||
}) |
||||
|
||||
$('#btn-logout').on('click', () => { |
||||
const auth = new Auth(); |
||||
auth.unload_token(); |
||||
login(temp_engine); |
||||
}) |
||||
}); |
||||
|
||||
modal.load("templates/modal_profile.html"); |
||||
} |
@ -1 +1 @@ |
||||
Subproject commit f6268ed6d83e077ddf4ff362530e9469f8f8a738 |
||||
Subproject commit df0d1be1df444b48cd1b6c09e5188af501bc9793 |
Loading…
Reference in New Issue