perf: remove d3.js + connections modal from base.html (-225KB per page)

d3.v7.min.js (225KB) and connections_modal.html (~1100 lines) were
loaded on every page but only used by owner-only "Mapa Powiązań" tool.

- Removed d3.js and connections_modal include from base.html
- Added {% block extra_scripts %} for pages that need external JS
- admin/zopk_knowledge_graph.html loads d3 via extra_scripts block
- connections_map.html already had its own d3 import
- "Mapa Powiązań" link now points to /connections page instead of modal
- zopk/index.html d3 code was disabled ({% if false %}) — no change needed

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Maciej Pienczyn 2026-04-07 18:23:06 +02:00
parent 085eafe503
commit 8f44c11af9
2 changed files with 6 additions and 6 deletions

View File

@ -2,6 +2,10 @@
{% block title %}Graf Relacji Encji - ZOPK Baza Wiedzy{% endblock %}
{% block extra_scripts %}
<script src="{{ url_for('static', filename='js/vendor/d3.v7.min.js') }}" defer></script>
{% endblock %}
{% block extra_css %}
<style>
.page-header {

View File

@ -2017,7 +2017,7 @@
</svg>
Raporty
</a>
<a href="#" onclick="openConnectionsMap(); return false;">
<a href="{{ url_for('public.connections_map') }}">
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 20l-5.447-2.724A1 1 0 013 16.382V5.618a1 1 0 011.447-.894L9 7m0 13l6-3m-6 3V7m6 10l5.447 2.724A1 1 0 0021 18.382V7.618a1 1 0 00-.553-.894L15 4m0 13V4m0 0L9 7"/>
</svg>
@ -2610,14 +2610,10 @@
{% block extra_js %}{% endblock %}
</script>
<!-- D3.js for Connections Map Modal -->
<script src="{{ url_for('static', filename='js/vendor/d3.v7.min.js') }}" defer></script>
<!-- Scroll Animations (Sprint 4) -->
<script src="{{ url_for('static', filename='js/scroll-animations.js') }}" defer></script>
<!-- Connections Map Modal -->
{% include 'connections_modal.html' %}
{% block extra_scripts %}{% endblock %}
{% if is_staging %}
<!-- Staging Test Panel -->