{# Above-the-fold triage. In app mode this is the antivirus-style protection home (big shield status + scan button + tiles + recommendations); the web dashboard keeps the slim operator strip. Both render as the content of
(first in
, self-polls every 30s). #} {% from "partials/_macros.html" import btn %} {% set grade_styles = { 'A': 'text-emerald-300 border-emerald-800 bg-emerald-900/30', 'B': 'text-lime-300 border-lime-800 bg-lime-900/30', 'C': 'text-amber-300 border-amber-800 bg-amber-900/30', 'D': 'text-orange-300 border-orange-800 bg-orange-900/30', 'F': 'text-red-300 border-red-800 bg-red-900/30', } %} {% if app_mode %} {# ===== antivirus protection home (app mode) ===== #} {% set bad_grade = risk and risk.grade in ['D','F'] %} {% if (not alive) or active_malicious %} {% set state = 'at_risk' %} {% elif active_suspicious or bad_grade %} {% set state = 'needs_attention' %} {% else %} {% set state = 'protected' %} {% endif %} {% set theme = { 'protected': {'ring':'border-emerald-800','glow':'shadow-[0_0_60px_-15px_rgba(16,185,129,0.45)]','txt':'text-emerald-300','dot':'bg-emerald-400','label':'Protected','line':'avai has your back. No active threats and protection is live.'}, 'needs_attention': {'ring':'border-amber-800','glow':'shadow-[0_0_60px_-15px_rgba(245,158,11,0.45)]','txt':'text-amber-300','dot':'bg-amber-400','label':'Needs attention','line':'avai found things worth a look. Review the items below.'}, 'at_risk': {'ring':'border-red-800','glow':'shadow-[0_0_60px_-15px_rgba(239,68,68,0.5)]','txt':'text-red-300','dot':'bg-red-500','label':'At risk','line':'avai needs you to act now. See the items below.'} } %} {% set t = theme[state] %} {% set paused = ctrl and ctrl.paused %} {% set scanning = ctrl and ctrl.status == 'scanning' %}
{# ===== top: shield + status + actions ===== #}
{# shield — colour is the whole-app verdict from status_logic #} {# status text #}
protection status

{{ t.label }}

{% if risk %} {% set gstyle = grade_styles.get(risk.grade, grade_styles['F']) %} {{ risk.grade }}{{ risk.score }}/100 {% endif %} {% if not alive %} monitor offline · data stale {% elif scanning %} scanning now {% elif paused %} protection paused {% endif %}

{{ risk.explanation if (risk and risk.explanation) else t.line }}

{# actions — real control routes; responses re-render #control, the hero updates on its next poll. hx-disabled-elt blocks a double scan. #}
{{ btn(('⟳ scanning…' if scanning else '⟳ scan now'), 'primary', extra='hx-post="/control/scan-now" hx-target="#control" hx-swap="innerHTML" hx-disabled-elt="this"' ~ (' disabled' if scanning else '')) }} {% if paused %} {{ btn('▶ resume protection', 'success', extra='hx-post="/control/resume" hx-target="#control" hx-swap="innerHTML"') }} {% else %} {{ btn('⏸ pause protection', 'secondary', extra='hx-post="/control/pause" hx-target="#control" hx-swap="innerHTML"') }} {% endif %}
{# ===== four understated stat tiles ===== #} {# ===== avai recommends — drivers = what's costing posture points ===== #}
avai recommends
{% if drivers %}
    {% for d in drivers %}
  • {{ d.label }} −{{ d.points }}
  • {% endfor %}
{% else %}

Nothing to do. No posture weaknesses detected.

{% endif %}
{% else %} {# ===== slim operator strip (web dashboard) ===== #} {% endif %}