@AntonKhorev commented on this pull request.


> +//= require popper
+//= require tooltip
+
+
+/* global CalHeatmap, CalendarLabel, Tooltip */
+document.addEventListener("DOMContentLoaded", () => {
+  const heatmapElement = document.querySelector("#cal-heatmap");
+
+  if (!heatmapElement) {
+    console.warn("Heatmap element not found in the DOM.");
+    return;
+  }
+
+  const heatmapData = heatmapElement.dataset.heatmap ? 
JSON.parse(heatmapElement.dataset.heatmap) : [];
+  const colorScheme = heatmapElement.dataset.siteColorScheme || "auto";
+  const locale = $("head").data().locale;

I think the entire heatmap can be delayed by putting it in turbo frame or maybe 
some collapsible section (maybe for performance reasons). You need `I18n` 
initialized before anyway, I don't know how you're going to translate dates 
correctly otherwise. Although popup dates seem to work even if `I18n` is not 
initialized before the heatmap because they are constructed later.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1923769736
You are receiving this because you are subscribed to this thread.

Message ID: 
<openstreetmap/openstreetmap-website/pull/5402/review/2564700...@github.com>
_______________________________________________
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to