From e43640e779834fdebc76e4d43d2fd36c8f11afd1 Mon Sep 17 00:00:00 2001 From: Olov Johansson Date: Sat, 8 Aug 2026 20:14:42 +0200 Subject: [PATCH] project sub-timeline: event dots on bars, click to add event, + Event shortcut --- game.html | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/game.html b/game.html index 8c8b9ff..edabb27 100644 --- a/game.html +++ b/game.html @@ -635,6 +635,24 @@ font:italic 1rem/1.6 var(--serif); color:var(--paper); } .truth-item-text { flex:1; } + /* Project bar event dots + click zone */ + .tl-project-evt-dot { + position: absolute; + width: 9px; height: 9px; + border-radius: 50%; + top: 50%; transform: translate(-50%, -50%); + z-index: 3; cursor: pointer; + border: 1.5px solid rgba(23,21,19,.7); + transition: transform .1s; + } + .tl-project-evt-dot.light { background: var(--brass); } + .tl-project-evt-dot.dark { background: var(--rust); } + .tl-project-evt-dot:hover { transform: translate(-50%, -50%) scale(1.5); } + .tl-bar-add-overlay { + position: absolute; top: 0; bottom: 0; + z-index: 2; cursor: crosshair; background: transparent; + } + .project-events { margin-top:.8rem; padding-top:.8rem; border-top:1px solid var(--line); } @@ -830,7 +848,7 @@
Projects
@@ -957,6 +989,7 @@
+
@@ -2075,6 +2108,29 @@ return result.sort((a, b) => a.term.localeCompare(b.term)) }, + openAddEventToProject(project, clickEvent) { + const env = this.randomEnv(project.discipline) + this.activeForm = { + type: 'event', title: '', description: '', + mood: project.mood || '', date: '', end_date: '', + status: 'active', discipline: project.discipline || '', + env, env_layout: env ? this.randomEnvLayout() : 'after', + project_id: project.id + } + // Calculate date from click position on the bar + if (clickEvent) { + const rect = clickEvent.currentTarget.getBoundingClientRect() + const pct = Math.max(0, Math.min(100, ((clickEvent.clientX - rect.left) / rect.width) * 100)) + const start = new Date(project.date).getTime() + const end = new Date(project.end_date || (this.game && this.game.timeline_end)).getTime() + this.activeForm.date = new Date(Math.round(start + (pct / 100) * (end - start))).toISOString().split('T')[0] + } + this.editingId = null + this.formError = null + this.modalType = 'item' + this.showModal = true + }, + eventsForProject(projectId) { return this.events().filter(e => e.project_id === projectId) },