Finishing up the MVP

This commit is contained in:
Bad Manners 2025-04-13 23:13:51 -03:00
parent 3619063e68
commit 7f533cc583
25 changed files with 535 additions and 291 deletions

View file

@ -2,9 +2,12 @@
<html lang="en">
<head>
<title>Create pool - {{ application_name }}</title>
<meta property="og:site_name" content="{{ application_name }}" />
{% include "fragments/common_headers.html" %}
</head>
<body>
{% if age_confirmation %}{% include "fragments/age_restricted_check.html"
%}{% endif %}
<div><a href="/">&lt; To home</a></div>
<main>
<h1>Create pool</h1>

View file

@ -2,9 +2,12 @@
<html lang="en">
<head>
<title>{{ application_name }}</title>
<meta property="og:site_name" content="{{ application_name }}" />
{% include "fragments/common_headers.html" %}
</head>
<body>
{% if age_confirmation %}{% include "fragments/age_restricted_check.html"
%}{% endif %}
<main>
<h1>{{ application_name }}</h1>
<article>

View file

@ -2,9 +2,12 @@
<html lang="en">
<head>
<title>Login - {{ application_name }}</title>
<meta property="og:site_name" content="{{ application_name }}" />
{% include "fragments/common_headers.html" %}
</head>
<body>
{% if age_confirmation %}{% include "fragments/age_restricted_check.html"
%}{% endif %}
<div><a href="/">&lt; To home</a></div>
<main>
<h1>Login</h1>

View file

@ -2,6 +2,7 @@
<html lang="en">
<head>
<title>Pool - {{ pool.name }} - {{ application_name }}</title>
<meta property="og:site_name" content="{{ application_name }}" />
{% include "fragments/common_headers.html" %}
<script src="/static/sortable.js"></script>
<meta property="og:title" content="{{ pool.name }}" />
@ -47,16 +48,37 @@
{% endif %}
</head>
<body>
{% if age_confirmation %}{% include "fragments/age_restricted_check.html"
%}{% endif %}
<div><a href="/">&lt; To home</a></div>
<main>
<h1 id="pool-title">Pool - {{ pool.name }}</h1>
<article>
<h2>Posts</h2>
{% include "fragments/pool_posts.html" %}
</article>
</main>
<article>
<h2>Posts</h2>
{% include "fragments/pool_posts.html" %}
</article>
{% if can_edit %}
<hr />
<article>
<h2>Add post to pool</h2>
<form
hx-post="/pool/{{ pool.id }}/post"
hx-target="#pool-posts"
hx-swap="outerHTML"
>
<input
id="add-post-input"
type="text"
name="post_id"
placeholder="Post ID"
pattern="[0-9]*"
/>
<button>Add post</button>
</form>
</article>
<article>
<h2>Pool settings</h2>
<div>
<label>Rename pool</label>
<input
@ -66,7 +88,6 @@
hx-trigger="input changed delay:500ms, keyup[key=='Enter']"
hx-swap="none"
placeholder="Name"
pattern="[0-9]*"
value="{{ pool.name }}"
/>
</div>
@ -85,23 +106,6 @@
value="true"
/>
</div>
<form
hx-post="/pool/{{ pool.id }}/post"
hx-target="#pool-posts"
hx-swap="outerHTML"
>
<div>
<label>Add post</label>
<input
id="add-post-input"
type="text"
name="post_id"
placeholder="Post ID"
pattern="[0-9]*"
/>
<button>Add post</button>
</div>
</form>
</article>
{% endif %}
</body>

View file

@ -2,9 +2,12 @@
<html lang="en">
<head>
<title>Pools - {{ application_name }}</title>
<meta property="og:site_name" content="{{ application_name }}" />
{% include "fragments/common_headers.html" %}
</head>
<body>
{% if age_confirmation %}{% include "fragments/age_restricted_check.html"
%}{% endif %}
<div><a href="/">&lt; To home</a></div>
<main>
<h1>Pools</h1>
@ -18,8 +21,10 @@
</li>
{% endfor %}
</ul>
<hr />
<div>
<ul>
<div class="flex"><span>Pages</span></div>
<ul class="reset flex">
{% for i in 1..=page_count %}
<li>
{% if i == page as u64 %}

View file

@ -2,9 +2,12 @@
<html lang="en">
<head>
<title>Posts - {{ application_name }}</title>
<meta property="og:site_name" content="{{ application_name }}" />
{% include "fragments/common_headers.html" %}
</head>
<body>
{% if age_confirmation %}{% include "fragments/age_restricted_check.html"
%}{% endif %}
<div><a href="/">&lt; To home</a></div>
<article>
<h2>Search</h2>
@ -49,8 +52,10 @@
{% endfor %}
</ul>
</div>
<hr>
<div>
<ul>
<div class="flex"><span>Pages</span></div>
<ul class="reset flex">
{% for i in 1..=page_count %}
<li>
{% if i == page as u64 %}

View file

@ -2,19 +2,38 @@
<html lang="en">
<head>
<title>Settings - {{ application_name }}</title>
<meta property="og:site_name" content="{{ application_name }}" />
{% include "fragments/common_headers.html" %}
</head>
<body>
{% if age_confirmation %}{% include "fragments/age_restricted_check.html"
%}{% endif %}
<div><a href="/">&lt; To home</a></div>
<main>
<h1>Settings</h1>
<form hx-put="/settings" hx-swap="none">
<label>Application name</label>
<input
name="application_name"
type="text"
value="{{ application_name }}"
/>
<form method="post" action="/settings">
<div>
<label>Application name</label>
<input
name="application_name"
type="text"
value="{{ application_name }}"
/>
</div>
<div>
<label>Ask for age confirmation?</label>
<input
name="age_confirmation"
type="checkbox"
{%
if
age_confirmation
%}checked{%
endif
%}
value="true"
/>
</div>
<button>Save changes</button>
</form>
</main>

View file

@ -2,9 +2,12 @@
<html lang="en">
<head>
<title>Upload media - {{ application_name }}</title>
<meta property="og:site_name" content="{{ application_name }}" />
{% include "fragments/common_headers.html" %}
</head>
<body>
{% if age_confirmation %}{% include "fragments/age_restricted_check.html"
%}{% endif %}
<div><a href="/">&lt; To home</a></div>
<main>
<h1>Upload media</h1>
@ -15,7 +18,7 @@
type="file"
id="media-file"
name="media-file"
accept=".jpg, .jpeg, .png, .webp, .gif, .mp4, .webm, .mkv, .mov"
accept=".jpg, .jpeg, .png, .webp, .gif, .bmp, .tiff, .mp4, .webm, .mkv, .mov"
/>
<button type="submit">Create post</button>
</form>

View file

@ -2,6 +2,7 @@
<html lang="en">
<head>
<title>Post #{{ post.id }} - {{ application_name }}</title>
<meta property="og:site_name" content="{{ application_name }}" />
{% include "fragments/common_headers.html" %}
{% if let Some(title) = post.title %}<meta property="og:title" content="{{ title }}"/>{% else %}<meta property="og:title" content="{{ tags_post }}" />{% endif %}
<meta property="og:url" content="/post/{{ post.id }}" />
@ -12,11 +13,11 @@
<meta property="og:image:height" content="{{ post.height }}" />
<meta property="og:image:alt" content="{{ tags_post }}" />
<meta property="twitter:card" content="summary_large_image" />
{% if let Some(title) = post.title %}<meta property="twitter:title" content="{{ title }}"/>{% else %}<meta property="twitter:title" content="{{ tags_post }}"/>{% endif %}
{% if let Some(title) = post.title %}<meta property="twitter:title" content="{{ title }}"/>{% else %}<meta property="twitter:title" content="{{ tags_post }}" />{% endif %}
{% if let Some(description) = post.description %}<meta property="twitter:description" content="{{ description }}" />{% endif %}
<meta property="twitter:image" content="/files/{{ post.media }}" />
{% when "video" %}
<meta property="og:type" content="video.other">
<meta property="og:type" content="video.other" />
<meta property="og:video" content="/files/{{ post.media }}" />
<meta property="og:video:width" content="{{ post.width }}" />
<meta property="og:video:height" content="{{ post.height }}" />
@ -25,6 +26,8 @@
{% else %} {% endmatch %}
</head>
<body>
{% if age_confirmation %}{% include "fragments/age_restricted_check.html"
%}{% endif %}
<div><a href="{% if let Some(tags_text) = tags_text %}/posts/1?tags={{ tags_text.replace(' ', "+") }}{% else %}/posts/1{% endif %}">&lt; To posts</a></div>
<article>
<h2>Search</h2>
@ -34,44 +37,48 @@
type="text"
id="search-tags"
name="tags"
placeholder="Tags"
hx-post="/search_tags"
hx-trigger="input changed"
hx-target="next .tags-autocomplete"
hx-vals="js:{selection_end: event.target.selectionEnd}"
hx-on::after-settle="this.focus(); this.setSelectionRange(-1, -1);"
value="{% if let Some(tags_text) = tags_text %}{{ tags_text }}{% endif %}"
autofocus
/>
<ul class="reset tags-autocomplete" id="search-autocomplete"></ul>
<button type="submit">Search</button>
</form>
</article>
<article>
<h2>Tags</h2>
{% if tags.is_empty() %}
<p>No tags in post. Consider adding some!</p>
{% else %}
<ul id="tags-list">
{% for tag in tags %}
<li>
<a href="/posts?tags={{ tag.name }}">{{ tag.name }}</a>
</li>
<table>
{% for item in pool_data %}
<tr>
<td>
{% if let Some(previous_post_id) = item.previous_post_id %}
<a href="/post/{{ previous_post_id }}">&lt; Previous</a>
{% endif %}
</td>
<th>
<a href="/pool/{{ item.id }}">Pool: {{ item.name }}</a>
</th>
<td>
{% if let Some(next_post_id) = item.next_post_id %}
<a href="/post/{{ next_post_id }}">Next &gt;</a>
{% endif %}
</td>
</tr>
{% endfor %}
</ul>
{% endif %}
</table>
</article>
<main>
<h1>View post #{{ post.id }}</h1>
<div class="center-item">
<div class="center-item" x-data="{ maximized: false, width: {{ post.width }}, height: {{ post.height }} }">
{% match post.media_type.as_ref() %}{% when "image" %}{% include
"fragments/get_image_media.html" %}{% when "video" %}{% include
"fragments/get_video_media.html" %}{% else %}{% endmatch %}
</div>
</main>
<article>
<h2>Details</h2>
{% include "fragments/post_details.html" %}
</article>
{% include "fragments/post_details.html" %}
{% if let Some(parent_post) = parent_post %}
<article id="parent-post">
<h2>Parent post</h2>
@ -105,5 +112,19 @@
</ul>
</article>
{% endif %}
<article>
<h2>Tags</h2>
{% if tags.is_empty() %}
<p>No tags in post. Consider adding some!</p>
{% else %}
<ul id="tags-list">
{% for tag in tags %}
<li>
<a href="/posts?tags={{ tag.name }}">{{ tag.name }}</a>
</li>
{% endfor %}
</ul>
{% endif %}
</article>
</body>
</html>