fixed centering issue with radius.
Signed-off-by: boris <boris@borishub.co.uk>
This commit is contained in:
@@ -7,7 +7,7 @@ const CommentsManager = {
|
||||
// Initialization states
|
||||
state: {
|
||||
isInitializing: false,
|
||||
isinitialised: false,
|
||||
isInitialised: false,
|
||||
isDomReady: false,
|
||||
isAuthReady: false
|
||||
},
|
||||
@@ -16,7 +16,7 @@ const CommentsManager = {
|
||||
* initialise status functionality
|
||||
*/
|
||||
initialise() {
|
||||
if (this.state.isinitialised) return;
|
||||
if (this.state.isInitialised) return;
|
||||
|
||||
console.log('Initializing comments...');
|
||||
|
||||
@@ -28,10 +28,10 @@ const CommentsManager = {
|
||||
|
||||
console.log('Comments initialised with auth state:', {
|
||||
isAuthenticated: this.isAuthenticated(),
|
||||
user: window.simpleAuth.getUser()
|
||||
user: window.auth.getUser()
|
||||
});
|
||||
|
||||
this.state.isinitialised = true;
|
||||
this.state.isInitialised = true;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -49,7 +49,7 @@ const CommentsManager = {
|
||||
* Check if user is authenticated
|
||||
*/
|
||||
isAuthenticated() {
|
||||
return window.simpleAuth && window.simpleAuth.isAuthenticated();
|
||||
return window.auth && window.auth.isAuthenticated();
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -253,8 +253,8 @@ const CommentsManager = {
|
||||
* Creates a comment form dynamically for authenticated users
|
||||
*/
|
||||
createCommentFormForAuthenticatedUser(facilityId) {
|
||||
// First check if simpleAuth is available
|
||||
if (!window.simpleAuth) {
|
||||
// First check if auth is available
|
||||
if (!window.auth) {
|
||||
return `
|
||||
<div class="alert alert-warning mb-0">
|
||||
<i class="bi bi-hourglass-split me-2"></i>
|
||||
@@ -265,9 +265,9 @@ const CommentsManager = {
|
||||
|
||||
// Validate authentication state
|
||||
try {
|
||||
const token = window.simpleAuth.getToken();
|
||||
const user = window.simpleAuth.getUser();
|
||||
const isAuthenticated = window.simpleAuth.isAuthenticated();
|
||||
const token = window.auth.getToken();
|
||||
const user = window.auth.getUser();
|
||||
const isAuthenticated = window.auth.isAuthenticated();
|
||||
|
||||
if (!isAuthenticated || !token || !user) {
|
||||
return `
|
||||
@@ -483,14 +483,14 @@ const CommentsManager = {
|
||||
* Checks if the current user is an admin
|
||||
*/
|
||||
isAdmin() {
|
||||
return window.simpleAuth && window.simpleAuth.isAdmin();
|
||||
return window.auth && window.auth.isAdmin();
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks if the given username matches the current user
|
||||
*/
|
||||
isCurrentUser(username) {
|
||||
const user = window.simpleAuth && window.simpleAuth.getUser();
|
||||
const user = window.auth && window.auth.getUser();
|
||||
return user && user.username === username;
|
||||
},
|
||||
|
||||
@@ -522,21 +522,21 @@ if (document.readyState === 'loading') {
|
||||
CommentsManager.checkinitialise();
|
||||
}
|
||||
|
||||
// Listen for simpleAuth ready
|
||||
if (window.simpleAuth) {
|
||||
// Listen for auth ready
|
||||
if (window.auth) {
|
||||
CommentsManager.state.isAuthReady = true;
|
||||
CommentsManager.checkinitialise();
|
||||
} else {
|
||||
window.addEventListener('simpleAuthReady', () => {
|
||||
console.log('SimpleAuth is now ready');
|
||||
window.addEventListener('authReady', () => {
|
||||
console.log('auth is now ready');
|
||||
CommentsManager.state.isAuthReady = true;
|
||||
CommentsManager.checkinitialise();
|
||||
});
|
||||
|
||||
// Fallback timeout in case the event doesn't fire
|
||||
setTimeout(() => {
|
||||
if (!CommentsManager.state.isAuthReady && window.simpleAuth) {
|
||||
console.log('SimpleAuth found via timeout check');
|
||||
if (!CommentsManager.state.isAuthReady && window.auth) {
|
||||
console.log('auth found via timeout check');
|
||||
CommentsManager.state.isAuthReady = true;
|
||||
CommentsManager.checkinitialise();
|
||||
}
|
||||
|
Reference in New Issue
Block a user