-
-
Notifications
You must be signed in to change notification settings - Fork 775
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clr backend #5192
Clr backend #5192
Changes from 40 commits
9014b88
6e18566
7bdb4e6
e1032d7
cb07934
d479d09
1f97743
6662b7b
580cd60
583d949
4a80f36
a463e01
dfc1be0
4b9a444
7179265
245223c
25a9a12
36ec03a
c745820
e0e6243
a9443f8
3a5d806
d4402b9
a4d27e3
4c0c598
0708ab3
3e6c16f
274a2cf
2ef6530
053c7ae
90cd3ee
81b8f24
bda1fa4
ce54f3f
7073a2a
b6628e8
0155cce
1720998
68952a7
a9761b6
dcdfe9b
1991165
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
#grant-link { | ||
color: #0D0764; | ||
} | ||
|
||
.tab_target{ | ||
width: 100%; | ||
} | ||
|
@@ -23,6 +24,12 @@ | |
object-fit: cover; | ||
} | ||
|
||
#grants_form .nav-link { | ||
border-top-left-radius: 4px; | ||
border-top-right-radius: 4px; | ||
color: #000; | ||
} | ||
|
||
#grants_form .form__input.valid, | ||
#grants_form .form__input.error { | ||
background-position: top 0.5rem right 0.5rem; | ||
|
@@ -146,22 +153,101 @@ | |
bottom: -1.2rem; | ||
} | ||
|
||
.nav{ | ||
.nav { | ||
text-align: center; | ||
} | ||
.nav-link{ | ||
|
||
.nav-link { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. extend core class don't overwrite |
||
border-right: 1px solid black; | ||
border-top: 1px solid black; | ||
border-left: 1px solid black; | ||
margin-right: 10px; | ||
} | ||
.nav-link:visited{ | ||
|
||
.nav-link:visited { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. extend core class don't overwrite |
||
color: black; | ||
} | ||
.nav-item.active{ | ||
|
||
.nav-item.active { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. extend core class don't overwrite |
||
text-decoration: underline; | ||
} | ||
|
||
.clr_estimate { | ||
background-color: white; | ||
border-radius: 5px; | ||
border: 2px solid #10cd7a; | ||
text-align: left; | ||
width: 250px; | ||
padding: 1rem 15px; | ||
position: absolute; | ||
top: 0px; | ||
left: 0px; | ||
} | ||
|
||
.clr_estimate.extraleft { | ||
left: -270px; | ||
} | ||
|
||
.clr_estimate:after { | ||
content: ''; | ||
position: absolute; | ||
right: 0; | ||
top: 30%; | ||
width: 0; | ||
height: 0; | ||
border: 20px solid transparent; | ||
border-left-color: #10cd7a; | ||
border-right: 0; | ||
border-bottom: 0; | ||
margin-top: -10px; | ||
margin-right: -20px; | ||
} | ||
|
||
.clr_estimate img { | ||
float: right; | ||
width: 50px; | ||
} | ||
|
||
.clr_estimate h3 { | ||
text-align: left; | ||
color: white; | ||
font-size: 12px; | ||
text-transform: uppercase; | ||
width: 150px; | ||
} | ||
|
||
.clr_estimate h3 span { | ||
background-color: #10cd7a; | ||
border-radius: 3px; | ||
padding: 4px 6px; | ||
|
||
} | ||
|
||
.clr_estimate h4 { | ||
padding-top: 0px; | ||
text-align: left; | ||
color: #10cd7a; | ||
font-size: 10px; | ||
font-weight: bold; | ||
} | ||
|
||
.clr_estimate h4 span { | ||
font-size: 16px; | ||
} | ||
|
||
.clr_estimate p { | ||
text-align: left; | ||
color: #10cd7a; | ||
font-size: 12px; | ||
color: #959595; | ||
} | ||
|
||
#phantom_fund .description i { | ||
thelostone-mc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
font-size: 10px; | ||
position: relative; | ||
top: -1px; | ||
} | ||
|
||
@media (min-width:1140px) and (max-width: 1600px) { | ||
|
||
#gitcoin-grant-section .fee-slider, | ||
|
@@ -188,3 +274,9 @@ | |
max-width: 100%; | ||
} | ||
} | ||
|
||
@media (max-width: 1199.98px) { | ||
.clr_estimate { | ||
display: none; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,14 @@ let gitcoinDonationAddress; | |
|
||
|
||
$(document).ready(function() { | ||
|
||
predictPhantomCLRMatch(); | ||
predictCLRMatch(); | ||
|
||
$('#amount').on('input', () => { | ||
predictCLRMatch(); | ||
}); | ||
|
||
gitcoinDonationAddress = $('#gitcoin_donation_address').val(); | ||
splitterAddress = $('#splitter_contract_address').val(); | ||
|
||
|
@@ -23,7 +31,7 @@ $(document).ready(function() { | |
|
||
updateSummary(); | ||
|
||
$('.nav-item').click(function(e) { | ||
$('#grants_form .nav-item').click(function(e) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this kind of rules will be a problem when we start creating a bundle js since we are not going to control this being loaded in other areas, use custom classes or data attr There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. agreed this would need to be fixed in a follow up PR to use what the tabs we already have cc @owocki |
||
$('.nav-item a').removeClass('active'); | ||
$(this).find('a').addClass('active'); | ||
var targetid = $(this).find('a').data('target'); | ||
|
@@ -489,6 +497,90 @@ const splitGrantAmount = () => { | |
} | ||
|
||
$('.gitcoin-grant-percent').html(percent); | ||
$('.summary-gitcoin-amount').html(gitcoin_grant_amount); | ||
$('.summary-gitcoin-amount').html(gitcoin_grant_amount.toFixed(2)); | ||
$('#summary-amount').html(grant_amount); | ||
}; | ||
|
||
const lerp = (x_lower, x_upper, y_lower, y_upper, x) => { | ||
return y_lower + (((y_upper - y_lower) * (x - x_lower)) / (x_upper - x_lower)); | ||
}; | ||
|
||
const predictPhantomCLRMatch = () => { | ||
|
||
let amount = phantom_value; | ||
|
||
if (0 < amount && amount < 1) { | ||
x_lower = 0; | ||
x_upper = 1; | ||
y_lower = clr_prediction_curve[0]; | ||
y_upper = clr_prediction_curve[1]; | ||
} else if (1 < amount && amount < 10) { | ||
x_lower = 1; | ||
x_upper = 10; | ||
y_lower = clr_prediction_curve[1]; | ||
y_upper = clr_prediction_curve[2]; | ||
} | ||
|
||
let predicted_clr = lerp(x_lower, x_upper, y_lower, y_upper, amount); | ||
|
||
$('.phantom_clr_increase').html((predicted_clr - clr_prediction_curve[0]).toFixed(2)); | ||
}; | ||
|
||
const predictCLRMatch = () => { | ||
|
||
let amount = Number.parseFloat($('#amount').val()); | ||
|
||
if (amount > 10000) { | ||
amount = 10000; | ||
} | ||
|
||
let predicted_clr = 0; | ||
|
||
const contributions_axis = [ 0, 1, 10, 100, 1000, 10000 ]; | ||
|
||
let index = 0; | ||
|
||
if (isNaN(amount)) { | ||
predicted_clr = clr_prediction_curve[index]; | ||
} else if (contributions_axis.indexOf(amount) >= 0) { | ||
index = contributions_axis.indexOf(amount); | ||
predicted_clr = clr_prediction_curve[index]; | ||
} else { | ||
let x_lower = 0; | ||
let x_upper = 0; | ||
let y_lower = 0; | ||
let y_upper = 0; | ||
|
||
if (0 < amount && amount < 1) { | ||
x_lower = 0; | ||
x_upper = 1; | ||
y_lower = clr_prediction_curve[0]; | ||
y_upper = clr_prediction_curve[1]; | ||
} else if (1 < amount && amount < 10) { | ||
x_lower = 1; | ||
x_upper = 10; | ||
y_lower = clr_prediction_curve[1]; | ||
y_upper = clr_prediction_curve[2]; | ||
} else if (10 < amount && amount < 100) { | ||
x_lower = 10; | ||
x_upper = 100; | ||
y_lower = clr_prediction_curve[2]; | ||
y_upper = clr_prediction_curve[3]; | ||
} else if (100 < amount && amount < 1000) { | ||
x_lower = 100; | ||
x_upper = 1000; | ||
y_lower = clr_prediction_curve[3]; | ||
y_upper = clr_prediction_curve[4]; | ||
} else { | ||
x_lower = 1000; | ||
x_upper = 10000; | ||
y_lower = clr_prediction_curve[4]; | ||
y_upper = clr_prediction_curve[5]; | ||
} | ||
|
||
predicted_clr = lerp(x_lower, x_upper, y_lower, y_upper, amount); | ||
} | ||
|
||
$('.clr_match_prediction').html(predicted_clr.toFixed(2)); | ||
$('.clr_increase').html((predicted_clr - clr_prediction_curve[0]).toFixed(2)); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
user text-center calls instead of overwriting the framework