From 0afb2c0046b55c123eafb4ab9ee77efa68d12463 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sat, 06 Jun 2026 17:15:31 +0000
Subject: [PATCH] =Starting the Favourites.js setup, converting previous Northeh stuff to new Registrar, fixing up Square.php integration to match

---
 assets/js/concise/UserInteractions.js |   35 +++++++----------------------------
 1 files changed, 7 insertions(+), 28 deletions(-)

diff --git a/assets/js/concise/UserInteractions.js b/assets/js/concise/UserInteractions.js
index 22babd7..6ad259a 100644
--- a/assets/js/concise/UserInteractions.js
+++ b/assets/js/concise/UserInteractions.js
@@ -1,5 +1,4 @@
 /**
- * FrontendInteractions - Unified class for frontend user interactions
  * Handles: Favourites, Votes, and related user actions
  */
 class UserInteractions {
@@ -8,8 +7,10 @@
 			return; // Don't initialize if not logged in
 		}
 
+		this.stores = {};
+
 		// Initialize favourites store
-		this.favouritesStore = window.jvbStore.register(
+		this.stores['favourites'] = window.jvbStore.register(
 			'favourites',
 			{
 				storeName: 'favourites',
@@ -32,7 +33,7 @@
 		);
 
 		// Initialize favourites lists store
-		this.listsStore = window.jvbStore.register(
+		this.stores['lists'] = window.jvbStore.register(
 			'favourites_lists',
 			{
 				storeName: 'lists',
@@ -43,7 +44,7 @@
 		);
 
 		// Initialize votes store
-		this.votesStore = window.jvbStore.register(
+		this.stores['votes'] = window.jvbStore.register(
 			'votes',
 			{
 				storeName: 'votes',
@@ -177,32 +178,10 @@
 	}
 }
 
-// Lazy initialization using requestIdleCallback for better performance
+
 function initFrontendInteractions() {
 	if (window.auth.getUser()) {
-		window.jvbInteractions = new FrontendInteractions();
-	}
-}
-
-// Initialize after DOM is ready but without blocking render
-if ('requestIdleCallback' in window) {
-	requestIdleCallback(async function() {
-		window.auth.subscribe((event) => {
-			if (event === 'auth-loaded') {
-				if (document.readyState === 'loading') {
-					document.addEventListener('DOMContentLoaded', initFrontendInteractions);
-				} else {
-					initFrontendInteractions();
-				}
-			}
-		});
-	});
-} else {
-	// Fallback for browsers without requestIdleCallback
-	if (document.readyState === 'loading') {
-		document.addEventListener('DOMContentLoaded', initFrontendInteractions);
-	} else {
-		setTimeout(initFrontendInteractions, 1);
+		window.jvbInteractions = new UserInteractions();
 	}
 }
 

--
Gitblit v1.10.0