Files
yoto-covers/index.html
T
Ross cda15991e3 feat: Initial commit of Yoto Up Covers web application
- Added main HTML file (index.html) for the web app interface.
- Created a sample cover template (sample_cover.html) for Yoto cards.
- Implemented a simple HTTP server (server.py) to serve the web app.
- Configured package.json for project metadata and scripts.
2026-01-04 20:43:57 +00:00

771 lines
24 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Yoto Up - Covers</title>
<link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;700;900&display=swap" rel="stylesheet">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: #f5f5f5;
color: #333;
line-height: 1.6;
}
.container {
max-width: 1400px;
margin: 0 auto;
padding: 20px;
}
.header {
background: #2c3e50;
color: white;
padding: 20px;
border-radius: 8px;
margin-bottom: 20px;
text-align: center;
}
.header h1 {
margin-bottom: 10px;
font-size: 2.5em;
}
.header p {
opacity: 0.9;
font-size: 1.1em;
}
.print-layout-panel {
margin-bottom: 20px;
}
.print-layout-panel .section {
display: flex;
flex-wrap: wrap;
gap: 20px;
align-items: end;
}
.print-layout-panel .form-group {
flex: 1;
min-width: 150px;
}
.main-content {
display: grid;
grid-template-columns: 250px 1fr 300px;
gap: 20px;
min-height: 600px;
}
.panel {
background: white;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
padding: 20px;
}
.image-panel {
overflow-y: auto;
max-height: 80vh;
}
.preview-panel {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 500px;
padding: 10px;
}
.card-features-panel {
overflow-y: auto;
max-height: 80vh;
}
.section {
margin-bottom: 25px;
padding-bottom: 15px;
border-bottom: 1px solid #eee;
}
.card-list-item {
padding: 12px;
border: 1px solid #e0e0e0;
border-radius: 6px;
margin-bottom: 8px;
background: #fafafa;
}
.card-list-item:hover {
background: #f0f0f0;
}
.section:last-child {
border-bottom: none;
}
.section h3 {
margin-bottom: 15px;
color: #2c3e50;
font-size: 1.2em;
font-weight: 600;
}
.form-group {
margin-bottom: 15px;
}
.form-group label {
display: block;
margin-bottom: 5px;
font-weight: 500;
color: #555;
}
.form-group input,
.form-group select,
.form-group textarea {
width: 100%;
padding: 8px 12px;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 14px;
transition: border-color 0.3s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
outline: none;
border-color: #3498db;
box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}
.form-group textarea {
resize: vertical;
min-height: 60px;
}
.checkbox-group {
display: flex;
align-items: center;
gap: 8px;
}
.checkbox-group.inline {
margin-top: 8px;
font-size: 14px;
}
.checkbox-group input[type="checkbox"] {
width: auto;
margin: 0;
}
.btn {
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
font-weight: 500;
transition: all 0.3s;
text-decoration: none;
display: inline-block;
text-align: center;
}
.btn-primary {
background: #3498db;
color: white;
}
.btn-primary:hover {
background: #2980b9;
}
.btn-secondary {
background: #95a5a6;
color: white;
}
.btn-secondary:hover {
background: #7f8c8d;
}
.btn-success {
background: #27ae60;
color: white;
}
.btn-success:hover {
background: #229954;
}
.btn-danger {
background: #e74c3c;
color: white;
}
.btn-danger:hover {
background: #c0392b;
}
.btn-group {
display: flex;
gap: 10px;
margin-top: 15px;
}
.image-list {
max-height: 300px;
overflow-y: auto;
border: 1px solid #ddd;
border-radius: 4px;
}
.image-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px;
border-bottom: 1px solid #eee;
transition: background-color 0.2s;
}
.image-item:hover {
background: #f8f9fa;
}
.image-item:last-child {
border-bottom: none;
}
.image-info {
flex: 1;
margin-right: 10px;
}
.image-name {
font-weight: 500;
margin-bottom: 2px;
}
.image-meta {
font-size: 12px;
color: #666;
}
.image-actions {
display: flex;
gap: 5px;
}
.preview-container {
width: 100%;
max-width: 100%;
margin: 10px 0;
border: 2px solid #ddd;
border-radius: 8px;
overflow: hidden;
background: white;
}
.preview-iframe {
width: 100%;
height: 600px;
border: none;
display: block;
}
.preview-placeholder {
width: 100%;
height: 400px;
display: flex;
align-items: center;
justify-content: center;
background: #f8f9fa;
color: #666;
font-size: 18px;
text-align: center;
}
.color-picker {
display: flex;
align-items: center;
gap: 10px;
}
.color-input {
width: 60px;
height: 40px;
border: 1px solid #ddd;
border-radius: 4px;
cursor: pointer;
}
.color-value {
font-family: monospace;
font-size: 12px;
background: #f8f9fa;
padding: 4px 8px;
border-radius: 3px;
border: 1px solid #ddd;
}
.file-input-wrapper {
position: relative;
display: inline-block;
width: 100%;
}
.file-input {
position: absolute;
opacity: 0;
width: 100%;
height: 100%;
cursor: pointer;
}
.file-input-label {
display: flex;
align-items: center;
justify-content: center;
padding: 12px;
border: 2px dashed #3498db;
border-radius: 4px;
background: #f8f9fa;
cursor: pointer;
transition: all 0.3s;
text-align: center;
}
.file-input-label:hover {
background: #e8f4fd;
border-color: #2980b9;
}
.file-input-label.dragover {
background: #e8f4fd;
border-color: #27ae60;
}
.template-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
gap: 10px;
margin-top: 10px;
}
.template-option {
padding: 10px;
border: 2px solid #ddd;
border-radius: 4px;
text-align: center;
cursor: pointer;
transition: all 0.3s;
font-size: 12px;
font-weight: 500;
}
.template-option:hover {
border-color: #3498db;
background: #f8f9fa;
}
.template-option.selected {
border-color: #3498db;
background: #e8f4fd;
color: #2980b9;
}
.title-style-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 8px;
margin-top: 10px;
}
.title-style-option {
padding: 8px;
border: 1px solid #ddd;
border-radius: 4px;
text-align: center;
cursor: pointer;
transition: all 0.3s;
font-size: 12px;
}
.title-style-option:hover {
border-color: #3498db;
background: #f8f9fa;
}
.title-style-option.selected {
border-color: #3498db;
background: #e8f4fd;
color: #2980b9;
}
.card-variation-item {
border: 1px solid #ddd;
border-radius: 4px;
padding: 15px;
margin-bottom: 10px;
background: #f9f9f9;
}
.status-message {
padding: 10px;
border-radius: 4px;
margin: 10px 0;
font-weight: 500;
}
.status-success {
background: #d4edda;
color: #155724;
border: 1px solid #c3e6cb;
}
.status-error {
background: #f8d7da;
color: #721c24;
border: 1px solid #f5c6cb;
}
.status-info {
background: #d1ecf1;
color: #0c5460;
border: 1px solid #bee5eb;
}
.loading {
display: inline-block;
width: 20px;
height: 20px;
border: 3px solid #f3f3f3;
border-top: 3px solid #3498db;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
@media (max-width: 1200px) {
.main-content {
grid-template-columns: 250px 1fr;
}
.card-features-panel {
display: none;
}
}
@media (max-width: 768px) {
.main-content {
grid-template-columns: 1fr;
}
.image-panel {
display: none;
}
.header h1 {
font-size: 2em;
}
}
.mobile-toggle {
display: none;
position: fixed;
bottom: 20px;
right: 20px;
z-index: 1000;
}
@media (max-width: 768px) {
.mobile-toggle {
display: block;
}
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>Yoto Up - Covers</h1>
<p>Create and customize Yoto card covers with templates, images, and text overlays</p>
</div>
<!-- Print Layout at the top -->
<div class="print-layout-panel panel">
<div class="section">
<h3>Print Layout</h3>
<div class="form-group">
<label for="cards-per-row">Cards per row</label>
<select id="cards-per-row">
<option value="1">1</option>
<option value="2" selected>2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</div>
<div class="form-group">
<label for="cards-per-column">Cards per column</label>
<select id="cards-per-column">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5" selected>5</option>
</select>
</div>
<div class="form-group">
<label for="page-margin">Page margin (mm)</label>
<input type="number" id="page-margin" value="10" min="0" max="50">
</div>
<div class="form-group">
<label for="card-spacing">Card spacing (mm)</label>
<input type="number" id="card-spacing" value="5" min="0" max="20">
</div>
</div>
</div>
<div class="main-content">
<!-- Image Management Panel (Left) -->
<div class="panel image-panel">
<div class="section">
<h3>Image Management</h3>
<div class="form-group">
<label>Upload Images</label>
<div class="file-input-wrapper">
<input type="file" id="image-upload" class="file-input" multiple accept="image/*">
<div class="file-input-label">
<span>Drop images here or click to browse</span>
</div>
</div>
</div>
<div class="image-list" id="image-list">
<!-- Images will be added here dynamically -->
</div>
<div class="btn-group">
<button class="btn btn-danger" id="clear-images">Clear All</button>
</div>
</div>
</div>
<!-- Preview Panel (Center) -->
<div class="panel preview-panel">
<h3 style="margin-bottom: 20px;">Preview</h3>
<div class="preview-container">
<div class="preview-placeholder" id="preview-placeholder">
Click "Generate Preview" to see your cover
</div>
<iframe id="preview-iframe" class="preview-iframe" style="display: none;"></iframe>
</div>
<div class="btn-group">
<button class="btn btn-secondary" id="open-preview">Open in New Tab</button>
<button class="btn btn-success" id="print-preview">Print Preview</button>
</div>
</div>
<!-- Card Features Panel (Right) -->
<div class="panel card-features-panel">
<div class="section">
<h3>Active Card</h3>
<div class="form-group">
<label for="active-card-select">Select Card</label>
<select id="active-card-select">
<option value="-1">No card selected</option>
</select>
</div>
</div>
<div id="card-editor" style="display: none;">
<div class="section">
<h3 id="card-editor-title">Edit Card</h3>
<div class="form-group">
<label for="card-template-preset">Template Preset</label>
<select id="card-template-preset">
<option value="">Custom</option>
<option value="classic">Classic</option>
<option value="frozen">Frozen</option>
<option value="minimal">Minimal</option>
<option value="vintage">Vintage</option>
<option value="comic">Comic</option>
</select>
</div>
<div class="form-group">
<label for="card-background-style">Background Style</label>
<select id="card-background-style">
<option value="solid">Solid</option>
<option value="gradient">Gradient</option>
<option value="pattern">Pattern</option>
<option value="comic">Comic</option>
</select>
</div>
<div class="form-group">
<label for="card-font-family">Font Family</label>
<select id="card-font-family">
<option value="Arial">Arial</option>
<option value="Georgia">Georgia</option>
<option value="Times New Roman">Times New Roman</option>
<option value="Comic Sans MS">Comic Sans MS</option>
<option value="Impact">Impact</option>
<option value="Courier New">Courier New</option>
</select>
</div>
<div class="form-group">
<label for="card-font-weight">Font Weight</label>
<select id="card-font-weight">
<option value="normal">Normal</option>
<option value="bold">Bold</option>
</select>
</div>
<div class="form-group">
<label for="card-footer-color">Footer Color</label>
<div class="color-picker">
<input type="color" id="card-footer-color" value="#111111" class="color-input">
<input type="text" id="card-footer-color-text" value="#111111" class="color-value" readonly>
</div>
</div>
<div class="form-group">
<label for="card-title-input">Title</label>
<input type="text" id="card-title-input" placeholder="Enter card title">
<div class="checkbox-group inline">
<input type="checkbox" id="card-show-title" checked>
<label for="card-show-title">Show title</label>
</div>
</div>
<div class="form-group">
<label for="card-footer-input">Footer</label>
<input type="text" id="card-footer-input" placeholder="Enter footer text">
<div class="checkbox-group inline">
<input type="checkbox" id="card-show-footer" checked>
<label for="card-show-footer">Show footer</label>
</div>
</div>
<div class="form-group">
<label>Title Style</label>
<div class="title-style-grid">
<div class="title-style-option" data-style="classic">Classic</div>
<div class="title-style-option" data-style="large">Large</div>
<div class="title-style-option" data-style="small">Small</div>
<div class="title-style-option selected" data-style="folded">Folded</div>
<div class="title-style-option" data-style="condensed">Condensed</div>
<div class="title-style-option" data-style="italic">Italic</div>
<div class="title-style-option" data-style="bold">Bold</div>
<div class="title-style-option" data-style="outlined">Outlined</div>
<div class="title-style-option" data-style="shadow">Shadow</div>
</div>
</div>
<div class="form-group">
<label for="global-title-font-size">Title Font Size (px)</label>
<input type="number" id="global-title-font-size" value="20" min="10" max="200" step="5">
</div>
<div class="form-group">
<label for="card-accent-color">Accent Color</label>
<div class="color-picker">
<input type="color" id="card-accent-color" value="#f1c40f" class="color-input">
<input type="text" id="card-accent-color-text" value="#f1c40f" class="color-value" readonly>
</div>
</div>
<div class="form-group">
<label for="card-title-color">Title Color</label>
<div class="color-picker">
<input type="color" id="card-title-color" value="#111111" class="color-input">
<input type="text" id="card-title-color-text" value="#111111" class="color-value" readonly>
</div>
</div>
<div class="checkbox-group">
<input type="checkbox" id="card-full-bleed" checked>
<label for="card-full-bleed">Full bleed background</label>
</div>
<div class="checkbox-group">
<input type="checkbox" id="card-title-shadow">
<label for="card-title-shadow">Title shadow</label>
</div>
<div class="form-group">
<label>Image</label>
<select id="card-image-select">
<option value="-1">Use default image</option>
</select>
</div>
<div class="btn-group" style="margin-top: 15px;">
<button class="btn btn-primary" id="update-card">Update Card</button>
<button class="btn btn-danger" id="delete-card">Delete Card</button>
</div>
</div>
</div>
<div class="section">
<h3>All Cards</h3>
<p style="color: #666; font-size: 14px; margin-bottom: 15px;">Manage your cards. Click on a card to edit it.</p>
<div id="card-list">
<!-- Cards will be listed here -->
</div>
<div class="btn-group" style="margin-top: 15px;">
<button class="btn btn-secondary" id="add-card">Add Card</button>
</div>
</div>
<div class="section">
<h3>Actions</h3>
<div class="btn-group">
<button class="btn btn-primary" id="generate-preview">Generate Preview</button>
<button class="btn btn-success" id="download-html">Download HTML</button>
</div>
</div>
</div>
</div>
<div id="status-message" style="display: none;"></div>
<!-- Mobile toggle buttons -->
<div class="mobile-toggle">
<button class="btn btn-primary" id="toggle-settings">Settings</button>
<button class="btn btn-primary" id="toggle-editor">Editor</button>
</div>
</div>
<script src="app.js"></script>
</body>
</html>