|
|
|
|
|
|
|
|
|
|
|
document.addEventListener('DOMContentLoaded', function() { |
|
|
console.log('AutoDev Agent Orchestrator Pro loaded successfully! 🚀'); |
|
|
|
|
|
|
|
|
const links = document.querySelectorAll('a[href]'); |
|
|
links.forEach(link => { |
|
|
link.addEventListener('click', function(e) { |
|
|
if (this.getAttribute('href').startsWith('/') && this.getAttribute('href') !== window.location.pathname) { |
|
|
|
|
|
document.body.style.opacity = '0.7'; |
|
|
setTimeout(() => { |
|
|
document.body.style.opacity = '1'; |
|
|
}, 500); |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
const observerOptions = { |
|
|
threshold: 0.1, |
|
|
rootMargin: '0px 0px -50px 0px' |
|
|
}; |
|
|
|
|
|
const observer = new IntersectionObserver((entries) => { |
|
|
entries.forEach(entry => { |
|
|
if (entry.isIntersecting) { |
|
|
entry.target.style.opacity = '1'; |
|
|
entry.target.style.transform = 'translateY(0)'; |
|
|
} |
|
|
}); |
|
|
}, observerOptions); |
|
|
|
|
|
|
|
|
document.querySelectorAll('.grid > div, section').forEach(el => { |
|
|
el.style.opacity = '0'; |
|
|
el.style.transform = 'translateY(20px)'; |
|
|
el.style.transition = 'opacity 0.6s ease, transform 0.6s ease'; |
|
|
observer.observe(el); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
class AgentAPI { |
|
|
static async getAgentStatus(agentId) { |
|
|
|
|
|
try { |
|
|
const response = await fetch(`/api/agents/${agentId}/status`); |
|
|
return await response.json(); |
|
|
} catch (error) { |
|
|
console.error('Failed to fetch agent status:', error); |
|
|
return { status: 'unknown', lastActivity: new Date() }; |
|
|
} |
|
|
} |
|
|
|
|
|
static async startDevelopment(projectData) { |
|
|
try { |
|
|
const response = await fetch('/api/projects/start', { |
|
|
method: 'POST', |
|
|
headers: { |
|
|
'Content-Type': 'application/json', |
|
|
}, |
|
|
body: JSON.stringify(projectData) |
|
|
}); |
|
|
return await response.json(); |
|
|
} catch (error) { |
|
|
console.error('Failed to start development:', error); |
|
|
return { success: false, projectId: null }; |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const Utils = { |
|
|
|
|
|
formatDate: (date) => { |
|
|
return new Date(date).toLocaleDateString('en-US', { |
|
|
year: 'numeric', |
|
|
month: 'short', |
|
|
day: 'numeric' |
|
|
}); |
|
|
}, |
|
|
|
|
|
|
|
|
debounce: (func, wait) => { |
|
|
let timeout; |
|
|
return function executedFunction(...args) { |
|
|
const later = () => { |
|
|
clearTimeout(timeout); |
|
|
func(...args); |
|
|
}; |
|
|
clearTimeout(timeout); |
|
|
timeout = setTimeout(later, wait); |
|
|
}; |
|
|
}, |
|
|
|
|
|
|
|
|
generateProjectId: () => { |
|
|
return 'proj_' + Math.random().toString(36).substr(2, 9); |
|
|
} |
|
|
}; |
|
|
|
|
|
|
|
|
if (typeof module !== 'undefined' && module.exports) { |
|
|
module.exports = { AgentAPI, Utils }; |
|
|
} |