Skip to content

Commit 4bf0d1b

Browse files
chore: clean up TS (gitcoinco#7062)
1 parent 7f2311f commit 4bf0d1b

File tree

11 files changed

+306
-327
lines changed

11 files changed

+306
-327
lines changed

app/assets/v2/css/activity_stream.css

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
#reflink {
22
cursor: pointer;
3-
font-size: 12px;
43
padding: 3px;
5-
background-color: #ecf0f4;
64
border: 0px solid;
7-
}
8-
9-
.dark-mode #reflink {
10-
background-color: var(--gc-blue);
11-
color: #ecf0f4;
5+
color: var(--link-color);
6+
background: var(--bg-shade-0);
127
}
138

149
.click_here_to_join_video{
@@ -33,12 +28,12 @@
3328
}
3429
#new_activity_notifier {
3530
text-align: center;
36-
background-color: #f5f5f9;
37-
border-bottom: 1px solid #eee;
31+
color: var(--link-color);
32+
background: var(--bg-shade-0);
33+
border-bottom: 1px solid var(--text-color);
3834
cursor: pointer;
39-
padding: 5px 10px;
35+
padding: 12px;
4036
border-radius: 3px;
41-
color: black;
4237
font-size: 0.8rem;
4338
font-weight: bold;
4439
}

app/assets/v2/css/gitcoin.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,12 @@ div.button-pink {
549549
transition: max-height 0.2s ease-out;
550550
}
551551

552+
.panel-active {
553+
max-height: 100%;
554+
overflow: hidden;
555+
transition: max-height 0.2s ease-out;
556+
}
557+
552558
.accordion:after {
553559
/* stylelint-disable-next-line */
554560
font-family: 'Font Awesome 5 Pro';

app/assets/v2/css/town_square.css

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -900,11 +900,9 @@ body.green.offer_view .announce {
900900
text-transform: uppercase;
901901
cursor: pointer;
902902
}
903-
.townsquare_block-header::after {
904-
content: ""
905-
}
906-
.townsquare_block-header.closed::after {
907-
content: "^"
903+
904+
.text-mode-color {
905+
color: var(--townsquare-block-header-color);
908906
}
909907

910908
#status .btn-group-toggle .btn-radio {
@@ -995,7 +993,7 @@ body.green.offer_view .announce {
995993
font-size: 12px;
996994
}
997995

998-
.townsquare_nav-list.tribe .avatar {
996+
.townsquare_nav-list .tribe .avatar {
999997
width: 20px;
1000998
height: 20px;
1001999
margin-right: 4px;

app/assets/v2/js/activity.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ $(document).ready(function() {
181181
// notifications of new activities
182182
var ping_activity_notifier = (function() {
183183
var plural = document.buffered_rows.length == 1 ? 'y' : 'ies';
184-
var html = '<div id=new_activity_notifier>' + document.buffered_rows.length + ' New Activit' + plural + ' - Click to View</div>';
184+
var html = '<div id="new_activity_notifier">' + document.buffered_rows.length + ' New Activit' + plural + ' - Click to View</div>';
185185

186186
if ($('#new_activity_notifier').length) {
187187
$('#new_activity_notifier').html(html);

app/assets/v2/js/base.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,21 +238,21 @@ $(document).ready(function() {
238238
$(event.target).parents('.faq_parent').find('.answer').toggleClass('show');
239239
});
240240

241-
$('.accordion').on('click', (event) => {
242-
const element = $(event.target);
243241

244-
element.toggleClass('active');
245-
let panel = element[0].nextElementSibling;
242+
$('body').on('click', '.accordion', event => {
243+
const element = $(event.target);
244+
const panel = element[0].nextElementSibling;
246245

247246
if (panel) {
248-
if (panel.style.maxHeight) {
249-
panel.style.maxHeight = null;
247+
if (element.hasClass('active')) {
248+
panel.style.maxHeight = 0;
250249
panel.style.marginBottom = 0 + 'px';
251250
} else {
252251
panel.style.maxHeight = panel.scrollHeight + 'px';
253252
panel.style.marginBottom = 10 + 'px';
254253
}
255254
}
255+
element.toggleClass('active');
256256
});
257257
attach_close_button();
258258
});

app/assets/v2/js/pages/townsquare.js

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,4 @@
11
$(document).ready(function() {
2-
// gets multi part (ex: 10 hours 2 minutes 5 seconds) time
3-
var time_difference_broken_down = function(difference) {
4-
let remaining = ' now. Refresh to view offer!';
5-
let prefix = ' in ';
6-
7-
if (difference > 0) {
8-
console.log(moment(difference).inspect());
9-
const parts = {
10-
days: Math.floor(difference / (1000 * 60 * 60 * 24)),
11-
hours: Math.floor((difference / (1000 * 60 * 60)) % 24),
12-
minutes: Math.floor((difference / 1000 / 60) % 60),
13-
seconds: Math.floor((difference / 1000) % 60)
14-
};
15-
16-
remaining = Object.keys(parts)
17-
.map(part => {
18-
if (!parts[part])
19-
return;
20-
return `${parts[part]} ${part}`;
21-
})
22-
.join(' ');
23-
} else {
24-
return remaining;
25-
}
26-
return prefix + remaining;
27-
};
282

293
$('body').on('click', '#mobile_nav_toggle li a', function(e) {
304
$('#mobile_nav_toggle li a').removeClass('active');
@@ -48,15 +22,6 @@ $(document).ready(function() {
4822
document.location = $(this).find('a.btn').attr('href');
4923
});
5024

51-
// collapse menu items
52-
$('body').on('click', '.townsquare_block-header', function(e) {
53-
let target_id = $(this).data('target');
54-
55-
$('#' + target_id).toggleClass('hidden');
56-
$(this).toggleClass('closed');
57-
localStorage.setItem(target_id, $(this).hasClass('closed'));
58-
});
59-
6025
// effects when an offer is clicked upon
6126
$('body').on('click', '.offer a', function(e) {
6227
var speed = 500;
@@ -173,15 +138,6 @@ $(document).ready(function() {
173138
$('#top_bar').html($(response).find('#top_bar').html());
174139
// bind more actions
175140
joinTribe();
176-
// collapse menu items
177-
$('.townsquare_block-header').each(function() {
178-
let target_id = $(this).data('target');
179-
var item = localStorage.getItem(target_id);
180-
181-
if (item == 'true') {
182-
$(this).click();
183-
}
184-
});
185141
const hide_promo = localStorage.getItem('hide_promo');
186142

187143
if (!hide_promo) {

app/townsquare/templates/townsquare/index.html

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,12 @@
4747
text-transform: none;
4848
border-radius: 5px 5px 0 0;
4949
}
50-
50+
5151
.box-hackathons {
5252
background: #ffff;
53-
border-bottom: 1px solid #ddd;
5453
border-radius: 0 0 5px 5px;
5554
}
56-
55+
5756
.box-hackathons .card {
5857
border: none;
5958
}
@@ -165,7 +164,6 @@
165164

166165
<div class="checkbox_container">
167166
<input name="trending" id="trending" type="checkbox" value="0" {% if trending_only %}checked=checked{%endif%} />
168-
<!-- <span class="checkbox"></span> -->
169167
<label for=trending>{% trans "Trending Only" %}</label>
170168
</div>
171169
</div>
@@ -189,51 +187,57 @@
189187
</div>
190188
<div class="actions_container col-12 col-md-4 col-lg-3">
191189
<div id=right_sidebar>
192-
{% if SHOW_DRESSING %}
190+
{% if SHOW_DRESSING %}
193191

194-
{% include 'townsquare/shared/tribe.html' %}
195-
192+
{% include 'townsquare/shared/tribe.html' %}
196193

197-
{% if hackathon_tabs|length %}
198-
<div class="townsquare_block-header box-collapse mt-1" data-target="hackathons">
199-
Gitcoin Hackathons
200-
</div>
201-
{% include 'townsquare/shared/hackathons.html' %}
202-
{% endif %}
194+
{% if hackathon_tabs|length %}
195+
{% include 'townsquare/shared/hackathons.html' %}
196+
{% endif %}
197+
198+
{% include 'townsquare/shared/reflink.html' %}
203199

204-
{% include 'townsquare/shared/reflink.html' %}
200+
<hr>
205201

206-
<div class="townsquare_block-header text-left my-4 mt-sm-0 mb-sm-2" data-target="actions">
207-
Actions <i data-toggle="tooltip" data-html="true" class="fas fa-info-circle mr-3" title="
208-
<strong>Gitcoin Actions</strong> are a way to introduce entropy into your learning routine. Gitcoin will select the best educational, networking, or (sometimes)monetary or reputational opportunities and put them in front of you on a daily, weekly, monthly, and (sometimes) secret basis!
209-
<br>
210-
<br>
211-
Come to Gitcion daily to discover today's daily action!
202+
<div class="townsquare_block-header text-left my-4 mt-sm-0 mb-sm-2" data-target="actions">
203+
<div class="accordion active">
204+
Actions
205+
<i data-toggle="tooltip" data-html="true" class="fas fa-info-circle mr-3" title="
206+
<p class='text-left'>
207+
<strong>Gitcoin Actions</strong> are a way to introduce entropy into your learning routine.
208+
Gitcoin will select the best educational, networking, or (sometimes)monetary or reputational opportunities and put them in front of you on a daily, weekly, monthly, and (sometimes) secret basis!
209+
</p>
210+
<p class='text-left'>
211+
Come to Gitcion daily to discover today's daily action!
212+
</p>
212213
"></i>
213-
</div>
214-
<div id=actions>
215-
<div class="offer_coming font-caption">
216-
<div class="checkbox_container">
217-
<input name="receive_daily_offers_in_inbox" id="receive_daily_offers_in_inbox" type="checkbox" value="1" {% if is_subscribed %} checked="checked" {% endif %} />
218-
<span class="checkbox"></span>
219-
<div class="filter-label ml-1">
220-
<label for=receive_daily_offers_in_inbox>{% trans "Email when available" %}</label>
214+
</div>
215+
216+
<div id="actions" class="panel-active">
217+
<div class="offer_coming font-caption">
218+
<div class="checkbox_container font-smaller-5">
219+
<input name="receive_daily_offers_in_inbox" id="receive_daily_offers_in_inbox" type="checkbox" value="1" {% if is_subscribed %} checked="checked" {% endif %} />
220+
<span class="checkbox"></span>
221+
<div class="filter-label ml-1">
222+
<label for=receive_daily_offers_in_inbox>{% trans "Email when available" %}</label>
223+
</div>
224+
</div>
221225
</div>
226+
227+
{% include 'townsquare/shared/offers.html' %}
228+
229+
<a href="/action/new" class="font-smaller-2 mb-2">
230+
<i class="fa fa-plus-circle" aria-hidden="true"></i>
231+
Create Action
232+
</a>
222233
</div>
223234
</div>
224235

225-
{% include 'townsquare/shared/offers.html' %}
226-
227-
<a href="/action/new" class="font-smaller-2 mb-2">
228-
<i class="fa fa-plus-circle" aria-hidden="true"></i>
229-
Create Action
230-
</a>
231236
<hr>
232-
</div>
233237

234238
{% include 'townsquare/shared/matchround.html' %}
235239
{% endif %}
236-
</div>
240+
</div>
237241
</div>
238242
</div>
239243
</div>
Lines changed: 51 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,56 @@
1-
<div class="townsquare_nav-list my-3">
2-
<div class="townsquare_block-header" data-target="feeds" >
1+
<div class="townsquare_nav-list">
2+
<div class="feed-container my-3">
3+
<div class="townsquare_block-header accordion active" data-target="feeds" >
34
Feeds
45
</div>
5-
<ul id=feeds class="nav d-inline-block font-body mb-2">
6-
{% for this_tab in tabs %}
7-
{% include 'townsquare/shared/thistab.html' %}
8-
{% endfor %}
9-
</ul>
10-
{% if hackathon_tabs|length %}
11-
<div class="townsquare_block-header mt-2" data-target="hackathons">
12-
Hackathons
6+
<div class="panel-active">
7+
<ul id=feeds class="nav d-inline-block font-body">
8+
{% for this_tab in tabs %}
9+
{% include 'townsquare/shared/thistab.html' %}
10+
{% endfor %}
11+
</ul>
1312
</div>
14-
<ul id=hackathons class="nav d-inline-block font-caption mb-2">
15-
{% for this_tab in hackathon_tabs %}
16-
{% include 'townsquare/shared/thistab.html' %}
17-
{% endfor %}
18-
</ul>
19-
{% endif %}
20-
<div class="townsquare_nav-list my-3">
21-
<div class="townsquare_block-header" data-target="filter">
22-
Filter
13+
</div>
14+
15+
<hr>
16+
17+
<div class="hacktathon-feed-container my-3">
18+
{% if hackathon_tabs|length %}
19+
<div class="townsquare_block-header mt-2 accordion active" data-target="hackathons">
20+
Hackathons
2321
</div>
24-
<ul id=filter class="nav d-inline-block font-caption mb-2">
25-
{% for tag in tags %}
26-
{% include 'townsquare/shared/tag.html' %}
22+
<div class="panel-active">
23+
<ul id=hackathons class="nav d-inline-block font-caption panel-active">
24+
{% for this_tab in hackathon_tabs %}
25+
{% include 'townsquare/shared/thistab.html' %}
2726
{% endfor %}
27+
</ul>
28+
</div>
29+
{% endif %}
30+
</div>
31+
32+
<hr>
33+
34+
<div class="filter-feed-container my-3">
35+
<div class="townsquare_block-header accordion active" data-target="filter">
36+
Filter
37+
</div>
38+
<div class="panel-active">
39+
<ul id=filter class="nav d-inline-block font-caption">
40+
{% for tag in tags %}
41+
{% include 'townsquare/shared/tag.html' %}
42+
{% endfor %}
2843
</ul>
2944
</div>
3045
</div>
3146

32-
<div class="townsquare_nav-list my-3 tribe">
33-
<div class="townsquare_block-header" data-target="tribes">
34-
Shortcuts
47+
<hr>
48+
49+
<div class="my-tribes-container my-3 tribe">
50+
<div class="townsquare_block-header accordion active tribe" data-target="tribes">
51+
My Tribes
3552
</div>
36-
<div id="tribes">
53+
<div id="tribes" class="panel-active">
3754
<ul class="nav d-inline-block font-caption">
3855
{% for tribe in following_tribes %}
3956
<li class="nav-item">
@@ -56,11 +73,13 @@
5673
</div>
5774
</div>
5875

59-
<div class="townsquare_nav-list my-3 tribe">
60-
<div class="townsquare_block-header" data-target="suggested-tribes">
76+
<hr>
77+
78+
<div class="suggested-tribes-container my-3 tribe">
79+
<div class="townsquare_block-header accordion active" data-target="suggested-tribes">
6180
Suggested Tribes
6281
</div>
63-
<div id="suggested-tribes">
82+
<div id="suggested-tribes" class="panel-active">
6483
<ul class="nav d-inline-block font-body col-sm-9 col-lg-8 pr-2" style="padding-right: 0">
6584
{% for tribe in suggested_tribes %}
6685
<li class="nav-item d-flex justify-content-between align-items-center my-1">
@@ -78,4 +97,6 @@
7897
{% endfor %}
7998
</ul>
8099
</div>
81-
</div>
100+
</div>
101+
<hr>
102+
</div>

0 commit comments

Comments
 (0)