Skip to content
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

Make It Clear Issue Has Been Crowdfunded V2 #2173

Merged
merged 17 commits into from
Oct 3, 2018
Merged

Make It Clear Issue Has Been Crowdfunded V2 #2173

merged 17 commits into from
Oct 3, 2018

Conversation

pinkiebell
Copy link
Contributor

Fixes #2164

app/assets/v2/js/pages/dashboard.js Show resolved Hide resolved

result['p'] = ((result['experience_level'] ? result['experience_level'] : 'Unknown Experience Level') + ' • ');
if (tokens.length) {
var obj = {};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected blank line after variable declarations. (newline-after-var)


if (result['status'] === 'done')
while (tokens.length) {
var tokenName = tokens.shift();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected blank line after variable declarations. (newline-after-var)

var opened_when = timeDifference(new Date(), new Date(result['web3_created']), true);
var openedWhen = timeDifference(dateNow, new Date(result['web3_created']), true);
var timeLeft = timeDifference(dateNow, dateExpires);
var expiredExpires = new Date() < dateExpires ? 'Expires' : 'Expired';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiple spaces found before ''Expires''. (no-multi-spaces)


result['p'] += ('Opened ' + opened_when + ' ago, Expires in ' + timeLeft);
result['p'] += ('Opened ' + openedWhen + ' ago, ' + expiredExpires + ' ' + timeLeft);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiple spaces found before '+'. (no-multi-spaces)


if (renderForExplorer) {
if (typeof web3 != 'undefined' && web3.eth.coinbase == result['bounty_ owner_address']) {
result['my_bounty'] = '<a class="btn font-smaller-2 btn-sm btn-outli ne-dark" role="button" href="#">mine</span></a>';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 8 spaces but found 10. (indent)

if (renderForExplorer) {
if (typeof web3 != 'undefined' && web3.eth.coinbase == result['bounty_ owner_address']) {
result['my_bounty'] = '<a class="btn font-smaller-2 btn-sm btn-outli ne-dark" role="button" href="#">mine</span></a>';
} else if (result['fulfiller_address'] !== '0x000000000000000000000000 0000000000000000') {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 6 spaces but found 8. (indent)

if (typeof web3 != 'undefined' && web3.eth.coinbase == result['bounty_ owner_address']) {
result['my_bounty'] = '<a class="btn font-smaller-2 btn-sm btn-outli ne-dark" role="button" href="#">mine</span></a>';
} else if (result['fulfiller_address'] !== '0x000000000000000000000000 0000000000000000') {
result['my_bounty'] = '<a class="btn font-smaller-2 btn-sm btn-outli ne-dark" role="button" href="#">' + result['status'] + '</span></a>';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 8 spaces but found 10. (indent)

result['my_bounty'] = '<a class="btn font-smaller-2 btn-sm btn-outli ne-dark" role="button" href="#">mine</span></a>';
} else if (result['fulfiller_address'] !== '0x000000000000000000000000 0000000000000000') {
result['my_bounty'] = '<a class="btn font-smaller-2 btn-sm btn-outli ne-dark" role="button" href="#">' + result['status'] + '</span></a>';
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 6 spaces but found 8. (indent)

@codecov
Copy link

codecov bot commented Sep 6, 2018

Codecov Report

Merging #2173 into master will decrease coverage by 0.02%.
The diff coverage is 18.51%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2173      +/-   ##
==========================================
- Coverage   27.75%   27.72%   -0.03%     
==========================================
  Files         142      142              
  Lines       11506    11519      +13     
  Branches     1562     1563       +1     
==========================================
+ Hits         3193     3194       +1     
- Misses       8201     8213      +12     
  Partials      112      112
Impacted Files Coverage Δ
app/dashboard/models.py 49.73% <18.51%> (-0.42%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update aa161c8...68d0f7e. Read the comment docs.

@@ -955,63 +955,107 @@ var usdToAmount = function(event) {
});
};

function renderBountyRowsFromResults(results) {
function renderBountyRowsFromResults(results, renderForExplorer) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

</g>
</g>
</g>
</svg>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pinkiebell can we run svgo against this file ?

@pinkiebell
Copy link
Contributor Author

@thelostone-mc svgo-ing Done 👍

@pinkiebell
Copy link
Contributor Author

Side note: I labelled this pr as wip because of one open question:

  • How do we handle tokens with no usd conversion?
    Right now we have no indicator for that and fixing requires backend changes,
    do we want to handle that case in this PR or defer?

@PixelantDesign
Copy link
Contributor

@pinkiebell could we display the token with no usd conversion in the tool tip but not average in the final USD value?

mbeacom
mbeacom previously approved these changes Sep 7, 2018
let leftHtml = '';
let rightHtml = '';

leftHtml +=

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'+=' should be placed at the beginning of the line. (operator-linebreak)

leftHtml +=
'<p class="m-0">&nbsp;&nbsp;&nbsp;' + bountyTokenAmount + ' ' + bountyTokenName + '</p>';

rightHtml +=

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'+=' should be placed at the beginning of the line. (operator-linebreak)

const tokenName = tokens.shift();
const obj = val[tokenName];
const ratio = obj['ratio'];
const amount = obj['amount']

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon. (semi)

const timePeg = timeDifference(dateNow, new Date(obj['timestamp']), false, 60 * 60);
const tooltip = '$' + normalizeAmount(usd, decimals) + ' ' + tokenName + ' in crowdfunding';

leftHtml +=

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'+=' should be placed at the beginning of the line. (operator-linebreak)


leftHtml +=
'<p class="m-0">+ ' + funding + ' ' + tokenName + '</p>';
rightHtml +=

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'+=' should be placed at the beginning of the line. (operator-linebreak)

@pinkiebell
Copy link
Contributor Author

The only thing what's left is the caret(arrow) with the right color(same as link color).
I'm also open for another round of improvements 👍

@thelostone-mc
Copy link
Member

@pinkiebell could you rebase it once ? we'll put this up on staging and test it out there today

@pinkiebell
Copy link
Contributor Author

pinkiebell commented Sep 10, 2018

@thelostone-mc Done.

Errors still in this PR are likely:
The tooltip misses the 'as of' .
I'm a little bit confused with the '$' sign in the crowdfunding tooltip,
because I always think of dollar valuation if I see the '$', was that actually right or is this wrong to
convert the crowdfunding token value to dollar in the tooltip?

@pinkiebell pinkiebell changed the title WIP: Make It Clear Issue Has Been Crowdfunded V2 Make It Clear Issue Has Been Crowdfunded V2 Sep 10, 2018

ele.className = 'tag token';
span.innerHTML = amount + ' ' + tokenName +
(isCrowdfunded ? '<i class="fas fa-users ml-1"></i>' : '' );

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be no spaces inside this paren. (space-in-parens)

@pinkiebell
Copy link
Contributor Author

@thelostone-mc
Any news?

@SaptakS
Copy link
Contributor

SaptakS commented Sep 18, 2018

@pinkiebell I will be reviewing it in some time and get back to you. :)

@SaptakS
Copy link
Contributor

SaptakS commented Sep 24, 2018

@pinkiebell I am seeing this in every non-crowfunded bounty details page. Can you please check?
screen shot 2018-09-24 at 4 04 16 pm

return ""
tokens = afs.keys()

if len(tokens) == 0:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to check len() here. Simply if not tokens:

return_dict['usd_value'] += tip.value_in_usdt if tip.value_in_usdt else 0
return return_dict
token = tip.tokenName
obj = ret.get(token, None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you default to {}:

obj = ret.get(token, {})

if not obj:
    obj['amount'] = 0.0
    

@pinkiebell
Copy link
Contributor Author

@SaptakS
I can't reproduce this behaviour, what wonders me is the 'as ofnow' in the USD tag.
That looks like the JS code is not from this PR. Maybe a cache issue?

@mbeacom
I addressed your comments. I did a rebase though, hope that's ok.

@pinkiebell
Copy link
Contributor Author

@SaptakS
Fun times 😄 . This may be problem with docker and inotify events.
Just reproduced that in the issue explorer because I switched branches/rebased and the django app didn't reload (fs inotify events).

@SaptakS
Copy link
Contributor

SaptakS commented Sep 24, 2018

@pinkiebell The icon beside See All is opposite according to me. It should point downwards when it is closed and upwards when it is open. cc: @thelostone-mc @mbeacom @PixelantDesign


tooltip_info.push(template);
}
const decimals = 2;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are showing 3 decimal places in almost all places. Any reason why we are showing only 2 for crowdfunded amount?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SaptakS Aesthetics? 😄 Fixed!

@SaptakS
Copy link
Contributor

SaptakS commented Sep 24, 2018

LGTM apart from above comments.

@pinkiebell
Copy link
Contributor Author

@PixelantDesign

  1. That's the ETH amount in USD, we should probably change the formatting?
  2. Did you mean putting the green USD tag on the left or should they all be aligned to the right for example? That could be a little bit tricky with our current CSS if we want to make sure that they are all aligned top-down.

@mbeacom
Hehe, we can tell future prices, nice! I will put a fix in 👍

@pinkiebell
Copy link
Contributor Author

pinkiebell commented Sep 25, 2018

screenshot 2018-09-27 at 00 02 59

@pinkiebell
Copy link
Contributor Author

@mbeacon @SaptakS @PixelantDesign
FInal review? 🙏

@thelostone-mc
Copy link
Member

@pinkiebell one final rebase and then we can throw it on staging

@pinkiebell
Copy link
Contributor Author

@thelostone-mc
Done 👍

@PixelantDesign
Copy link
Contributor

PixelantDesign commented Oct 1, 2018

@pinkiebell Looking good to me...One thing I see...

It should not be possible to have 791 cents.

screen shot 2018-10-01 at 11 11 01 am

And here

screen shot 2018-10-01 at 11 31 52 am

@pinkiebell
Copy link
Contributor Author

@PixelantDesign
Resolved 👍 . We now display token amounts with max .3 decimals and dollar conversion .2 decimals.

Copy link
Member

@thelostone-mc thelostone-mc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@thelostone-mc thelostone-mc merged commit e349ace into gitcoinco:master Oct 3, 2018
@pinkiebell pinkiebell deleted the crowdfund branch November 6, 2018 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend This needs frontend expertise.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants