summaryrefslogtreecommitdiffstats
path: root/adenosine-pds/templates
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2022-11-10 16:32:36 -0800
committerBryan Newbold <bnewbold@robocracy.org>2022-11-10 16:32:36 -0800
commitcd67cbbb2827c161aa6e99c93fe57f5500cbb789 (patch)
tree74288ae72c0f7ad07cf1f77416b180ab9a4f65c0 /adenosine-pds/templates
parent5e149eef22d34e5a2b2081de3533dee3373d47f8 (diff)
downloadadenosine-cd67cbbb2827c161aa6e99c93fe57f5500cbb789.tar.gz
adenosine-cd67cbbb2827c161aa6e99c93fe57f5500cbb789.zip
pds: more web view implementation
Diffstat (limited to 'adenosine-pds/templates')
-rw-r--r--adenosine-pds/templates/account.html36
-rw-r--r--adenosine-pds/templates/adenosine.css74
-rw-r--r--adenosine-pds/templates/at_collection.html7
-rw-r--r--adenosine-pds/templates/at_record.html7
-rw-r--r--adenosine-pds/templates/at_repo.html16
-rw-r--r--adenosine-pds/templates/base.html10
-rw-r--r--adenosine-pds/templates/macro.html41
-rw-r--r--adenosine-pds/templates/post.html5
-rw-r--r--adenosine-pds/templates/profile.html7
-rw-r--r--adenosine-pds/templates/thread.html8
10 files changed, 179 insertions, 32 deletions
diff --git a/adenosine-pds/templates/account.html b/adenosine-pds/templates/account.html
new file mode 100644
index 0000000..bd015d5
--- /dev/null
+++ b/adenosine-pds/templates/account.html
@@ -0,0 +1,36 @@
+{% extends "base.html" %}
+{% import "macro.html" as macro %}
+
+{% block main %}
+
+<article class="profile">
+<h4>
+ {% if profile.displayName.is_some() %}
+ <span class="display_name">{{ profile.displayName.as_ref().unwrap() }}</span>
+ {% endif %}
+ <span class="handle">@{{ profile.handle }}</span>
+</h4>
+<a href="/at/{{ profile.did }}" class="ident">{{ profile.did }}</a>
+
+{% if profile.description.is_some() %}
+ <p>{{ profile.description.as_ref().unwrap() }}
+{% endif %}
+
+<p class="counts">
+ [<a href="#">{{ profile.followersCount}} followers</a> /
+ <a href="#">{{ profile.followsCount }} follows</a>]
+</p>
+</article>
+
+{% if feed.len() == 0 %}
+ <center><i>--- no posts yet! ---</i></center>
+{% else %}
+ <center><i>--- showing {{ feed.len() }} of {{ profile.postsCount }} posts</i> ---</center>
+{% endif %}
+
+{% for item in feed %}
+ {% call macro::feed_item(item) %}
+{% endfor %}
+
+
+{% endblock %}
diff --git a/adenosine-pds/templates/adenosine.css b/adenosine-pds/templates/adenosine.css
index 0686f9e..9a0f890 100644
--- a/adenosine-pds/templates/adenosine.css
+++ b/adenosine-pds/templates/adenosine.css
@@ -622,5 +622,75 @@ progress:indeterminate::-moz-progress-bar {
}
/********** adenosine tweaks **********/
-body { font-family: var(--mono-font); }
-a { text-decoration: none; }
+body {
+ font-family: var(--mono-font);
+}
+a {
+ text-decoration: none;
+}
+main {
+ font-size: smaller;
+ padding-top: 0px;
+}
+h2 {
+ margin-top: 0px;
+ margin-bottom: 1rem;
+ font-size: 2.5em;
+}
+nav.header {
+ border-bottom: 2px dashed var(--border);
+}
+nav.header img {
+ vertical-align: middle;
+}
+nav.header span {
+ vertical-align: middle;
+ color: var(--text);
+}
+nav.header h1 {
+ font-weight: normal;
+ font-size: 2rem;
+ margin-top: 1rem;
+ margin-bottom: 0.5rem;
+}
+.ident, a:hover.ident, a:visited.ident {
+ color: var(--text-light);
+}
+.smaller {
+ font-size: smaller;
+}
+body footer {
+ border-top: 2px dashed var(--border);
+ padding: 1rem 1rem 1rem 1rem;
+}
+.counts {
+ color: var(--text-light);
+}
+.counts a {
+ color: var(--text-light);
+}
+p.counts {
+ margin-bottom: 0px;
+}
+.display_name {
+ color: green;
+ font-weight: normal;
+}
+.handle {
+ color: green;
+ font-weight: bold;
+}
+.feed_item {
+ margin-top: 1rem;
+ margin-bottom: 1rem;
+}
+.profile h4 {
+ margin-top: 0px;
+ margin-bottom: 0px;
+}
+.repo_aturi, .repo_aturi a, .repo_aturi a:visited {
+ color: var(--code);
+ font-size: smaller;
+ overflow: auto;
+ font-weight: bold;
+}
diff --git a/adenosine-pds/templates/at_collection.html b/adenosine-pds/templates/at_collection.html
index b4b7036..670cb0d 100644
--- a/adenosine-pds/templates/at_collection.html
+++ b/adenosine-pds/templates/at_collection.html
@@ -1,12 +1,13 @@
{% extends "base.html" %}
{% block main %}
-<p><b>at://{{ did }}/{{ collection }}/</b>
+<h2>ATP Repository Explorer</h2>
+<div class="repo_aturi">at://<a href="/at/{{ did }}">{{ did }}</a>/{{ collection }}/</div>
-<p><b>records:</b>
+<h4>Records</h4>
<ul>
{% for record in records %}
- <li><a href="/at/{{did}}/{{collection}}/{{record["tid"].as_str().unwrap() }}">{{ record["tid"].as_str().unwrap() }}</a>
+ <li>/{{ collection }}/<a href="/at/{{did}}/{{collection}}/{{record["tid"].as_str().unwrap() }}">{{ record["tid"].as_str().unwrap() }}</a>/
{% endfor %}
</ul>
{% endblock %}
diff --git a/adenosine-pds/templates/at_record.html b/adenosine-pds/templates/at_record.html
index 10ed838..829ed4a 100644
--- a/adenosine-pds/templates/at_record.html
+++ b/adenosine-pds/templates/at_record.html
@@ -1,8 +1,9 @@
{% extends "base.html" %}
{% block main %}
-<p><b>at://{{ did }}/{{ collection }}/{{ tid }}</b>
+<h2>ATP Repository Explorer</h2>
+<div class="repo_aturi">at://<a href="/at/{{ did }}">{{ did }}</a>/<a href="/at/{{ did }}/{{ collection }}">{{ collection }}</a>/{{ tid }}</div>
-<p><b>record json:</b>
-<pre><code>{{ record }}</code></pre>
+<h4>JSON</h4>
+<pre><code>{{ record|json }}</code></pre>
{% endblock %}
diff --git a/adenosine-pds/templates/at_repo.html b/adenosine-pds/templates/at_repo.html
index dcf4d87..384b8dc 100644
--- a/adenosine-pds/templates/at_repo.html
+++ b/adenosine-pds/templates/at_repo.html
@@ -1,18 +1,20 @@
{% extends "base.html" %}
{% block main %}
-<p><b>at://{{ did }}/</b>
+<h2>ATP Repository Explorer</h2>
+<div class="repo_aturi">at://{{ did }}/</div>
-<p><b>collections:</b>
+<h4>Collections</h4>
<ul>
{% for collection in describe.collections %}
- <li><a href="/at/{{ did }}/{{ collection }}">{{collection}}/</a>
+ <li>/<a href="/at/{{ did }}/{{ collection }}">{{collection}}</a>/
{% endfor %}
</ul>
-<p>repo commit:
-<pre><code>{{ "{:?}"|format(commit) }}</code></pre>
+<h4>Describe</h4>
+<pre><code>{{ describe|json }}</code></pre>
+
+<h4>Commit Node</h4>
+<pre><code>{{ commit|json }}</code></pre>
-<p>repo describe
-<pre><code>{{ "{:?}"|format(describe) }}</code></pre>
{% endblock %}
diff --git a/adenosine-pds/templates/base.html b/adenosine-pds/templates/base.html
index 0ae2061..cb88c0c 100644
--- a/adenosine-pds/templates/base.html
+++ b/adenosine-pds/templates/base.html
@@ -9,11 +9,11 @@
{% block head %}{% endblock %}
</head>
<body>
- <nav>
+ <nav class="header">
<a href="/">
- <h3>
- <img src="/static/logo_128.png" width="64" height="64">{{ domain }}
- </h3>
+ <h1>
+ <img src="/static/logo_128.png" width="48" height="48"><span> {{ domain }}</span>
+ </h1>
</a>
</nav>
<hr>
@@ -25,7 +25,7 @@
<nav>
<a href="/">home</a> -
<a href="/about">about</a> -
- <a href="https://gitlab.com/bnewbold/adenosine">source code</a>
+ <a href="https://gitlab.com/bnewbold/adenosine">adenosine v{{ env!("CARGO_PKG_VERSION") }}</a>
</nav>
</footer>
</body>
diff --git a/adenosine-pds/templates/macro.html b/adenosine-pds/templates/macro.html
new file mode 100644
index 0000000..1d38482
--- /dev/null
+++ b/adenosine-pds/templates/macro.html
@@ -0,0 +1,41 @@
+
+{% macro feed_item(item) %}
+
+<div class="feed_item">
+{% if item.repostedBy.is_some() %}
+ {% if item.author.displayName.is_some() %}{{ item.author.displayName.as_ref().unwrap() }}{% endif %}
+ <b>@{{ item.author.handle }}</b>
+{% endif %}
+
+<div style="float: right;">
+ <a class="item_timestamp" href="/u/{{ item.author.handle }}/post/{{ item.uri|aturi_to_tid }}">
+ {% if item.record["createdAt"].as_str().is_some() %}
+ {{ item.record["createdAt"].as_str().unwrap() }}
+ {% else %}
+ {{ item.indexedAt }}
+ {% endif %}
+ </a>
+</div>
+
+
+{% if item.author.displayName.is_some() %}
+ <a href="/u/{{ item.author.handle }}"><span class="display_name">{{ item.author.displayName.as_ref().unwrap() }}</span></a>
+{% endif %}
+<a href="/u/{{ item.author.handle }}"><span class="handle">@{{ item.author.handle }}</span></a>
+<br>
+{{ item.record["text"].as_str().unwrap() }}
+<br>
+<span class="counts">
+ [<a href="#">{{ item.likeCount }} like</a> / <a href="#">{{ item.repostCount }} repost</a> / <a href="#">{{ item.replyCount }} reply</a>]
+</span>
+
+{% if item.record.get("reply").is_some() %}
+<br>
+<b style="color: orange;">reply to:</b> <a href="{{ item.record["reply"]["uri"].as_str().unwrap()|aturi_to_thread_path }}">{{ item.record["reply"]["uri"] }}</a>
+{% endif %}
+
+<!-- TODO: "reposted by" -->
+<!-- TODO: "reply to" -->
+
+</div>
+{% endmacro %}
diff --git a/adenosine-pds/templates/post.html b/adenosine-pds/templates/post.html
deleted file mode 100644
index d7e6c85..0000000
--- a/adenosine-pds/templates/post.html
+++ /dev/null
@@ -1,5 +0,0 @@
-{% extends "base.html" %}
-
-{% block post %}
-Post page (TODO)
-{% endblock %}
diff --git a/adenosine-pds/templates/profile.html b/adenosine-pds/templates/profile.html
deleted file mode 100644
index 7c17951..0000000
--- a/adenosine-pds/templates/profile.html
+++ /dev/null
@@ -1,7 +0,0 @@
-{% extends "base.html" %}
-
-{% block main %}
-<p><b>at://{{ did }}/</b>
-
-<p>Profile page (TODO)
-{% endblock %}
diff --git a/adenosine-pds/templates/thread.html b/adenosine-pds/templates/thread.html
new file mode 100644
index 0000000..e2e2e96
--- /dev/null
+++ b/adenosine-pds/templates/thread.html
@@ -0,0 +1,8 @@
+{% extends "base.html" %}
+{% import "macro.html" as macro %}
+
+{% block post %}
+
+Post stuff will go here
+
+{% endblock %}