From 4bf0d1b604f7533884f30c7c8880f54d53ab37ce Mon Sep 17 00:00:00 2001 From: Aditya Anand M C Date: Mon, 6 Jul 2020 16:02:34 +0530 Subject: [PATCH] chore: clean up TS (#7062) --- app/assets/v2/css/activity_stream.css | 17 +- app/assets/v2/css/gitcoin.css | 6 + app/assets/v2/css/town_square.css | 10 +- app/assets/v2/js/activity.js | 2 +- app/assets/v2/js/base.js | 12 +- app/assets/v2/js/pages/townsquare.js | 44 --- .../templates/townsquare/index.html | 76 ++--- .../templates/townsquare/shared/feednav.html | 81 ++++-- .../townsquare/shared/hackathons.html | 85 +++--- .../townsquare/shared/matchround.html | 259 +++++++++--------- .../templates/townsquare/shared/reflink.html | 41 ++- 11 files changed, 306 insertions(+), 327 deletions(-) diff --git a/app/assets/v2/css/activity_stream.css b/app/assets/v2/css/activity_stream.css index c8204d90acb..fa7edc0c36a 100644 --- a/app/assets/v2/css/activity_stream.css +++ b/app/assets/v2/css/activity_stream.css @@ -1,14 +1,9 @@ #reflink { cursor: pointer; - font-size: 12px; padding: 3px; - background-color: #ecf0f4; border: 0px solid; -} - -.dark-mode #reflink { - background-color: var(--gc-blue); - color: #ecf0f4; + color: var(--link-color); + background: var(--bg-shade-0); } .click_here_to_join_video{ @@ -33,12 +28,12 @@ } #new_activity_notifier { text-align: center; - background-color: #f5f5f9; - border-bottom: 1px solid #eee; + color: var(--link-color); + background: var(--bg-shade-0); + border-bottom: 1px solid var(--text-color); cursor: pointer; - padding: 5px 10px; + padding: 12px; border-radius: 3px; - color: black; font-size: 0.8rem; font-weight: bold; } diff --git a/app/assets/v2/css/gitcoin.css b/app/assets/v2/css/gitcoin.css index e9a5558c6f4..66d64717630 100644 --- a/app/assets/v2/css/gitcoin.css +++ b/app/assets/v2/css/gitcoin.css @@ -549,6 +549,12 @@ div.button-pink { transition: max-height 0.2s ease-out; } +.panel-active { + max-height: 100%; + overflow: hidden; + transition: max-height 0.2s ease-out; +} + .accordion:after { /* stylelint-disable-next-line */ font-family: 'Font Awesome 5 Pro'; diff --git a/app/assets/v2/css/town_square.css b/app/assets/v2/css/town_square.css index 4db3ff7ee90..86298018bb3 100644 --- a/app/assets/v2/css/town_square.css +++ b/app/assets/v2/css/town_square.css @@ -900,11 +900,9 @@ body.green.offer_view .announce { text-transform: uppercase; cursor: pointer; } -.townsquare_block-header::after { - content: "" -} -.townsquare_block-header.closed::after { - content: "^" + +.text-mode-color { + color: var(--townsquare-block-header-color); } #status .btn-group-toggle .btn-radio { @@ -995,7 +993,7 @@ body.green.offer_view .announce { font-size: 12px; } -.townsquare_nav-list.tribe .avatar { +.townsquare_nav-list .tribe .avatar { width: 20px; height: 20px; margin-right: 4px; diff --git a/app/assets/v2/js/activity.js b/app/assets/v2/js/activity.js index e12a983589f..2f2dec09a0e 100644 --- a/app/assets/v2/js/activity.js +++ b/app/assets/v2/js/activity.js @@ -181,7 +181,7 @@ $(document).ready(function() { // notifications of new activities var ping_activity_notifier = (function() { var plural = document.buffered_rows.length == 1 ? 'y' : 'ies'; - var html = '
' + document.buffered_rows.length + ' New Activit' + plural + ' - Click to View
'; + var html = '
' + document.buffered_rows.length + ' New Activit' + plural + ' - Click to View
'; if ($('#new_activity_notifier').length) { $('#new_activity_notifier').html(html); diff --git a/app/assets/v2/js/base.js b/app/assets/v2/js/base.js index 9881ff6b7f3..d17fae3e60b 100644 --- a/app/assets/v2/js/base.js +++ b/app/assets/v2/js/base.js @@ -238,21 +238,21 @@ $(document).ready(function() { $(event.target).parents('.faq_parent').find('.answer').toggleClass('show'); }); - $('.accordion').on('click', (event) => { - const element = $(event.target); - element.toggleClass('active'); - let panel = element[0].nextElementSibling; + $('body').on('click', '.accordion', event => { + const element = $(event.target); + const panel = element[0].nextElementSibling; if (panel) { - if (panel.style.maxHeight) { - panel.style.maxHeight = null; + if (element.hasClass('active')) { + panel.style.maxHeight = 0; panel.style.marginBottom = 0 + 'px'; } else { panel.style.maxHeight = panel.scrollHeight + 'px'; panel.style.marginBottom = 10 + 'px'; } } + element.toggleClass('active'); }); attach_close_button(); }); diff --git a/app/assets/v2/js/pages/townsquare.js b/app/assets/v2/js/pages/townsquare.js index cd8779a862f..74d3401e9cd 100644 --- a/app/assets/v2/js/pages/townsquare.js +++ b/app/assets/v2/js/pages/townsquare.js @@ -1,30 +1,4 @@ $(document).ready(function() { - // gets multi part (ex: 10 hours 2 minutes 5 seconds) time - var time_difference_broken_down = function(difference) { - let remaining = ' now. Refresh to view offer!'; - let prefix = ' in '; - - if (difference > 0) { - console.log(moment(difference).inspect()); - const parts = { - days: Math.floor(difference / (1000 * 60 * 60 * 24)), - hours: Math.floor((difference / (1000 * 60 * 60)) % 24), - minutes: Math.floor((difference / 1000 / 60) % 60), - seconds: Math.floor((difference / 1000) % 60) - }; - - remaining = Object.keys(parts) - .map(part => { - if (!parts[part]) - return; - return `${parts[part]} ${part}`; - }) - .join(' '); - } else { - return remaining; - } - return prefix + remaining; - }; $('body').on('click', '#mobile_nav_toggle li a', function(e) { $('#mobile_nav_toggle li a').removeClass('active'); @@ -48,15 +22,6 @@ $(document).ready(function() { document.location = $(this).find('a.btn').attr('href'); }); - // collapse menu items - $('body').on('click', '.townsquare_block-header', function(e) { - let target_id = $(this).data('target'); - - $('#' + target_id).toggleClass('hidden'); - $(this).toggleClass('closed'); - localStorage.setItem(target_id, $(this).hasClass('closed')); - }); - // effects when an offer is clicked upon $('body').on('click', '.offer a', function(e) { var speed = 500; @@ -173,15 +138,6 @@ $(document).ready(function() { $('#top_bar').html($(response).find('#top_bar').html()); // bind more actions joinTribe(); - // collapse menu items - $('.townsquare_block-header').each(function() { - let target_id = $(this).data('target'); - var item = localStorage.getItem(target_id); - - if (item == 'true') { - $(this).click(); - } - }); const hide_promo = localStorage.getItem('hide_promo'); if (!hide_promo) { diff --git a/app/townsquare/templates/townsquare/index.html b/app/townsquare/templates/townsquare/index.html index 7de7d0ef1c8..4727696fca0 100644 --- a/app/townsquare/templates/townsquare/index.html +++ b/app/townsquare/templates/townsquare/index.html @@ -47,13 +47,12 @@ text-transform: none; border-radius: 5px 5px 0 0; } - + .box-hackathons { background: #ffff; - border-bottom: 1px solid #ddd; border-radius: 0 0 5px 5px; } - + .box-hackathons .card { border: none; } @@ -165,7 +164,6 @@
-
@@ -189,51 +187,57 @@
diff --git a/app/townsquare/templates/townsquare/shared/feednav.html b/app/townsquare/templates/townsquare/shared/feednav.html index 58b85bfcc95..9c005b48f6e 100644 --- a/app/townsquare/templates/townsquare/shared/feednav.html +++ b/app/townsquare/templates/townsquare/shared/feednav.html @@ -1,39 +1,56 @@ -
-
+
+
+
Feeds
- - {% if hackathon_tabs|length %} -
- Hackathons +
+
- - {% endif %} -
-
- Filter +
+ +
+ +
+ {% if hackathon_tabs|length %} +
+ Hackathons
-
+ +
+ +
+
+ Filter +
+
+
-
-
- Shortcuts +
+ +
+
+ My Tribes
-
+
-
-
+
+ +
+
Suggested Tribes
-
+
-
\ No newline at end of file +
+
+
\ No newline at end of file diff --git a/app/townsquare/templates/townsquare/shared/hackathons.html b/app/townsquare/templates/townsquare/shared/hackathons.html index 08bc07dbaec..42ff6df865d 100644 --- a/app/townsquare/templates/townsquare/shared/hackathons.html +++ b/app/townsquare/templates/townsquare/shared/hackathons.html @@ -1,46 +1,53 @@ -
- {% for hackathon in hackathon_tabs|slice:":5" %} -
-
-
- {% firstof hackathon.logo_svg or hackathon.logo as logo %} - {% if logo %} +
+
+ Gitcoin Hackathons +
+
+ {% for hackathon in hackathon_tabs|slice:":5" %} +
+
+
+ {% firstof hackathon.logo_svg or hackathon.logo as logo %} + {% if logo %} - {% else %} - - {% endif %} -
-
-
- - {{ hackathon.title }} - -
-
- From - - To - + {% else %} + + {% endif %}
-
- {% if hackathon.end|timesince <= "1 min" %} - - Join Hackathon > + +
+
+ + {{ hackathon.title }} - {% endif %} +
+
+ From + + To + +
+
+ {% if hackathon.end|timesince <= "1 min" %} + + Join Hackathon > + + {% endif %} +
-
-
- {% endfor %} -

- VIEW ALL -

+
+ {% endfor %} +

+ VIEW ALL +

+
+
\ No newline at end of file diff --git a/app/townsquare/templates/townsquare/shared/matchround.html b/app/townsquare/templates/townsquare/shared/matchround.html index cf5975e1110..1684af3a6d3 100644 --- a/app/townsquare/templates/townsquare/shared/matchround.html +++ b/app/townsquare/templates/townsquare/shared/matchround.html @@ -1,168 +1,163 @@ {% load humanize static i18n %} {% if current_match_round %}
- -
-
-
- Payout -
- - +
+
+ Payout +
+
+ + + + + + {% if matching_leaderboard|length == 0 %} + + + + {% endif %} + {% for mli in matching_leaderboard %} + - - - - {% if matching_leaderboard|length == 0 %} - - - {% endif %} - {% for mli in matching_leaderboard %} - + {% endfor %} +
+ # + + Who + + Haul +
+ +
+ None Yet - Keep sending micro-tips, and check back soon ;-) +
- # + {{mli.i}} - Who - - Haul + + + + + {% if mli.you %} +
+ + it me + + {% endif %}
- + + + ${{mli.amount}} from + {{mli.contributors}} contributor{{mli.contributors|pluralize}}
+ ${{mli.match_amount}} matched +
+ {% if not mli.following %} + + {% else %} +
+ Following +
+ {% endif %}
+ + {% if suggested_actions|length %} +
+ How to earn in round #{{current_match_round.number}}: +
+ + - - - {% endfor %} -
- {{mli.i}} + Action - - - - {% if mli.you %} -
- - it me - - {% endif %} + Suggested Donation
- - ${{mli.amount}} from - {{mli.contributors}} contributor{{mli.contributors|pluralize}}
- ${{mli.match_amount}} matched -
- {% if not mli.following %} - - {% else %} -
- Following -
- {% endif %} +
+ Match Potential
- - {% if suggested_actions|length %} -
- How to earn in round #{{current_match_round.number}}: -
- - + + {% for suggested_action in suggested_actions %} + - {% for suggested_action in suggested_actions %} - - - - - - {% endfor %} -
- Action + {{suggested_action.title}} + {% if suggested_action.desc %} + + {% endif %} - Suggested Donation + {{suggested_action.suggested_donation}} - Match Potential + {{suggested_action.matchpotential}}
- {{suggested_action.title}} - {% if suggested_action.desc %} - - {% endif %} - - {{suggested_action.suggested_donation}} - - {{suggested_action.matchpotential}} -
- {% endif %} + {% endfor %} + + {% endif %} -
+
{% endif %} diff --git a/app/townsquare/templates/townsquare/shared/reflink.html b/app/townsquare/templates/townsquare/shared/reflink.html index febec03e0ce..c31d6956fbd 100644 --- a/app/townsquare/templates/townsquare/shared/reflink.html +++ b/app/townsquare/templates/townsquare/shared/reflink.html @@ -1,22 +1,19 @@ - {% if REFER_LINK %} -
- Ref A Friend! -
- - {% endif %} \ No newline at end of file +{% if REFER_LINK %} +
+
+ Ref A Friend! + +

+
+ +
+{% endif %} \ No newline at end of file