mirror of
https://github.com/mwisnowski/mtg_python_deckbuilder.git
synced 2026-04-06 13:11:28 +02:00
feat: Card Kingdom prices, shopping cart export, and hover panel fixes (#73)
* feat: add CK prices, shopping cart export, and hover panel fixes * fix: include commander in Buy This Deck cart export
This commit is contained in:
parent
dd996939e6
commit
69d84cc414
24 changed files with 899 additions and 146 deletions
|
|
@ -19,6 +19,9 @@
|
|||
{{ card.name }}
|
||||
</div>
|
||||
|
||||
{# Price overlay #}
|
||||
<div class="card-price-overlay" data-price-for="{{ card.name }}" aria-hidden="true"></div>
|
||||
|
||||
{# Owned indicator #}
|
||||
{% if card.is_owned %}
|
||||
<div style="position:absolute; top:4px; right:4px; background:rgba(34,197,94,0.9); color:white; padding:2px 6px; border-radius:4px; font-size:12px; font-weight:600;">
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@
|
|||
cursor: pointer;
|
||||
border-radius: 8px;
|
||||
transition: transform 0.2s;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.similar-card-image:hover {
|
||||
|
|
@ -235,6 +236,8 @@
|
|||
<div class="similar-card-tile card-tile" data-card-name="{{ card.name }}">
|
||||
<!-- Card Image (uses hover system for preview) -->
|
||||
<div class="similar-card-image">
|
||||
{# Price overlay #}
|
||||
<div class="card-price-overlay" data-price-for="{{ card.name }}" aria-hidden="true"></div>
|
||||
<img src="{{ card.name|card_image('normal') }}"
|
||||
alt="{{ card.name }}"
|
||||
loading="lazy"
|
||||
|
|
|
|||
|
|
@ -247,7 +247,29 @@
|
|||
<span class="card-stat-value">{{ card.rarity | capitalize }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="card-stat" id="card-detail-price-wrap" style="display:none;">
|
||||
<span class="card-stat-label">Price</span>
|
||||
<span class="card-stat-value" id="card-detail-price-display"></span>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
(function(){
|
||||
var name = {{ card.name | tojson }};
|
||||
fetch('/api/price/' + encodeURIComponent(name))
|
||||
.then(function(r){ return r.ok ? r.json() : null; })
|
||||
.then(function(d){
|
||||
if (!d) return;
|
||||
var parts = [];
|
||||
if (d.price != null) parts.push('<span class="price-src-label">TCG</span> $' + parseFloat(d.price).toFixed(2));
|
||||
if (d.ck_price != null) parts.push('<span class="price-src-label">CK</span> $' + parseFloat(d.ck_price).toFixed(2));
|
||||
if (parts.length) {
|
||||
document.getElementById('card-detail-price-display').innerHTML = parts.join(' <span class="price-sep">\u00B7</span> ');
|
||||
document.getElementById('card-detail-price-wrap').style.display = '';
|
||||
}
|
||||
}).catch(function(){});
|
||||
})();
|
||||
</script>
|
||||
|
||||
<!-- Oracle Text -->
|
||||
{% if card.text %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue