Initial implementation
This commit is contained in:
10
web/embed.go
Normal file
10
web/embed.go
Normal file
@@ -0,0 +1,10 @@
|
||||
// Package web provides embedded static assets and templates.
|
||||
package web
|
||||
|
||||
import "embed"
|
||||
|
||||
//go:embed all:templates
|
||||
var TemplatesFS embed.FS
|
||||
|
||||
//go:embed all:static
|
||||
var StaticFS embed.FS
|
||||
517
web/static/css/style.css
Normal file
517
web/static/css/style.css
Normal file
@@ -0,0 +1,517 @@
|
||||
/* Chronological - Main Stylesheet */
|
||||
|
||||
/* CSS Reset and Base Styles */
|
||||
*, *::before, *::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
:root {
|
||||
--color-primary: #3b82f6;
|
||||
--color-primary-dark: #2563eb;
|
||||
--color-secondary: #64748b;
|
||||
--color-success: #22c55e;
|
||||
--color-danger: #ef4444;
|
||||
--color-warning: #f59e0b;
|
||||
|
||||
--color-bg: #f8fafc;
|
||||
--color-surface: #ffffff;
|
||||
--color-border: #e2e8f0;
|
||||
--color-text: #1e293b;
|
||||
--color-text-muted: #64748b;
|
||||
|
||||
--spacing-xs: 0.25rem;
|
||||
--spacing-sm: 0.5rem;
|
||||
--spacing-md: 1rem;
|
||||
--spacing-lg: 1.5rem;
|
||||
--spacing-xl: 2rem;
|
||||
|
||||
--radius-sm: 0.25rem;
|
||||
--radius-md: 0.5rem;
|
||||
--radius-lg: 1rem;
|
||||
|
||||
--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
|
||||
--shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
--shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
|
||||
|
||||
--font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||
--font-size-sm: 0.875rem;
|
||||
--font-size-md: 1rem;
|
||||
--font-size-lg: 1.25rem;
|
||||
--font-size-xl: 1.5rem;
|
||||
}
|
||||
|
||||
html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: var(--font-family);
|
||||
font-size: var(--font-size-md);
|
||||
line-height: 1.5;
|
||||
color: var(--color-text);
|
||||
background-color: var(--color-bg);
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
/* App Layout */
|
||||
.app-header {
|
||||
background-color: var(--color-primary);
|
||||
color: white;
|
||||
padding: var(--spacing-md) var(--spacing-lg);
|
||||
box-shadow: var(--shadow-md);
|
||||
}
|
||||
|
||||
.app-header h1 {
|
||||
margin: 0;
|
||||
font-size: var(--font-size-xl);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.app-main {
|
||||
height: calc(100vh - 60px);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Timeline Container - Split Layout */
|
||||
.timeline-container {
|
||||
display: grid;
|
||||
grid-template-columns: 350px 1fr;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/* Calendar Panel */
|
||||
.calendar-panel {
|
||||
background-color: var(--color-surface);
|
||||
border-right: 1px solid var(--color-border);
|
||||
padding: var(--spacing-lg);
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.calendar {
|
||||
max-width: 320px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.calendar-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: var(--spacing-md);
|
||||
}
|
||||
|
||||
.calendar-header h2 {
|
||||
margin: 0;
|
||||
font-size: var(--font-size-lg);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.nav-btn {
|
||||
background: none;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-sm);
|
||||
padding: var(--spacing-xs) var(--spacing-sm);
|
||||
cursor: pointer;
|
||||
font-size: var(--font-size-lg);
|
||||
color: var(--color-text);
|
||||
transition: background-color 0.2s, border-color 0.2s;
|
||||
}
|
||||
|
||||
.nav-btn:hover {
|
||||
background-color: var(--color-bg);
|
||||
border-color: var(--color-primary);
|
||||
}
|
||||
|
||||
.calendar-weekdays {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(7, 1fr);
|
||||
text-align: center;
|
||||
font-size: var(--font-size-sm);
|
||||
font-weight: 600;
|
||||
color: var(--color-text-muted);
|
||||
margin-bottom: var(--spacing-sm);
|
||||
}
|
||||
|
||||
.calendar-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(7, 1fr);
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.calendar-day {
|
||||
aspect-ratio: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: var(--color-bg);
|
||||
border-radius: var(--radius-sm);
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s;
|
||||
position: relative;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
.calendar-day:hover {
|
||||
background-color: var(--color-border);
|
||||
}
|
||||
|
||||
.calendar-day.empty {
|
||||
background: none;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.calendar-day.today {
|
||||
background-color: var(--color-primary);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.calendar-day.today:hover {
|
||||
background-color: var(--color-primary-dark);
|
||||
}
|
||||
|
||||
.calendar-day.has-content {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.day-number {
|
||||
font-size: var(--font-size-sm);
|
||||
}
|
||||
|
||||
.day-indicators {
|
||||
display: flex;
|
||||
gap: 1px;
|
||||
font-size: 0.6rem;
|
||||
position: absolute;
|
||||
bottom: 2px;
|
||||
}
|
||||
|
||||
.indicator {
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.calendar-actions {
|
||||
margin-top: var(--spacing-lg);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Timeline Panel */
|
||||
.timeline-panel {
|
||||
padding: var(--spacing-lg);
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.timeline {
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.timeline-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: var(--spacing-lg);
|
||||
padding-bottom: var(--spacing-md);
|
||||
border-bottom: 2px solid var(--color-border);
|
||||
}
|
||||
|
||||
.timeline-header h2 {
|
||||
margin: 0;
|
||||
font-size: var(--font-size-xl);
|
||||
}
|
||||
|
||||
.timeline-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-lg);
|
||||
}
|
||||
|
||||
.timeline-day {
|
||||
background-color: var(--color-surface);
|
||||
border-radius: var(--radius-lg);
|
||||
box-shadow: var(--shadow-sm);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.timeline-day-header {
|
||||
background-color: var(--color-bg);
|
||||
padding: var(--spacing-md) var(--spacing-lg);
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
}
|
||||
|
||||
.timeline-day-header time {
|
||||
font-weight: 600;
|
||||
color: var(--color-primary);
|
||||
}
|
||||
|
||||
.timeline-entries {
|
||||
padding: var(--spacing-md) var(--spacing-lg);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-md);
|
||||
}
|
||||
|
||||
.timeline-entry {
|
||||
display: flex;
|
||||
gap: var(--spacing-md);
|
||||
padding: var(--spacing-md);
|
||||
background-color: var(--color-bg);
|
||||
border-radius: var(--radius-md);
|
||||
}
|
||||
|
||||
.entry-icon {
|
||||
font-size: 1.5rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.entry-content {
|
||||
flex-grow: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.entry-content h4 {
|
||||
margin: 0 0 var(--spacing-xs);
|
||||
font-size: var(--font-size-md);
|
||||
}
|
||||
|
||||
.entry-time {
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--color-text-muted);
|
||||
margin-right: var(--spacing-sm);
|
||||
}
|
||||
|
||||
.entry-location {
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
|
||||
.entry-description {
|
||||
margin: var(--spacing-sm) 0 0;
|
||||
color: var(--color-text-muted);
|
||||
font-size: var(--font-size-sm);
|
||||
}
|
||||
|
||||
.diary-text {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.timeline-empty {
|
||||
text-align: center;
|
||||
padding: var(--spacing-xl);
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
|
||||
/* Photo Grid */
|
||||
.photo-grid, .photo-gallery {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
|
||||
gap: var(--spacing-md);
|
||||
margin-top: var(--spacing-sm);
|
||||
}
|
||||
|
||||
.photo-item {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.photo-item img {
|
||||
width: 100%;
|
||||
height: 150px;
|
||||
object-fit: cover;
|
||||
border-radius: var(--radius-md);
|
||||
cursor: pointer;
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
|
||||
.photo-item img:hover {
|
||||
transform: scale(1.02);
|
||||
}
|
||||
|
||||
.photo-item figcaption {
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--color-text-muted);
|
||||
margin-top: var(--spacing-xs);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Day Modal */
|
||||
.day-modal {
|
||||
border: none;
|
||||
border-radius: var(--radius-lg);
|
||||
box-shadow: var(--shadow-lg);
|
||||
max-width: 600px;
|
||||
width: 90%;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.day-modal::backdrop {
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.day-detail {
|
||||
padding: var(--spacing-lg);
|
||||
}
|
||||
|
||||
.day-header {
|
||||
margin-bottom: var(--spacing-lg);
|
||||
padding-bottom: var(--spacing-md);
|
||||
border-bottom: 2px solid var(--color-border);
|
||||
}
|
||||
|
||||
.day-header h2 {
|
||||
margin: 0;
|
||||
font-size: var(--font-size-lg);
|
||||
}
|
||||
|
||||
.day-section {
|
||||
margin-bottom: var(--spacing-lg);
|
||||
}
|
||||
|
||||
.day-section h3 {
|
||||
margin: 0 0 var(--spacing-md);
|
||||
font-size: var(--font-size-md);
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
|
||||
.event-list {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.event-item {
|
||||
padding: var(--spacing-sm);
|
||||
background-color: var(--color-bg);
|
||||
border-radius: var(--radius-sm);
|
||||
margin-bottom: var(--spacing-sm);
|
||||
}
|
||||
|
||||
.event-item strong {
|
||||
display: block;
|
||||
margin-bottom: var(--spacing-xs);
|
||||
}
|
||||
|
||||
.empty-message {
|
||||
color: var(--color-text-muted);
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/* Form Elements */
|
||||
textarea {
|
||||
width: 100%;
|
||||
padding: var(--spacing-md);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-md);
|
||||
font-family: inherit;
|
||||
font-size: var(--font-size-md);
|
||||
resize: vertical;
|
||||
min-height: 100px;
|
||||
}
|
||||
|
||||
textarea:focus {
|
||||
outline: none;
|
||||
border-color: var(--color-primary);
|
||||
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
|
||||
}
|
||||
|
||||
.form-actions {
|
||||
display: flex;
|
||||
gap: var(--spacing-sm);
|
||||
margin-top: var(--spacing-md);
|
||||
}
|
||||
|
||||
/* Buttons */
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: var(--spacing-sm) var(--spacing-md);
|
||||
border: none;
|
||||
border-radius: var(--radius-md);
|
||||
font-family: inherit;
|
||||
font-size: var(--font-size-sm);
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s, transform 0.1s;
|
||||
}
|
||||
|
||||
.btn:hover {
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.btn:active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background-color: var(--color-primary);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-primary:hover {
|
||||
background-color: var(--color-primary-dark);
|
||||
}
|
||||
|
||||
.btn-secondary {
|
||||
background-color: var(--color-border);
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
.btn-secondary:hover {
|
||||
background-color: var(--color-secondary);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-danger {
|
||||
background-color: var(--color-danger);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-danger:hover {
|
||||
background-color: #dc2626;
|
||||
}
|
||||
|
||||
.btn-small {
|
||||
padding: var(--spacing-xs) var(--spacing-sm);
|
||||
font-size: var(--font-size-sm);
|
||||
}
|
||||
|
||||
/* Responsive Design */
|
||||
@media (max-width: 768px) {
|
||||
.timeline-container {
|
||||
grid-template-columns: 1fr;
|
||||
grid-template-rows: auto 1fr;
|
||||
}
|
||||
|
||||
.calendar-panel {
|
||||
border-right: none;
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
max-height: 50vh;
|
||||
}
|
||||
|
||||
.calendar {
|
||||
max-width: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* HTMX Loading Indicator */
|
||||
.htmx-request {
|
||||
opacity: 0.7;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.htmx-request::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
margin: -10px 0 0 -10px;
|
||||
border: 2px solid var(--color-border);
|
||||
border-top-color: var(--color-primary);
|
||||
border-radius: 50%;
|
||||
animation: spin 0.8s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
74
web/static/js/app.js
Normal file
74
web/static/js/app.js
Normal file
@@ -0,0 +1,74 @@
|
||||
// Chronological - Minimal JavaScript
|
||||
// Most interactivity is handled by HTMX
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Close modal when clicking backdrop
|
||||
document.querySelectorAll('dialog').forEach(function(dialog) {
|
||||
dialog.addEventListener('click', function(event) {
|
||||
if (event.target === dialog) {
|
||||
dialog.close();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Event delegation for dynamic content
|
||||
document.body.addEventListener('click', function(event) {
|
||||
var target = event.target;
|
||||
|
||||
// Handle modal opening via data attribute
|
||||
var modalOpener = target.closest('[data-opens-modal]');
|
||||
if (modalOpener) {
|
||||
var modalId = modalOpener.getAttribute('data-opens-modal');
|
||||
var modal = document.getElementById(modalId);
|
||||
if (modal && modal.showModal) {
|
||||
modal.showModal();
|
||||
}
|
||||
}
|
||||
|
||||
// Handle diary edit toggle
|
||||
if (target.matches('[data-action="toggle-diary-edit"]')) {
|
||||
var display = target.closest('.diary-display');
|
||||
if (display) {
|
||||
display.style.display = 'none';
|
||||
var editForm = display.nextElementSibling;
|
||||
if (editForm) {
|
||||
editForm.style.display = 'block';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handle diary edit cancel
|
||||
if (target.matches('[data-action="cancel-diary-edit"]')) {
|
||||
var editDiv = target.closest('.diary-edit');
|
||||
if (editDiv) {
|
||||
editDiv.style.display = 'none';
|
||||
var displayDiv = editDiv.previousElementSibling;
|
||||
if (displayDiv) {
|
||||
displayDiv.style.display = 'block';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Handle keyboard shortcuts
|
||||
document.addEventListener('keydown', function(event) {
|
||||
// Close modal on Escape
|
||||
if (event.key === 'Escape') {
|
||||
document.querySelectorAll('dialog[open]').forEach(function(dialog) {
|
||||
dialog.close();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// HTMX event handlers
|
||||
document.body.addEventListener('htmx:afterSwap', function(event) {
|
||||
// Re-initialize any dynamic elements after HTMX swaps
|
||||
if (event.detail.target.id === 'day-modal-content') {
|
||||
// Focus textarea when opening day modal with diary form
|
||||
var textarea = event.detail.target.querySelector('textarea');
|
||||
if (textarea) {
|
||||
textarea.focus();
|
||||
}
|
||||
}
|
||||
});
|
||||
1
web/static/js/htmx.min.js
vendored
Normal file
1
web/static/js/htmx.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
21
web/templates/layouts/base.html
Normal file
21
web/templates/layouts/base.html
Normal file
@@ -0,0 +1,21 @@
|
||||
{{define "base"}}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Chronological</title>
|
||||
<link rel="stylesheet" href="/static/css/style.css">
|
||||
<script src="/static/js/htmx.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<header class="app-header">
|
||||
<h1>Chronological</h1>
|
||||
</header>
|
||||
<main class="app-main">
|
||||
{{template "content" .}}
|
||||
</main>
|
||||
<script src="/static/js/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
{{end}}
|
||||
14
web/templates/pages/index.html
Normal file
14
web/templates/pages/index.html
Normal file
@@ -0,0 +1,14 @@
|
||||
{{define "index.html"}}
|
||||
{{template "base" .}}
|
||||
{{end}}
|
||||
|
||||
{{define "content"}}
|
||||
<div class="timeline-container">
|
||||
<aside class="calendar-panel" id="calendar-panel">
|
||||
{{template "calendar.html" .Calendar}}
|
||||
</aside>
|
||||
<section class="timeline-panel" id="timeline-panel">
|
||||
{{template "timeline.html" .Timeline}}
|
||||
</section>
|
||||
</div>
|
||||
{{end}}
|
||||
80
web/templates/partials/calendar.html
Normal file
80
web/templates/partials/calendar.html
Normal file
@@ -0,0 +1,80 @@
|
||||
{{define "calendar.html"}}
|
||||
<div class="calendar">
|
||||
<div class="calendar-header">
|
||||
<button
|
||||
hx-get="/calendar/{{.PrevYear}}/{{.PrevMonth}}"
|
||||
hx-target="#calendar-panel"
|
||||
hx-swap="innerHTML"
|
||||
class="nav-btn"
|
||||
aria-label="Previous month">
|
||||
‹
|
||||
</button>
|
||||
<h2>{{.MonthName}} {{.Year}}</h2>
|
||||
<button
|
||||
hx-get="/calendar/{{.NextYear}}/{{.NextMonth}}"
|
||||
hx-target="#calendar-panel"
|
||||
hx-swap="innerHTML"
|
||||
class="nav-btn"
|
||||
aria-label="Next month">
|
||||
›
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="calendar-weekdays">
|
||||
<span>Sun</span>
|
||||
<span>Mon</span>
|
||||
<span>Tue</span>
|
||||
<span>Wed</span>
|
||||
<span>Thu</span>
|
||||
<span>Fri</span>
|
||||
<span>Sat</span>
|
||||
</div>
|
||||
|
||||
<div class="calendar-grid">
|
||||
{{/* Empty cells before first day */}}
|
||||
{{range seq 0 (sub .FirstDayWeekday 1)}}
|
||||
<div class="calendar-day empty"></div>
|
||||
{{end}}
|
||||
|
||||
{{/* Day cells */}}
|
||||
{{range $day := seq 1 .DaysInMonth}}
|
||||
{{$content := index $.Days $day}}
|
||||
<div
|
||||
class="calendar-day{{if isToday $.Year $.Month $day}} today{{end}}{{if $content.HasContent}} has-content{{end}}"
|
||||
hx-get="/day/{{$.Year}}/{{$.Month | printf "%d"}}/{{$day}}"
|
||||
hx-target="#day-modal-content"
|
||||
hx-swap="innerHTML"
|
||||
hx-trigger="click"
|
||||
data-opens-modal="day-modal">
|
||||
<span class="day-number">{{$day}}</span>
|
||||
{{if $content.HasContent}}
|
||||
<div class="day-indicators">
|
||||
{{if $content.HasEvents}}<span class="indicator event-indicator" title="Events">📅</span>{{end}}
|
||||
{{if $content.HasDiary}}<span class="indicator diary-indicator" title="Diary">📝</span>{{end}}
|
||||
{{if $content.HasPhotos}}<span class="indicator photo-indicator" title="Photos">📷</span>{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
<div class="calendar-actions">
|
||||
<button
|
||||
hx-get="/timeline/{{.Year}}/{{.Month | printf "%d"}}"
|
||||
hx-target="#timeline-panel"
|
||||
hx-swap="innerHTML"
|
||||
class="btn btn-primary">
|
||||
View Timeline
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<dialog id="day-modal" class="day-modal">
|
||||
<div id="day-modal-content">
|
||||
<!-- Day content loaded via HTMX -->
|
||||
</div>
|
||||
<form method="dialog">
|
||||
<button class="btn btn-secondary">Close</button>
|
||||
</form>
|
||||
</dialog>
|
||||
{{end}}
|
||||
112
web/templates/partials/day.html
Normal file
112
web/templates/partials/day.html
Normal file
@@ -0,0 +1,112 @@
|
||||
{{define "day.html"}}
|
||||
<div class="day-detail">
|
||||
<header class="day-header">
|
||||
<h2>{{.Date.Format "Monday, January 2, 2006"}}</h2>
|
||||
</header>
|
||||
|
||||
<div id="day-detail-content">
|
||||
{{template "day_content.html" .}}
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{define "day_content.html"}}
|
||||
<div class="day-content">
|
||||
{{/* Events Section */}}
|
||||
<section class="day-section events-section">
|
||||
<h3>📅 Events</h3>
|
||||
{{if .Content.Events}}
|
||||
<ul class="event-list">
|
||||
{{range .Content.Events}}
|
||||
<li class="event-item">
|
||||
<strong>{{.Title}}</strong>
|
||||
{{if not .AllDay}}
|
||||
<span class="event-time">{{formatTime .Start}} - {{formatTime .End}}</span>
|
||||
{{else}}
|
||||
<span class="event-time">All day</span>
|
||||
{{end}}
|
||||
{{if .Location}}
|
||||
<span class="event-location">📍 {{.Location}}</span>
|
||||
{{end}}
|
||||
{{if .Description}}
|
||||
<p class="event-description">{{.Description}}</p>
|
||||
{{end}}
|
||||
</li>
|
||||
{{end}}
|
||||
</ul>
|
||||
{{else}}
|
||||
<p class="empty-message">No events scheduled.</p>
|
||||
{{end}}
|
||||
</section>
|
||||
|
||||
{{/* Diary Section */}}
|
||||
<section class="day-section diary-section">
|
||||
<h3>📝 Journal</h3>
|
||||
{{if .Content.Diary}}
|
||||
<div class="diary-display">
|
||||
<p class="diary-text">{{.Content.Diary.Text}}</p>
|
||||
<button
|
||||
class="btn btn-small"
|
||||
data-action="toggle-diary-edit">
|
||||
Edit
|
||||
</button>
|
||||
</div>
|
||||
<div class="diary-edit" style="display: none;">
|
||||
<form
|
||||
hx-post="/diary/{{formatDate .Date}}"
|
||||
hx-target="#day-detail-content"
|
||||
hx-swap="innerHTML">
|
||||
<textarea name="text" rows="5" placeholder="Write your thoughts...">{{.Content.Diary.Text}}</textarea>
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-secondary"
|
||||
data-action="cancel-diary-edit">
|
||||
Cancel
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-danger"
|
||||
hx-delete="/diary/{{formatDate .Date}}"
|
||||
hx-target="#day-detail-content"
|
||||
hx-swap="innerHTML"
|
||||
hx-confirm="Delete this diary entry?">
|
||||
Delete
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{{else}}
|
||||
<form
|
||||
hx-post="/diary/{{formatDate .Date}}"
|
||||
hx-target="#day-detail-content"
|
||||
hx-swap="innerHTML">
|
||||
<textarea name="text" rows="5" placeholder="Write your thoughts..."></textarea>
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
{{end}}
|
||||
</section>
|
||||
|
||||
{{/* Photos Section */}}
|
||||
<section class="day-section photos-section">
|
||||
<h3>📷 Photos</h3>
|
||||
{{if .Content.Photos}}
|
||||
<div class="photo-gallery">
|
||||
{{range .Content.Photos}}
|
||||
<figure class="photo-item">
|
||||
<a href="{{.URLPath}}" target="_blank">
|
||||
<img src="{{.URLPath}}" alt="{{.Description}}" loading="lazy">
|
||||
</a>
|
||||
<figcaption>{{.Description}}</figcaption>
|
||||
</figure>
|
||||
{{end}}
|
||||
</div>
|
||||
{{else}}
|
||||
<p class="empty-message">No photos for this day.</p>
|
||||
{{end}}
|
||||
</section>
|
||||
</div>
|
||||
{{end}}
|
||||
26
web/templates/partials/diary_form.html
Normal file
26
web/templates/partials/diary_form.html
Normal file
@@ -0,0 +1,26 @@
|
||||
{{define "diary_form.html"}}
|
||||
<div class="diary-form">
|
||||
<h3>Journal Entry - {{.Date.Format "January 2, 2006"}}</h3>
|
||||
<form
|
||||
hx-post="/diary/{{formatDate .Date}}"
|
||||
hx-target="this"
|
||||
hx-swap="outerHTML">
|
||||
<textarea
|
||||
name="text"
|
||||
rows="8"
|
||||
placeholder="Write your thoughts...">{{if .Entry}}{{.Entry.Text}}{{end}}</textarea>
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
{{if .Entry}}
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-danger"
|
||||
hx-delete="/diary/{{formatDate .Date}}"
|
||||
hx-confirm="Delete this diary entry?">
|
||||
Delete
|
||||
</button>
|
||||
{{end}}
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{{end}}
|
||||
93
web/templates/partials/timeline.html
Normal file
93
web/templates/partials/timeline.html
Normal file
@@ -0,0 +1,93 @@
|
||||
{{define "timeline.html"}}
|
||||
<div class="timeline">
|
||||
<div class="timeline-header">
|
||||
<button
|
||||
hx-get="/timeline/{{.PrevYear}}/{{.PrevMonth}}"
|
||||
hx-target="#timeline-panel"
|
||||
hx-swap="innerHTML"
|
||||
class="nav-btn"
|
||||
aria-label="Previous month">
|
||||
‹
|
||||
</button>
|
||||
<h2>{{.MonthName}} {{.Year}}</h2>
|
||||
<button
|
||||
hx-get="/timeline/{{.NextYear}}/{{.NextMonth}}"
|
||||
hx-target="#timeline-panel"
|
||||
hx-swap="innerHTML"
|
||||
class="nav-btn"
|
||||
aria-label="Next month">
|
||||
›
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="timeline-content">
|
||||
{{if .Days}}
|
||||
{{range .Days}}
|
||||
<article class="timeline-day">
|
||||
<header class="timeline-day-header">
|
||||
<time datetime="{{formatDate .Date}}">
|
||||
{{.Date.Format "Monday, January 2"}}
|
||||
</time>
|
||||
</header>
|
||||
|
||||
<div class="timeline-entries">
|
||||
{{/* Events */}}
|
||||
{{range .Events}}
|
||||
<div class="timeline-entry event-entry">
|
||||
<div class="entry-icon">📅</div>
|
||||
<div class="entry-content">
|
||||
<h4>{{.Title}}</h4>
|
||||
{{if not .AllDay}}
|
||||
<span class="entry-time">{{formatTime .Start}} - {{formatTime .End}}</span>
|
||||
{{else}}
|
||||
<span class="entry-time">All day</span>
|
||||
{{end}}
|
||||
{{if .Location}}
|
||||
<span class="entry-location">📍 {{.Location}}</span>
|
||||
{{end}}
|
||||
{{if .Description}}
|
||||
<p class="entry-description">{{.Description}}</p>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{/* Diary entry */}}
|
||||
{{if .Diary}}
|
||||
<div class="timeline-entry diary-entry">
|
||||
<div class="entry-icon">📝</div>
|
||||
<div class="entry-content">
|
||||
<h4>Journal Entry</h4>
|
||||
<p class="entry-description diary-text">{{.Diary.Text}}</p>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{/* Photos */}}
|
||||
{{if .Photos}}
|
||||
<div class="timeline-entry photo-entry">
|
||||
<div class="entry-icon">📷</div>
|
||||
<div class="entry-content">
|
||||
<h4>Photos</h4>
|
||||
<div class="photo-grid">
|
||||
{{range .Photos}}
|
||||
<figure class="photo-item">
|
||||
<img src="{{.URLPath}}" alt="{{.Description}}" loading="lazy">
|
||||
<figcaption>{{.Description}}</figcaption>
|
||||
</figure>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</article>
|
||||
{{end}}
|
||||
{{else}}
|
||||
<div class="timeline-empty">
|
||||
<p>No entries for this month.</p>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
Reference in New Issue
Block a user