undefined - Follow Up Deployment
Browse files- index.html +0 -77
index.html
CHANGED
|
@@ -532,83 +532,6 @@
|
|
| 532 |
}
|
| 533 |
});
|
| 534 |
|
| 535 |
-
// Add authentication UI elements
|
| 536 |
-
document.addEventListener('DOMContentLoaded', function() {
|
| 537 |
-
// Create auth container
|
| 538 |
-
const authContainer = document.createElement('div');
|
| 539 |
-
authContainer.id = 'auth-container';
|
| 540 |
-
authContainer.className = 'absolute top-4 right-4 bg-white rounded-lg shadow-md p-3 flex items-center';
|
| 541 |
-
|
| 542 |
-
// Create sign in button
|
| 543 |
-
const signInButton = document.createElement('button');
|
| 544 |
-
signInButton.id = 'sign-in-button';
|
| 545 |
-
signInButton.className = 'text-sm bg-indigo-600 hover:bg-indigo-700 text-white px-3 py-1 rounded';
|
| 546 |
-
signInButton.textContent = 'Sign In';
|
| 547 |
-
signInButton.style.display = 'none';
|
| 548 |
-
|
| 549 |
-
// Create sign out button
|
| 550 |
-
const signOutButton = document.createElement('button');
|
| 551 |
-
signOutButton.id = 'sign-out-button';
|
| 552 |
-
signOutButton.className = 'text-sm bg-slate-200 hover:bg-slate-300 text-slate-700 px-3 py-1 rounded';
|
| 553 |
-
signOutButton.textContent = 'Sign Out';
|
| 554 |
-
signOutButton.style.display = 'none';
|
| 555 |
-
|
| 556 |
-
// Append buttons to auth container
|
| 557 |
-
authContainer.appendChild(signInButton);
|
| 558 |
-
authContainer.appendChild(signOutButton);
|
| 559 |
-
|
| 560 |
-
// Insert auth container before auth-status
|
| 561 |
-
const canvas = document.getElementById('canvas');
|
| 562 |
-
const authStatus = document.getElementById('auth-status');
|
| 563 |
-
canvas.insertBefore(authContainer, authStatus);
|
| 564 |
-
|
| 565 |
-
// Set up authentication event listeners
|
| 566 |
-
signInButton.addEventListener('click', async function() {
|
| 567 |
-
try {
|
| 568 |
-
await puter.auth.signIn();
|
| 569 |
-
updateAuthUI();
|
| 570 |
-
// Reload workflows after sign in
|
| 571 |
-
await loadWorkflows();
|
| 572 |
-
} catch (error) {
|
| 573 |
-
console.error('Sign in failed:', error);
|
| 574 |
-
}
|
| 575 |
-
});
|
| 576 |
-
|
| 577 |
-
signOutButton.addEventListener('click', function() {
|
| 578 |
-
puter.auth.signOut();
|
| 579 |
-
updateAuthUI();
|
| 580 |
-
// Reset workflows display
|
| 581 |
-
document.getElementById('workflow-name').textContent = 'Workflow: Untitled';
|
| 582 |
-
});
|
| 583 |
-
|
| 584 |
-
// Initial UI update
|
| 585 |
-
updateAuthUI();
|
| 586 |
-
});
|
| 587 |
-
|
| 588 |
-
// Function to update authentication UI
|
| 589 |
-
async function updateAuthUI() {
|
| 590 |
-
const isSignedIn = await puter.auth.isSignedIn();
|
| 591 |
-
const signInButton = document.getElementById('sign-in-button');
|
| 592 |
-
const signOutButton = document.getElementById('sign-out-button');
|
| 593 |
-
const authIndicator = document.getElementById('auth-indicator');
|
| 594 |
-
const authText = document.getElementById('auth-text');
|
| 595 |
-
|
| 596 |
-
if (isSignedIn) {
|
| 597 |
-
// User is signed in
|
| 598 |
-
const user = await puter.auth.getUser();
|
| 599 |
-
authIndicator.className = 'w-3 h-3 rounded-full bg-green-500 mr-2';
|
| 600 |
-
authText.textContent = `Signed in as: ${user.username}`;
|
| 601 |
-
signInButton.style.display = 'none';
|
| 602 |
-
signOutButton.style.display = 'inline-block';
|
| 603 |
-
} else {
|
| 604 |
-
// User is not signed in
|
| 605 |
-
authIndicator.className = 'w-3 h-3 rounded-full bg-red-500 mr-2';
|
| 606 |
-
authText.textContent = 'Not authenticated';
|
| 607 |
-
signInButton.style.display = 'inline-block';
|
| 608 |
-
signOutButton.style.display = 'none';
|
| 609 |
-
}
|
| 610 |
-
}
|
| 611 |
-
|
| 612 |
// New workflow button
|
| 613 |
document.getElementById('new-workflow-btn').addEventListener('click', function() {
|
| 614 |
// Clear canvas for new workflow
|
|
|
|
| 532 |
}
|
| 533 |
});
|
| 534 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 535 |
// New workflow button
|
| 536 |
document.getElementById('new-workflow-btn').addEventListener('click', function() {
|
| 537 |
// Clear canvas for new workflow
|