diff --git a/.gitignore b/.gitignore
index e69de29..6cae44f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/.vs/
diff --git a/js/API/API.js b/css/animation.css
similarity index 100%
rename from js/API/API.js
rename to css/animation.css
diff --git a/css/style.css b/css/style.css
index aa39c4e..e69de29 100644
--- a/css/style.css
+++ b/css/style.css
@@ -1,5 +0,0 @@
-canvas {
- width: 50%;
- border: 2px solid black;
- border-radius: 5px;
-}
\ No newline at end of file
diff --git a/html/template.html b/html/template.html
new file mode 100644
index 0000000..6d4fdca
--- /dev/null
+++ b/html/template.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+ Contracts
+ System
+ Ships
+ Profile
+ Ships
+
+
+
+
diff --git a/html/templates/test.html b/html/templates/test.html
new file mode 100644
index 0000000..aba8eea
--- /dev/null
+++ b/html/templates/test.html
@@ -0,0 +1,2 @@
+
Coucou
+Btn 1
\ No newline at end of file
diff --git a/html/templates/test2.html b/html/templates/test2.html
new file mode 100644
index 0000000..2a9b82e
--- /dev/null
+++ b/html/templates/test2.html
@@ -0,0 +1,2 @@
+Hello
+Btn 2
\ No newline at end of file
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..78a2fef
--- /dev/null
+++ b/index.html
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/js/Render/renderer.js b/js/Render/renderer.js
deleted file mode 100644
index b5d4fdf..0000000
--- a/js/Render/renderer.js
+++ /dev/null
@@ -1,41 +0,0 @@
-class renderer {
- constructor(canvas) {
- this.canvas = canvas;
- this.ctx = canvas.getContext("2d");
- this.waypoints = [];
- this.ships = [];
- }
-
- drawSystem() {
- const canvas = document.getElementById("canvas");
- let w = canvas.width;
- let h = canvas.height;
- const ctx = canvas.getContext("2d");
-
- this.waypoints.forEach(waypoint => {
- switch (waypoint.type) {
- case "PLANET":
- drawWaypoint(waypoint, ctx, w/2, h/2, 'green');
- break;
- case "ASTEROID":
- drawWaypoint(waypoint, ctx, w/2, h/2, 'blue');
- break;
- case "GAS_GIANT":
- drawWaypoint(waypoint, ctx, w/2, h/2, 'red');
- break;
- }
-
- });
- }
-
- drawShips() {
-
- }
-
- drawWaypoint(wayPoint, ctx, w, h, color) {
- ctx.beginPath();
- ctx.fillStyle = color;
- ctx.arc(wayPoint.x/offset.x + w, wayPoint.y/offset.y + h, 1, 0, 2 * Math.PI);
- ctx.fill();
- }
-}
\ No newline at end of file
diff --git a/js/api/agent/agent.js b/js/api/agent/agent.js
new file mode 100644
index 0000000..e69de29
diff --git a/js/api/api.js b/js/api/api.js
new file mode 100644
index 0000000..e69de29
diff --git a/js/api/ships/ship.js b/js/api/ships/ship.js
new file mode 100644
index 0000000..e69de29
diff --git a/js/api/ships/ship_crew.js b/js/api/ships/ship_crew.js
new file mode 100644
index 0000000..e69de29
diff --git a/js/api/ships/ship_engine.js b/js/api/ships/ship_engine.js
new file mode 100644
index 0000000..e69de29
diff --git a/js/api/ships/ship_movement.js b/js/api/ships/ship_movement.js
new file mode 100644
index 0000000..e69de29
diff --git a/js/api/systems/get_systems.js b/js/api/systems/get_systems.js
new file mode 100644
index 0000000..e69de29
diff --git a/js/api/systems/get_waypoints_system.js b/js/api/systems/get_waypoints_system.js
new file mode 100644
index 0000000..e69de29
diff --git a/js/commun.js b/js/commun.js
new file mode 100644
index 0000000..e69de29
diff --git a/js/index.js b/js/index.js
new file mode 100644
index 0000000..fea19dc
--- /dev/null
+++ b/js/index.js
@@ -0,0 +1,12 @@
+import {UIRenderer} from "./ui/templeting_engine.js";
+
+let UI = new UIRenderer("html");
+
+UI.render("templates/test.html");
+
+UI.add_event("#btn1", "click", () => {
+ UI.render("templates/test2.html");
+});
+UI.add_event("#btn2", "click", () => {
+ UI.render("templates/test.html");
+})
\ No newline at end of file
diff --git a/js/main.js b/js/main.js
deleted file mode 100644
index 0a09669..0000000
--- a/js/main.js
+++ /dev/null
@@ -1,85 +0,0 @@
-let token = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZGVudGlmaWVyIjoiQU5OTk5VTEFYMTIyNSIsInZlcnNpb24iOiJ2Mi4xLjEiLCJyZXNldF9kYXRlIjoiMjAyMy0xMS0wNCIsImlhdCI6MTcwMDIyNDU5MSwic3ViIjoiYWdlbnQtdG9rZW4ifQ.r05mWtD5FjC4s6Td-ycmHdzL7C2s75lz3q7OBmWeCqUUZ1ejPsRGQRWJDPmIh1kAqO4D9FFs3GCTPZUn1KsnQ-xmDvsIi_mqC1gJV-Q0irI7gwfsGXbfLaVCXo-Q98C_QWRh-O_xkrbhJkCcvnwdEhZm7FnZ3PL4XXKrG0XNa98JrnmG0qlz0cv8V9Q0sSIwXZbvA9BrhuV8PK7_YzPc6LZuNqgPeKiX_B-tSIHHl6Sr1EzuydnczmuS-xKQnbhmcqnpaCXzQmJr7tA8KLgu70KqpPCvA8AI6PLmBlvPWtZ20RdzezqlBh6S9SrBzQ9R0zr_9RyJxq28ws2jnHpVPw";
-let offset = {
- x: 10,
- y: 10
-};
-
-function initGame() {
- const settings = {
- async: true,
- crossDomain: true,
- url: 'https://api.spacetraders.io/v2/register',
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- Accept: 'application/json'
- },
- processData: false,
- data: '{\n "faction": "COSMIC",\n "symbol": "ANNNNulax1225",\n "email": ""\n}'
- };
-
- $.ajax(settings).done(function (response) {
- console.log(response);
- });
-}
-
-function getAgent() {
- const settings = {
- async: true,
- crossDomain: true,
- url: 'https://api.spacetraders.io/v2/my/agent',
- method: 'GET',
- headers: {
- Accept: 'application/json',
- Authorization: `Bearer ${token}`
- }
- };
- $.ajax(settings).done(function (reponse) {
- $('.main-window').prepend(`
-
- ${reponse.data.accountId}
- ${reponse.data.symbol}
- ${reponse.data.headquarters}
- ${reponse.data.credits}
- ${reponse.data.startingFaction}
- ${reponse.data.shipCount}
-
- `);
- let metaSystem = reponse.data.headquarters.split("-");
- getSystem(metaSystem[0] + "-" + metaSystem[1]);
- });
-}
-
-function getWayPoint(wayPoint) {
- const settings = {
- async: true,
- crossDomain: true,
- url: `https://api.spacetraders.io/v2/systems/systemSymbol/waypoints/waypointSymbol`,
- method: 'GET',
- headers: {
- Accept: 'application/json'
- }
- };
-
- $.ajax(settings).done(function (response) {
- console.log(response);
- });
-};
-
-function getSystem(system) {
- const settings = {
- async: true,
- crossDomain: true,
- url: `https://api.spacetraders.io/v2/systems/${system}`,
- method: 'GET',
- headers: {
- Accept: 'application/json'
- }
- };
-
- $.ajax(settings).done(function (response) {
- drawSystem(response.data.waypoints);
- });
-}
-
-getAgent();
diff --git a/js/rendering/canvas_render.js b/js/rendering/canvas_render.js
new file mode 100644
index 0000000..e69de29
diff --git a/js/ui/templeting_engine.js b/js/ui/templeting_engine.js
new file mode 100644
index 0000000..05af941
--- /dev/null
+++ b/js/ui/templeting_engine.js
@@ -0,0 +1,27 @@
+export class UIRenderer {
+ constructor(path) {
+ this.templatePath = path;
+ }
+ render(template) {
+ this.get_template((reponse) => {
+ $('body').html(reponse);
+ this.get_template((reponse) => {
+ $('#block-content').html(reponse);
+ }, template)
+ });
+ }
+ get_template(callback, template = "") {
+ let url = template === "" ? `${this.templatePath}/template.html`: `${this.templatePath}/${template}`;
+ let data = $.ajax(url,{
+ async: false,
+ method: "GET",
+ success: callback,
+ fail: (err) => {
+ console.log(err);
+ }
+ });
+ }
+ add_event(tag, action, callback) {
+ $("body").on(action, tag, callback);
+ }
+}
diff --git a/templates/index.html b/templates/index.html
deleted file mode 100644
index f372487..0000000
--- a/templates/index.html
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
- Space traders
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/token b/token
deleted file mode 100644
index 9b9b8d9..0000000
--- a/token
+++ /dev/null
@@ -1 +0,0 @@
-eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZGVudGlmaWVyIjoiQU5OTk5VTEFYMTIyNSIsInZlcnNpb24iOiJ2Mi4xLjEiLCJyZXNldF9kYXRlIjoiMjAyMy0xMS0wNCIsImlhdCI6MTcwMDIyNDU5MSwic3ViIjoiYWdlbnQtdG9rZW4ifQ.r05mWtD5FjC4s6Td-ycmHdzL7C2s75lz3q7OBmWeCqUUZ1ejPsRGQRWJDPmIh1kAqO4D9FFs3GCTPZUn1KsnQ-xmDvsIi_mqC1gJV-Q0irI7gwfsGXbfLaVCXo-Q98C_QWRh-O_xkrbhJkCcvnwdEhZm7FnZ3PL4XXKrG0XNa98JrnmG0qlz0cv8V9Q0sSIwXZbvA9BrhuV8PK7_YzPc6LZuNqgPeKiX_B-tSIHHl6Sr1EzuydnczmuS-xKQnbhmcqnpaCXzQmJr7tA8KLgu70KqpPCvA8AI6PLmBlvPWtZ20RdzezqlBh6S9SrBzQ9R0zr_9RyJxq28ws2jnHpVPw
\ No newline at end of file