rimgo/views/post.hbs

128 lines
3.6 KiB
Handlebars

<!DOCTYPE html>
<html lang="en">
<head>
<title>
{{#if post.Title}}
{{post.Title}} -
{{/if}}
rimgo
</title>
{{> partials/head }}
</head>
<body class="font-sans text-lg bg-slate-800 text-white">
{{> partials/nav }}
<section class="my-4 w-full flex flex-col items-center">
{{> partials/searchBar }}
</section>
<header>
<h1 class="text-3xl font-bold">{{post.Title}}</h1>
<p>{{post.CreatedAt}}</p>
</header>
<main>
<div class="flex flex-col sm:flex-row my-4 w-full justify-between">
<div class="flex flex-col gap-2 md:flex-row md:gap-4 md:items-center">
{{#if post.User.Username}}
<a href="/user/{{post.User.Username}}" class="flex gap-2 items-center">
<img src="{{post.User.Avatar}}" class="rounded-full" width="36" height="36" />
<p>
<b>{{post.User.Username}}</b>
</p>
</a>
{{/if}}
<div class="flex gap-2 items-center">
<div class="flex flex-center gap-2">
<img class="icon invert" src="/static/icons/PhEye.svg" alt="Views" width="24px" height="24px">
<p>{{post.Views}}</p>
</div>
{{#if post.SharedWithCommunity}}
<div class="flex flex-center gap-2">
<img class="icon invert" src="/static/icons/PhArrowFatUp.svg" alt="Likes" width="24px" height="24px">
<p>{{post.Upvotes}}</p>
</div>
<div class="flex flex-center gap-2">
<img class="icon invert" src="/static/icons/PhArrowFatDown.svg" alt="Dislikes" width="24px" height="24px">
<p>{{post.Downvotes}}</p>
</div>
{{/if}}
</div>
</div>
{{#noteq next ""}}
<a href="{{next}}" class="self-end">
<button class="p-2 rounded-lg bg-slate-600">Next &gt;</button>
</a>
{{/noteq}}
</div>
<div class="flex flex-center flex-col break-words">
{{#each post.Media}}
{{#if this.Title}}
<h4 class="font-bold">{{this.Title}}</h4>
{{/if}}
{{#equal this.Type "image"}}
<img class="my-2 max-h-96 object-contain" src="{{this.Url}}" loading="lazy">
{{/equal}}
{{#equal this.Type "video"}}
<video class="my-2 max-h-96 object-contain" controls loop>
<source type="{{this.MimeType}}" src="{{this.Url}}" />
</video>
{{/equal}}
{{#if this.Description}}
<p>{{{this.Description}}}</p>
{{/if}}
{{/each}}
</div>
{{#if post.tags}}
<div class="flex gap-2 my-2 flex-wrap">
<style nonce="{{nonce}}">
{{#each post.tags}}
.{{this.BackgroundId}} { background-image: url('{{this.Background}}') }
{{/each}}
</style>
{{#each post.tags}}
<a href="/t/{{this.Tag}}">
<div class="rounded-md p-4 min-w-[110px] bg-slate-500 {{this.BackgroundId}}">
<p class="font-bold text-white text-center">
{{#if tag.Display}}
{{this.Display}}
{{else}}
{{this.Tag}}
{{/if}}
</p>
</div>
</a>
{{/each}}
</div>
{{/if}}
</main>
<section>
{{#if comments}}
<div>
<input id="comments__expandBtn" type="checkbox" checked>
<label class="comments__expandBtn__label my-2 py-4 border-solid border-t-2 border-slate-400"
for="comments__expandBtn">
<h3 class="text-xl font-bold">Comments ({{post.Comments}})</h3>
<span class="text-xl font-bold"></span>
</label>
<div class="comments flex flex-col gap-2">
{{#each comments}}
{{> partials/comment }}
{{/each}}
</div>
</div>
{{/if}}
</section>
{{> partials/footer }}
</body>
</html>