Files
WebtreesFullDiagram/resources/js/modules/index.js
Alexander Bocken 04ff9f4711 Add homepage block, reactive controls, i18n, and full-width layout
- Implement ModuleBlockInterface for tree/user homepage embedding
  with configurable individual and generation settings
- Make generation sliders reactive (auto-navigate on change)
- Persist generation counts when clicking between persons
- Expand chart to full viewport width and remaining height
- Add German and Dutch translations for all custom strings
- Pass translated labels to JS bio card tooltip via window.fullDiagramI18n
- Use webtrees core translation keys where available
- Increase default generations to 4, remove show siblings checkbox
- Expose Chart class globally for block instantiation
2026-03-14 19:53:12 +01:00

34 lines
803 B
JavaScript

/**
* Full Diagram — entry point.
*
* Reads embedded data from the page and initializes the chart.
*/
import Chart from "./lib/chart.js";
// Expose Chart class for block usage
window.FullDiagramChart = Chart;
async function init() {
const data = window.fullDiagramData;
const baseUrl = window.fullDiagramBaseUrl;
if (!data || !data.persons) {
console.error("Full Diagram: No tree data found.");
return;
}
try {
const chart = new Chart("#full-diagram-container", data, baseUrl);
await chart.render();
} catch (err) {
console.error("Full Diagram: Render failed", err);
}
}
// Initialize when DOM is ready
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", init);
} else {
init();
}