141 lines
5.4 KiB
HTML
141 lines
5.4 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}{{ BRAND_NAME }} · Dashboard{% endblock %}
|
|
|
|
{% block main %}
|
|
<div id="dash-header-container"
|
|
style="grid-column: 1 / -1;"
|
|
hx-get="/api/summary/aggregate?as=html"
|
|
hx-trigger="load, every 300s, tone-changed"
|
|
hx-swap="innerHTML">
|
|
<div class="empty">loading aggregate read…</div>
|
|
</div>
|
|
|
|
<section id="indicators-panel" class="panel">
|
|
<div class="panel-header">
|
|
<span class="title">Indicators</span>
|
|
<span class="meta">{% if anchor %}anchor {{ anchor }} · {% endif %}ingest hourly @ :05 UTC</span>
|
|
</div>
|
|
<div class="group-tabs" id="group-tabs">
|
|
{% for g in groups %}
|
|
<button
|
|
class="{% if loop.first %}active{% endif %}"
|
|
hx-get="/api/indicators/{{ g }}?as=html"
|
|
hx-target="#indicators-body"
|
|
hx-trigger="click"
|
|
onclick="document.querySelectorAll('#group-tabs button').forEach(b=>b.classList.remove('active'));this.classList.add('active')"
|
|
>{{ g }}</button>
|
|
{% endfor %}
|
|
</div>
|
|
<div id="indicators-body"
|
|
class="panel-body panel-body--scroll"
|
|
hx-get="/api/indicators/{{ groups[0] }}?as=html"
|
|
hx-trigger="load, tone-changed"
|
|
hx-swap="innerHTML">
|
|
<div class="empty">loading…</div>
|
|
</div>
|
|
</section>
|
|
<script>
|
|
// Auto-refresh the *currently selected* group every 60s by simulating a
|
|
// click on the active tab. Replaces the hard-coded `every 60s` on
|
|
// #indicators-body which always re-fetched groups[0].
|
|
setInterval(function () {
|
|
var active = document.querySelector('#group-tabs button.active');
|
|
if (active) active.click();
|
|
}, 60000);
|
|
</script>
|
|
|
|
<section id="portfolio-panel" class="panel">
|
|
<div class="panel-header">
|
|
<span class="title">Portfolio</span>
|
|
<span class="meta">held locally · prices via /api/universe</span>
|
|
<button type="button" id="pf-edit-btn" class="pf-edit-btn"
|
|
title="Add or remove positions" aria-pressed="false">
|
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none"
|
|
stroke="currentColor" stroke-width="2" aria-hidden="true">
|
|
<path d="M12 20h9"/>
|
|
<path d="M16.5 3.5a2.121 2.121 0 1 1 3 3L7 19l-4 1 1-4L16.5 3.5z"/>
|
|
</svg>
|
|
<span class="pf-edit-btn__label">Edit</span>
|
|
</button>
|
|
<button type="button" id="pf-done-btn" class="pf-done-btn" hidden>Done</button>
|
|
</div>
|
|
<div class="panel-body">
|
|
<div id="pf-add-form" class="pf-add-form" hidden>
|
|
<div class="pf-add-row">
|
|
<label class="pf-add-field">
|
|
<span class="pf-add-label">Ticker</span>
|
|
<input type="text" id="pf-add-ticker" autocomplete="off"
|
|
spellcheck="false" maxlength="32" placeholder="AAPL">
|
|
<span id="pf-add-ticker-status" class="pf-add-status"></span>
|
|
</label>
|
|
<label class="pf-add-field">
|
|
<span class="pf-add-label">Quantity</span>
|
|
<input type="number" id="pf-add-qty" min="0" step="any" placeholder="100">
|
|
</label>
|
|
</div>
|
|
<div class="pf-add-row pf-add-cost-mode">
|
|
<label class="pf-add-radio">
|
|
<input type="radio" name="pf-cost-mode" value="avg" checked>
|
|
Avg cost per share
|
|
</label>
|
|
<label class="pf-add-radio">
|
|
<input type="radio" name="pf-cost-mode" value="date">
|
|
Bought on date
|
|
</label>
|
|
</div>
|
|
<div class="pf-add-row">
|
|
<label class="pf-add-field" id="pf-add-date-field" hidden>
|
|
<span class="pf-add-label">Acquisition date</span>
|
|
<input type="date" id="pf-add-date">
|
|
<span id="pf-add-date-status" class="pf-add-status"></span>
|
|
</label>
|
|
<label class="pf-add-field">
|
|
<span class="pf-add-label">Cost per share</span>
|
|
<input type="number" id="pf-add-cost" min="0" step="any" placeholder="150.25">
|
|
<span id="pf-add-cost-currency" class="pf-add-currency"></span>
|
|
</label>
|
|
<button type="button" id="pf-add-submit" class="pf-add-submit" disabled>
|
|
+ Add
|
|
</button>
|
|
</div>
|
|
<div id="pf-add-warning" class="pf-add-warning" hidden></div>
|
|
</div>
|
|
<div id="pf-mount">
|
|
<div class="empty">loading…</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<script src="{{ url_for('static', path='/js/portfolio-sync.js') }}" defer></script>
|
|
<script src="{{ url_for('static', path='/js/portfolio.js') }}" defer></script>
|
|
<script src="{{ url_for('static', path='/js/portfolio_edit.js') }}" defer></script>
|
|
|
|
<section id="log-panel" class="panel">
|
|
<div class="panel-header">
|
|
<span class="title">Strategic Log</span>
|
|
<span class="meta">
|
|
{% if paid %}refreshed hourly @ :20 UTC{% else %}refreshed every 6 hours · <a href="/pricing">hourly on Paid</a>{% endif %}
|
|
</span>
|
|
</div>
|
|
<div class="panel-body"
|
|
hx-get="/api/log/latest?as=html"
|
|
hx-trigger="load, every 300s, tone-changed"
|
|
hx-swap="innerHTML">
|
|
<div class="empty">awaiting first log…</div>
|
|
</div>
|
|
</section>
|
|
|
|
<section id="news-panel" class="panel">
|
|
<div class="panel-header">
|
|
<span class="title">Flash News</span>
|
|
<span class="meta">
|
|
{% if paid %}last 24h · ingest hourly @ :10 UTC{% else %}last 6h · <a href="/pricing">full 24h on Paid</a>{% endif %}
|
|
</span>
|
|
</div>
|
|
<div class="panel-body panel-body--scroll"
|
|
hx-get="/api/news?as=html&limit=40"
|
|
hx-trigger="load, every 60s, tags-changed"
|
|
hx-swap="innerHTML">
|
|
<div class="empty">loading…</div>
|
|
</div>
|
|
</section>
|
|
{% endblock %}
|