-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathlive_event.templ
More file actions
92 lines (84 loc) · 2.01 KB
/
Copy pathlive_event.templ
File metadata and controls
92 lines (84 loc) · 2.01 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package main
import (
"fiatjaf.com/nostr/nip53"
"fiatjaf.com/nostr/sdk"
"html/template"
)
type LiveEventPageParams struct {
BaseEventPageParams
OpenGraphParams
HeadParams
Details DetailsParams
Content template.HTML
LiveEvent Kind30311Metadata
Clients []ClientReference
}
type Kind30311Metadata struct {
nip53.LiveEvent
Host *sdk.ProfileMetadata
}
func (le Kind30311Metadata) title() string {
if le.Host != nil {
return le.Title + " by " + le.Host.Name
}
return le.Title
}
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,
) {
@liveEventInnerBlock(params)
}
} else {
@eventPageTemplate(
params.LiveEvent.title(),
params.OpenGraphParams,
params.HeadParams,
params.Clients,
params.Details,
params.Event,
) {
@liveEventInnerBlock(params)
}
}
}