From 01075c6bc42b30b3106b2ac8136b3749e1a1ccfb Mon Sep 17 00:00:00 2001 From: lza_menace Date: Thu, 30 Dec 2021 02:38:18 -0800 Subject: [PATCH] ux improvements --- suchwowx/config.py | 1 + suchwowx/filters.py | 12 ++++++++++++ suchwowx/templates/includes/meme_card.html | 4 ++-- suchwowx/templates/profile.html | 17 ++++++++++++++--- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/suchwowx/config.py b/suchwowx/config.py index 157368b..412379f 100644 --- a/suchwowx/config.py +++ b/suchwowx/config.py @@ -20,6 +20,7 @@ MAX_CONTENT_LENGTH = 32 * 1024 * 1024 TEMPLATES_AUTO_RELOAD = getenv('TEMPLATES_AUTO_RELOAD', True) # Contract +CONTRACT_TESTNET = getenv('TESTNET', True) CONTRACT_ADDRESS = '0x9797afc5d0258704109f71109188fdcba19c24c2' # Fuji CONTRACT_ABI = [ { diff --git a/suchwowx/filters.py b/suchwowx/filters.py index cc3e9e1..fe18e92 100644 --- a/suchwowx/filters.py +++ b/suchwowx/filters.py @@ -1,6 +1,8 @@ from flask import Blueprint from arrow import get as arrow_get +from suchwowx import config + bp = Blueprint('filters', 'filters') @@ -15,3 +17,13 @@ def shorten_address(a): @bp.app_template_filter('humanize') def humanize(d): return arrow_get(d).humanize() + +@bp.app_template_filter() +def show_snowtrace(s) -> str: + """ + Return proper links to Etherscan based upon the currently configured network. + """ + if config.CONTRACT_TESTNET: + return f'https://testnet.snowtrace.io/search?f=0&q={s}' + else: + return f'https://snowtrace.io/search?f=0&q={s}' diff --git a/suchwowx/templates/includes/meme_card.html b/suchwowx/templates/includes/meme_card.html index 469a4e6..d3996fc 100644 --- a/suchwowx/templates/includes/meme_card.html +++ b/suchwowx/templates/includes/meme_card.html @@ -24,8 +24,8 @@ {% endif %}
-

{{ meme.user.handle }}

-

{{ meme.user.public_address | shorten_address }}

+

{{ meme.user.handle }}

+

{{ meme.user.public_address | shorten_address }}

diff --git a/suchwowx/templates/profile.html b/suchwowx/templates/profile.html index f3fe682..88efd2b 100644 --- a/suchwowx/templates/profile.html +++ b/suchwowx/templates/profile.html @@ -26,24 +26,35 @@

From Local Database

- Handle: + Handle: {% if is_user %} + Publish AVAX + {% else %} + {{ user.handle }} {% endif %}

- Wownero Address: + Wownero Address: {% if is_user %} + Publish AVAX + {% else %} + {{ user.wownero_address }} {% endif %}

- Metadata IPFS Hash: + Metadata IPFS Hash: {% if is_user %} + Publish AVAX + {% else %} + {{ user.ipfs_hash }} {% endif %}

+ {% if is_user %}

Save DB

+ {% endif %}

Register Date: {{ user.register_date }}

Login Date: {{ user.last_login_date }}

Moderator: {{ user.is_moderator() }}