Files
chronological/web/templates/partials/day.html
2025-12-12 11:55:37 +01:00

113 lines
4.0 KiB
HTML

{{define "day.html"}}
<div class="day-detail">
<div class="day-header white-255-text">
{{.Date.Format "Monday, January 2, 2006"}}
</div>
<div id="day-detail-content">
{{template "day_content.html" .}}
</div>
</div>
{{end}}
{{define "day_content.html"}}
<div class="day-content">
{{/* Events Section */}}
<fieldset class="tui-input-fieldset">
<legend class="cyan-255-text">Events</legend>
{{if .Content.Events}}
<ul class="event-list">
{{range .Content.Events}}
<li class="event-item">
<span class="white-255-text">{{.Title}}</span>
{{if not .AllDay}}
<span class="green-255-text">{{formatTime .Start}} - {{formatTime .End}}</span>
{{else}}
<span class="green-255-text">All day</span>
{{end}}
{{if .Location}}
<span class="yellow-255-text">@ {{.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}}
</fieldset>
{{/* Diary Section */}}
<fieldset class="tui-input-fieldset">
<legend class="purple-255-text">Journal</legend>
{{if .Content.Diary}}
<div class="diary-display">
<p class="diary-text white-255-text">{{.Content.Diary.Text}}</p>
<button
class="tui-button"
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" class="tui-input full-width" rows="5" placeholder="Write your thoughts...">{{.Content.Diary.Text}}</textarea>
<div class="form-actions">
<button type="submit" class="tui-button green-168 white-text">Save</button>
<button
type="button"
class="tui-button"
data-action="cancel-diary-edit">
Cancel
</button>
<button
type="button"
class="tui-button red-168 white-text"
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" class="tui-input full-width" rows="5" placeholder="Write your thoughts..."></textarea>
<div class="form-actions">
<button type="submit" class="tui-button green-168 white-text">Save</button>
</div>
</form>
{{end}}
</fieldset>
{{/* Photos Section */}}
<fieldset class="tui-input-fieldset">
<legend class="orange-255-text">Photos</legend>
{{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>
{{if .Description}}<figcaption>{{.Description}}</figcaption>{{end}}
</figure>
{{end}}
</div>
{{else}}
<p class="empty-message">No photos for this day.</p>
{{end}}
</fieldset>
</div>
{{end}}