mirror of
https://github.com/Alvin-Zilverstand/school.git
synced 2026-11-30 18:17:51 +01:00
f
This commit is contained in:
1 parent
f3e79a7aeb
commit
d420c317ab
88 files changed
+36601
No files matched your search
@@ -0,0 +1,153 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>converter</title>
|
||||
<link rel="stylesheet" href="style.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<nav class="navbar">
|
||||
<h1>Converter</h1>
|
||||
</nav>
|
||||
|
||||
<!-- Upload Box -->
|
||||
<div id="dropZone" class="box upload-box">
|
||||
<div class="upload-icon" aria-hidden="true">
|
||||
<svg viewBox="0 0 24 24" role="presentation">
|
||||
<path d="M12 15V5" />
|
||||
<path d="M8 9L12 5L16 9" />
|
||||
<path d="M5 13V17C5 18.1 5.9 19 7 19H17C18.1 19 19 18.1 19 17V13" />
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
<h2>Sleep je bestand hierheen</h2>
|
||||
<p>of klik om te bladeren</p>
|
||||
|
||||
<div class="file-types">
|
||||
<!-- ✅ FIX: added accept -->
|
||||
<input id="filePicker" type="file" accept=".xlsx,.xls,.pdf,.docx" hidden />
|
||||
|
||||
<button id="openFilePicker" class="tag excel" type="button">
|
||||
Bestand zoeken
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="middle-arrow" aria-hidden="true"></div>
|
||||
|
||||
<!-- Result Box -->
|
||||
<div class="box2 result-box">
|
||||
<div class="file-icon" aria-hidden="true"></div>
|
||||
|
||||
<p id="fileName" class="file-name">bestandsnaam.json</p>
|
||||
|
||||
<p id="downloadStatus" class="download-status" aria-live="polite"></p>
|
||||
|
||||
<div class="file-separator" aria-hidden="true"></div>
|
||||
|
||||
<button id="downloadBtn" class="download-button" type="button">
|
||||
<svg
|
||||
class="download-icon"
|
||||
viewBox="0 0 24 24"
|
||||
role="presentation"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path d="M12 15V6" />
|
||||
<path d="M8.5 11.5L12 15L15.5 11.5" />
|
||||
<path d="M6 17.5H18" />
|
||||
</svg>
|
||||
<span>Download JSON</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const openFilePickerButton = document.getElementById("openFilePicker");
|
||||
const filePickerInput = document.getElementById("filePicker");
|
||||
const downloadBtn = document.getElementById("downloadBtn");
|
||||
const dropZone = document.getElementById("dropZone");
|
||||
const fileNameText = document.getElementById("fileName");
|
||||
const downloadStatusText = document.getElementById("downloadStatus");
|
||||
const downloadBtnLabel = downloadBtn.querySelector("span");
|
||||
|
||||
let selectedFile = null;
|
||||
|
||||
openFilePickerButton.addEventListener("click", () => {
|
||||
filePickerInput.click();
|
||||
});
|
||||
|
||||
filePickerInput.addEventListener("change", () => {
|
||||
selectedFile = filePickerInput.files[0];
|
||||
if (selectedFile) {
|
||||
fileNameText.textContent = selectedFile.name;
|
||||
}
|
||||
});
|
||||
|
||||
dropZone.addEventListener("dragover", (e) => {
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
dropZone.addEventListener("drop", (e) => {
|
||||
e.preventDefault();
|
||||
selectedFile = e.dataTransfer.files[0];
|
||||
|
||||
if (selectedFile) {
|
||||
fileNameText.textContent = selectedFile.name;
|
||||
}
|
||||
});
|
||||
|
||||
downloadBtn.addEventListener("click", async () => {
|
||||
if (!selectedFile) {
|
||||
alert("Select a file first!");
|
||||
return;
|
||||
}
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append("file", selectedFile);
|
||||
|
||||
downloadBtn.disabled = true;
|
||||
downloadBtnLabel.textContent = "Downloaden...";
|
||||
downloadStatusText.textContent = "Bezig met downloaden...";
|
||||
|
||||
try {
|
||||
const response = await fetch("http://localhost:5037/api/upload", {
|
||||
method: "POST",
|
||||
body: formData,
|
||||
});
|
||||
|
||||
// ✅ FIX: show real error
|
||||
if (!response.ok) {
|
||||
const errorText = await response.text();
|
||||
console.error("Backend error:", errorText);
|
||||
|
||||
downloadStatusText.textContent = "Download mislukt.";
|
||||
alert("Upload failed: " + errorText);
|
||||
return;
|
||||
}
|
||||
|
||||
const blob = await response.blob();
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
|
||||
const a = document.createElement("a");
|
||||
a.href = url;
|
||||
a.download = "converted.json";
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
a.remove();
|
||||
window.URL.revokeObjectURL(url);
|
||||
|
||||
downloadStatusText.textContent = "Download voltooid.";
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
downloadStatusText.textContent =
|
||||
"Er ging iets fout tijdens downloaden.";
|
||||
alert("Error uploading file");
|
||||
} finally {
|
||||
downloadBtn.disabled = false;
|
||||
downloadBtnLabel.textContent = "Download JSON";
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,228 @@
|
||||
html,
|
||||
body {
|
||||
background-color: rgb(220, 220, 220);
|
||||
margin: 0;
|
||||
height: 100%;
|
||||
min-height: 100vh;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 110px;
|
||||
padding-top: 80px;
|
||||
font-family: "Segoe UI", Tahoma, sans-serif;
|
||||
}
|
||||
|
||||
.navbar {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 64px;
|
||||
background-color: rgb(0, 0, 0);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 24px;
|
||||
box-sizing: border-box;
|
||||
color: white;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.navbar h1 {
|
||||
margin: 0;
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.box {
|
||||
width: 350px;
|
||||
background-color: rgb(243, 243, 243);
|
||||
height: 350px;
|
||||
border: 2px dashed rgb(187, 187, 187);
|
||||
box-sizing: border-box;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 3cm;
|
||||
}
|
||||
|
||||
.box2 {
|
||||
width: 350px;
|
||||
background-color: rgb(243, 243, 243);
|
||||
height: 350px;
|
||||
border: 2px dashed rgb(187, 187, 187);
|
||||
box-sizing: border-box;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 3cm;
|
||||
}
|
||||
|
||||
.upload-box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.upload-icon {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
border: 1px solid rgb(174, 212, 226);
|
||||
border-radius: 5px;
|
||||
background-color: rgb(221, 236, 244);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.upload-icon svg {
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
}
|
||||
|
||||
.upload-icon path {
|
||||
fill: none;
|
||||
stroke: rgb(41, 159, 196);
|
||||
stroke-width: 1.8;
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
}
|
||||
|
||||
.upload-box h2 {
|
||||
margin: 1cm;
|
||||
color: rgb(40, 40, 40);
|
||||
font-size: 18px;
|
||||
font-weight: 7 00;
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
.upload-box p {
|
||||
margin: 16px 0 18px;
|
||||
color: rgb(123, 142, 154);
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.file-types {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.tag {
|
||||
color: white;
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
padding: 7px 13px;
|
||||
border-radius: 2px;
|
||||
border: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.tag.excel {
|
||||
background-color: rgb(87, 169, 50);
|
||||
}
|
||||
|
||||
.tag.word {
|
||||
background-color: rgb(44, 166, 209);
|
||||
}
|
||||
|
||||
.tag:hover {
|
||||
filter: brightness(0.95);
|
||||
}
|
||||
|
||||
.result-box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 58px 34px 30px;
|
||||
}
|
||||
|
||||
.file-icon {
|
||||
width: 66px;
|
||||
height: 58px;
|
||||
border-radius: 4px;
|
||||
background: linear-gradient(
|
||||
145deg,
|
||||
rgb(239, 239, 239),
|
||||
rgb(229, 229, 229)
|
||||
);
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.file-name {
|
||||
margin: 18px 0 16px;
|
||||
color: rgb(0, 0, 0);
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.download-status {
|
||||
min-height: 24px;
|
||||
margin: 0 0 10px;
|
||||
color: rgb(90, 90, 90);
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.file-separator {
|
||||
width: 18px;
|
||||
background-color: rgb(213, 213, 213);
|
||||
margin-bottom: 48px;
|
||||
}
|
||||
|
||||
.download-button {
|
||||
width: 100%;
|
||||
height: 72px;
|
||||
border: 0;
|
||||
border-radius: 4px;
|
||||
background-color: rgb(180, 180, 180);
|
||||
color: rgb(250, 250, 250);
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.download-button:hover {
|
||||
background-color: rgb(168, 168, 168);
|
||||
}
|
||||
|
||||
.download-button:disabled {
|
||||
background-color: rgb(145, 145, 145);
|
||||
cursor: wait;
|
||||
}
|
||||
|
||||
.download-icon {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.download-icon path {
|
||||
fill: none;
|
||||
stroke: rgb(250, 250, 250);
|
||||
stroke-width: 2;
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
}
|
||||
|
||||
.middle-arrow {
|
||||
position: relative;
|
||||
width: 56px;
|
||||
height: 3px;
|
||||
background-color: rgb(183, 183, 183);
|
||||
margin-bottom: 3cm;
|
||||
}
|
||||
|
||||
.middle-arrow::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
right: -9px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
border-top: 7px solid transparent;
|
||||
border-bottom: 7px solid transparent;
|
||||
border-left: 9px solid rgb(183, 183, 183);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user