feat: Add metrics on homepage

This commit is contained in:
kbe
2025-08-17 23:39:24 +02:00
parent 17e6711299
commit ba3f36a5e8
5 changed files with 200 additions and 3 deletions

View File

@@ -1,3 +1,16 @@
// Entry point for the build script in your package.json
import "@hotwired/turbo-rails"
import "./controllers"
import Counter from "./components/counter"
// Initialize counters when DOM is ready
document.addEventListener('DOMContentLoaded', () => {
const counters = document.querySelectorAll('.counter')
counters.forEach(counter => new Counter(counter))
})
// Re-initialize counters on Turbo page loads
document.addEventListener('turbo:load', () => {
const counters = document.querySelectorAll('.counter')
counters.forEach(counter => new Counter(counter))
})