Compare commits
1 Commits
5963c6b11e
...
014fb08935
Author | SHA1 | Date | |
---|---|---|---|
014fb08935
|
@@ -17,16 +17,9 @@ function toggleAskAI() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function checkAuthenticationStatus() {
|
function checkAuthenticationStatus() {
|
||||||
// Wait a bit for OAuth app to load if needed
|
const userSections = document.querySelectorAll('.user-section');
|
||||||
setTimeout(() => {
|
const isAuthenticated = userSections.length > 0;
|
||||||
const userSections = document.querySelectorAll('.user-section');
|
|
||||||
const isAuthenticated = userSections.length > 0;
|
|
||||||
|
|
||||||
handleAuthenticationStatus(isAuthenticated);
|
|
||||||
}, 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleAuthenticationStatus(isAuthenticated) {
|
|
||||||
if (isAuthenticated) {
|
if (isAuthenticated) {
|
||||||
// User is authenticated - show Ask AI UI
|
// User is authenticated - show Ask AI UI
|
||||||
document.getElementById('authCheck').style.display = 'none';
|
document.getElementById('authCheck').style.display = 'none';
|
||||||
@@ -384,37 +377,6 @@ function setupAskAIEventListeners() {
|
|||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
setupAskAIEventListeners();
|
setupAskAIEventListeners();
|
||||||
console.log('Ask AI initialized successfully');
|
console.log('Ask AI initialized successfully');
|
||||||
|
|
||||||
// Also listen for OAuth app load completion
|
|
||||||
const observer = new MutationObserver(function(mutations) {
|
|
||||||
mutations.forEach(function(mutation) {
|
|
||||||
if (mutation.type === 'childList') {
|
|
||||||
// Check if user-section was added/removed
|
|
||||||
const userSectionAdded = Array.from(mutation.addedNodes).some(node =>
|
|
||||||
node.nodeType === Node.ELEMENT_NODE &&
|
|
||||||
(node.classList?.contains('user-section') || node.querySelector?.('.user-section'))
|
|
||||||
);
|
|
||||||
const userSectionRemoved = Array.from(mutation.removedNodes).some(node =>
|
|
||||||
node.nodeType === Node.ELEMENT_NODE &&
|
|
||||||
(node.classList?.contains('user-section') || node.querySelector?.('.user-section'))
|
|
||||||
);
|
|
||||||
|
|
||||||
if (userSectionAdded || userSectionRemoved) {
|
|
||||||
console.log('User section status changed');
|
|
||||||
// Update Ask AI panel if it's visible
|
|
||||||
const panel = document.getElementById('askAiPanel');
|
|
||||||
if (panel && panel.style.display !== 'none') {
|
|
||||||
checkAuthenticationStatus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
observer.observe(document.body, {
|
|
||||||
childList: true,
|
|
||||||
subtree: true
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Global functions for onclick handlers
|
// Global functions for onclick handlers
|
||||||
|
@@ -56,7 +56,7 @@ export default function RecordTabs({ langRecords, commentRecords, userComments,
|
|||||||
setActiveTab('profiles')
|
setActiveTab('profiles')
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
about ({filteredProfileRecords.length})
|
profile ({filteredProfileRecords.length})
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
className={`tab-btn ${activeTab === 'collection' ? 'active' : ''}`}
|
className={`tab-btn ${activeTab === 'collection' ? 'active' : ''}`}
|
||||||
@@ -64,17 +64,17 @@ export default function RecordTabs({ langRecords, commentRecords, userComments,
|
|||||||
>
|
>
|
||||||
chat ({userChatRecords?.length || 0})
|
chat ({userChatRecords?.length || 0})
|
||||||
</button>
|
</button>
|
||||||
<button
|
|
||||||
className={`tab-btn ${activeTab === 'comment' ? 'active' : ''}`}
|
|
||||||
onClick={() => setActiveTab('comment')}
|
|
||||||
>
|
|
||||||
comment ({filteredCommentRecords.length})
|
|
||||||
</button>
|
|
||||||
<button
|
<button
|
||||||
className={`tab-btn ${activeTab === 'users' ? 'active' : ''}`}
|
className={`tab-btn ${activeTab === 'users' ? 'active' : ''}`}
|
||||||
onClick={() => setActiveTab('users')}
|
onClick={() => setActiveTab('users')}
|
||||||
>
|
>
|
||||||
feedback ({filteredUserComments.length})
|
comment ({filteredUserComments.length})
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
className={`tab-btn ${activeTab === 'comment' ? 'active' : ''}`}
|
||||||
|
onClick={() => setActiveTab('comment')}
|
||||||
|
>
|
||||||
|
feedback ({filteredCommentRecords.length})
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
className={`tab-btn ${activeTab === 'lang' ? 'active' : ''}`}
|
className={`tab-btn ${activeTab === 'lang' ? 'active' : ''}`}
|
||||||
|
Reference in New Issue
Block a user