Files
zpl-viewer-clean/index.html
2025-09-24 19:30:34 +00:00

187 lines
4.1 KiB
HTML

<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8" />
<title>ZIR - Live Preview</title>
<style>
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: #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;
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;
}
</style>
</head>
<body>
<header>ZIR - Live Preview</header>
<main>
<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>Neue Labels werden automatisch angezeigt. Neueste oben.</footer>
<script>
const { ipcRenderer } = require('electron');
const container = document.getElementById('labels');
const clearBtn = document.getElementById('clearBtn');
ipcRenderer.on('show-png', (ev, filePath) => {
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;
});
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>