parent
ba150be610
commit
23f8bf763d
18 changed files with 599 additions and 517 deletions
@ -1,3 +0,0 @@ |
|||||||
{ |
|
||||||
"liveServer.settings.port": 5502 |
|
||||||
} |
|
@ -1,49 +0,0 @@ |
|||||||
<!--Copyright © 2023 Entreprise SpaceTarders --> |
|
||||||
|
|
||||||
<!DOCTYPE html> |
|
||||||
<html lang="fr" class="html-index"> |
|
||||||
|
|
||||||
<head> |
|
||||||
<meta charset="UTF-8" /> |
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> |
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com" /> |
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> |
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@500&display=swap" rel="stylesheet" /> |
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.min.js" |
|
||||||
integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script> |
|
||||||
<script type="module" src="scripts/main.js" defer></script> |
|
||||||
<link rel="stylesheet" href="/css/global.css" /> |
|
||||||
<link rel="icon" href="img/logo.png" /> |
|
||||||
<title>SpaceTraders</title> |
|
||||||
</head> |
|
||||||
|
|
||||||
<body> |
|
||||||
<header id="header"> |
|
||||||
<div class="menu"> |
|
||||||
<div class="title-section"> |
|
||||||
<img src="img/logo.png" alt="Logo AppleTech.svg" /> |
|
||||||
<p>SpaceTraders</p> |
|
||||||
</div> |
|
||||||
<div class="page-change-link"> |
|
||||||
<a href="http://127.0.0.1:5502/agent.html">Mon agent</a> |
|
||||||
<a href="http://127.0.0.1:5502/contracts.html">Mes contracts</a> |
|
||||||
<a href="http://127.0.0.1:5502/faction.html">Ma faction</a> |
|
||||||
<a href="http://127.0.0.1:5502/vaiseaux.html">Mes vaiseaux</a> |
|
||||||
<a href="http://127.0.0.1:5502/systeme.html">Systeme</a> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<hr /> |
|
||||||
</header> |
|
||||||
|
|
||||||
<main> |
|
||||||
<p>PAGE D'ACCEUIL</p> |
|
||||||
</main> |
|
||||||
|
|
||||||
<footer id="footer"> |
|
||||||
<hr /> |
|
||||||
<p>SpaceTrader © 2023</p> |
|
||||||
</footer> |
|
||||||
</body> |
|
||||||
|
|
||||||
</html> |
|
@ -1,63 +1,165 @@ |
|||||||
/* Copyright © 2023 Entreprise SpaceTarders */ |
/* Copyright © 2023 Entreprise SkamCraft */ |
||||||
|
|
||||||
|
/* @font-face { |
||||||
|
font-family: M42; |
||||||
|
src: url(/fonts/m42.TTF); |
||||||
|
} */ |
||||||
|
|
||||||
* { |
* { |
||||||
background-color: #272727; |
font-family: "Montserrat", sans-serif; |
||||||
|
font-size: 16px; |
||||||
|
color: #ffffff; |
||||||
|
margin: 0; |
||||||
|
padding: 0; |
||||||
|
text-decoration: none; |
||||||
|
list-style: none; |
||||||
} |
} |
||||||
|
|
||||||
body { |
body { |
||||||
text-align: center; |
background-color: #212121; |
||||||
|
} |
||||||
|
|
||||||
|
.logo { |
||||||
display: flex; |
display: flex; |
||||||
justify-content: center; |
justify-content: center; |
||||||
align-items: center; |
align-items: center; |
||||||
height: 100vh; |
|
||||||
} |
} |
||||||
|
|
||||||
.container-auth { |
.logo img { |
||||||
border-radius: 10px; |
width: 80px; |
||||||
padding: 20px; |
padding: 20px; |
||||||
|
} |
||||||
|
|
||||||
|
.logo h4 { |
||||||
|
font-size: 30px; |
||||||
|
} |
||||||
|
|
||||||
|
.form { |
||||||
|
--input-focus: #a37b03; |
||||||
|
--font-color: #323232; |
||||||
|
--font-color-sub: #666666; |
||||||
|
--bg-color: beige; |
||||||
|
--main-color: black; |
||||||
|
padding: 20px; |
||||||
|
background: #eab308; |
||||||
|
display: flex; |
||||||
|
flex-direction: column; |
||||||
|
align-items: center; |
||||||
|
justify-content: center; |
||||||
text-align: center; |
text-align: center; |
||||||
max-width: 400px; |
gap: 20px; |
||||||
width: 100%; |
border-radius: 20px; |
||||||
|
border: 2px solid var(--main-color); |
||||||
|
box-shadow: 4px 4px var(--main-color); |
||||||
|
width: 20%; |
||||||
|
margin: auto; |
||||||
|
margin-top: 10%; |
||||||
|
} |
||||||
|
|
||||||
|
.title { |
||||||
|
color: var(--font-color); |
||||||
|
font-weight: 900; |
||||||
|
font-size: 20px; |
||||||
} |
} |
||||||
|
|
||||||
h1 { |
.title span { |
||||||
font-weight: bold; |
color: var(--font-color-sub); |
||||||
font-size: 24px; |
|
||||||
line-height: 30px; |
|
||||||
font-weight: 600; |
font-weight: 600; |
||||||
|
font-size: 17px; |
||||||
} |
} |
||||||
|
|
||||||
h2 { |
.input { |
||||||
font-weight: 400; |
width: 250px; |
||||||
font-size: 16px; |
height: 40px; |
||||||
line-height: 20px; |
border-radius: 5px; |
||||||
color: #fa777c; |
border: 2px solid var(--main-color); |
||||||
|
background-color: var(--bg-color); |
||||||
|
box-shadow: 4px 4px var(--main-color); |
||||||
|
font-size: 15px; |
||||||
|
font-weight: 600; |
||||||
|
color: var(--font-color); |
||||||
|
padding: 5px 10px; |
||||||
|
outline: none; |
||||||
|
} |
||||||
|
|
||||||
|
.input::placeholder { |
||||||
|
color: var(--font-color-sub); |
||||||
|
opacity: 0.8; |
||||||
|
} |
||||||
|
|
||||||
|
.input:focus { |
||||||
|
border: 2px solid var(--input-focus); |
||||||
} |
} |
||||||
|
|
||||||
label { |
.select * { |
||||||
font-weight: 700; |
color: var(--main-color); |
||||||
font-size: 12px; |
|
||||||
color: #b5bac1; |
|
||||||
line-height: 16px; |
|
||||||
} |
} |
||||||
|
|
||||||
input { |
.button-confirm { |
||||||
color: #fff; |
width: 120px; |
||||||
width: 100%; |
height: 40px; |
||||||
height: 30px; |
|
||||||
border-radius: 5px; |
border-radius: 5px; |
||||||
padding: 5px; |
border: 2px solid var(--main-color); |
||||||
|
background-color: var(--bg-color); |
||||||
|
box-shadow: 4px 4px var(--main-color); |
||||||
|
font-size: 17px; |
||||||
|
font-weight: 600; |
||||||
|
color: var(--font-color); |
||||||
|
cursor: pointer; |
||||||
} |
} |
||||||
|
|
||||||
button { |
.button-confirm:active { |
||||||
font-weight: 500; |
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); |
||||||
font-size: 16px; |
} |
||||||
line-height: 24px; |
|
||||||
color: #fff; |
.link-connection { |
||||||
margin-top: 10px; |
position: relative; |
||||||
padding: 10px 20px; |
display: inline-block; |
||||||
|
} |
||||||
|
|
||||||
|
.link-connection:hover { |
||||||
cursor: pointer; |
cursor: pointer; |
||||||
border-radius: 10px; |
text-underline-offset: 2px; |
||||||
width: 100%; |
text-decoration: underline; |
||||||
margin-bottom: 10px; |
transform: scale(1.1); |
||||||
|
transition: 0.3s; |
||||||
|
} |
||||||
|
|
||||||
|
.alert { |
||||||
|
position: fixed; |
||||||
|
left: 50%; |
||||||
|
transform: translateX(-50%); |
||||||
|
bottom: 10%; |
||||||
|
border-radius: 0.5rem; |
||||||
|
border-width: 0.25rem; |
||||||
|
border-color: #ef4444; |
||||||
|
background-color: #fee2e2; |
||||||
|
padding: 1rem; |
||||||
|
width: 300px; |
||||||
|
max-width: 90%; |
||||||
|
text-align: center; |
||||||
|
} |
||||||
|
|
||||||
|
.alert-inner { |
||||||
|
display: flex; |
||||||
|
align-items: center; |
||||||
|
gap: 0.5rem; |
||||||
|
color: #ef4444; |
||||||
|
} |
||||||
|
|
||||||
|
.icon { |
||||||
|
height: 1.25rem; |
||||||
|
width: 1.25rem; |
||||||
|
fill: #d94848; |
||||||
|
} |
||||||
|
|
||||||
|
.message { |
||||||
|
color: #d94848; |
||||||
|
font-weight: 500; |
||||||
|
} |
||||||
|
|
||||||
|
.content { |
||||||
|
margin-top: 0.5rem; |
||||||
|
font-size: 0.875rem; |
||||||
|
color: #d94848; |
||||||
} |
} |
Binary file not shown.
After Width: | Height: | Size: 209 KiB |
Before Width: | Height: | Size: 1.1 MiB |
Before Width: | Height: | Size: 4.7 KiB |
@ -1,49 +1,54 @@ |
|||||||
<!--Copyright © 2023 Entreprise SpaceTarders --> |
<!-- Copyright © 2023 Entreprise SkamKraft --> |
||||||
|
|
||||||
<!DOCTYPE html> |
<!DOCTYPE html> |
||||||
<html lang="fr" class="html-index"> |
<html lang="fr" class="html-index"> |
||||||
|
<head> |
||||||
<head> |
|
||||||
<meta charset="UTF-8" /> |
<meta charset="UTF-8" /> |
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> |
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
||||||
<link rel="preconnect" href="https://fonts.googleapis.com" /> |
<link rel="preconnect" href="https://fonts.googleapis.com" /> |
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> |
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@500&display=swap" rel="stylesheet" /> |
<link |
||||||
<script src="https://code.jquery.com/jquery-3.7.1.min.js" |
href="https://fonts.googleapis.com/css2?family=Inter:wght@500&display=swap" |
||||||
integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script> |
rel="stylesheet" |
||||||
|
/> |
||||||
|
<script |
||||||
|
src="https://code.jquery.com/jquery-3.7.1.min.js" |
||||||
|
integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" |
||||||
|
crossorigin="anonymous" |
||||||
|
></script> |
||||||
<script type="module" src="scripts/main.js" defer></script> |
<script type="module" src="scripts/main.js" defer></script> |
||||||
<link rel="stylesheet" href="/css/global.css" /> |
<link rel="stylesheet" href="/css/global.css" /> |
||||||
<link rel="icon" href="img/logo.png" /> |
<link rel="icon" href="img/logo.png" /> |
||||||
<title>SpaceTraders</title> |
<title>SkamCraft</title> |
||||||
</head> |
</head> |
||||||
|
|
||||||
<body> |
<body> |
||||||
<header id="header"> |
<header id="header"> |
||||||
<div class="menu"> |
<div class="menu"> |
||||||
<div class="title-section"> |
<div class="title-section"> |
||||||
<img src="img/logo.png" alt="Logo AppleTech.svg" /> |
<img src="img/Skamkraft.png" alt="Logo AppleTech.svg" /> |
||||||
<p>SpaceTraders</p> |
<p>SkamCraft</p> |
||||||
</div> |
|
||||||
<div class="page-change-button"> |
<div class="page-change-button"> |
||||||
<button id="btn-agent">Mon agent</button> |
|
||||||
<button id="btn-contract">Mes contracts</button> |
<button id="btn-contract">Mes contracts</button> |
||||||
<button id="btn-faction">Ma faction</button> |
<button id="btn-faction">Ma faction</button> |
||||||
<button id="btn-ship">Mes vaiseaux</button> |
<button id="btn-ship">Mes vaisseaux</button> |
||||||
<button id="btn-system">Systeme</button> |
<button id="btn-system">Systeme</button> |
||||||
</div> |
</div> |
||||||
</div> |
</div> |
||||||
|
<div class="title-section"> |
||||||
|
<p id="credits">N/A Credtis</p> |
||||||
|
<button id="btn-logout">Se deconnecter</button> |
||||||
|
</div> |
||||||
|
</div> |
||||||
<hr /> |
<hr /> |
||||||
</header> |
</header> |
||||||
|
|
||||||
<main> |
<main></main> |
||||||
<p>PAGE D'ACCEUIL</p> |
|
||||||
</main> |
|
||||||
|
|
||||||
<footer id="footer"> |
<footer id="footer"> |
||||||
<hr /> |
<hr /> |
||||||
<p>SpaceTrader © 2023</p> |
<p>SkamKraft © 2023</p> |
||||||
</footer> |
</footer> |
||||||
</body> |
</body> |
||||||
|
|
||||||
</html> |
</html> |
@ -1,40 +1,65 @@ |
|||||||
<!--Copyright © 2023 Entreprise SpaceTarders --> |
<!-- Copyright © 2023 Entreprise SkamKraft --> |
||||||
|
|
||||||
<!DOCTYPE html> |
<!DOCTYPE html> |
||||||
<html lang="fr" class="html-index"> |
<html lang="en"> |
||||||
|
<head> |
||||||
<head> |
|
||||||
<meta charset="UTF-8" /> |
<meta charset="UTF-8" /> |
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> |
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
||||||
<link rel="preconnect" href="https://fonts.googleapis.com" /> |
<title>Skamkraft</title> |
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> |
<link rel="icon" type="image/png" href="/img/Skamkraft.png" /> |
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@500&display=swap" rel="stylesheet" /> |
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.min.js" |
|
||||||
integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script> |
|
||||||
<script type="module" src="/scripts/main.js" defer></script> |
|
||||||
<link rel="stylesheet" href="/css/auth.css" /> |
<link rel="stylesheet" href="/css/auth.css" /> |
||||||
<link rel="icon" href="img/logo.png" /> |
|
||||||
<title>SpaceTraders</title> |
|
||||||
</head> |
|
||||||
|
|
||||||
<body> |
<link rel="preconnect" href="https://fonts.googleapis.com" /> |
||||||
<main> |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> |
||||||
<div className="container-auth"> |
<link |
||||||
<h1>Connexion</h1> |
href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;500&display=swap" |
||||||
<h2 id="error"> |
rel="stylesheet" |
||||||
<h2> |
/> |
||||||
|
<script |
||||||
|
src="https://code.jquery.com/jquery-3.7.1.min.js" |
||||||
|
integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" |
||||||
|
crossorigin="anonymous" |
||||||
|
></script> |
||||||
|
<script type="module" src="scripts/main.js" defer></script> |
||||||
|
</head> |
||||||
|
<body> |
||||||
|
<div class="logo"> |
||||||
|
<img src="/img/Skamkraft.png" /> |
||||||
|
<h4>Skamkraft</h4> |
||||||
|
</div> |
||||||
|
|
||||||
<div className="input-auth"> |
<div class="form" aria-setsize="19"> |
||||||
<label>TOKEN</label> |
<div class="title"> |
||||||
<input type="text" id="input-token" /> |
Bienvenue sur Skamkraft,<br /><span |
||||||
|
>Entrez votre token pour continuer</span |
||||||
|
> |
||||||
|
</div> |
||||||
|
<input id="input-token" class="input" placeholder="Token" type="text" /> |
||||||
|
<button id="btn-login" class="button-confirm">Continuer →</button> |
||||||
|
<div class="link-connection"> |
||||||
|
<a class="animation-underline" href="register.html">Sign Up</a> |
||||||
|
</div> |
||||||
</div> |
</div> |
||||||
|
|
||||||
<button id="btn-login">Connexion</button> |
<div id="box-alert" class="alert" hidden> |
||||||
|
<div class="alert-inner"> |
||||||
|
<svg |
||||||
|
xmlns="http://www.w3.org/2000/svg" |
||||||
|
viewBox="0 0 24 24" |
||||||
|
class="icon" |
||||||
|
> |
||||||
|
<path |
||||||
|
fill-rule="evenodd" |
||||||
|
d="M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z" |
||||||
|
clip-rule="evenodd" |
||||||
|
></path> |
||||||
|
</svg> |
||||||
|
|
||||||
<a href="/register.html">S'inscrire</a> |
<strong class="message"> Quelque chose s'est mal passé</strong> |
||||||
</div> |
</div> |
||||||
</main> |
|
||||||
</body> |
|
||||||
|
|
||||||
|
<p id="error-message" class="content"></p> |
||||||
|
</div> |
||||||
|
</body> |
||||||
</html> |
</html> |
@ -1,45 +1,68 @@ |
|||||||
<!--Copyright © 2023 Entreprise SpaceTarders --> |
<!-- Copyright © 2023 Entreprise SkamKraft --> |
||||||
|
|
||||||
<!DOCTYPE html> |
<!DOCTYPE html> |
||||||
<html lang="fr" class="html-index"> |
<html lang="en"> |
||||||
|
<head> |
||||||
<head> |
|
||||||
<meta charset="UTF-8" /> |
<meta charset="UTF-8" /> |
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> |
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
||||||
<link rel="preconnect" href="https://fonts.googleapis.com" /> |
<title>Skamkraft</title> |
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> |
<link rel="icon" type="image/png" href="/img/Skamkraft.png" /> |
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@500&display=swap" rel="stylesheet" /> |
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.min.js" |
|
||||||
integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script> |
|
||||||
<script type="module" src="/scripts/main.js" defer></script> |
|
||||||
<link rel="stylesheet" href="/css/auth.css" /> |
|
||||||
<link rel="icon" href="img/logo.png" /> |
|
||||||
<title>SpaceTraders</title> |
|
||||||
</head> |
|
||||||
|
|
||||||
<body> |
<link rel="stylesheet" href="/css/auth.css" /> |
||||||
<main> |
|
||||||
<div className="container-auth"> |
|
||||||
<h1>S'inscrire</h1> |
|
||||||
<h2 id="error"> |
|
||||||
<h2> |
|
||||||
|
|
||||||
<div className="input-auth"> |
<link rel="preconnect" href="https://fonts.googleapis.com" /> |
||||||
<label>SYMBOL</label> |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> |
||||||
<input type="text" id="input-symbol" /> |
<link |
||||||
|
href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;500&display=swap" |
||||||
|
rel="stylesheet" |
||||||
|
/> |
||||||
|
<script |
||||||
|
src="https://code.jquery.com/jquery-3.7.1.min.js" |
||||||
|
integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" |
||||||
|
crossorigin="anonymous" |
||||||
|
></script> |
||||||
|
<script type="module" src="scripts/main.js" defer></script> |
||||||
|
</head> |
||||||
|
<body> |
||||||
|
<div class="logo"> |
||||||
|
<img src="/img/Skamkraft.png" /> |
||||||
|
<h4>Skamkraft</h4> |
||||||
</div> |
</div> |
||||||
|
|
||||||
<div className="input-auth"> |
<div class="form" aria-setsize="19"> |
||||||
<label>FACTION</label> |
<div class="title"> |
||||||
<input type="text" id="input-faction" /> |
Bienvenue sur Skamkraft,<br /> |
||||||
|
<span>Entrez votre symbol pour continuer</span> |
||||||
|
</div> |
||||||
|
<input id="input-symbol" class="input" placeholder="Symbol" type="text" /> |
||||||
|
<select id="input-faction" class="input select"> |
||||||
|
<option value="" disabled selected>Faction</option> |
||||||
|
<optgroup id="group-faction" label="---------"></optgroup> |
||||||
|
</select> |
||||||
|
<button id="btn-register" class="button-confirm">Continuer →</button> |
||||||
|
<div class="link-connection"> |
||||||
|
<a class="animation-underline" href="login.html">Login</a> |
||||||
|
</div> |
||||||
</div> |
</div> |
||||||
|
|
||||||
<button id="btn-register">S'inscrire</button> |
<div id="box-alert" class="alert" hidden> |
||||||
|
<div class="alert-inner"> |
||||||
|
<svg |
||||||
|
xmlns="http://www.w3.org/2000/svg" |
||||||
|
viewBox="0 0 24 24" |
||||||
|
class="icon" |
||||||
|
> |
||||||
|
<path |
||||||
|
fill-rule="evenodd" |
||||||
|
d="M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z" |
||||||
|
clip-rule="evenodd" |
||||||
|
></path> |
||||||
|
</svg> |
||||||
|
|
||||||
<a href="/login.html">Se connecter</a> |
<strong class="message"> Quelque chose s'est mal passé</strong> |
||||||
</div> |
</div> |
||||||
</main> |
|
||||||
</body> |
|
||||||
|
|
||||||
|
<p id="error-message" class="content"></p> |
||||||
|
</div> |
||||||
|
</body> |
||||||
</html> |
</html> |
@ -0,0 +1,125 @@ |
|||||||
|
// Copyright © 2023 Entreprise SkamKraft
|
||||||
|
|
||||||
|
"use strict"; |
||||||
|
|
||||||
|
const spacetradersApiUrl = "https://api.spacetraders.io/v2/"; |
||||||
|
|
||||||
|
const REQUEST = async (url, method, headers, data) => { |
||||||
|
try { |
||||||
|
const response = await $.ajax(url, { |
||||||
|
method, |
||||||
|
headers, |
||||||
|
data, |
||||||
|
}); |
||||||
|
|
||||||
|
return response.data; |
||||||
|
} catch (error) { |
||||||
|
return error; |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
export default { |
||||||
|
Agent: { |
||||||
|
create: (symbol, faction) => { |
||||||
|
const url = `${spacetradersApiUrl}register`; |
||||||
|
const headers = { "Content-Type": "application/json" }; |
||||||
|
const data = JSON.stringify({ symbol, faction }); |
||||||
|
|
||||||
|
return REQUEST(url, "POST", headers, data); |
||||||
|
}, |
||||||
|
|
||||||
|
get: (token) => { |
||||||
|
const url = `${spacetradersApiUrl}my/agent`; |
||||||
|
const headers = { |
||||||
|
Accept: "application/json", |
||||||
|
Authorization: `Bearer ${token}`, |
||||||
|
}; |
||||||
|
|
||||||
|
return REQUEST(url, "GET", headers); |
||||||
|
}, |
||||||
|
|
||||||
|
getPublic: (symbol) => { |
||||||
|
const url = `${spacetradersApiUrl}agents/${symbol}`; |
||||||
|
const headers = { Accept: "application/json" }; |
||||||
|
|
||||||
|
return REQUEST(url, "GET", headers); |
||||||
|
}, |
||||||
|
|
||||||
|
list: (limit, page) => { |
||||||
|
const url = `${spacetradersApiUrl}agents`; |
||||||
|
const headers = { Accept: "application/json" }; |
||||||
|
const data = { limit, page }; |
||||||
|
|
||||||
|
return REQUEST(url, "GET", headers, data); |
||||||
|
}, |
||||||
|
}, |
||||||
|
|
||||||
|
Faction: { |
||||||
|
list: (limit, page) => { |
||||||
|
const url = `${spacetradersApiUrl}factions`; |
||||||
|
const headers = { Accept: "application/json" }; |
||||||
|
const data = { limit, page }; |
||||||
|
|
||||||
|
return REQUEST(url, "GET", headers, data); |
||||||
|
}, |
||||||
|
}, |
||||||
|
|
||||||
|
System: { |
||||||
|
list: (limit, page) => { |
||||||
|
const url = `${spacetradersApiUrl}systems/`; |
||||||
|
const headers = { Accept: "application/json" }; |
||||||
|
const data = { limit, page }; |
||||||
|
|
||||||
|
return REQUEST(url, "GET", headers, data); |
||||||
|
}, |
||||||
|
|
||||||
|
get: (symbol) => { |
||||||
|
const url = `${spacetradersApiUrl}systems/${symbol}`; |
||||||
|
const headers = { Accept: "application/json" }; |
||||||
|
|
||||||
|
return REQUEST(url, "GET", headers); |
||||||
|
}, |
||||||
|
}, |
||||||
|
|
||||||
|
Waypoint: { |
||||||
|
list: (limit, page, systemSymbol) => { |
||||||
|
const url = `${spacetradersApiUrl}systems/${systemSymbol}/waypoints`; |
||||||
|
const headers = { Accept: "application/json" }; |
||||||
|
const data = { limit, page }; |
||||||
|
|
||||||
|
return REQUEST(url, "GET", headers, data); |
||||||
|
}, |
||||||
|
|
||||||
|
get: (systemSymbol, waypointSymbol, token) => { |
||||||
|
const url = `${spacetradersApiUrl}systems/${systemSymbol}/waypoints/${waypointSymbol}/market`; |
||||||
|
const headers = { |
||||||
|
Accept: "application/json", |
||||||
|
Authorization: `Bearer ${token}`, |
||||||
|
}; |
||||||
|
|
||||||
|
return REQUEST(url, "GET", headers); |
||||||
|
}, |
||||||
|
}, |
||||||
|
|
||||||
|
Contract: { |
||||||
|
list: (token) => { |
||||||
|
const url = `${spacetradersApiUrl}my/contracts/`; |
||||||
|
const headers = { |
||||||
|
Accept: "application/json", |
||||||
|
Authorization: `Bearer ${token}`, |
||||||
|
}; |
||||||
|
|
||||||
|
return REQUEST(url, "GET", headers); |
||||||
|
}, |
||||||
|
|
||||||
|
get: async (contratId, token) => { |
||||||
|
const url = `${spacetradersApiUrl}my/contracts/${contratId}`; |
||||||
|
const headers = { |
||||||
|
Accept: "application/json", |
||||||
|
Authorization: `Bearer ${token}`, |
||||||
|
}; |
||||||
|
|
||||||
|
return REQUEST(url, "GET", headers); |
||||||
|
}, |
||||||
|
}, |
||||||
|
}; |
@ -1,88 +0,0 @@ |
|||||||
// Copyright © 2023 Entreprise SpaceTarders
|
|
||||||
|
|
||||||
"use strict"; |
|
||||||
|
|
||||||
export async function createAgent(symbol, faction) { |
|
||||||
let agent; |
|
||||||
|
|
||||||
await $.ajax("https://api.spacetraders.io/v2/register", { |
|
||||||
method: "POST", |
|
||||||
headers: { |
|
||||||
"Content-Type": "application/json", |
|
||||||
}, |
|
||||||
data: JSON.stringify({ |
|
||||||
symbol: symbol, |
|
||||||
faction: faction, |
|
||||||
}), |
|
||||||
success: function (response) { |
|
||||||
agent = response.data; |
|
||||||
}, |
|
||||||
error: function (error) { |
|
||||||
return error; |
|
||||||
}, |
|
||||||
}); |
|
||||||
|
|
||||||
return agent; |
|
||||||
} |
|
||||||
|
|
||||||
export async function getAgent(token) { |
|
||||||
let agent; |
|
||||||
|
|
||||||
await $.ajax("https://api.spacetraders.io/v2/my/agent", { |
|
||||||
method: "GET", |
|
||||||
headers: { |
|
||||||
Accept: "application/json", |
|
||||||
Authorization: `Bearer ${token}`, |
|
||||||
}, |
|
||||||
success: function (response) { |
|
||||||
agent = response.data; |
|
||||||
}, |
|
||||||
error: function (error) { |
|
||||||
return error; |
|
||||||
}, |
|
||||||
}); |
|
||||||
|
|
||||||
return agent; |
|
||||||
} |
|
||||||
|
|
||||||
export async function listAgents(limit, page) { |
|
||||||
let agents; |
|
||||||
|
|
||||||
await $.ajax("https://api.spacetraders.io/v2/agents", { |
|
||||||
method: "GET", |
|
||||||
headers: { |
|
||||||
Accept: "application/json", |
|
||||||
}, |
|
||||||
data: { |
|
||||||
limit: limit, |
|
||||||
page: page, |
|
||||||
}, |
|
||||||
success: function (response) { |
|
||||||
agents = response.data; |
|
||||||
}, |
|
||||||
error: function (error) { |
|
||||||
console.log(error); |
|
||||||
}, |
|
||||||
}); |
|
||||||
|
|
||||||
return agents; |
|
||||||
} |
|
||||||
|
|
||||||
export async function getPublicAgent(agentSymbol) { |
|
||||||
let agent; |
|
||||||
|
|
||||||
await $.ajax(`https://api.spacetraders.io/v2/agents/${agentSymbol}`, { |
|
||||||
method: "GET", |
|
||||||
headers: { |
|
||||||
Accept: "application/json", |
|
||||||
}, |
|
||||||
success: function (response) { |
|
||||||
agent = response.data; |
|
||||||
}, |
|
||||||
error: function (error) { |
|
||||||
console.log(error); |
|
||||||
}, |
|
||||||
}); |
|
||||||
|
|
||||||
return agent; |
|
||||||
} |
|
@ -1,117 +0,0 @@ |
|||||||
// Copyright © 2023 Entreprise SpaceTarders
|
|
||||||
|
|
||||||
"use strict"; |
|
||||||
|
|
||||||
export async function listSystems(limit, page) { |
|
||||||
let systems; |
|
||||||
|
|
||||||
await $.ajax("https://api.spacetraders.io/v2/systems/", { |
|
||||||
method: "GET", |
|
||||||
headers: { |
|
||||||
Accept: "application/json", |
|
||||||
}, |
|
||||||
data: { |
|
||||||
limit: limit, |
|
||||||
page: page, |
|
||||||
}, |
|
||||||
success: function (response) { |
|
||||||
systems = response.data; |
|
||||||
}, |
|
||||||
error: function (error) { |
|
||||||
console.log(error); |
|
||||||
}, |
|
||||||
}); |
|
||||||
|
|
||||||
return systems; |
|
||||||
} |
|
||||||
|
|
||||||
export async function getSystem(systemSymbol) { |
|
||||||
let system; |
|
||||||
|
|
||||||
await $.ajax(`https://api.spacetraders.io/v2/systems/${systemSymbol}`, { |
|
||||||
method: "GET", |
|
||||||
headers: { |
|
||||||
Accept: "application/json", |
|
||||||
}, |
|
||||||
success: function (response) { |
|
||||||
system = response.data; |
|
||||||
}, |
|
||||||
error: function (error) { |
|
||||||
console.log(error); |
|
||||||
}, |
|
||||||
}); |
|
||||||
|
|
||||||
return system; |
|
||||||
} |
|
||||||
|
|
||||||
export async function listWaypointsInSystem(limit, page, systemSymbol) { |
|
||||||
let waypoints; |
|
||||||
|
|
||||||
await $.ajax( |
|
||||||
`https://api.spacetraders.io/v2/systems/${systemSymbol}/waypoints`, |
|
||||||
{ |
|
||||||
method: "GET", |
|
||||||
headers: { |
|
||||||
Accept: "application/json", |
|
||||||
}, |
|
||||||
data: { |
|
||||||
limit: limit, |
|
||||||
page: page, |
|
||||||
}, |
|
||||||
success: function (response) { |
|
||||||
waypoints = response.data; |
|
||||||
}, |
|
||||||
error: function (error) { |
|
||||||
console.log(error); |
|
||||||
}, |
|
||||||
} |
|
||||||
); |
|
||||||
|
|
||||||
return waypoints; |
|
||||||
} |
|
||||||
|
|
||||||
export async function getWaypoint(systemSymbol, waypointSymbol) { |
|
||||||
let waypoint; |
|
||||||
|
|
||||||
await $.ajax( |
|
||||||
`https://api.spacetraders.io/v2/systems/${systemSymbol}/waypoints/${waypointSymbol}`, |
|
||||||
{ |
|
||||||
method: "GET", |
|
||||||
headers: { |
|
||||||
Accept: "application/json", |
|
||||||
}, |
|
||||||
success: function (response) { |
|
||||||
waypoint = response.data; |
|
||||||
}, |
|
||||||
error: function (error) { |
|
||||||
console.log(error); |
|
||||||
}, |
|
||||||
} |
|
||||||
); |
|
||||||
|
|
||||||
return waypoint; |
|
||||||
} |
|
||||||
|
|
||||||
export async function getMarket(systemSymbol, waypointSymbol, token) { |
|
||||||
let market; |
|
||||||
|
|
||||||
await $.ajax( |
|
||||||
`https://api.spacetraders.io/v2/systems/X1-KD70/waypoints/X1-KD70-AA1X/market`, |
|
||||||
{ |
|
||||||
method: "GET", |
|
||||||
headers: { |
|
||||||
Accept: "application/json", |
|
||||||
Authorization: `Bearer ${token}`, |
|
||||||
}, |
|
||||||
success: function (response) { |
|
||||||
console.log(response); |
|
||||||
market = response; |
|
||||||
}, |
|
||||||
error: function (error) { |
|
||||||
console.log(error); |
|
||||||
}, |
|
||||||
} |
|
||||||
); |
|
||||||
|
|
||||||
return market; |
|
||||||
} |
|
@ -1,60 +1,83 @@ |
|||||||
// Copyright © 2023 Entreprise SpaceTarders
|
// Copyright © 2023 Entreprise SkamCraft
|
||||||
|
|
||||||
"use strict"; |
"use strict"; |
||||||
|
|
||||||
import { getAgent } from "./api/agent.js"; |
import SpaceTraders from "./api.js"; |
||||||
import { createAgent } from "./api/agent.js"; |
|
||||||
|
|
||||||
export async function login() { |
const $inputToken = $("#input-token"); |
||||||
let token = $('#input-token').val(); |
const $inputSymbol = $("#input-symbol"); |
||||||
|
const $inputFaction = $("#input-faction"); |
||||||
|
const $alert = document.querySelector("#box-alert"); |
||||||
|
const $error = $("#error-message"); |
||||||
|
|
||||||
|
const showError = (message) => { |
||||||
|
$alert.removeAttribute("hidden"); |
||||||
|
$error.text(message); |
||||||
|
}; |
||||||
|
|
||||||
|
const redirectToIndex = () => { |
||||||
|
window.location.href = "/index.html"; |
||||||
|
}; |
||||||
|
|
||||||
|
export default { |
||||||
|
login: async () => { |
||||||
|
const token = $inputToken.val(); |
||||||
|
|
||||||
if (!token) { |
if (!token) { |
||||||
$('#error').text('Token manquant'); |
showError("Token manquant"); |
||||||
return; |
return; |
||||||
} |
} |
||||||
|
|
||||||
try { |
try { |
||||||
await getAgent(token); |
await SpaceTraders.Agent.get(token); |
||||||
localStorage.setItem('token', token); |
localStorage.setItem("token", token); |
||||||
window.location.href = '/index.html'; |
redirectToIndex(); |
||||||
} catch (error) { |
} catch { |
||||||
$('#error').text('Token invalide'); |
showError("Token invalide"); |
||||||
} |
} |
||||||
} |
}, |
||||||
|
|
||||||
|
|
||||||
export async function register() { |
register: async () => { |
||||||
|
const symbol = $inputSymbol.val(); |
||||||
|
|
||||||
let symbol = $('#input-symbol').val(); |
|
||||||
if (!symbol) { |
if (!symbol) { |
||||||
$('#error').text('Symbol manquant'); |
showError("Symbol manquant"); |
||||||
return; |
return; |
||||||
} |
} |
||||||
|
|
||||||
let faction = $('#input-faction').val(); |
const faction = $inputFaction.val(); |
||||||
|
|
||||||
|
console.log(faction); |
||||||
|
|
||||||
if (!faction) { |
if (!faction) { |
||||||
$('#error').text('Faction manquante'); |
showError("Faction manquante"); |
||||||
return; |
return; |
||||||
} |
} |
||||||
|
|
||||||
try { |
try { |
||||||
await createAgent(symbol, faction); |
const agent = await SpaceTraders.Agent.create(symbol, faction); |
||||||
localStorage.setItem('token', token); |
|
||||||
window.location.href = '/index.html'; |
if (agent.token !== undefined) { |
||||||
|
localStorage.setItem("token", agent.token); |
||||||
|
redirectToIndex(); |
||||||
|
} else { |
||||||
|
showError("Symbol ou faction invalide"); |
||||||
|
} |
||||||
} catch { |
} catch { |
||||||
$('#error').text('Symbol ou faction invalide'); |
showError("Erreur lors de l'inscription"); |
||||||
} |
} |
||||||
} |
}, |
||||||
|
|
||||||
export async function isLogin() { |
isLogin: async () => { |
||||||
let token = localStorage.getItem('token'); |
const token = localStorage.getItem("token"); |
||||||
|
|
||||||
if (!token) return false; |
if (!token) return false; |
||||||
|
|
||||||
try { |
try { |
||||||
await getAgent(token); |
await SpaceTraders.Agent.get(token); |
||||||
return true; |
return true; |
||||||
} catch { |
} catch { |
||||||
return false; |
return false; |
||||||
} |
} |
||||||
} |
}, |
||||||
|
}; |
||||||
|
@ -1,25 +1,84 @@ |
|||||||
// Copyright © 2023 Entreprise SpaceTarders
|
// Copyright © 2023 Entreprise SkamCraft
|
||||||
|
|
||||||
"use strict"; |
"use strict"; |
||||||
|
|
||||||
import { login } from './auth.js' |
import AUTH from "./auth.js"; |
||||||
import { register } from './auth.js' |
import SpaceTraders from "./api.js"; |
||||||
import { isLogin } from './auth.js'; |
|
||||||
|
|
||||||
$(document).ready(async function () { |
$(document).ready(async function () { |
||||||
|
//Auth
|
||||||
if (document.URL.includes('login.html')) { |
if (document.URL.includes("login.html")) { |
||||||
$('#btn-login').on('click', () => { |
$("#btn-login").on("click", () => { |
||||||
login(); |
AUTH.login(); |
||||||
}); |
}); |
||||||
return; |
return; |
||||||
} |
} |
||||||
if (document.URL.includes('register.html')) { |
|
||||||
$('#btn-register').on('click', () => { |
if (document.URL.includes("register.html")) { |
||||||
register(); |
const factions = await SpaceTraders.Faction.list(10, 1); |
||||||
}) |
factions.forEach((faction) => { |
||||||
|
const option = `<option>${faction.symbol}</option>`; |
||||||
|
$("#group-faction").append(option); |
||||||
|
}); |
||||||
|
|
||||||
|
$("#btn-register").on("click", () => { |
||||||
|
AUTH.register(); |
||||||
|
}); |
||||||
return; |
return; |
||||||
} |
} |
||||||
|
|
||||||
if (!await isLogin()) window.location.href = '/login.html'; |
if (!(await AUTH.isLogin())) window.location.href = "login.html"; |
||||||
|
|
||||||
|
agent(); |
||||||
|
|
||||||
|
//Buttons
|
||||||
|
$("#btn-contract").on("click", () => { |
||||||
|
contract(); |
||||||
|
}); |
||||||
|
$("#btn-faction").on("click", () => {}); |
||||||
|
$("#btn-ship").on("click", () => {}); |
||||||
|
$("#btn-system").on("click", () => {}); |
||||||
|
$("#btn-logout").on("click", () => { |
||||||
|
logout(); |
||||||
|
}); |
||||||
}); |
}); |
||||||
|
|
||||||
|
function loadPage(page) { |
||||||
|
$("main").load(`templates/${page}.html`); |
||||||
|
} |
||||||
|
|
||||||
|
function logout() { |
||||||
|
localStorage.removeItem("token"); |
||||||
|
window.location.href = "login.html"; |
||||||
|
} |
||||||
|
|
||||||
|
async function agent() { |
||||||
|
let token = localStorage.getItem("token"); |
||||||
|
let agent = await SpaceTraders.Agent.get(token); |
||||||
|
|
||||||
|
$("#credits").text(agent.credits.toLocaleString() + " $"); |
||||||
|
} |
||||||
|
|
||||||
|
async function contract() { |
||||||
|
const token = localStorage.getItem("token"); |
||||||
|
const contracts = await SpaceTraders.Contract.list(token); |
||||||
|
|
||||||
|
$("main").empty(); |
||||||
|
|
||||||
|
contracts.forEach((contract) => { |
||||||
|
let card = `<div class="card">
|
||||||
|
<div class="card-title"> |
||||||
|
<h1>${contract.id}</h1> |
||||||
|
</div> |
||||||
|
<div class="card-content"> |
||||||
|
|
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="card-footer"> |
||||||
|
<button id="btn-accept-contract">Accepter</button> |
||||||
|
<button id="btn-reject-contract">Refuser</button> |
||||||
|
</div> |
||||||
|
</div>;`; |
||||||
|
$("main").append(card); |
||||||
|
}); |
||||||
|
} |
||||||
|
@ -0,0 +1 @@ |
|||||||
|
<div class="contrats"></div> |
@ -0,0 +1 @@ |
|||||||
|
<div id="faction" class="page-faction"></div> |
Loading…
Reference in New Issue