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

Adding a Close Button on BCH QR code and also handling user's without BCH address #1863 #1865

Merged
merged 2 commits into from
Mar 1, 2024
Merged
Changes from all 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
21 changes: 18 additions & 3 deletions website/templates/_leaderboard_widget.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,16 @@
TIP:<i class="fab fa-btc"></i>
</button>
<dialog id="dialog">
<img id="qr-image" alt="QR Code" height="400" width="400">
<p id="bch-address">BCH: {{ leader.userprofile.crypto_address }}</p>
<img id="qr-image" alt="QR Code" height="400" width="500">
<p id="bch-address">
BCH:
{% if leader.userprofile.crypto_address %}
{{ leader.userprofile.crypto_address }}
{% else %}
User has not entered a BCH address - your tip will go to the leaderboard fund
{% endif %}
</p>
<button id="close" class="btn btn-danger w-full">Close</button>
</dialog>
</div>
{% endfor %}
Expand All @@ -72,9 +80,16 @@
<script>
document.getElementById('openModal').addEventListener('click', function() {
var address = "{{ leader.userprofile.crypto_address }}";
var qrUrl = "https://api.qrserver.com/v1/create-qr-code/?data=bitcoincash:" + address + "&size=400x400";
console.log("{{ leader.userprofile.crypto_address }}");
if (address == '') {
address = "qqeht8vnwag20yv8dvtcrd4ujx09fwxwsqqqw93w88";
}
var qrUrl = "https://api.qrserver.com/v1/create-qr-code/?data=bitcoincash:" + address + "&size=400x500";
document.getElementById('qr-image').src = qrUrl;
document.getElementById('dialog').showModal();
document.getElementById('close').addEventListener('click',function(){
document.getElementById('dialog').close();
});
});
document.addEventListener('DOMContentLoaded', function() {
const grid = document.querySelector('.hero-bugs-container');
Expand Down
Loading