From 48927fc4527968546d88c93a30fb191559491033 Mon Sep 17 00:00:00 2001
From: aqquq <jannik.wurche@student.uni-halle.de>
Date: Thu, 4 Jul 2024 22:44:18 +0200
Subject: [PATCH] =?UTF-8?q?=F0=9F=93=A6=20move=20QuizEditor=20to=20seperat?=
 =?UTF-8?q?e=20HTML=20file?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/Pages/HomeView.elm       |  5 +++--
 src/Pages/UploadFileView.elm |  8 --------
 src/QuizEditor/Editor.elm    |  1 +
 src/editor.html              | 31 +++++++++++++++++++++++++++++++
 4 files changed, 35 insertions(+), 10 deletions(-)
 delete mode 100644 src/Pages/UploadFileView.elm
 create mode 100644 src/QuizEditor/Editor.elm
 create mode 100644 src/editor.html

diff --git a/src/Pages/HomeView.elm b/src/Pages/HomeView.elm
index a4aa741..e5abf27 100644
--- a/src/Pages/HomeView.elm
+++ b/src/Pages/HomeView.elm
@@ -1,8 +1,8 @@
 module Pages.HomeView exposing (homeView)
 
 import Types exposing (Model, Msg(..))
-import Html exposing (Html, div, p, text, form, input, button, h1)
-import Html.Attributes exposing (class, type_, placeholder, value)
+import Html exposing (Html, div, p, a, text, form, input, button, h1)
+import Html.Attributes exposing (class, type_, placeholder, value, href)
 import Html.Events exposing (onSubmit, onClick, onInput)
 import String exposing (startsWith)
 
@@ -43,5 +43,6 @@ homeView model =
                 ]
               -- Display the loading message or any error message.
             , loadingMsg 
+            , a [ class "btn", href "/editor.html" ] [ text "Quiz Editor" ]
             ] 
         ]
\ No newline at end of file
diff --git a/src/Pages/UploadFileView.elm b/src/Pages/UploadFileView.elm
deleted file mode 100644
index 080180e..0000000
--- a/src/Pages/UploadFileView.elm
+++ /dev/null
@@ -1,8 +0,0 @@
-module Pages.UploadFileView exposing (..)
-
-import Html exposing (..)
-import Types exposing (Msg)
-
-uploadView : Html Msg
-uploadView = 
-    div [] []
\ No newline at end of file
diff --git a/src/QuizEditor/Editor.elm b/src/QuizEditor/Editor.elm
new file mode 100644
index 0000000..b9f9dbd
--- /dev/null
+++ b/src/QuizEditor/Editor.elm
@@ -0,0 +1 @@
+module QuizEditor.Editor exposing (..)
\ No newline at end of file
diff --git a/src/editor.html b/src/editor.html
new file mode 100644
index 0000000..3f2fb9f
--- /dev/null
+++ b/src/editor.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Elm JSON Type Check</title>
+    <link rel="stylesheet" href="style.css">
+    <script defer>
+        document.getElementById('fileInput').addEventListener('change', function(event) {
+            const file = event.target.files[0];
+            if (file) {
+                const reader = new FileReader();
+                reader.onload = function(e) {
+                    const jsonString = e.target.result;
+                    const json = JSON.parse(jsonString);
+                    const app = Elm.Main.init({
+                        node: document.getElementById('elm-container'),
+                        flags: json
+                    });
+                };
+                reader.readAsText(file);
+            }
+        });        
+    </script>
+</head>
+<body>
+    <input type="file" id="fileInput" />
+    <div id="elm-container"></div>
+    <!--script src="elm.js"></script-->
+</body>
+</html>
\ No newline at end of file
-- 
GitLab