www.byjp.me/layouts/calendar/single.html
2024-04-30 10:58:22 +01:00

108 lines
5.1 KiB
HTML

{{ define "main" }}
<main class="post h-event">
{{ partial "memex-header.html" . }}
{{ $event := partial "event.obj" .Params.timings }}
<article>
<hgroup class="post-title">
<h1 class="p-name">
{{ with .Params.emoji }}<span data-emoji="{{.}}"></span>{{end}}
<a href="{{ .RelPermalink }}" class="noaccent">{{ .Title | markdownify }}</a>
</h1>
</hgroup>
{{ with .Summary }}
<div class="post-summary p-summary" aria-hidden="true">{{ . }}</div>
{{ end }}
{{ if .Params.Cover }}
<figure class="post-cover">
<img src="{{ .Params.Cover | absURL }}" alt="{{ .Title }}" />
{{ if .Params.CoverCaption }}
<figcaption class="center">{{ .Params.CoverCaption | markdownify }}</figcaption>
{{ end }}
</figure>
{{ end }}
<div class="post-content p-description" data-pagefind-body data-pagefind-filter="type:{{.Type | title}}">
{{ if not $event.isPast }}
<p class="next-visit">
{{ partial "svg.html" (dict "name" "calendar") }} I'm planning on going to this event on {{ partial "year-relative-date.html" (slice (time.AsTime $event.timing.starts) "dt-start") }}.
See the bottom of the post for more information.
</p>
{{ end }}
{{ .Content }}
</div>
</article>
<hr />
<div class="post-info" id="post-info">
{{ partial "claps.html" (dict "url" .RelPermalink) }}
{{ partial "tags.html" .Params.tags }}
{{ with .Params.location }}<p>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-map-pin">
<path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"></path>
<circle cx="12" cy="10" r="3"></circle>
</svg>
At <a href="{{ partial "geolink.url" . }}" class="p-location h-geo" target="_blank"><span class="p-name">{{ .name }}</span><span class="hidden" aria-hidden> (<span class="p-latitude">{{ .latitude }}</span>, <span class="p-longitude">{{ .longitude }}</span>)</span></a>
</p>{{ end }}
<p>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-calendar">
<rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect>
<line x1="16" y1="2" x2="16" y2="6"></line>
<line x1="8" y1="2" x2="8" y2="6"></line>
<line x1="3" y1="10" x2="21" y2="10"></line>
</svg>
On {{ partial "year-relative-date.html" (slice (time.AsTime $event.timing.starts) "dt-start") }}
{{ with sub (len $event.timings) 1 }}{{ if gt . 0 }} (and {{ . }} other{{ if gt . 1}}s{{end}}){{ end }}{{ end }}
</p>
<p>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-clock">
<circle cx="12" cy="12" r="10"></circle>
<polyline points="12 6 12 12 16 14"></polyline>
</svg>
{{ $starts := time.AsTime $event.timing.starts }}
{{ $durationStr := ((strings.Substr $event.timing.duration 1) | strings.ToLower) }}
{{ $duration := partial "iso8601.duration" $event.timing.duration }}
From {{ $starts.Format "15:04" }} until {{ $starts.Add $duration | dateFormat "15:04 (MST)" }} (<span class="dt-duration">{{ replace $durationStr "t" "" }}</span>)
</p>
{{ if $event.timing.attending }}
<p class="attending">
{{ partial "svg.html" (dict "name" "attending") }}
{{ if eq $event.timing.attending true }}{{ partial "friend.html" "jp.no-emoji" }} is going
{{ else if eq (len $event.timing.attending) 1 }}
{{ partial "friend.html" (printf "%s.no-emoji" (index $event.timing.attending 0)) }} is going
{{ else }}
{{ $count := len $event.timing.attending}}
{{ range $i, $attendee := $event.timing.attending }}
{{ partial "friend.html" (printf "%s.no-emoji" $attendee) -}}
{{- if eq $i (sub $count 2) }}{{ if gt $count 2 }},{{ end }} and {{ else if lt $i (sub $count 1) }}, {{ end }}
{{ end }} are going
{{ end }}
</p>
{{ end }}
<p>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link">
<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path>
<path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path>
</svg>
More info on <a href="{{.Params.link}}" class="u-url" target="_blank">{{ (urls.Parse .Params.link).Host }}</a>
</p>
</div>
<hr />
<div class="syndication">
{{ partial "syndication.html" . }}
</div>
{{ partial "pagination-single.html" . }}
</main>
{{ end }}