index.html aktualisiert

This commit is contained in:
2025-09-24 19:30:34 +00:00
parent edaf149e34
commit bba2e2c416

View File

@@ -1,70 +1,186 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta charset="utf-8" />
<title>ZIR - Live Preview</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
margin: 0; padding: 0;
background-color: #f4f4f7; color: #333;
display: flex; flex-direction: column; align-items: center; min-height: 100vh;
html, body {
height: 100%;
margin: 0;
font-family: "Segoe UI", Roboto, Arial, sans-serif;
background: #f0f2f5;
color: #222;
display: flex;
flex-direction: column;
}
header {
background-color: #0078d7; color: white; width: 100%;
padding: 16px 24px; box-shadow: 0 2px 4px rgba(0,0,0,0.1);
text-align: center; font-size: 1.2rem; font-weight: 600;
background: #0078d7;
color: white;
padding: 16px 24px;
font-size: 20px;
font-weight: 600;
box-shadow: 0 2px 6px rgba(0,0,0,0.08);
flex-shrink: 0;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
}
main { flex: 1; display:flex; align-items:center; justify-content:center; width:100%; padding:20px; box-sizing:border-box; }
.preview-container {
background-color: white; padding: 16px; border-radius: 12px;
box-shadow: 0 6px 18px rgba(0,0,0,0.08); max-width: 1000px; width: 100%; text-align: center; position: relative;
main {
flex: 1;
display: flex;
flex-direction: column;
max-width: 1200px;
margin: 20px auto;
width: 95%;
}
.controls {
display: flex;
gap: 12px;
align-items: center;
margin-bottom: 12px;
}
button {
background: #0078d7;
color: white;
border: none;
padding: 8px 14px;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
transition: background 0.2s ease;
}
button:hover {
background: #005fa1;
}
button.secondary {
background: #e5e7eb;
color: #222;
}
button.secondary:hover {
background: #d1d5db;
}
.panel {
background: #fff;
border-radius: 12px;
padding: 16px;
box-shadow: 0 6px 18px rgba(0,0,0,0.06);
flex: 1;
overflow-y: auto;
display: flex;
flex-direction: column;
gap: 12px;
}
.labels {
display: flex;
flex-direction: column;
gap: 16px;
}
.label-card {
display: flex;
gap: 16px;
border: 1px solid #e5e7eb;
border-radius: 10px;
background: #fafafa;
padding: 16px;
align-items: flex-start;
box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}
.label-card img {
max-width: 500px;
width: 100%;
border-radius: 6px;
border: 1px solid #ddd;
object-fit: contain;
}
.meta {
font-size: 13px;
color: #555;
}
footer {
flex-shrink: 0;
text-align: center;
color: #666;
font-size: 13px;
padding: 10px 0;
background: #f0f2f5;
border-top: 1px solid #ddd;
}
.preview-container img { border: 1px solid #e0e0e0; max-width: 100%; height: auto; border-radius: 8px; display: none; }
.info { margin-top: 12px; font-size: 0.95rem; color: #555; }
footer { padding: 12px 24px; text-align:center; font-size:0.8rem; color:#888; }
.spinner { border:6px solid #f3f3f3; border-top:6px solid #0078d7; border-radius:50%; width:48px; height:48px; animation:spin 1s linear infinite; margin: 26px auto; }
@keyframes spin { 0%{transform:rotate(0deg)} 100%{transform:rotate(360deg)} }
</style>
</head>
<body>
<header>ZIR Live Preview</header>
<header>ZIR - Live Preview</header>
<main>
<div class="preview-container">
<div class="spinner" id="spinner"></div>
<img id="labelImage" src="" alt="Label preview" />
<div class="info"><code id="inputPath"></code> Neue Labels werden automatisch angezeigt.</div>
<div class="controls">
<button id="clearBtn" class="secondary">Verlauf löschen</button>
<div style="flex:1"></div>
</div>
<div class="panel">
<div id="labels" class="labels"></div>
</div>
</main>
<footer>© 2025 ZIR Viewer</footer>
<footer>Neue Labels werden automatisch angezeigt. Neueste oben.</footer>
<script>
const { ipcRenderer, remote } = require('electron');
const img = document.getElementById('labelImage');
const spinner = document.getElementById('spinner');
const inputPath = document.getElementById('inputPath');
// Zeige Input-Pfad (wird per ipc vom Main ggf. gesetzt)
ipcRenderer.on('show-input-path', (ev, p) => {
inputPath.textContent = p;
});
const { ipcRenderer } = require('electron');
const container = document.getElementById('labels');
const clearBtn = document.getElementById('clearBtn');
ipcRenderer.on('show-png', (ev, filePath) => {
spinner.style.display = 'block';
img.style.display = 'none';
img.src = filePath + "?t=" + Date.now();
img.onload = () => {
spinner.style.display = 'none';
img.style.display = 'block';
};
img.onerror = () => {
spinner.style.display = 'none';
img.style.display = 'none';
};
const card = document.createElement('div');
card.className = 'label-card';
const img = document.createElement('img');
img.src = filePath + '?t=' + Date.now();
img.alt = 'Label';
const info = document.createElement('div');
info.innerHTML = `<div class="meta">Erstellt: ${new Date().toLocaleString()}</div>`;
card.appendChild(img);
card.appendChild(info);
container.prepend(card);
container.scrollTop = 0;
});
// Request main to send input path (in case main wants to show it)
ipcRenderer.send('request-input-path');
clearBtn.addEventListener('click', () => {
while (container.firstChild) container.removeChild(container.firstChild);
ipcRenderer.send('clear-history');
});
ipcRenderer.send('request-existing');
ipcRenderer.on('existing-files', (ev, files) => {
files.reverse().forEach(fp => {
const card = document.createElement('div');
card.className = 'label-card';
const img = document.createElement('img');
img.src = fp + '?t=' + Date.now();
const info = document.createElement('div');
info.innerHTML = `<div class="meta">Vorhanden</div>`;
card.appendChild(img);
card.appendChild(info);
container.appendChild(card);
});
container.scrollTop = 0;
});
</script>
</body>
</html>