mtg_python_deckbuilder/code/web/templates/home.html

45 lines
2.3 KiB
HTML
Raw Normal View History

{% extends "base.html" %}
{% from 'partials/_buttons.html' import button %}
{% block content %}
<section>
<div class="actions-grid">
{{ button('Build a Deck', variant='primary', href='/build', classes='action-button home-button') }}
{{ button('Run a JSON Config', variant='secondary', href='/configs', classes='action-button home-button') }}
{% if show_setup %}{{ button('Initial Setup', variant='secondary', href='/setup', classes='action-button home-button') }}{% endif %}
{{ button('Owned Library', variant='secondary', href='/owned', classes='action-button home-button') }}
{{ button('Browse All Cards', variant='secondary', href='/cards', classes='action-button home-button') }}
{% if show_commanders %}{{ button('Browse Commanders', variant='secondary', href='/commanders', classes='action-button home-button') }}{% endif %}
{{ button('Finished Decks', variant='secondary', href='/decks', classes='action-button home-button') }}
{{ button('Browse Themes', variant='secondary', href='/themes/', classes='action-button home-button') }}
{% if random_ui %}{{ button('Random Build', variant='secondary', href='/random', classes='action-button home-button') }}{% endif %}
{% if show_diagnostics %}{{ button('Diagnostics', variant='secondary', href='/diagnostics', classes='action-button home-button') }}{% endif %}
{% if show_logs %}{{ button('View Logs', variant='secondary', href='/logs', classes='action-button home-button') }}{% endif %}
</div>
<div id="themes-quick" style="margin-top:1rem; font-size:.85rem; color:var(--text-muted);">
<span id="themes-quick-status">Themes: …</span>
</div>
</section>
<script>
(function(){
function upd(data){
var el = document.getElementById('themes-quick-status');
if(!el) return;
if(!data || !data.ok){ el.textContent='Themes: unavailable'; return; }
var badge = '';
if(data.phase === 'themes' || data.phase === 'themes-fast') badge=' (refreshing)';
else if(data.stale) badge=' (stale)';
el.textContent = 'Themes: ' + (data.theme_count != null ? data.theme_count : '?') + badge;
}
function poll(){
fetch('/themes/status', { cache:'no-store' })
.then(function(r){ return r.json(); })
.then(upd)
.catch(function(){});
}
poll();
setInterval(poll, 7000);
})();
</script>
{% endblock %}