peach-workspace/peach-web/templates/scuttlebutt/profile.html.tera

74 lines
4.1 KiB
Plaintext

{%- extends "nav" -%}
{%- block card %}
<!-- USER PROFILE -->
<div class="card center">
{# only render the profile info elements if the sbot is active #}
{%- if sbot_status and sbot_status.state == "active" %}
<!-- PROFILE INFO BOX -->
<div class="capsule capsule-profile border-ssb" title="Scuttlebutt account profile information">
{% if is_local_profile %}
<!-- edit profile button -->
<a class="nav-icon-right" href="/scuttlebutt/profile/update" title="Edit your profile">
<img id="editProfile" class="icon-small icon-active" src="/icons/pencil.svg" alt="Edit">
</a>
{% endif %}
<!-- PROFILE BIO -->
<!-- profile picture -->
{# only try to render profile pic if we have the blob #}
{%- if blob_path and blob_exists == true %}
<img id="profilePicture" class="icon-large" src="/blob/{{ blob_path }}" title="Profile picture" alt="Profile picture">
{% else %}
{# render a placeholder profile picture (icon) #}
<img id="profilePicture" class="icon" src="/icons/user.svg" title="Profile picture" alt="Profile picture">
{% endif %}
<!-- name, public key & description -->
<p id="profileName" class="card-text" title="Name">{{ name }}</p>
<label class="label-small label-ellipsis font-gray" style="user-select: all;" for="profileName" title="Public Key">{{ id }}</label>
<p id="profileDescription" style="margin-top: 1rem" class="card-text" title="Description">{{ description }}</p>
</div>
{% if is_local_profile %}
<!-- PUBLIC POST FORM -->
<form id="postForm" class="center" action="/scuttlebutt/publish" method="post">
<!-- input for message contents -->
<textarea id="publicPost" class="center input message-input" name="text" title="Compose Public Post" placeholder="Write a public post..."></textarea>
<input id="publishPost" class="button button-primary center" title="Publish" type="submit" value="Publish">
</form>
{% else %}
<!-- BUTTONS -->
<!-- TODO: each of these buttons needs to be a form with a public key -->
<div id="buttons" style="margin-top: 2rem;">
{% if following == false %}
<form id="followForm" action="/scuttlebutt/follow" method="post">
<input type="hidden" id="publicKey" name="public_key" value="{{ id }}">
<input id="followPeer" class="button button-primary center" type="submit" title="Follow Peer" value="Follow">
</form>
{% elif following == true %}
<form id="unfollowForm" action="/scuttlebutt/unfollow" method="post">
<input type="hidden" id="publicKey" name="public_key" value="{{ id }}">
<input id="unfollowPeer" class="button button-primary center" type="submit" title="Unfollow Peer" value="Unfollow">
</form>
{% else %}
<p>Unable to determine follow state</p>
{% endif %}
{% if blocking == false %}
<form id="blockForm" action="/scuttlebutt/block" method="post">
<input type="hidden" id="publicKey" name="public_key" value="{{ id }}">
<input id="blockPeer" class="button button-primary center" type="submit" title="Block Peer" value="Block">
</form>
{% elif blocking == true %}
<form id="unblockForm" action="/scuttlebutt/unblock" method="post">
<input type="hidden" id="publicKey" name="public_key" value="{{ id }}">
<input id="unblockPeer" class="button button-primary center" type="submit" title="Unblock Peer" value="Unblock">
</form>
{% else %}
<p>Unable to determine block state</p>
{% endif %}
<a id="privateMessage" class="button button-primary center" href="/scuttlebutt/private?public_key={{ id }}" title="Private Message">Send Private Message</a>
</div>
{%- endif %}
{%- endif %}
<!-- FLASH MESSAGE -->
{% include "snippets/flash_message" %}
</div>
{%- endblock card -%}