feat: A4 Gridstack.js template designer + Puppeteer PDF renderer

This commit is contained in:
root
2026-07-16 07:57:16 +00:00
parent 56abeb9e4d
commit 70735502f2
10 changed files with 1802 additions and 3 deletions

211
static/designer.css Normal file
View File

@@ -0,0 +1,211 @@
/* A4 Template Designer with Gridstack.js */
@import url('https://cdn.jsdelivr.net/npm/gridstack@11.1.3/gridstack.min.css');
/* Designer layout */
.designer-layout {
display: grid;
grid-template-columns: 220px 1fr;
gap: 16px;
min-height: 700px;
}
/* Sidebar palette */
.designer-palette {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 16px;
height: fit-content;
position: sticky;
top: 0;
}
.designer-palette h3 {
font-size: 13px;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 0.5px;
margin-bottom: 12px;
}
.palette-block {
background: var(--bg-input);
border: 1px solid var(--border);
border-radius: 6px;
padding: 10px 12px;
margin-bottom: 8px;
cursor: grab;
font-size: 13px;
transition: all 0.15s;
display: flex;
align-items: center;
gap: 8px;
user-select: none;
}
.palette-block:hover {
border-color: var(--accent);
background: rgba(91,141,239,0.08);
}
.palette-block:active { cursor: grabbing; }
.palette-block .icon {
width: 28px; height: 28px;
border-radius: 6px;
background: var(--accent);
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
flex-shrink: 0;
color: white;
}
.palette-block .label { flex: 1; }
.palette-block .desc { font-size: 11px; color: var(--text-muted); }
/* A4 Canvas container */
.designer-canvas-area {
display: flex;
flex-direction: column;
align-items: center;
overflow: auto;
max-height: 800px;
padding: 20px;
background: var(--bg);
border: 1px solid var(--border);
border-radius: var(--radius);
}
/* The actual A4 page */
.a4-page {
width: 794px;
height: 1123px;
background: white;
position: relative;
box-shadow: 0 4px 20px rgba(0,0,0,0.3);
overflow: hidden;
}
/* Gridstack overrides for the A4 canvas */
.a4-page .grid-stack {
background: transparent;
width: 794px;
height: 1123px;
position: relative;
}
.a4-page .grid-stack-item {
border: 1px dashed #5b8def;
background: rgba(91,141,239,0.05);
border-radius: 4px;
overflow: hidden;
}
.a4-page .grid-stack-item:hover {
border-style: solid;
background: rgba(91,141,239,0.1);
}
.a4-page .grid-stack-item-content {
padding: 8px 12px;
font-size: 12px;
color: #333;
font-family: sans-serif;
overflow: hidden;
}
.a4-page .grid-stack-item .block-label {
font-size: 11px;
font-weight: 600;
color: #5b8def;
text-transform: uppercase;
letter-spacing: 0.5px;
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 4px;
}
.a4-page .grid-stack-item .block-content {
font-size: 11px;
color: #666;
overflow: hidden;
max-height: calc(100% - 20px);
}
.a4-page .grid-stack-item .block-config-btn {
background: rgba(91,141,239,0.2);
border: none;
border-radius: 3px;
padding: 2px 6px;
font-size: 10px;
cursor: pointer;
color: #5b8def;
}
/* Gridstack resize handle styling */
.a4-page .grid-stack-item .grid-stack-item-handle {
cursor: grab;
background: rgba(91,141,239,0.1);
height: 16px;
display: flex;
align-items: center;
justify-content: center;
}
/* Block type colors */
.block-PersonalDetails { border-left: 3px solid #2c3e50 !important; }
.block-WorkExperience { border-left: 3px solid #27ae60 !important; }
.block-SkillsList { border-left: 3px solid #e67e22 !important; }
.block-Education { border-left: 3px solid #8e44ad !important; }
.block-Certifications { border-left: 3px solid #e74c3c !important; }
.block-ProfessionalSummary { border-left: 3px solid #3498db !important; }
.block-CustomText { border-left: 3px solid #95a5a6 !important; }
.block-Footer { border-left: 3px solid #bdc3c7 !important; }
/* Designer toolbar */
.designer-toolbar {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 16px;
flex-wrap: wrap;
}
.designer-toolbar input {
max-width: 250px;
}
/* Config panel */
.block-config-panel {
position: fixed;
right: 20px;
top: 50%;
transform: translateY(-50%);
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 20px;
width: 320px;
z-index: 1100;
max-height: 600px;
overflow-y: auto;
display: none;
}
.block-config-panel.active { display: block; }
.block-config-panel h3 {
font-size: 15px;
margin-bottom: 16px;
color: var(--accent);
}
.block-config-panel .form-group { margin-bottom: 12px; }
.block-config-panel label { font-size: 12px; }
/* Preview modal */
.cv-pdf-preview {
width: 100%;
min-height: 600px;
background: white;
border-radius: var(--radius);
}
.cv-pdf-preview iframe {
width: 100%;
height: 700px;
border: none;
border-radius: var(--radius);
}