mirror of
https://github.com/aljazceru/njump.git
synced 2025-12-17 06:14:22 +01:00
77 lines
1.7 KiB
Plaintext
77 lines
1.7 KiB
Plaintext
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,
|
|
) {
|
|
@liveEventInnerBlock(params)
|
|
}
|
|
} else {
|
|
@eventPageTemplate(
|
|
params.LiveEvent.title(),
|
|
params.OpenGraphParams,
|
|
params.HeadParams,
|
|
params.Clients,
|
|
params.Details,
|
|
params.Event,
|
|
) {
|
|
@liveEventInnerBlock(params)
|
|
}
|
|
}
|
|
}
|