-
Notifications
You must be signed in to change notification settings - Fork 24
/
live_event.templ
78 lines (72 loc) · 1.77 KB
/
live_event.templ
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package main
import "html/template"
type LiveEventPageParams struct {
BaseEventPageParams
OpenGraphParams
HeadParams
Details DetailsParams
Content template.HTML
LiveEvent Kind30311Metadata
Clients []ClientReference
}
templ liveEventInnerBlock(params LiveEventPageParams) {
<h1 class="text-2xl">
<span class="mr-2">{ params.LiveEvent.Title }</span>
switch params.LiveEvent.Status {
case "ended":
<span class="whitespace-nowrap rounded bg-neutral-400 px-4 py-1 align-text-top text-base text-white dark:bg-neutral-700">Ended</span>
case "live":
<span class="whitespace-nowrap rounded bg-strongpink px-4 py-1 align-text-top text-base text-white">Live now!</span>
}
</h1>
<div class="mb-4">
if params.LiveEvent.Host != nil {
Streaming hosted by
<a href={ templ.URL("/" + params.LiveEvent.Host.Npub()) }>
{ params.LiveEvent.Host.Name }
</a>
}
</div>
<!-- main content -->
<div class="mb-4">
for _, v := range params.LiveEvent.Hashtags {
<span class="mr-2 whitespace-nowrap rounded bg-neutral-200 px-2 dark:bg-neutral-700 dark:text-white">
{ v }
</span>
}
</div>
if params.LiveEvent.Summary != "" {
<div>{ params.LiveEvent.Summary }</div>
}
if params.LiveEvent.Image != "" {
<img
src={ params.LiveEvent.Image }
alt={ params.Alt }
_="on load repeat set @src to @src wait 5s end"
/>
}
}
templ liveEventTemplate(params LiveEventPageParams, isEmbed bool) {
<!DOCTYPE html>
if isEmbed {
@embeddedPageTemplate(
params.Event,
params.NeventNaked,
isEmbed,
) {
@liveEventInnerBlock(params)
}
} else {
@eventPageTemplate(
params.LiveEvent.title(),
params.OpenGraphParams,
params.HeadParams,
params.Clients,
params.Details,
params.Event,
isEmbed,
) {
@liveEventInnerBlock(params)
}
}
}