threads/templates/threads.html
2024-04-28 10:04:02 +02:00

343 lines
10 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{ app.title }}</title>
<meta name="theme-color" content="#3054bf">
{% if threads|length == 1 %}
<meta name="description" content="{{ threads[0].summary }}" />
<meta property="og:description" content="{{ threads[0].summary }}" />
{% else %}
<meta name="description" content="{{ app.description }}" />
<meta property="og:description" content="{{ app.description }}" />
{% endif %}
<meta name="author" content="{{ attribution.owner }}" />
<meta property="og:type" content="website" />
<meta property="og:site_name" content="{{ app.site_name }}" />
<meta property="og:title" content="{{ app.title }}" />
<link rel="stylesheet" href="https://webcomponent.io/reset.css" />
<style>
body {
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
max-width: 600px;
margin: 0 auto;
color: #232323;
padding: 5px;
}
header, footer, main {
padding: 1em;
}
header, footer {
background: linear-gradient(45deg, #3054bf, #416fff);
color: white;
border-radius: 5px;
& a {
color: white;
}
}
ul {
list-style: none;
}
.card.descendant {
/* TODO: damn, fix the markup maybe */
margin-left: calc(-80px - 1em - 5px);
}
.card {
margin-left: -40px;
background-color: #fff;
display: grid;
grid-template-columns: 55px auto;
gap: 5px;
padding: 1em 0;
}
.card_content {
& .invisible {
display: none;
}
& .emoji {
display: inline;
height: calc(1rem + 6px);
margin-bottom: -4px;
}
& .ellipsis::after {
content: '...'
}
& .body {
& code {
background: rgb(245, 242, 240);
padding: 0.25em 0.3em;
border-radius: 5px;
display: inline;
}
& .media, & .link_card {
border: 1px solid rgba(34, 34, 34, 0.15);
border-radius: 5px;
box-shadow: 5px 25px 10px -25px rgba(34, 34, 34, 0.15);
max-width: 100%;
margin: 15px 0 1em;
object-fit: cover;
}
& .media:hover, & .link_card:hover {
color: blue;
text-decoration-color: blue;
border-color: blue;
}
& p {
margin-bottom: 0.5em;
}
}
& .heading {
display: grid;
grid-template-columns: auto auto;
gap: 5px;
& .right_menu {
padding-top: 5px;
font-size: small;
text-align: right;
color: #888;
& a:hover{
color: blue
}
& a{
color: #888;
}
}
& .author a {
display: block;
text-decoration: none;
color: #232323;
&:hover {
text-decoration: underline;
}
}
}
& .meta {
margin-bottom: 5px;
& a {
font-size: small;
color: #555;
}
& a:hover {
color: blue;
}
}
& .action {
color: blue;
margin: 1em 0;
cursor: pointer;
margin-top: 1em;
}
& .link_card {
color: #555;
text-decoration: underline;
text-decoration-color: #888;
& strong, & small {
text-decoration-thickness: 1px;
display: block;
}
padding: 1rem;
}
}
.card_avatar img {
border-radius: 50%;
display: inline;
width: 50px;
}
</style>
</head>
<body>
<header>
<nav><a href="/">Go home</a></nav>
<h1>{{ app.title }}</h1>
<p>{{ app.description }}</p>
</header>
<main>
{% if threads|length == 1 and threads[0].descendants %}
<div class="back">
<a href="{{url_for('threads.home')}}">Back</a>
</div>
{% endif %}
<ul>
{% for thread in threads %}
<li class="card">
<div class="card_avatar">
{% if thread.account.avatar is defined %}
<a href="{{ thread.account.avatar }}">
<img class="avatar" src="{{ thread.account.avatar }}"
alt="avatar of {{ thread.account.display_name }}"
title="avatar of {{ thread.account.display_name }}" />
</a>
{% endif %}
</div>
<div class="card_content" id="{{ thread.id }}">
<div class="heading">
<h3 class="author">
<a rel="author" href="{{thread.account.url}}">{{thread.account.display_name | safe}}</a>
</h3>
<div class="right_menu">
<a href="{{ thread.url }}" title="{{ thread.created_at | format_date }}">{{ thread.created_at | time_ago }}</a> &middot;
<a href="{{ url_for('threads.thread', id=thread['id']) + '#' + thread['id'] }}">Anchor</a>
</div>
</div>
<div class="body">
{{thread.content | safe}} {% if thread.descendants is defined %}
{% for media in thread.media_attachments %} {% if media.type ==
'image'%}
<a href="{{ media.url }}">
<img
class="media"
src="{{media.preview_url}}"
alt="{{ media.description or 'media attachment' }}"
title="{{ media.description or 'media attachment' }}"
/>
</a>
{% elif media.type == 'gifv' %}
<video
class="media"
controls
autoplay="autoplay"
muted
loop
alt="{{ media.description or 'media attachment' }}"
title="{{ media.description or 'media attachment' }}"
>
<source src="{{media.url}}" type="video/mp4" />
Your browser does not support the video tag.
</video>
{% endif %} {% endfor %} {% endif %}
</div>
{% if thread.descendants is defined %}
<ul>
{% for descendant in thread.descendants %}
<li class="card descendant">
<div class="card_avatar">
{% if descendant.account.avatar is defined %}
<a href="{{ descendant.account.avatar }}">
<img class="avatar" src="{{ descendant.account.avatar }}"
alt="avatar of {{ descendant.account.display_name }}"
title="avatar of {{ descendant.account.display_name }}" />
</a>
{% endif %}
</div>
<div class="card_content" id="{{ descendant.id }}">
<div class="heading">
<h3 class="author">
<a rel="author" href="{{descendant.account.url}}"
>{{descendant.account.display_name | safe}}</a
>
</h3>
<div class="right_menu">
<a href="{{ descendant.url }}" title="{{ descendant.created_at | format_date }}">{{ descendant.created_at | time_ago }}</a> &middot;
<a href="{{ url_for('threads.thread', id=thread['id']) + '#' + descendant['id'] }}">Anchor</a>
</div>
</div>
<div class="body">
{{ descendant.content | safe }}
{% for media in descendant.media_attachments%}
{% if media.type == 'image'%}
<a href="{{ media.url }}">
<img
class="media"
src="{{media.preview_url}}"
alt="{{ media.description or 'media attachment' }}"
title="{{ media.description or 'media attachment' }}"
/>
</a>
{% elif media.type == 'gifv' %}
<video
class="media"
controls
autoplay="autoplay"
muted
loop
alt="{{ media.description or 'media attachment' }}"
title="{{ media.description or 'media attachment' }}"
>
<source src="{{media.url}}" type="video/mp4" />
Your browser does not support the video tag.
</video>
{% endif %}
{% endfor %}
{% if descendant.card %}
<a href="{{ descendant.card.url }}">
<div class="link_card">
<small>
{{ descendant.card.provider_name or
descendant.card.provider_url }}
</small>
<strong>{{ descendant.card.title }}</strong>
<small>{{descendant.card.description}}</small>
</div>
</a>
{% endif %}
</div>
</div>
</li>
<li>{% endfor %}</li>
</ul>
{% else %}
<a
class="action"
href="{{ url_for('threads.thread', id=thread.id) }}"
>Read full thread</a
>
{% endif %}
</div>
</li>
{% endfor %}
</ul>
</main>
<footer>
<p>
Copyright &copy;
{% if attribution.current_year %}
{{ attribution.year}}-{{ attribution.current_year }}
{% else %}
{{ attribution.year}}
{% endif %}
{{ attribution.owner }}
</p>
<p>Powered by <a href="https://ayco.io/sh/threads">/threads</a></p>
</footer>
</body>
</html>