From 5fc765d8cb97027cf9204180b86e242e085cb2d5 Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Thu, 16 Jul 2020 23:21:02 +1200 Subject: [PATCH] Add badge to verified accounts --- .../html/static/img/verified.original.svg | 82 +++++++++++++++++++ src/site/html/static/img/verified.svg | 1 + src/site/pug/user.pug | 13 ++- src/site/sass/includes/_main.sass | 12 +++ src/site/server.js | 1 + 5 files changed, 107 insertions(+), 2 deletions(-) create mode 100644 src/site/html/static/img/verified.original.svg create mode 100644 src/site/html/static/img/verified.svg diff --git a/src/site/html/static/img/verified.original.svg b/src/site/html/static/img/verified.original.svg new file mode 100644 index 0000000..e42ada1 --- /dev/null +++ b/src/site/html/static/img/verified.original.svg @@ -0,0 +1,82 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/src/site/html/static/img/verified.svg b/src/site/html/static/img/verified.svg new file mode 100644 index 0000000..78ed15f --- /dev/null +++ b/src/site/html/static/img/verified.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/site/pug/user.pug b/src/site/pug/user.pug index e05bb4b..00821fe 100644 --- a/src/site/pug/user.pug +++ b/src/site/pug/user.pug @@ -10,6 +10,9 @@ include includes/feed_link mixin selector-button(text, selectorType, urlSuffix) a(href=(type !== selectorType && `/u/${user.data.username}${urlSuffix}`) class=(type === selectorType && "active")).selector= text +mixin verified-badge(classes) + img.verified-badge(class=classes src=getStaticURL("html", "/static/img/verified.svg") width=19 height=19 alt="Verified." title="Verified") + doctype html html head @@ -50,9 +53,15 @@ html The alt text is pathetic, I know. I don't have much to work with. if user.data.full_name h1.full-name= user.data.full_name - h2.username= `@${user.data.username}` + h2.username + = `@${user.data.username}` + if user.data.is_verified + +verified-badge("as-username") else - h1.full-name= `@${user.data.username}` + h1.full-name + = `@${user.data.username}` + if user.data.is_verified + +verified-badge("as-fullname") p.structured-text.bio - const bio = user.getStructuredBio() if bio diff --git a/src/site/sass/includes/_main.sass b/src/site/sass/includes/_main.sass index 0330424..1938457 100644 --- a/src/site/sass/includes/_main.sass +++ b/src/site/sass/includes/_main.sass @@ -123,6 +123,18 @@ body font-weight: normal color: map-get($theme, "foreground-header") + .verified-badge + position: relative + user-select: none + margin-left: 4px + + &.as-username + top: 4px + + &.as-fullname + top: 1px + + .bio margin: 20px 0px unicode-bidi: plaintext diff --git a/src/site/server.js b/src/site/server.js index d5b7b2b..cffc396 100644 --- a/src/site/server.js +++ b/src/site/server.js @@ -43,6 +43,7 @@ subdirs("pug", async (err, dirs) => { pinski.addPugDir("pug", dirs) pinski.addSassDir("sass", ["sass/includes", "sass/themes"]) pinski.addStaticHashTableDir("html/static/js") + pinski.addStaticHashTableDir("html/static/img") pinski.muteLogsStartingWith("/imageproxy") pinski.muteLogsStartingWith("/videoproxy") pinski.muteLogsStartingWith("/static")