Let people add plays from photos; library, editor, compose; full-page PDF
- Replace the static nginx site with a small Node server: serves public/, stores plays on a /data volume and exposes a JSON API. Writes need a shared UPLOAD_PASSWORD; unpublished plays are hidden without it. - Page photos (shrunk to <=1.15 MP JPEG in the browser) are transcribed one request per page by a Claude vision model (claude-haiku-5-5 by default, CLAUDE_MODEL to change) into the play markup, then stitched together: speaker spellings unified, gaps in page numbers marked as missing pages, failed pages flagged. DAILY_PAGE_LIMIT caps spend. - New pages: library (play menu), add (upload + progress), editor (text next to the photos, checks for [?] readings and one-off names, publish, delete). The reader loads plays from the API and remembers the chosen role per play; old /?postava= links still work. - PDF export: text now flows across original pages and prints at the on-screen size, so A4 sheets are full instead of half empty; page numbers in the footer. - docker-compose.yml + .env.example for one-click deploys; the 1931 play moves to seed/ and is copied into an empty volume on first start. - Tests: parser leniency, transcription assembly, API end to end with a stubbed Claude client. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HA82gVRDXpoukzgMFumoJt
This commit is contained in:
parent
2608d10dd2
commit
46aa1236ed
32 changed files with 1761 additions and 160 deletions
143
public/app.css
143
public/app.css
|
|
@ -224,8 +224,137 @@ body.reading .lines-nav .read-only { display: inline-block; }
|
|||
:root[data-layout="original"] .stage { padding-left: 1.5em; }
|
||||
}
|
||||
|
||||
/* ---- PDF export (print) ---- */
|
||||
@page { size: A4; margin: 18mm 16mm; }
|
||||
/* ---- shared bits for the library, upload and editor pages ---- */
|
||||
a { color: var(--accent); }
|
||||
.muted { color: var(--muted); }
|
||||
.small { font-size: 13px; }
|
||||
.error { color: var(--accent); font-weight: 600; }
|
||||
.crumbs { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; margin-bottom: 10px; }
|
||||
.crumbs a { text-decoration: none; }
|
||||
.crumbs a:hover { text-decoration: underline; }
|
||||
input:not([type]), input[type="text"], input[type="password"], textarea {
|
||||
width: 100%;
|
||||
padding: 8px 10px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid var(--line);
|
||||
background: var(--bg);
|
||||
}
|
||||
button, .button {
|
||||
display: inline-block;
|
||||
padding: 8px 14px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid var(--line);
|
||||
background: var(--bg);
|
||||
cursor: pointer;
|
||||
font-weight: 600;
|
||||
font-size: 15px;
|
||||
text-decoration: none;
|
||||
color: var(--fg);
|
||||
}
|
||||
button:disabled { opacity: 0.5; cursor: default; }
|
||||
.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
|
||||
:root[data-theme="dark"] .primary { color: #17171a; }
|
||||
button.link { border: 0; background: none; padding: 0; font: inherit; color: var(--accent); text-align: left; cursor: pointer; }
|
||||
|
||||
.topbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px 16px;
|
||||
padding: 14px 24px;
|
||||
background: var(--panel);
|
||||
border-bottom: 1px solid var(--line);
|
||||
}
|
||||
.topbar h1 { font-size: 20px; margin: 0; }
|
||||
.topbar .crumbs { margin: 0; }
|
||||
.topbar-actions { display: flex; align-items: center; gap: 10px; }
|
||||
.wrap { max-width: 760px; margin: 0 auto; padding: 20px 16px 60px; }
|
||||
.wrap.wide { max-width: 1400px; }
|
||||
.stack > * + * { margin-top: 12px; }
|
||||
|
||||
.play-list { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 10px; }
|
||||
.play-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 14px 16px;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 10px;
|
||||
background: var(--panel);
|
||||
}
|
||||
.play-main { flex: 1; min-width: 0; text-decoration: none; color: inherit; display: grid; gap: 2px; }
|
||||
.play-main:hover .play-title { color: var(--accent); }
|
||||
.play-title { font-weight: 700; font-size: 17px; }
|
||||
.play-card .play-note { margin: 0; }
|
||||
.play-meta { font-size: 12.5px; color: var(--muted); }
|
||||
.badge { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--hl); color: var(--fg); vertical-align: 2px; }
|
||||
|
||||
dialog.login { border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--fg); padding: 20px; width: min(380px, calc(100vw - 32px)); }
|
||||
dialog.login h2 { margin: 0 0 8px; font-size: 18px; }
|
||||
dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
|
||||
|
||||
.dropzone {
|
||||
display: block;
|
||||
padding: 28px 16px;
|
||||
border: 2px dashed var(--line);
|
||||
border-radius: 10px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
background: var(--panel);
|
||||
}
|
||||
.dropzone.over { border-color: var(--accent); }
|
||||
.dropzone input { position: absolute; opacity: 0; width: 1px; height: 1px; }
|
||||
.dropzone:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
|
||||
.thumbs { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
|
||||
.thumb { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); font-size: 12px; }
|
||||
.thumb img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
|
||||
.thumb-num { position: absolute; top: 4px; left: 4px; background: var(--accent); color: #fff; border-radius: 999px; padding: 0 7px; font-weight: 700; }
|
||||
.thumb-name { display: block; padding: 4px 6px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
|
||||
.thumb-tools { display: flex; justify-content: space-between; padding: 4px; }
|
||||
.thumb-tools button { padding: 2px 8px; font-size: 12px; }
|
||||
.progress progress { width: 100%; accent-color: var(--accent); }
|
||||
form.busy .dropzone, form.busy .thumb-tools { pointer-events: none; opacity: 0.6; }
|
||||
|
||||
.meta-row { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
|
||||
.meta-row .grow { flex: 1 1 260px; }
|
||||
.field.toggle { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; }
|
||||
.field.toggle span { margin: 0; }
|
||||
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 0.8fr); gap: 16px; align-items: start; }
|
||||
.editor textarea {
|
||||
height: calc(100vh - 230px);
|
||||
min-height: 360px;
|
||||
font-family: "Courier Prime", ui-monospace, monospace;
|
||||
font-size: 15px;
|
||||
line-height: 1.45;
|
||||
resize: vertical;
|
||||
tab-size: 4;
|
||||
}
|
||||
.editor-side { position: sticky; top: 12px; display: grid; gap: 14px; }
|
||||
.photo-nav { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 14px; }
|
||||
.photo-nav span { flex: 1; text-align: center; color: var(--muted); }
|
||||
.photo-nav button { padding: 4px 10px; font-size: 13px; }
|
||||
.photo img { display: block; width: 100%; max-height: calc(100vh - 330px); object-fit: contain; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
|
||||
.checks h2 { font-size: 16px; margin: 0 0 4px; }
|
||||
.checks ul { margin: 6px 0 10px; padding-left: 18px; max-height: 220px; overflow-y: auto; font-size: 14px; }
|
||||
.help { font-size: 14px; margin-top: 8px; }
|
||||
.help td { padding: 2px 10px 2px 0; vertical-align: top; }
|
||||
.danger button { color: var(--accent); border-color: var(--accent); background: transparent; }
|
||||
@media (max-width: 900px) {
|
||||
.editor { grid-template-columns: minmax(0, 1fr); }
|
||||
.editor-side { position: static; order: -1; }
|
||||
.photo img { max-height: 60vh; }
|
||||
.editor textarea { height: 70vh; }
|
||||
}
|
||||
|
||||
/* ---- PDF export (print) ----
|
||||
The text runs on from one original page to the next so every sheet is full,
|
||||
at the size chosen on screen (1 CSS px = 0.75 pt, so the default 19 px is ~14 pt). */
|
||||
@page {
|
||||
size: A4;
|
||||
margin: 14mm 15mm 16mm;
|
||||
@bottom-center { content: counter(page) " / " counter(pages); font-family: system-ui, sans-serif; font-size: 9pt; color: #666; }
|
||||
}
|
||||
@media print {
|
||||
:root, :root[data-theme] {
|
||||
--bg: #fff; --fg: #000; --muted: #444; --line: #ccc; --accent: #000;
|
||||
|
|
@ -234,11 +363,13 @@ body.reading .lines-nav .read-only { display: inline-block; }
|
|||
body { background: #fff; }
|
||||
.layout { display: block; }
|
||||
.panel, .lines-nav { display: none !important; }
|
||||
.script { padding: 0; font-size: calc(var(--script-size) * 0.7); line-height: 1.35; orphans: 3; widows: 3; }
|
||||
.script { padding: 0; font-size: var(--script-size); line-height: 1.4; orphans: 2; widows: 2; }
|
||||
.script > * { max-width: none; }
|
||||
.page { border: 0; padding: 0; break-before: page; }
|
||||
.page:first-child { break-before: auto; }
|
||||
.speech { margin: 0.6em 0; }
|
||||
.page { border: 0; padding: 0; }
|
||||
/* original page numbers stay as small markers in the margin of the flow */
|
||||
.pnum { font-size: 0.65em; margin: 0.6em 0 0.2em; text-align: right; }
|
||||
.missing-note { padding: 0.4em 0; }
|
||||
.speech { margin: 0.5em 0; }
|
||||
.speech.current { outline: none; }
|
||||
.speech.mine .say { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
|
||||
.speech.mine .who { text-decoration: underline; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue