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

chore: cross-chain improvs #6472

Merged
merged 3 commits into from
Apr 22, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/assets/onepager/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ input[type='checkbox']:checked + label::before,
input[type='radio']:checked + label::before {
color: #ff7496;
content: '\f00c';
font-family: "Font Awesome 5 free", sans-serif;
font-family: "Font Awesome 5 Pro", sans-serif;
font-weight: 900;
}

Expand Down
4 changes: 4 additions & 0 deletions app/assets/v2/css/bounty.css
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,10 @@ a.btn {
margin: 0;
}

.bounty_details .tooltip-inner {
max-width: 500px !important;
}

@media (max-width: 575.98px) {

#timer {
Expand Down
6 changes: 4 additions & 2 deletions app/assets/v2/css/gitcoin.css
Original file line number Diff line number Diff line change
Expand Up @@ -546,13 +546,15 @@ div.button-pink {

.accordion:after {
/* stylelint-disable-next-line */
font-family: 'Font Awesome 5 Free';
font-family: 'Font Awesome 5 Pro';
content: '\f107';
font-size: 1.2em;
font-size: 1em;
margin-right: auto;
margin-top: auto;
float: right;
font-weight: 600;
top: 1px;
position: relative;
}

.accordion.active:after {
Expand Down
82 changes: 47 additions & 35 deletions app/assets/v2/js/pages/bounty_details2.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const loadingState = {
};

document.result = bounty;
// listen_for_web3_changes();

Vue.mixin({
methods: {
Expand Down Expand Up @@ -44,6 +43,52 @@ Vue.mixin({
_alert('Error fetching bounties. Please contact [email protected]', 'error');
});
},
getTransactionURL: function(token_name, txn) {
let url;

switch (token_name) {
case 'ETC':
url = `https://blockscout.com/etc/mainnet/tx/${txn}`;
break;

case 'cUSD':
case 'cGLD':
url = `https://alfajores-blockscout.celo-testnet.org/tx/${txn}`;
break;

case 'ZIL':
url = `https://viewblock.io/zilliqa/tx/${txn}`;
break;

default:
url = `https://etherscan.io/tx/${txn}`;

}
return url;
},
getAddressURL: function(token_name, address) {
let url;

switch (token_name) {
case 'ETC':
url = `https://blockscout.com/etc/mainnet/address/${address}`;
break;

case 'cUSD':
case 'cGLD':
url = `https://alfajores-blockscout.celo-testnet.org/address/${address}`;
break;

case 'ZIL':
url = `https://viewblock.io/zilliqa/address/${address}`;
break;

default:
url = `https://etherscan.io/address/${address}`;
}
return url;
},

syncBounty: function() {
let vm = this;

Expand Down Expand Up @@ -272,15 +317,6 @@ Vue.mixin({
}
document.location.href = `${vm.bounty.url}?snooze=${text}`;
},
overrideStatus: function() {
let vm = this;
let text = window.prompt('What new status (valid choices: "open", "started", "submitted", "done", "expired", "cancelled", "" to remove override )?', '');

if (text === null) {
return;
}
document.location.href = `${vm.bounty.url}?admin_override_satatus=${text}`;
},
hasAcceptedFulfillments: function() {
let vm = this;

Expand Down Expand Up @@ -370,13 +406,6 @@ Vue.mixin({
activities.forEach(activity => {
if (activity.metadata) {
if (activity.metadata.new_bounty) {
// ETH
activity.metadata.new_bounty['token_value'] = activity.metadata.new_bounty.value_in_token / 10 ** decimals;
if (activity.metadata.old_bounty) {
activity.metadata.old_bounty['token_value'] = activity.metadata.old_bounty.value_in_token / 10 ** decimals;
}
} else {
// cross-chain
Comment on lines -373 to -379
Copy link
Contributor

@octavioamu octavioamu Apr 21, 2020

Choose a reason for hiding this comment

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

are not going to jump and use this file in eth bounties in near future?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd want to do it via the backend where we streamline the response and then pass it to the frontend !
Activity will be in common format when it comes to frontend (irrespective of if it's ETH or cross-chain)

activity.metadata['token_value'] = activity.metadata.value_in_token / 10 ** decimals;
}
}
Expand Down Expand Up @@ -502,7 +531,6 @@ var extend_expiration = function(bounty_pk, data) {
};

var show_interest_modal = function() {
var self = this;
var modals = $('#modalInterest');
let modalBody = $('#modalInterest .modal-content');
let modalUrl = `/interest/modal?redirect=${window.location.pathname}&pk=${document.result['pk']}`;
Expand All @@ -529,9 +557,6 @@ var show_interest_modal = function() {
discord_username: $('#discord_username').length ? $('#discord_username').val() : null
}).then(success => {
if (success) {
// $(self).attr('href', '/uninterested');
// $(self).find('span').text(gettext('Stop Work'));
// $(self).parent().attr('title', '<div class="tooltip-info tooltip-sm">' + gettext('Notify the funder that you will not be working on this project') + '</div>');
appBounty.fetchBounty();
modals.bootstrapModal('hide');

Expand Down Expand Up @@ -579,17 +604,4 @@ const promisify = (inner) =>
resolve(res);
}
})
);

// async function waitBlock(txid) {
// while (true) {
// let receipt = web3.eth.getTransactionReceipt(txid);
// if (receipt && receipt.contractAddress) {
// console.log("Your contract has been deployed at http://testnet.etherscan.io/address/" + receipt.contractAddress);
// console.log("Note that it might take 30 - 90 sceonds for the block to propagate befor it's visible in etherscan.io");
// break;
// }
// console.log("Waiting a mined block to include your contract... currently in block " + web3.eth.blockNumber);
// await sleep(4000);
// }
// }
);
36 changes: 21 additions & 15 deletions app/dashboard/templates/bounty/details2.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
<a v-for="link in quickLinks" class="btn btn-outline-gc-blue px-2 mx-2 font-smaller-4" :href="[[link.href]]" :title="[[ link.title ]]">[[ link.label ]]</a>
<button class="btn btn-outline-gc-blue px-2 mx-2 font-smaller-4" @click="contactFunder()">Contact Funder</button>
Copy link
Contributor

Choose a reason for hiding this comment

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

these removed are not part of quickLinks since are not links, are prompts and I fixed them to not send the actions if are empty (today that is broken in normal bounties if you click that prompts then the action is sent even without nothing

Copy link
Member Author

Choose a reason for hiding this comment

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

Added this back !

<button class="btn btn-outline-gc-blue px-2 mx-2 font-smaller-4" @click="overrideStatus()">Override Status</button>
<button class="btn btn-outline-gc-blue px-2 mx-2 font-smaller-4" @click="snoozeeGitbot()">Snooze Gitcoinbot</button>
</div>
<div class="col-12" v-if="loadingState === 'resolved'">
{% if event_tag %}
Expand Down Expand Up @@ -273,7 +272,7 @@ <h5 class="font-body font-weight-semibold">{% trans "SUBMISSIONS" %}</h5>
[[ fulfillment.profile.handle ]]
</a>
<div class="font-smaller-4" v-if="fulfillment.fulfiller_address">
<a :href="`${is_bounties_network ? `https://etherscan.io/address/${fulfillment.fulfiller_address}` : `https://classic.etccoopexplorer.com/address/${fulfillment.fulfiller_address}` }`" target="_blank">[[ fulfillment.fulfiller_address | truncateHash ]]</a>
<a :href="getAddressURL(fulfillment.token_name, fulfillment.fulfiller_address)" target="_blank">[[ fulfillment.fulfiller_address | truncateHash ]]</a>
<button class="btn btn-sm my-0 px-1" @click="copyTextToClipboard(fulfillment.fulfiller_address)">
<i class="far fa-clipboard-check"></i>
</button>
Expand All @@ -291,7 +290,7 @@ <h5 class="font-body font-weight-semibold">{% trans "SUBMISSIONS" %}</h5>
<i class="fas fa-check mr-2 font-caption"></i> Bounty Paid
</span>
<p class="font-smaller-4 my-0">
<a :href="`${is_bounties_network ? `https://etherscan.io/address/${fulfillment.payout_tx_id}` : `https://classic.etccoopexplorer.com/tx/${fulfillment.payout_tx_id}` }`" target="_blank">([[ fulfillment.payout_tx_id | truncateHash ]])</a>
<a :href="getTransactionURL(fulfillment.token_name, fulfillment.payout_tx_id)" target="_blank">([[ fulfillment.payout_tx_id | truncateHash ]])</a>
<button class="btn btn-sm my-0 px-1" @click="copyTextToClipboard(fulfillment.payout_tx_id)">
<i class="far fa-clipboard-check"></i>
</button>
Expand All @@ -303,16 +302,26 @@ <h5 class="font-body font-weight-semibold">{% trans "SUBMISSIONS" %}</h5>
<i class="fas fa-spinner fa-spin mr-2 font-caption"></i>Pending Verification
</button>
<p class="font-smaller-4 my-0">
<a :href="`${is_bounties_network ? `https://etherscan.io/address/${fulfillment.payout_tx_id}` : `https://classic.etccoopexplorer.com/tx/${fulfillment.payout_tx_id}` }`" target="_blank">([[ fulfillment.payout_tx_id | truncateHash ]])</a>
<a :href="getTransactionURL(fulfillment.token_name, fulfillment.payout_tx_id)" target="_blank">([[ fulfillment.payout_tx_id | truncateHash ]])</a>
<button class="btn btn-sm my-0 px-1" @click="copyTextToClipboard(fulfillment.payout_tx_id)">
<i class="far fa-clipboard-check"></i>
</button>
</p>
</template>

<button v-else data-toggle="modal" :data-target="`#payoutModal${fulfillment.pk}`" class="btn btn-sm btn-gc-blue my-auto px-3 font-smaller-2 font-weight-semibold">
<i class="fas fa-money-check-alt mr-2 font-caption"></i>Payout Bounty
</button>
<template v-else>
<template v-if="fulfillment.payout_status == 'expired'">
<span class="font-smaller-1 position-relative" style="top: 2px" data-html="true" data-toggle="tooltip"
title="<div class='tooltip-info text-left'><p class='font-smaller-1 font-weight-semibold mb-1'>We couldn't find the transaction on chain</p><p class='mb-0 font-smaller-2'>Please ensure the payment has been made and click on payout bounty </p></div>">
<i class="fas fa-exclamation-triangle text-danger mr-3"></i>
</span>
</template>

<button data-toggle="modal" :data-target="`#payoutModal${fulfillment.pk}`" class="btn btn-sm btn-gc-blue my-auto px-3 font-smaller-2 font-weight-semibold">
<i class="fas fa-money-check-alt mr-2 font-caption"></i>Payout Bounty
</button>
</template>

</template>

<template v-else>
Expand All @@ -321,7 +330,7 @@ <h5 class="font-body font-weight-semibold">{% trans "SUBMISSIONS" %}</h5>
<i class="fas fa-check mr-2 font-caption"></i> Bounty Paid
</span>
<p class="font-smaller-4 my-0">
<a :href="`${is_bounties_network ? `https://etherscan.io/address/${fulfillment.payout_tx_id}` : `https://classic.etccoopexplorer.com/tx/${fulfillment.payout_tx_id}` }`" target="_blank">([[ fulfillment.payout_tx_id | truncateHash ]])</a>
<a :href="getTransactionURL(fulfillment.token_name, fulfillment.payout_tx_id)" target="_blank">([[ fulfillment.payout_tx_id | truncateHash ]])</a>
<button class="btn btn-sm my-0 px-1" @click="copyTextToClipboard(fulfillment.payout_tx_id)">
<i class="far fa-clipboard-check"></i>
</button>
Expand All @@ -332,7 +341,7 @@ <h5 class="font-body font-weight-semibold">{% trans "SUBMISSIONS" %}</h5>
<i class="fas fa-spinner fa-spin mr-2 font-caption"></i>Pending Verification
</button>
<p class="font-smaller-4 my-0">
<a :href="`${is_bounties_network ? `https://etherscan.io/address/${fulfillment.payout_tx_id}` : `https://classic.etccoopexplorer.com/tx/${fulfillment.payout_tx_id}` }`" target="_blank">([[ fulfillment.payout_tx_id | truncateHash ]])</a>
<a :href="getTransactionURL(fulfillment.token_name, fulfillment.payout_tx_id)" target="_blank">([[ fulfillment.payout_tx_id | truncateHash ]])</a>
<button class="btn btn-sm my-0 px-1" @click="copyTextToClipboard(fulfillment.payout_tx_id)">
<i class="far fa-clipboard-check"></i>
</button>
Expand Down Expand Up @@ -371,7 +380,7 @@ <h5 class="font-body font-weight-semibold">{% trans "SUBMISSIONS" %}</h5>

<p v-if="bounty.bounty_owner_address">
<span class="d-block">Scan QR code using address</span>
<span class="font-subheader font-weight-semibold">[[bounty.bounty_owner_address]]</span>
<a :href="getAddressURL(bounty.token_name, bounty.bounty_owner_address)" target="_blank" class="font-subheader font-weight-semibold">[[bounty.bounty_owner_address]]</a>
</p>

<p class="payout-input-amount-container font-weight-semibold ">
Expand Down Expand Up @@ -664,17 +673,14 @@ <h3>{{ noscript.keywords }}</h3>
<script>
$('body').bootstrapTooltip({
selector: '[data-toggle="tooltip"]',
template: '<div class="no-tooltip" role="tooltip"><div class="tooltip-inner"></div></div>'
template: '<div class="no-tooltip" role="tooltip"><div class="tooltip-inner font-smaller-2"></div></div>'
});

$('[data-toggle="popover"]').popover()
$('body').on('mouseover', '[data-username]', function(e) {
openContributorPopOver($(this).data('username'), $(this));
});

// $('body').on('mouseout', '[data-username]', function(e) {
// $(this).popover('dispose');
// });

$('body').on('show.bs.popover', '[data-username]', function () {
$('body [data-username]').not(this).popover('hide');
})
Expand Down
19 changes: 6 additions & 13 deletions app/dashboard/templates/shared/organization_tooltip.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
{% endcomment %}
{% load i18n %}
<div class="tooltip-info">
<p class="font-subheader">{% trans "Tribe Name" %}</p>
<div class="font-body">
<div class="row">
<div class="col-12">
<strong>{% trans "Search by tribe name" %}:</strong>

{% trans "ex. gitcoinco, ethereum" %}

</div>
</div>
</div>
</div>
<div class="tooltip-info text-left">
<p class="font-smaller-1 font-weight-semibold">Tribe Name</p>
<p class="mb-0 font-smaller-2">
<span class="font-weight-bold">Search by tribe name</span> like gitcoinco, ethereum
</p>
</div>
16 changes: 6 additions & 10 deletions app/dashboard/templates/shared/permissions_type_tooltip.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
{% endcomment %}
{% load i18n %}
<div class="tooltip-info">
<p class="font-subheader">{% trans "Permissions" %}</p>
<div class="font-body">
<div class="row">
<ol class="pl-3">
<li class="mb-2"><strong>{% trans "Permissionless" %}:</strong> {% trans "Anyone can start work" %}</li>
<li class="mb-2"><strong>{% trans "Approval Required" %}:</strong> {% trans "Submitter will approve bounty hunters can start work." %}</li>
</ol>
</div>
</div>
<div class="tooltip-info text-left">
<p class="font-smaller-1 font-weight-semibold">Permissions</p>
<ol class="pl-3 mb-0 font-smaller-2">
<li class="mb-2"><strong>{% trans "Permissionless" %}:</strong> {% trans "Anyone can start work" %}</li>
<li class="mb-2"><strong>{% trans "Approval Required" %}:</strong> {% trans "Submitter will approve bounty hunters can start work." %}</li>
</ol>
</div>
20 changes: 8 additions & 12 deletions app/dashboard/templates/shared/project_type_tooltip.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,11 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
{% endcomment %}
{% load i18n %}
<div class="tooltip-info">
<p class="font-subheader">{% trans "Project Types" %}</p>
<div class="font-body">
<div class="row">
<ol class="pl-3">
<li class="mb-2"><strong>{% trans "Traditional" %}:</strong> {% trans "1 worker at a time, 1 is paid out" %}</li>
<li class="mb-2"><strong>{% trans "Contest" %}:</strong> {% trans "many workers at a time, 1 is paid out" %}</li>
<li class="mb-2"><strong>{% trans "Cooperative" %}:</strong> {% trans "many workers at a time, many are paid out" %}</li>
</ol>
</div>
</div>
</div>
<div class="tooltip-info text-left">
<p class="font-smaller-1 font-weight-semibold">{% trans "Project Types" %}</p>
<ol class="pl-3 mb-0 font-smaller-2">
<li class="mb-2"><strong>{% trans "Traditional" %}:</strong> {% trans "1 worker at a time, 1 is paid out" %}</li>
<li class="mb-2"><strong>{% trans "Contest" %}:</strong> {% trans "many workers at a time, 1 is paid out" %}</li>
<li class="mb-2"><strong>{% trans "Cooperative" %}:</strong> {% trans "many workers at a time, many are paid out" %}</li>
</ol>
</div>
36 changes: 14 additions & 22 deletions app/dashboard/templates/shared/status_tooltip.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,19 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
{% endcomment %}
{% load i18n %}
<div class="tooltip-info">
<p class="font-subheader">{% trans "Possible Status" %}</p>
<div class="font-body">
<div class="row">
<ol class="pl-3">
<li class="mb-2"><strong>{% trans "Open" %}:</strong> {% trans "A funded bounty is available for anyone to work on." %}</li>
<li class="mb-2"><strong>{% trans "Work Started" %}:</strong> {% trans "Work has been started by at least one person." %}</li>
<li class="mb-2"><strong>{% trans "Work Submitted" %}:</strong> {% trans "Completed work has been submitted by for review." %}</li>
<li class="mb-2"><strong>{% trans "Work Done" %}:</strong> {% trans "The submitted project has been accepted and the funds have been paid." %}</li>
</ol>
</div>
<div class="tooltip-info text-left">
<p class="font-smaller-1 font-weight-semibold">Possible Status</p>
<ol class="pl-3 mb-2 font-smaller-2">
<li class="mb-2"><strong>{% trans "Open" %}:</strong> {% trans "A funded bounty is available for anyone to work on." %}</li>
<li class="mb-2"><strong>{% trans "Work Started" %}:</strong> {% trans "Work has been started by at least one person." %}</li>
<li class="mb-2"><strong>{% trans "Work Submitted" %}:</strong> {% trans "Completed work has been submitted by for review." %}</li>
<li class="mb-2"><strong>{% trans "Work Done" %}:</strong> {% trans "The submitted project has been accepted and the funds have been paid." %}</li>
</ol>

<p class="font-smaller-1 font-weight-semibold">Possible Status</p>
<ol class="pl-3 mb-0 font-smaller-2">
<li class="mb-2"><strong>{% trans "Expired" %}:</strong> {% trans "Work was not completed by the expiration date." %}</li>
<li class="mb-2"><strong>{% trans "Canceled" %}:</strong> {% trans "A funded bounty was cancelled by the owner of the project" %}</li>
</ol>

</div>
<p class="font-subheader">{% trans "Cancellation Status" %}</p>
<div class="font-body">
<div class="row">
<ol class="pl-3">
<li class="mb-2"><strong>{% trans "Expired" %}:</strong> {% trans "Work was not completed by the expiration date." %}</li>
<li class="mb-2"><strong>{% trans "Canceled" %}:</strong> {% trans "A funded bounty was cancelled by the owner of the project" %}</li>
</ol>
</div>
</div>
</div>
</div>
Loading