mirror of
https://github.com/aljazceru/njump.git
synced 2025-12-18 06:44:22 +01:00
80 lines
3.5 KiB
Plaintext
80 lines
3.5 KiB
Plaintext
package main
|
|
|
|
var compileTimeTs string
|
|
|
|
templ headCommonTemplate(params HeadParams) {
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
if params.Oembed != "" {
|
|
<link rel="alternate" type="application/json+oembed" href={ params.Oembed + "&format=json" }/>
|
|
<link rel="alternate" type="text/xml+oembed" href={ params.Oembed + "&format=xml" }/>
|
|
}
|
|
if params.IsProfile {
|
|
<link rel="apple-touch-icon" sizes="180x180" href="/njump/static/favicon/profile/apple-touch-icon.png?v=2"/>
|
|
<link rel="icon" type="image/png" sizes="32x32" href="/njump/static/favicon/profile/favicon-32x32.png?v=2"/>
|
|
<link rel="icon" type="image/png" sizes="16x16" href="/njump/static/favicon/profile/favicon-16x16.png?v=2"/>
|
|
} else {
|
|
<link rel="apple-touch-icon" sizes="180x180" href="/njump/static/favicon/event/apple-touch-icon.png?v=2"/>
|
|
<link rel="icon" type="image/png" sizes="32x32" href="/njump/static/favicon/event/favicon-32x32.png?v=2"/>
|
|
<link rel="icon" type="image/png" sizes="16x16" href="/njump/static/favicon/event/favicon-16x16.png?v=2"/>
|
|
}
|
|
<script src="https://unpkg.com/hyperscript.org@0.9.12"></script>
|
|
if tailwindDebugStuff != "" {
|
|
@templ.Raw(tailwindDebugStuff)
|
|
} else {
|
|
<link rel="stylesheet" type="text/css" href={ "/njump/static/tailwind-bundle.min.css?t=" + compileTimeTs }/>
|
|
}
|
|
<style> @media print { @page { margin: 2cm 3cm; } } </style>
|
|
<meta name="theme-color" content="#e42a6d"/>
|
|
if params.NaddrNaked != "" {
|
|
<link rel="canonical" href={ "https://njump.me/" + params.NaddrNaked }/>
|
|
} else {
|
|
<link rel="canonical" href={ "https://njump.me/" + params.NeventNaked }/>
|
|
}
|
|
<script type="text/hyperscript">
|
|
on load get [navigator.userAgent.includes('Safari'), navigator.userAgent.includes('Chrome')] then if it[0] is true and it[1] is false add .safari to <body /> end
|
|
</script>
|
|
}
|
|
|
|
templ authorHeaderTemplate(metadata Metadata) {
|
|
<header class="mb-4 max-w-full">
|
|
<a class="flex flex-wrap items-center" href={ templ.URL("/" + metadata.Npub()) }>
|
|
<div class="print:basis-1-12 imgclip mr-2 max-w-full basis-1/6 overflow-hidden sm:mr-4">
|
|
<img class="block h-auto w-full" src={ metadata.Picture }/>
|
|
</div>
|
|
<div class="block print:text-base sm:grow">
|
|
<div class="leading-4 sm:text-2xl">
|
|
{ metadata.Name }
|
|
if metadata.Name != metadata.DisplayName {
|
|
<span class="text-stone-400 sm:text-xl">/ { metadata.DisplayName } </span>
|
|
}
|
|
</div>
|
|
<div class="text-sm leading-4 text-stone-400 sm:text-base">
|
|
{ metadata.NpubShort() }
|
|
</div>
|
|
</div>
|
|
</a>
|
|
</header>
|
|
}
|
|
|
|
templ lastNotesTemplate(lastNotes []EnhancedEvent) {
|
|
<aside>
|
|
<div class="-ml-4 mb-6 h-1.5 w-1/3 bg-zinc-100 dark:bg-zinc-700 sm:-ml-2.5"></div>
|
|
<nav class="mb-6 leading-5">
|
|
<h2 class="text-2xl text-strongpink">Last Notes</h2>
|
|
for _, ee := range lastNotes {
|
|
<a class="my-8 block no-underline hover:-ml-6 hover:border-l-05rem hover:border-solid hover:border-l-gray-100 hover:pl-4 dark:hover:border-l-zinc-700" href={ templ.URL("/" + ee.Nevent()) }>
|
|
<div class="-ml-2.5 mb-1.5 flex flex-row flex-wrap border-b-4 border-solid border-b-gray-100 pb-1 pl-2.5 dark:border-b-neutral-800">
|
|
<div class="text-sm text-strongpink">{ ee.CreatedAtStr() }</div>
|
|
if ee.isReply() {
|
|
<div class="ml-2 text-sm text-gray-300 dark:text-gray-400">- reply</div>
|
|
}
|
|
</div>
|
|
<div class="mt-0.5 max-h-40 basis-full overflow-hidden hover:text-strongpink" _="on load if my scrollHeight > my offsetHeight add .gradient" dir="auto">
|
|
@templ.Raw(ee.Preview())
|
|
</div>
|
|
</a>
|
|
}
|
|
</nav>
|
|
</aside>
|
|
}
|