{# settings/_catalog_partial.html — HTMX partial for plugin catalog #}
{% if error %}
{{ error }}
{% endif %}
{% if catalog %}
{% for plugin in catalog %}
{% set is_installed = plugin.name in installed_names %}
{% set is_loaded = plugin.name in loaded_names %}
{% set installed_ver = installed_versions.get(plugin.name, "") %}
{# update_available: catalog version is strictly newer than what's on disk #}
{% set update_available = is_installed and installed_ver and installed_ver != plugin.version %}
{{ plugin.name }}v{{ plugin.version }}
{% if update_available %}
Update available — installed v{{ installed_ver }}
{% elif is_loaded %}
Active
{% elif is_installed %}
Installed
{% endif %}
{% for tag in plugin.tags %}
{{ tag }}
{% endfor %}
{% if plugin.description %}
{{ plugin.description }}
{% endif %}
{% if plugin.author %}by {{ plugin.author }}{% endif %}
{% if plugin.license %}{{ plugin.license }}{% endif %}
{% if plugin.min_app_version %}requires v{{ plugin.min_app_version }}+{% endif %}
{% if plugin.homepage %}
Docs
{% elif plugin.repository_url %}
Source
{% endif %}
{% if update_available %}
{# Installed but outdated — offer update (download + restart) #}
{% elif is_loaded %}
{# Active and up to date — no action needed #}
{% elif is_installed %}
{# Installed but not active — offer hot-reload #}
{% else %}
{# Not installed — offer install #}
{% endif %}
{# Inline result placeholder — replaced by _install_result.html after action #}