From 2e1186a4b23be609773feced44fc41fd4723b28a Mon Sep 17 00:00:00 2001
From: Sting <loic.allegre@ensiie.fr>
Date: Wed, 23 Sep 2020 02:05:43 +0200
Subject: [PATCH] INSTANCE: Basic CSS layout with dummy data

---
 instance/index.html | 41 +++++++++++++++++++++++++++++------------
 instance/main.js    | 16 ++++++++++++++++
 main.js             |  6 +++---
 3 files changed, 48 insertions(+), 15 deletions(-)

diff --git a/instance/index.html b/instance/index.html
index 216db04..8f29f83 100644
--- a/instance/index.html
+++ b/instance/index.html
@@ -8,19 +8,36 @@
         <script src="../style/jquery/jquery-3.5.1.js"></script>
         <script src="../style/bootstrap-4.5.2-dist/js/bootstrap.min.js"></script>
         <script src="./main.js"></script>
+        <style>
+            ::-webkit-scrollbar {
+                display: none;
+            }
+        </style>
     </head>
-    <body>
-        <div class="card">
-            <div class="card-header text-center">
-                <h2 class="text-center">
-                    LektorApp Admin Interface
-                </h2>
+    <body style="overflow: hidden; height: 100vh;">
+        <div class="container-fluid" style="height: 100%; display: flex; flex-direction: column; padding-bottom: 10px">
+            <div class="row" style="flex-basis: auto; height: 150px;">
+                <div class="card" style="width: 100%;">
+                    <div class="card-header text-center" style="-webkit-user-select: none; -webkit-app-region: drag;">
+                        <h2 class="text-center">
+                            LektorApp Admin Interface
+                        </h2>
+                    </div>
+                    <div class="card-body text-center">
+                        <button id="closeButton" type="button" class="btn btn-outline-primary">
+                            Quit LektorApp
+                        </button>
+                    </div>
+                </div>     
             </div>
-            <div class="card-body text-center">
-                <button id="closeButton" type="button" class="btn btn-outline-primary">
-                    Quit LektorApp
-                </button>
-            </div>       
-        </div>
+            <div class="row" style="width: 100%; margin-left: 0px; margin-right: 0px; flex-grow: 1; overflow: hidden; padding-top: 20px; padding-bottom: 20px;">
+                <div id="karaList" class="col" style="height: 100%; overflow-y: scroll;">
+                    
+                </div>
+                <div id="playingList" class="col" style="height: 100%; overflow-y: scroll;">
+                    
+                </div>
+            </div>
+        </div>   
     </body>
 </html>
diff --git a/instance/main.js b/instance/main.js
index eb0e3e1..e6d9475 100644
--- a/instance/main.js
+++ b/instance/main.js
@@ -1,9 +1,25 @@
 const {ipcRenderer} = require('electron');
 
+const karaJSON = require('../dummyKaras.json');
 
 window.onload = function(){
     const closeApp = document.getElementById("closeButton");
     closeApp.addEventListener('click', () => {
         ipcRenderer.send('close-app')
     });
+    karaList(karaJSON);
+}
+
+
+function karaList(karas){
+  var karaList = "";
+  var playingList = "";
+  karas.forEach(function(kara) {
+    if(kara.author_name === "Sting"){
+      playingList += '<div class="card shadow" style="margin: 5px; border-radius: 10px; margin: 20px 0px 20px 0px;"><div class="card-body">' + kara.source_name + ' - ' + kara.song_name + '</div></div>';
+    }
+    karaList += '<div class="card shadow" style="margin: 5px; border-radius: 10px; margin: 20px 0px 20px 0px;"><div class="card-body">' + kara.source_name + ' - ' + kara.song_name + '</div></div>';
+  });
+  document.getElementById("karaList").innerHTML = karaList;
+  document.getElementById("playingList").innerHTML = playingList;
 }
\ No newline at end of file
diff --git a/main.js b/main.js
index e62b5dd..9594b95 100644
--- a/main.js
+++ b/main.js
@@ -9,8 +9,8 @@ const {ipcMain} = require('electron')
 function createInstanceWindow () {
   // Create the browser window.
   const win = new BrowserWindow({
-    width: 800,
-    height: 600,
+    width: 1280,
+    height: 720,
     frame: false,
     webPreferences: {
       nodeIntegration: true
@@ -19,7 +19,7 @@ function createInstanceWindow () {
 
   // and load the index.html of the app.
   win.loadFile('instance/index.html');
-
+  //win.webContents.openDevTools();
 }
 
 /** Creates the main process for the Express app
-- 
GitLab