generated from coulomb/repo-seed
enhance: integrated UI with visual loading feedback
- Integrate file upload controls with status display for cleaner UX - Add dark grey internal styling vs. dark green external theme - Create enhanced SVG template with prominent month indicators - Improve file loading error detection and user guidance - Add visual confirmation system for external resource loading - Update generator to support enhanced template styling - Fix CSV/template loading context binding issues 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
279
index.html
279
index.html
@@ -5,46 +5,273 @@
|
||||
<title>Timeline Generator</title>
|
||||
<script src="https://cdn.jsdelivr.net/npm/papaparse@5.4.1/papaparse.min.js"></script>
|
||||
<link id="dynamicCss" rel="stylesheet" href="">
|
||||
<script defer src="engine.js"></script>
|
||||
<script defer src="generator.js"></script>
|
||||
<style>
|
||||
/* File Manager Styling */
|
||||
.file-item {
|
||||
background: #fff;
|
||||
border: 1px solid #dee2e6;
|
||||
border-radius: 8px;
|
||||
padding: 12px;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.file-item:hover {
|
||||
border-color: #495057;
|
||||
box-shadow: 0 2px 8px rgba(73, 80, 87, 0.1);
|
||||
}
|
||||
|
||||
.file-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.file-label {
|
||||
font-weight: 600;
|
||||
color: #495057;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.upload-btn {
|
||||
background: #495057;
|
||||
color: white;
|
||||
padding: 4px 8px;
|
||||
border-radius: 4px;
|
||||
font-size: 11px;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s;
|
||||
border: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.upload-btn:hover {
|
||||
background: #343a40;
|
||||
}
|
||||
|
||||
.file-status {
|
||||
border-top: 1px solid #f1f3f4;
|
||||
padding-top: 8px;
|
||||
}
|
||||
|
||||
.file-name {
|
||||
font-family: 'Courier New', monospace;
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
display: block;
|
||||
padding: 4px 8px;
|
||||
border-radius: 4px;
|
||||
background: #f8f9fa;
|
||||
color: #6c757d;
|
||||
font-style: italic;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.file-name[style*="color: #28a745"] {
|
||||
background: #d4edda;
|
||||
border: 1px solid #c3e6cb;
|
||||
color: #155724 !important;
|
||||
font-style: normal;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.file-name[style*="color: #dc3545"] {
|
||||
background: #f8d7da;
|
||||
border: 1px solid #f1b6bb;
|
||||
color: #721c24 !important;
|
||||
font-style: normal;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.file-name[style*="color: #6c757d"] {
|
||||
background: #f8f9fa;
|
||||
border: 1px solid #e9ecef;
|
||||
}
|
||||
|
||||
.controls {
|
||||
animation: fadeInUp 0.3s ease;
|
||||
}
|
||||
|
||||
@keyframes fadeInUp {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(10px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
#fileManager {
|
||||
transition: all 0.3s ease-in-out;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.file-grid {
|
||||
grid-template-columns: 1fr !important;
|
||||
}
|
||||
|
||||
.file-header {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.upload-btn {
|
||||
align-self: flex-end;
|
||||
}
|
||||
|
||||
.controls {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.controls button {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
/* Button improvements */
|
||||
button {
|
||||
transition: all 0.2s ease;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
button:hover:not(:disabled) {
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 4px 8px rgba(0,0,0,0.15);
|
||||
}
|
||||
|
||||
button:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.6;
|
||||
}
|
||||
</style>
|
||||
<script src="generator.js"></script>
|
||||
<script src="engine.js"></script>
|
||||
</head>
|
||||
<body class="internal-mode" style="font-family: Inter, Arial, sans-serif; background:#f5f7fa; margin:20px;">
|
||||
|
||||
<h1 id="projectName" style="color:#0A4D8C; margin-bottom:8px;">Timeline Generator</h1>
|
||||
<h1 id="projectName" style="color:#495057; margin-bottom:8px;">Timeline Generator</h1>
|
||||
<p id="projectSubtitle" style="color:#5C6B7A; margin-top:0; margin-bottom:16px;">
|
||||
Wähle ein Projekt oder lade CSV/CSS/SVG-Dateien, um eine Timeline zu erzeugen.
|
||||
Lade Projektdateien um eine Timeline zu erstellen oder verwende den lokalen Server für automatisches Laden.
|
||||
</p>
|
||||
|
||||
<div class="controls" style="margin-bottom:16px; display:flex; flex-wrap:wrap; gap:12px; align-items:center;">
|
||||
<label>Projekt laden:
|
||||
<input type="file" id="projectInput" accept=".json" />
|
||||
</label>
|
||||
<label>CSV laden:
|
||||
<input type="file" id="csvInput" accept=".csv" />
|
||||
</label>
|
||||
<label>CSS laden:
|
||||
<input type="file" id="cssInput" accept=".css" />
|
||||
</label>
|
||||
<label>SVG Template laden:
|
||||
<input type="file" id="svgInput" accept=".svg" />
|
||||
</label>
|
||||
<!-- Integrated File Management -->
|
||||
<div id="fileManager" style="margin-bottom:16px; padding:16px; background:#f8f9fa; border:1px solid #e9ecef; border-radius:8px;">
|
||||
<h3 style="margin:0 0 12px 0; font-size:14px; font-weight:600; color:#495057;">Project Files</h3>
|
||||
|
||||
<button id="toggleView" style="padding:8px 14px; background:#0A4D8C; color:white; border:none; border-radius:6px; cursor:pointer;">
|
||||
Switch View (Internal / External)
|
||||
</button>
|
||||
<button id="downloadSvg" disabled
|
||||
style="padding:8px 14px; background:#0A4D8C; color:white; border:none; border-radius:6px; cursor:pointer; opacity:0.6;">
|
||||
Download SVG
|
||||
</button>
|
||||
<div class="file-grid" style="display:grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap:12px; margin-bottom:16px;">
|
||||
<div class="file-item">
|
||||
<div class="file-header">
|
||||
<span class="file-label">Project Configuration</span>
|
||||
<label class="upload-btn">
|
||||
<input type="file" id="projectInput" accept=".json" style="display:none;" />
|
||||
📁 Load
|
||||
</label>
|
||||
</div>
|
||||
<div class="file-status">
|
||||
<span id="projectFile" class="file-name">Not loaded</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="file-item">
|
||||
<div class="file-header">
|
||||
<span class="file-label">CSV Data</span>
|
||||
<label class="upload-btn">
|
||||
<input type="file" id="csvInput" accept=".csv" style="display:none;" />
|
||||
📊 Load
|
||||
</label>
|
||||
</div>
|
||||
<div class="file-status">
|
||||
<span id="csvFile" class="file-name">Not loaded</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="file-item">
|
||||
<div class="file-header">
|
||||
<span class="file-label">Stylesheet</span>
|
||||
<label class="upload-btn">
|
||||
<input type="file" id="cssInput" accept=".css" style="display:none;" />
|
||||
🎨 Load
|
||||
</label>
|
||||
</div>
|
||||
<div class="file-status">
|
||||
<span id="cssFile" class="file-name">Not loaded</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="file-item">
|
||||
<div class="file-header">
|
||||
<span class="file-label">SVG Template</span>
|
||||
<label class="upload-btn">
|
||||
<input type="file" id="svgInput" accept=".svg" style="display:none;" />
|
||||
🖼️ Load
|
||||
</label>
|
||||
</div>
|
||||
<div class="file-status">
|
||||
<span id="svgFile" class="file-name">Not loaded</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="controls" style="display:flex; flex-wrap:wrap; gap:12px; justify-content:center; padding-top:12px; border-top:1px solid #dee2e6;">
|
||||
<button id="toggleView" style="padding:8px 16px; background:#495057; color:white; border:none; border-radius:6px; cursor:pointer; font-size:12px;">
|
||||
🔄 Switch View (Internal / External)
|
||||
</button>
|
||||
<button id="downloadSvg" disabled
|
||||
style="padding:8px 16px; background:#495057; color:white; border:none; border-radius:6px; cursor:pointer; opacity:0.6; font-size:12px;">
|
||||
💾 Download SVG
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="viewer" style="border:1px solid #ccd3db; background:white; padding:12px; border-radius:8px; overflow-x:auto; min-height:200px;">
|
||||
<em style="color:#999;">Noch keine Timeline generiert.</em>
|
||||
<div style="text-align:center; padding:40px 20px; color:#6c757d;">
|
||||
<div style="font-size:48px; margin-bottom:16px;">📊</div>
|
||||
<h4 style="margin:0 0 8px 0; color:#495057;">Keine Timeline verfügbar</h4>
|
||||
<p style="margin:0; font-size:14px;">
|
||||
Lade eine <strong>Projektkonfiguration</strong> oder <strong>CSV-Datei</strong> um zu beginnen.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
window.timelineEngine.autoLoadDefaultProject();
|
||||
// Setup event handlers first
|
||||
if (typeof setupEventHandlers === 'function') {
|
||||
setupEventHandlers();
|
||||
console.log("Event handlers set up");
|
||||
}
|
||||
|
||||
// Ensure engines are loaded before auto-loading
|
||||
function tryAutoLoad() {
|
||||
if (window.timelineEngine && window.timelineGenerator) {
|
||||
console.log("Both engines loaded, starting auto-load");
|
||||
// Only try auto-load if not running from file:// protocol
|
||||
if (location.protocol !== 'file:') {
|
||||
window.timelineEngine.autoLoadDefaultProject();
|
||||
} else {
|
||||
console.log("Running from file:// protocol - auto-load disabled due to CORS");
|
||||
document.getElementById("viewer").innerHTML =
|
||||
"<div style='text-align:center; padding:40px 20px; color:#6c757d;'>" +
|
||||
"<div style='font-size:48px; margin-bottom:16px;'>📁</div>" +
|
||||
"<h4 style='margin:0 0 8px 0; color:#495057;'>Manuelle Dateien laden</h4>" +
|
||||
"<p style='margin:0; font-size:14px;'>" +
|
||||
"Verwende die <strong>Load</strong>-Buttons oben um Projektdateien zu laden.<br>" +
|
||||
"<small>💡 Tipp: Für automatisches Laden verwende einen lokalen Server (z.B. <code>make serve</code>)</small>" +
|
||||
"</p></div>";
|
||||
}
|
||||
} else {
|
||||
console.log("Engines not ready, retrying...", {
|
||||
engine: !!window.timelineEngine,
|
||||
generator: !!window.timelineGenerator
|
||||
});
|
||||
setTimeout(tryAutoLoad, 50);
|
||||
}
|
||||
}
|
||||
tryAutoLoad();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user