From 249c5933799710ac3cb5c249770b32cb02e8faf4 Mon Sep 17 00:00:00 2001 From: TLSM Date: Thu, 11 Aug 2022 03:27:08 -0400 Subject: [PATCH] Hats: frontend interface, migrate cakeday. Getting the basic hats frontend changes into master so my branch stops diverging from the templates. Migrates the existing cakeday partyhat functionality to the new system also. Establishes a (hopefully) static interface for PFP hat display: - Hat image assets are 100px w x 130px h and anchored to the bottom- left corner of pfps. - User.hat_active provides either empty string or the internal string identifier for active user hat. - User.hat_tooltip provides mouseover text. Likely only to be used for cakeday hats on one's cakeday. Additionally, per discussion with Carp, PFPs in comments and posts increased from 25px diameter to 30px. --- files/assets/css/main.css | 72 ++++++++++++++---------- files/assets/images/hats/cakeday-1.webp | Bin 0 -> 4816 bytes files/classes/user.py | 21 +++++++ files/helpers/const.py | 3 + files/templates/comments.html | 10 ++-- files/templates/header.html | 10 ++-- files/templates/submission.html | 10 ++-- files/templates/submission_listing.html | 10 ++-- files/templates/userpage.html | 19 +++++-- files/templates/util/assetcache.html | 2 +- 10 files changed, 103 insertions(+), 54 deletions(-) create mode 100644 files/assets/images/hats/cakeday-1.webp diff --git a/files/assets/css/main.css b/files/assets/css/main.css index 1c6cb3090..24e11ece8 100644 --- a/files/assets/css/main.css +++ b/files/assets/css/main.css @@ -3366,6 +3366,14 @@ small, .small { object-fit: cover; background-color: var(--gray-600); } +.profile-pic-30 { + width: 30px; + height: 30px; + border-radius: 50%; + text-align: center; + object-fit: cover; + background-color: var(--gray-600); +} .profile-pic-35 { width: 35px; height: 35px; @@ -3406,6 +3414,37 @@ small, .small { object-fit: cover; background-color: var(--gray-600); } + +.profile-pic-30-wrapper, +.profile-pic-35-wrapper, +.profile-pic-65-wrapper, +.profile-pic-100-wrapper { + display: inline-block; + position: relative; + vertical-align: middle; +} +.profile-pic-30-hat, +.profile-pic-35-hat, +.profile-pic-65-hat, +.profile-pic-100-hat { + position: absolute; + left: 0; + bottom: 0; +} + +.profile-pic-30-wrapper { width: 30px; height: 30px; } +.profile-pic-35-wrapper { width: 35px; height: 35px; } +.profile-pic-65-wrapper { width: 65px; height: 65px; } +.profile-pic-100-wrapper { width: 100px; height: 100px; } +.profile-pic-30-hat { width: 30px; } +.profile-pic-35-hat { width: 35px; } +.profile-pic-65-hat { width: 65px; } +.profile-pic-100-hat { width: 100px; } + +.profile--pfp--hat { + margin-top: 20px; +} + .card-header:first-child { border-radius: 0.35rem 0.35rem 0 0; } @@ -3730,6 +3769,7 @@ small, .small { color: var(--muted); margin-bottom: 0.25rem; margin-top: -0.25rem; + padding-top: 10px; } .comment .comment-body .user-name { color: var(--black); @@ -3876,7 +3916,7 @@ ul.comment-section { .comment.collapsed .user-info { margin-bottom: 0; } -.comment.collapsed .profile-pic-25 { +.comment.collapsed .profile-pic-30 { opacity: 0.5; } .comment.collapsed .comment-body { @@ -5085,7 +5125,7 @@ html { scroll-padding-top: 100px; } .comment .comment-body { - padding: 3px 0 0 0; + padding: 0px 0 0 0; } .comment-anchor { padding: 1px; @@ -5353,34 +5393,6 @@ th, td { } } -.party-hat { - cursor: pointer; - height: 20px; - position: absolute; - transform: translate(-36px, -10px); -} - -.party-hat2 { - cursor: pointer; - height: 50px; - position: absolute; - transform: translate(-100px,-30px); -} - -.party-hat3 { - cursor: pointer; - height: 40px; - position: absolute; - transform: translate(-70px,-22px); -} - -.party-hat4 { - cursor: pointer; - height: 30px; - position: absolute; - transform: translate(-40px,-20px); -} - .checkmark { color: #1DA1F2 !important; } diff --git a/files/assets/images/hats/cakeday-1.webp b/files/assets/images/hats/cakeday-1.webp new file mode 100644 index 0000000000000000000000000000000000000000..8ff14c49264980305b05f0db4868230ab730241d GIT binary patch literal 4816 zcmV;>5-;siNk&G<5&!^KMM6+kP&iDy5&!@%V?ZDfBG3K*udSVJTdLS#UY2Cb0?W26 zlWZ?$W@hpt<6<)7;?2y=`;~0wFf%hVQxpDYny7}nQp_`#f)08vtNY zBJF;`9Wzf%QZis*AR-uG!E$tWFO7q(XUDm{#&&n_zTMs3-QC^&ev@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M(H<&@QyXU;Y`VmDsM&Ve{Q+Bq-3qry93@rDR*g7Bv- z{?})TU$`#icWJV{3{|L@^S-#b4xJjUvVD%!7t=W~ugv$C()YUwE_w+DEd&#Wcq%0s z8{vNu>2Ay_ca8@=d1~gyYPZ^H^2UGz_1^iN7A - - {% if c.author.is_cakeday %} - - {% endif %} +
+ + {% if c.author.hat_active -%} + + {%- endif %} +
{{c.author_name}}
{% if FEATURES['PRONOUNS'] %} diff --git a/files/templates/header.html b/files/templates/header.html index 24339a14c..9c58da980 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -199,11 +199,11 @@
- - {% if p.author.is_cakeday %} - - {% endif %} +
+ + {% if p.author.hat_active -%} + + {%- endif %} +
{{p.author_name}}
{% if FEATURES['PRONOUNS'] %} diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index 5c9341636..b4f85cdb4 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -206,10 +206,12 @@ {% if p.author.verified %} {% endif %} - - {% if p.author.is_cakeday %} - - {% endif %} +
+ + {% if p.author.hat_active -%} + + {%- endif %} +
{{p.author_name}}
{% if FEATURES['PRONOUNS'] %} diff --git a/files/templates/userpage.html b/files/templates/userpage.html index dde645b45..07e3bc601 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -38,11 +38,13 @@
-
- - {% if u.is_cakeday %} - - {% endif %} +
{% if u.is_suspended %} @@ -392,7 +394,12 @@
- + + + {% if u.hat_active -%} + + {%- endif %} + {% if u.is_cakeday %} {% endif %} diff --git a/files/templates/util/assetcache.html b/files/templates/util/assetcache.html index 8687b4094..d0e3ba8e8 100644 --- a/files/templates/util/assetcache.html +++ b/files/templates/util/assetcache.html @@ -1,6 +1,6 @@ {%- set CACHE_VER = { - 'css/main.css': 443, + 'css/main.css': 444, 'css/catalog.css': 2, 'css/4chan.css': 61,