threads/templates/threads.html

187 lines
4.8 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ title }}</title>
<link rel="stylesheet" href="https://webcomponent.io/reset.css" />
<style>
body {
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
max-width: 570px;
margin: 0 auto;
color: #232323;
padding: 5px;
}
header, footer {
background: linear-gradient(45deg, #3054bf, #416fff);
padding: 1em;
color: white;
border-radius: 5px;
& a {
color: white;
}
}
ul {
list-style: none;
}
.card.descendant {
padding-bottom: 1em;
}
.card {
border-bottom: 1px solid rgba(34, 34, 34, 0.15);
margin-left: -40px;
background-color: #fff;
display: grid;
grid-template-columns: 55px auto;
gap: 5px;
}
.card_content {
padding: 1em 0;
& .invisible {
display: none;
}
& .ellipsis::after {
content: '...'
}
& img, & video, & p {
margin-bottom: 1em;
}
& img, & video {
border-radius: 5px;
max-width: 100%;
object-fit: cover;
border: 1px solid rgba(34, 34, 34, 0.15);
}
& .author a {
text-decoration: none;
&: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;
}
}
.card_avatar img {
border: 1px solid rgba(34, 34, 34, 0.35);
border-radius: 5px;
display: inline;
margin-top: 1em;
width: 50px;
}
</style>
</head>
<body>
<header>
<h1>{{ title }}</h1>
<a href="/">go home</a></nav>
</header>
<main>
<ul>
{% for thread in threads %}
<li class="card">
<div class="card_avatar">
{% if thread.account.avatar is defined %}
<img class="avatar" src="{{thread.account.avatar}}" />
{% endif %}
</div>
<div class="card_content">
<h3 class="author">
<a rel="author" href="{{thread.account.url}}">{{thread.account.display_name}}</a>
</h3>
{{thread.content | safe}}
{% for media in thread.media_attachments %}
{% if media.type == 'image'%}
<img src="{{media.url}}" />
{% elif media.type == 'gifv' %}
<video controls autoplay="autoplay" muted loop>
<source src="{{media.url}}" type="video/mp4">
Your browser does not support the video tag.
</video>
{% endif %}
{% endfor %}
{% if thread.descendants %}
<div class="meta">
<a href="{{thread.url}}" target="_blank">{{ thread.created_at }}</a>
</div>
<ul>
{% for descendant in thread.descendants %}
<li class="card descendant">
<div class="card_avatar">
{% if descendant.account.avatar is defined %}
<img class="avatar" src="{{thread.account.avatar}}" />
{% endif %}
</div>
<div class="card_content">
{{ descendant.content | safe }}
{% for media in descendant.media_attachments%}
{% if media.type == 'image'%}
<img src="{{media.url}}" />
{% elif media.type == 'gifv' %}
<video controls autoplay="autoplay" muted loop>
<source src="{{media.url}}" type="video/mp4">
Your browser does not support the video tag.
</video>
{% endif %}
{% endfor %}
<div class="meta">
<a href="{{descendant.url}}" target="_blank">{{ descendant.created_at }}</a>
</div>
</div>
<li>
{% endfor %}
</ul>
{% else %}
<a class="action" href="{{ url_for('threads.thread', id=thread.id) }}">Read full thread</a>
{% endif %}
</div>
</li>
{% endfor %}
</ul>
</main>
<footer>
&copy; {{ attribution.year }} {{ attribution.owner }}
<p>See the <a href="https://ayco.io/sh/threads">source code</a>. Or <a href="/">go home</a>.</p>
</footer>
</body>
</html>