cleanup
CI / Frontend (push) Successful in 11m7s
CI / Go - apps/auth-service (push) Failing after 8s
CI / Go - apps/backend (push) Failing after 2s
CI / Docker publish - auth-service (push) Has been skipped
CI / Docker publish - backend (push) Has been skipped

This commit is contained in:
Tomas Dvorak committed 2026-05-05 09:48:15 +02:00
1 parent 48c3e15a38
commit cf3315e8fc
155 files changed
+70334 -19015

No files matched your search

+276
View File
@@ -0,0 +1,276 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>graphify - graphify-out/graph.html</title>
<script src="https://unpkg.com/vis-network/standalone/umd/vis-network.min.js"></script>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: #0f0f1a; color: #e0e0e0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; display: flex; height: 100vh; overflow: hidden; }
#graph { flex: 1; }
#sidebar { width: 280px; background: #1a1a2e; border-left: 1px solid #2a2a4e; display: flex; flex-direction: column; overflow: hidden; }
#search-wrap { padding: 12px; border-bottom: 1px solid #2a2a4e; }
#search { width: 100%; background: #0f0f1a; border: 1px solid #3a3a5e; color: #e0e0e0; padding: 7px 10px; border-radius: 6px; font-size: 13px; outline: none; }
#search:focus { border-color: #4E79A7; }
#search-results { max-height: 140px; overflow-y: auto; padding: 4px 12px; border-bottom: 1px solid #2a2a4e; display: none; }
.search-item { padding: 4px 6px; cursor: pointer; border-radius: 4px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-item:hover { background: #2a2a4e; }
#info-panel { padding: 14px; border-bottom: 1px solid #2a2a4e; min-height: 140px; }
#info-panel h3 { font-size: 13px; color: #aaa; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.05em; }
#info-content { font-size: 13px; color: #ccc; line-height: 1.6; }
#info-content .field { margin-bottom: 5px; }
#info-content .field b { color: #e0e0e0; }
#info-content .empty { color: #555; font-style: italic; }
.neighbor-link { display: block; padding: 2px 6px; margin: 2px 0; border-radius: 3px; cursor: pointer; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid #333; }
.neighbor-link:hover { background: #2a2a4e; }
#neighbors-list { max-height: 160px; overflow-y: auto; margin-top: 4px; }
#legend-wrap { flex: 1; overflow-y: auto; padding: 12px; }
#legend-wrap h3 { font-size: 13px; color: #aaa; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.legend-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; border-radius: 4px; font-size: 12px; }
.legend-item:hover { background: #2a2a4e; padding-left: 4px; }
.legend-item.dimmed { opacity: 0.35; }
.legend-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.legend-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-count { color: #666; font-size: 11px; }
#stats { padding: 10px 14px; border-top: 1px solid #2a2a4e; font-size: 11px; color: #555; }
#legend-controls { display: flex; gap: 6px; margin-bottom: 8px; }
#legend-controls button { flex: 1; background: #0f0f1a; border: 1px solid #3a3a5e; color: #aaa; padding: 4px 0; border-radius: 4px; font-size: 11px; cursor: pointer; }
#legend-controls button:hover { border-color: #4E79A7; color: #e0e0e0; }
</style>
</head>
<body>
<div id="graph"></div>
<div id="sidebar">
<div id="search-wrap">
<input id="search" type="text" placeholder="Search nodes..." autocomplete="off">
<div id="search-results"></div>
</div>
<div id="info-panel">
<h3>Node Info</h3>
<div id="info-content"><span class="empty">Click a node to inspect it</span></div>
</div>
<div id="legend-wrap">
<h3>Communities</h3>
<div id="legend-controls">
<button onclick="toggleAllCommunities(false)">Show All</button>
<button onclick="toggleAllCommunities(true)">Hide All</button>
</div>
<div id="legend"></div>
</div>
<div id="stats">794 nodes &middot; 1114 edges &middot; 63 communities</div>
</div>
<script>
const RAW_NODES = [{"id": "generate_map_tsx", "label": "generate_map.tsx", "color": {"background": "#BAB0AC", "border": "#BAB0AC", "highlight": {"background": "#ffffff", "border": "#BAB0AC"}}, "size": 10.5, "font": {"size": 0, "color": "#ffffff"}, "title": "generate_map.tsx", "community": 39, "community_name": "Contact Map", "source_file": "generate_map.tsx", "file_type": "code", "degree": 1}, {"id": "bookra_generate_map_contactmap", "label": "ContactMap()", "color": {"background": "#BAB0AC", "border": "#BAB0AC", "highlight": {"background": "#ffffff", "border": "#BAB0AC"}}, "size": 10.5, "font": {"size": 0, "color": "#ffffff"}, "title": "ContactMap()", "community": 39, "community_name": "Contact Map", "source_file": "generate_map.tsx", "file_type": "code", "degree": 1}, {"id": "map_ts", "label": "map.ts", "color": {"background": "#B07AA1", "border": "#B07AA1", "highlight": {"background": "#ffffff", "border": "#B07AA1"}}, "size": 12.5, "font": {"size": 0, "color": "#ffffff"}, "title": "map.ts", "community": 26, "community_name": "Map URL Parsing", "source_file": "map.ts", "file_type": "code", "degree": 5}, {"id": "bookra_map_parsemapyczurl", "label": "parseMapyCzUrl()", "color": {"background": "#B07AA1", "border": "#B07AA1", "highlight": {"background": "#ffffff", "border": "#B07AA1"}}, "size": 11.0, "font": {"size": 0, "color": "#ffffff"}, "title": "parseMapyCzUrl()", "community": 26, "community_name": "Map URL Parsing", "source_file": "map.ts", "file_type": "code", "degree": 2}, {"id": "bookra_map_parsegooglemapsurl", "label": "parseGoogleMapsUrl()", "color": {"background": "#B07AA1", "border": "#B07AA1", "highlight": {"background": "#ffffff", "border": "#B07AA1"}}, "size": 11.0, "font": {"size": 0, "color": "#ffffff"}, "title": "parseGoogleMapsUrl()", "community": 26, "community_name": "Map URL Parsing", "source_file": "map.ts", "file_type": "code", "degree": 2}, {"id": "bookra_map_parsemapurl", "label": "parseMapUrl()", "color": {"background": "#B07AA1", "border": "#B07AA1", "highlight": {"background": "#ffffff", "border": "#B07AA1"}}, "size": 11.5, "font": {"size": 0, "color": "#ffffff"}, "title": "parseMapUrl()", "community": 26, "community_name": "Map URL Parsing", "source_file": "map.ts", "file_type": "code", "degree": 3}, {"id": "bookra_map_validatecoordinates", "label": "validateCoordinates()", "color": {"background": "#B07AA1", "border": "#B07AA1", "highlight": {"background": "#ffffff", "border": "#B07AA1"}}, "size": 10.5, "font": {"size": 0, "color": "#ffffff"}, "title": "validateCoordinates()", "community": 26, "community_name": "Map URL Parsing", "source_file": "map.ts", "file_type": "code", "degree": 1}, {"id": "bookra_map_reversegeocode", "label": "reverseGeocode()", "color": {"background": "#B07AA1", "border": "#B07AA1", "highlight": {"background": "#ffffff", "border": "#B07AA1"}}, "size": 10.5, "font": {"size": 0, "color": "#ffffff"}, "title": "reverseGeocode()", "community": 26, "community_name": "Map URL Parsing", "source_file": "map.ts", "file_type": "code", "degree": 1}, {"id": "apps_auth_service_cmd_api_main_go", "label": "main.go", "color": {"background": "#EDC948", "border": "#EDC948", "highlight": {"background": "#ffffff", "border": "#EDC948"}}, "size": 11.0, "font": {"size": 0, "color": "#ffffff"}, "title": "main.go", "community": 5, "community_name": "Server & Main Entry", "source_file": "apps/auth-service/cmd/api/main.go", "file_type": "code", "degree": 2}, {"id": "api_main_main", "label": "main()", "color": {"background": "#EDC948", "border": "#EDC948", "highlight": {"background": "#ffffff", "border": "#EDC948"}}, "size": 14.1, "font": {"size": 0, "color": "#ffffff"}, "title": "main()", "community": 5, "community_name": "Server & Main Entry", "source_file": "apps/backend/cmd/api/main.go", "file_type": "code", "degree": 8}, {"id": "api_main_runmigrations", "label": "runMigrations()", "color": {"background": "#EDC948", "border": "#EDC948", "highlight": {"background": "#ffffff", "border": "#EDC948"}}, "size": 11.5, "font": {"size": 0, "color": "#ffffff"}, "title": "runMigrations()", "community": 5, "community_name": "Server & Main Entry", "source_file": "apps/auth-service/cmd/api/main.go", "file_type": "code", "degree": 3}, {"id": "apps_auth_service_internal_email_templates_go", "label": "templates.go", "color": {"background": "#4E79A7", "border": "#4E79A7", "highlight": {"background": "#ffffff", "border": "#4E79A7"}}, "size": 16.6, "font": {"size": 12, "color": "#ffffff"}, "title": "templates.go", "community": 10, "community_name": "Email Templates Service", "source_file": "apps/auth-service/internal/email/templates.go", "file_type": "code", "degree": 13}, {"id": "email_emailtemplate", "label": "EmailTemplate", "color": {"background": "#4E79A7", "border": "#4E79A7", "highlight": {"background": "#ffffff", "border": "#4E79A7"}}, "size": 10.5, "font": {"size": 0, "color": "#ffffff"}, "title": "EmailTemplate", "community": 10, "community_name": "Email Templates Service", "source_file"Line truncated
const RAW_EDGES = [{"from": "generate_map_tsx", "to": "bookra_generate_map_contactmap", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "map_ts", "to": "bookra_map_parsemapyczurl", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "map_ts", "to": "bookra_map_parsegooglemapsurl", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "map_ts", "to": "bookra_map_parsemapurl", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "map_ts", "to": "bookra_map_validatecoordinates", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "map_ts", "to": "bookra_map_reversegeocode", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "bookra_map_parsemapyczurl", "to": "bookra_map_parsemapurl", "label": "calls", "title": "calls [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "bookra_map_parsegooglemapsurl", "to": "bookra_map_parsemapurl", "label": "calls", "title": "calls [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "apps_auth_service_cmd_api_main_go", "to": "api_main_main", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "apps_auth_service_cmd_api_main_go", "to": "api_main_runmigrations", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "api_main_main", "to": "api_main_runmigrations", "label": "calls", "title": "calls [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "api_main_main", "to": "apps_backend_cmd_api_main_go", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "api_main_main", "to": "config_config_load", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "api_main_main", "to": "config_config_getenv", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "api_main_main", "to": "handlers_handlers_new", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "api_main_main", "to": "db_pool_newpools", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "api_main_main", "to": "api_server_newserver", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "api_main_runmigrations", "to": "api_server_close", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "apps_auth_service_internal_email_templates_go", "to": "email_emailtemplate", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "apps_auth_service_internal_email_templates_go", "to": "email_templates_magiclinkemail", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "apps_auth_service_internal_email_templates_go", "to": "email_templates_welcomeemail", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "apps_auth_service_internal_email_templates_go", "to": "email_templates_bookingconfirmationemail", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "apps_auth_service_internal_email_templates_go", "to": "email_templates_passwordresetemail", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "apps_auth_service_internal_email_templates_go", "to": "email_templates_magiclinkemailen", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "apps_auth_service_internal_email_templaLine truncated
const LEGEND = [{"cid": 0, "color": "#4E79A7", "label": "Neon Database Core", "count": 79}, {"cid": 1, "color": "#F28E2B", "label": "Paddle Billing &amp; Dashboard", "count": 72}, {"cid": 2, "color": "#E15759", "label": "Memory Repository", "count": 48}, {"cid": 3, "color": "#76B7B2", "label": "PostgreSQL Repository", "count": 47}, {"cid": 4, "color": "#59A14F", "label": "Domain Models", "count": 41}, {"cid": 5, "color": "#EDC948", "label": "Server &amp; Main Entry", "count": 40}, {"cid": 6, "color": "#B07AA1", "label": "Admin Dashboard", "count": 39}, {"cid": 7, "color": "#FF9DA7", "label": "Test Suite", "count": 35}, {"cid": 8, "color": "#9C755F", "label": "Database Records", "count": 33}, {"cid": 9, "color": "#BAB0AC", "label": "Widget Builder &amp; Icons", "count": 28}, {"cid": 10, "color": "#4E79A7", "label": "Email Templates Service", "count": 24}, {"cid": 11, "color": "#F28E2B", "label": "Notification Service", "count": 23}, {"cid": 12, "color": "#E15759", "label": "Database Connection", "count": 21}, {"cid": 13, "color": "#76B7B2", "label": "UI Icons Library", "count": 20}, {"cid": 14, "color": "#59A14F", "label": "Email Provider", "count": 19}, {"cid": 15, "color": "#EDC948", "label": "Auth &amp; Magic Links", "count": 18}, {"cid": 16, "color": "#B07AA1", "label": "Business Service", "count": 17}, {"cid": 17, "color": "#FF9DA7", "label": "Shell &amp; Auth UI", "count": 15}, {"cid": 18, "color": "#9C755F", "label": "Landing Page UI", "count": 14}, {"cid": 19, "color": "#BAB0AC", "label": "Email Localization", "count": 12}, {"cid": 20, "color": "#4E79A7", "label": "Customer Notifications", "count": 12}, {"cid": 21, "color": "#F28E2B", "label": "Maps &amp; Geocoding", "count": 12}, {"cid": 22, "color": "#E15759", "label": "Brand Profile Service", "count": 11}, {"cid": 23, "color": "#76B7B2", "label": "Dialog Component", "count": 9}, {"cid": 24, "color": "#59A14F", "label": "Google OAuth", "count": 8}, {"cid": 25, "color": "#EDC948", "label": "Card Component", "count": 7}, {"cid": 26, "color": "#B07AA1", "label": "Map URL Parsing", "count": 6}, {"cid": 27, "color": "#FF9DA7", "label": "Location Map", "count": 6}, {"cid": 28, "color": "#9C755F", "label": "Tabs Component", "count": 6}, {"cid": 29, "color": "#BAB0AC", "label": "Legal Pages", "count": 5}, {"cid": 30, "color": "#4E79A7", "label": "Auth Provider", "count": 5}, {"cid": 31, "color": "#F28E2B", "label": "Skeleton Component", "count": 4}, {"cid": 32, "color": "#E15759", "label": "Theme Provider", "count": 4}, {"cid": 33, "color": "#76B7B2", "label": "User Repository", "count": 3}, {"cid": 34, "color": "#59A14F", "label": "Paddle Config Tests", "count": 3}, {"cid": 35, "color": "#EDC948", "label": "App Root", "count": 3}, {"cid": 36, "color": "#B07AA1", "label": "Public Booking", "count": 3}, {"cid": 37, "color": "#FF9DA7", "label": "Bookra Character", "count": 3}, {"cid": 38, "color": "#9C755F", "label": "Booking Types", "count": 3}, {"cid": 39, "color": "#BAB0AC", "label": "Contact Map", "count": 2}, {"cid": 40, "color": "#4E79A7", "label": "About Page", "count": 2}, {"cid": 41, "color": "#F28E2B", "label": "Auth Callback", "count": 2}, {"cid": 42, "color": "#E15759", "label": "Contact Page", "count": 2}, {"cid": 43, "color": "#76B7B2", "label": "Not Found Page", "count": 2}, {"cid": 44, "color": "#59A14F", "label": "Integration Modal", "count": 2}, {"cid": 45, "color": "#EDC948", "label": "Tooltip Component", "count": 2}, {"cid": 46, "color": "#B07AA1", "label": "Input Component", "count": 2}, {"cid": 47, "color": "#FF9DA7", "label": "Badge Component", "count": 2}, {"cid": 48, "color": "#9C755F", "label": "Select Component", "count": 2}, {"cid": 49, "color": "#BAB0AC", "label": "Textarea Component", "count": 2}, {"cid": 50, "color": "#4E79A7", "label": "Avatar Component", "count": 2}, {"cid": 51, "color": "#F28E2B", "label": "Vite Config", "count": 1}, {"cid": 52, "color": "#E15759", "label": "Main Entry", "count": 1}, {"cid": 53, "color": "#76B7B2", "label": "API Index", "count": 1}, {"cid": 54, "color": "#59A14F", "label": "Button Component", "count": 1}, {"cid": 55, "color": "#EDC948", "label": "Repository Index", "count": 1}, {"cid": 56, "color": "#B07AA1", "label": "I18n Provider", "count": 1}, {"cid": 57, "color": "#FF9DA7", "label": "API Client", "count": 1}, {"cid": 58, "color": "#9C755F", "label": "Shared Types", "count": 1}, {"cid": 59, "color": "#BAB0AC", "label": "Index Export", "count": 1}, {"cid": 60, "color": "#4E79A7", "label": "Repository Export", "count": 1}, {"cid": 61, "color": "#F28E2B", "label": "Types Export", "count": 1}, {"cid": 62, "color": "#E15759", "label": "Generate Script", "count": 1}];
// HTML-escape helper — prevents XSS when injecting graph data into innerHTML
function esc(s) {
return String(s).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;').replace(/'/g,'&#39;');
}
// Build vis datasets
const nodesDS = new vis.DataSet(RAW_NODES.map(n => ({
id: n.id, label: n.label, color: n.color, size: n.size,
font: n.font, title: n.title,
_community: n.community, _community_name: n.community_name,
_source_file: n.source_file, _file_type: n.file_type, _degree: n.degree,
})));
const edgesDS = new vis.DataSet(RAW_EDGES.map((e, i) => ({
id: i, from: e.from, to: e.to,
label: '',
title: e.title,
dashes: e.dashes,
width: e.width,
color: e.color,
arrows: { to: { enabled: true, scaleFactor: 0.5 } },
})));
const container = document.getElementById('graph');
const network = new vis.Network(container, { nodes: nodesDS, edges: edgesDS }, {
physics: {
enabled: true,
solver: 'forceAtlas2Based',
forceAtlas2Based: {
gravitationalConstant: -60,
centralGravity: 0.005,
springLength: 120,
springConstant: 0.08,
damping: 0.4,
avoidOverlap: 0.8,
},
stabilization: { iterations: 200, fit: true },
},
interaction: {
hover: true,
tooltipDelay: 100,
hideEdgesOnDrag: true,
navigationButtons: false,
keyboard: false,
},
nodes: { shape: 'dot', borderWidth: 1.5 },
edges: { smooth: { type: 'continuous', roundness: 0.2 }, selectionWidth: 3 },
});
network.once('stabilizationIterationsDone', () => {
network.setOptions({ physics: { enabled: false } });
});
function showInfo(nodeId) {
const n = nodesDS.get(nodeId);
if (!n) return;
const neighborIds = network.getConnectedNodes(nodeId);
const neighborItems = neighborIds.map(nid => {
const nb = nodesDS.get(nid);
const color = nb ? nb.color.background : '#555';
return `<span class="neighbor-link" style="border-left-color:${esc(color)}" onclick="focusNode(${JSON.stringify(nid)})">${esc(nb ? nb.label : nid)}</span>`;
}).join('');
document.getElementById('info-content').innerHTML = `
<div class="field"><b>${esc(n.label)}</b></div>
<div class="field">Type: ${esc(n._file_type || 'unknown')}</div>
<div class="field">Community: ${esc(n._community_name)}</div>
<div class="field">Source: ${esc(n._source_file || '-')}</div>
<div class="field">Degree: ${n._degree}</div>
${neighborIds.length ? `<div class="field" style="margin-top:8px;color:#aaa;font-size:11px">Neighbors (${neighborIds.length})</div><div id="neighbors-list">${neighborItems}</div>` : ''}
`;
}
function focusNode(nodeId) {
network.focus(nodeId, { scale: 1.4, animation: true });
network.selectNodes([nodeId]);
showInfo(nodeId);
}
// Track hovered node — hover detection is more reliable than click params
let hoveredNodeId = null;
network.on('hoverNode', params => {
hoveredNodeId = params.node;
container.style.cursor = 'pointer';
});
network.on('blurNode', () => {
hoveredNodeId = null;
container.style.cursor = 'default';
});
container.addEventListener('click', () => {
if (hoveredNodeId !== null) {
showInfo(hoveredNodeId);
network.selectNodes([hoveredNodeId]);
}
});
network.on('click', params => {
if (params.nodes.length > 0) {
showInfo(params.nodes[0]);
} else if (hoveredNodeId === null) {
document.getElementById('info-content').innerHTML = '<span class="empty">Click a node to inspect it</span>';
}
});
const searchInput = document.getElementById('search');
const searchResults = document.getElementById('search-results');
searchInput.addEventListener('input', () => {
const q = searchInput.value.toLowerCase().trim();
searchResults.innerHTML = '';
if (!q) { searchResults.style.display = 'none'; return; }
const matches = RAW_NODES.filter(n => n.label.toLowerCase().includes(q)).slice(0, 20);
if (!matches.length) { searchResults.style.display = 'none'; return; }
searchResults.style.display = 'block';
matches.forEach(n => {
const el = document.createElement('div');
el.className = 'search-item';
el.textContent = n.label;
el.style.borderLeft = `3px solid ${n.color.background}`;
el.style.paddingLeft = '8px';
el.onclick = () => {
network.focus(n.id, { scale: 1.5, animation: true });
network.selectNodes([n.id]);
showInfo(n.id);
searchResults.style.display = 'none';
searchInput.value = '';
};
searchResults.appendChild(el);
});
});
document.addEventListener('click', e => {
if (!searchResults.contains(e.target) && e.target !== searchInput)
searchResults.style.display = 'none';
});
const hiddenCommunities = new Set();
function toggleAllCommunities(hide) {
document.querySelectorAll('.legend-item').forEach(item => {
hide ? item.classList.add('dimmed') : item.classList.remove('dimmed');
});
LEGEND.forEach(c => {
if (hide) hiddenCommunities.add(c.cid); else hiddenCommunities.delete(c.cid);
});
const updates = RAW_NODES.map(n => ({ id: n.id, hidden: hide }));
nodesDS.update(updates);
}
const legendEl = document.getElementById('legend');
LEGEND.forEach(c => {
const item = document.createElement('div');
item.className = 'legend-item';
item.innerHTML = `<div class="legend-dot" style="background:${c.color}"></div>
<span class="legend-label">${c.label}</span>
<span class="legend-count">${c.count}</span>`;
item.onclick = () => {
if (hiddenCommunities.has(c.cid)) {
hiddenCommunities.delete(c.cid);
item.classList.remove('dimmed');
} else {
hiddenCommunities.add(c.cid);
item.classList.add('dimmed');
}
const updates = RAW_NODES
.filter(n => n.community === c.cid)
.map(n => ({ id: n.id, hidden: hiddenCommunities.has(c.cid) }));
nodesDS.update(updates);
};
legendEl.appendChild(item);
});
</script>
<script>
// Render hyperedges as shaded regions
const hyperedges = [];
// afterDrawing passes ctx already transformed to network coordinate space.
// Draw node positions raw — no manual pan/zoom/DPR math needed.
network.on('afterDrawing', function(ctx) {
hyperedges.forEach(h => {
const positions = h.nodes
.map(nid => network.getPositions([nid])[nid])
.filter(p => p !== undefined);
if (positions.length < 2) return;
ctx.save();
ctx.globalAlpha = 0.12;
ctx.fillStyle = '#6366f1';
ctx.strokeStyle = '#6366f1';
ctx.lineWidth = 2;
ctx.beginPath();
// Centroid and expanded hull in network coordinates
const cx = positions.reduce((s, p) => s + p.x, 0) / positions.length;
const cy = positions.reduce((s, p) => s + p.y, 0) / positions.length;
const expanded = positions.map(p => ({
x: cx + (p.x - cx) * 1.15,
y: cy + (p.y - cy) * 1.15
}));
ctx.moveTo(expanded[0].x, expanded[0].y);
expanded.slice(1).forEach(p => ctx.lineTo(p.x, p.y));
ctx.closePath();
ctx.fill();
ctx.globalAlpha = 0.4;
ctx.stroke();
// Label
ctx.globalAlpha = 0.8;
ctx.fillStyle = '#4f46e5';
ctx.font = 'bold 11px sans-serif';
ctx.textAlign = 'center';
ctx.fillText(h.label, cx, cy - 5);
ctx.restore();
});
});
</script>
</body>
</html>