-
Notifications
You must be signed in to change notification settings - Fork 23
/
file_metadata.templ
91 lines (83 loc) · 2.4 KB
/
file_metadata.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
79
80
81
82
83
84
85
86
87
88
89
90
91
package main
import "html/template"
type FileMetadataPageParams struct {
BaseEventPageParams
OpenGraphParams
HeadParams
Details DetailsParams
Content template.HTML
FileMetadata Kind1063Metadata
IsImage bool
IsVideo bool
Clients []ClientReference
}
templ fileMetadataInnerBlock(params FileMetadataPageParams) {
if params.FileMetadata.Image != "" {
<img src={ params.FileMetadata.Image } alt={ params.Alt }/>
} else if params.IsImage {
<img src={ params.FileMetadata.URL } alt={ params.Alt }/>
} else if params.IsVideo {
<video
controls
width="100%%"
class="max-h-[90vh] bg-neutral-300 dark:bg-zinc-700"
>
<source src={ params.FileMetadata.URL } alt={ params.Alt }/>
</video>
}
<a
href={ templ.URL(params.FileMetadata.URL) }
target="_new"
class="not-prose mx-auto mb-3 block w-4/5 basis-full rounded-lg border-0 bg-strongpink px-4 py-2 text-center text-[17px] font-light text-white no-underline sm:w-2/6"
>Download file</a>
}
templ fileMetadataTemplate(params FileMetadataPageParams, isEmbed bool) {
<!DOCTYPE html>
if isEmbed {
@embeddedPageTemplate(
params.Event,
params.NeventNaked,
isEmbed,
) {
@fileMetadataInnerBlock(params)
}
} else {
@eventPageTemplate(
"File Metadata",
params.OpenGraphParams,
params.HeadParams,
params.Clients,
params.Details,
params.Event,
isEmbed,
) {
@fileMetadataInnerBlock(params)
}
}
}
templ fileMetadataDetails(params FileMetadataPageParams) {
if params.FileMetadata.Summary != "" {
<div class="mb-6 leading-5">
<div class="text-sm text-strongpink">Summary</div>
<span class="text-neutral-500 dark:text-neutral-300 text-[16px]">{ params.FileMetadata.Summary }</span>
</div>
}
if params.FileMetadata.Dim != "" {
<div class="mb-6 leading-5">
<div class="text-sm text-strongpink">Dimension</div>
<span class="text-neutral-500 dark:text-neutral-300 text-[16px]">{ params.FileMetadata.Dim }</span>
</div>
}
if params.FileMetadata.Size != "" {
<div class="mb-6 leading-5">
<div class="text-sm text-strongpink">Size</div>
<span class="text-neutral-500 dark:text-neutral-300 text-[16px]">{ params.FileMetadata.Size } bytes</span>
</div>
}
if params.FileMetadata.Magnet != "" {
<div class="mb-6 leading-5">
<div class="text-sm text-strongpink">Magnet URL</div>
<span class="text-neutral-500 dark:text-neutral-300 text-[16px]">{ params.FileMetadata.Magnet }</span>
</div>
}
}