CatPortal / modules /AppManager.js
NikaMimi's picture
Upload 17 files
06163ac verified
/**
* CatOS Application Manager Module
* Handles app registration, launching, and management
*/
class AppManager {
constructor(core) {
this.core = core;
this.projects = {
'sneaky-cat-proxy': {
title: 'Sneaky Cat Proxy',
icon: 'πŸ”—',
description: 'A purr-fessional proxy that helps cats navigate the internet stealthily! πŸ•΅οΈβ€β™€οΈ',
technologies: ['Node.js', 'Express', 'Stealth'],
features: [
'Stealth browsing capabilities',
'Cat-safe internet filtering',
'Automatic mouse toy detection',
'Built-in treat dispenser API'
],
github: 'https://github.com/catcoder/sneaky-proxy',
demo: 'https://sneaky-cat-proxy.vercel.app'
},
'cat-photo-gallery': {
title: 'Cat Photo Gallery',
icon: 'πŸ“Έ',
description: 'A claw-some gallery to showcase all your favorite cat pics with purr-fect filtering! 😻',
technologies: ['React', 'TypeScript', 'Tailwind'],
features: [
'Advanced cat photo filtering',
'Automatic whisker detection',
'Paw print watermarking',
'Social sharing for cat influencers'
],
github: 'https://github.com/catcoder/cat-gallery',
demo: 'https://cat-gallery.vercel.app'
},
'robo-cat-manager': {
title: 'Robo-Cat Manager',
icon: 'πŸ€–',
description: 'Managing Discord bots like herding cats! Keep your digital kitties in line with style! πŸ±β€πŸ’»',
technologies: ['Discord.js', 'MongoDB', 'Docker'],
features: [
'Multi-bot management dashboard',
'Automatic yarn ball deployment',
'Cat behavior analytics',
'Emergency tuna button'
],
github: 'https://github.com/catcoder/robo-cat-manager',
demo: 'https://discord-bot-manager.vercel.app'
}
};
}
registerAllApps(core) {
this.core = core;
// Register core apps (only if Terminal module is available)
if (window.CatOSTerminal) {
this.core.apps.set('terminal', {
title: 'CatOS Terminal',
icon: 'πŸ’»',
create: this.createTerminalApp.bind(this)
});
}
this.core.apps.set('project-viewer', {
title: 'Project Viewer',
icon: 'πŸ“',
create: this.createProjectViewer.bind(this)
});
this.core.apps.set('about', {
title: 'About CatOS',
icon: 'πŸ“‹',
create: this.createAboutApp.bind(this)
});
this.core.apps.set('contact', {
title: 'Contact',
icon: 'πŸ“§',
create: this.createContactApp.bind(this)
});
this.core.apps.set('file-explorer', {
title: 'File Explorer',
icon: 'πŸ“',
create: this.createFileExplorer.bind(this)
});
}
launchApp(appType, options = {}) {
const app = this.core.apps.get(appType);
if (!app) {
this.core.showNotification('Error', `App "${appType}" not found! 😿`);
return;
}
// Check if app is already running (for singleton apps)
if (appType === 'about' || appType === 'contact') {
for (let [windowId, window] of this.core.windows) {
if (window.appType === appType) {
// Focus existing window instead of creating new one
this.core.windowManager.focusWindow(windowId);
return;
}
}
}
const content = app.create(options);
const windowId = this.core.windowManager.createWindow({
title: app.title,
icon: app.icon,
content: content,
appType: appType
});
this.core.windowManager.addToTaskbar(windowId, app);
return windowId;
}
createTerminalApp() {
const terminalId = `terminal-${Date.now()}`;
setTimeout(() => {
if (window.CatOSTerminal) {
window.CatOSTerminal.initialize(terminalId, this.core);
}
}, 100);
return `
<div class="terminal-app" data-terminal-id="${terminalId}">
<div class="terminal-content" id="terminal-content-${terminalId}">
<div class="terminal-line">
<span class="terminal-prompt">cat@catos:~$</span>
<span class="terminal-text">Welcome to CatOS Terminal! 🐱</span>
</div>
<div class="terminal-line">
<span class="terminal-prompt">cat@catos:~$</span>
<span class="terminal-text">Type 'help' for available commands or 'meow' for cat wisdom</span>
</div>
</div>
<div class="terminal-input-line">
<span class="terminal-prompt" id="prompt-${terminalId}">cat@catos:~$</span>
<input type="text" class="terminal-input" id="terminal-input-${terminalId}" autofocus>
</div>
</div>
`;
}
createProjectViewer(options) {
const projectId = options.projectId;
const project = this.projects[projectId];
if (!project) {
return `
<div class="error-content">
<div class="error-icon">😿</div>
<div class="error-title">Project Not Found</div>
<div class="error-message">The requested project could not be found.</div>
</div>
`;
}
return `
<div class="project-viewer">
<div class="project-header">
<div class="project-icon">${project.icon}</div>
<div class="project-info">
<h1 class="project-title">${project.title}</h1>
<p class="project-description">${project.description}</p>
</div>
</div>
<div class="project-details">
<div class="detail-section">
<h3>πŸ› οΈ Technologies</h3>
<div class="tech-stack">
${project.technologies.map(tech => `<span class="tech-badge">${tech}</span>`).join('')}
</div>
</div>
<div class="detail-section">
<h3>✨ Features</h3>
<ul class="feature-list">
${project.features.map(feature => `<li>🐾 ${feature}</li>`).join('')}
</ul>
</div>
<div class="detail-section">
<h3>πŸ”— Links</h3>
<div class="project-links">
<a href="${project.github}" target="_blank" rel="noopener noreferrer" class="project-link">
<span class="link-icon">πŸ“</span>
<span class="link-text">View on GitHub</span>
</a>
<a href="${project.demo}" target="_blank" rel="noopener noreferrer" class="project-link">
<span class="link-icon">🌐</span>
<span class="link-text">Live Demo</span>
</a>
</div>
</div>
</div>
</div>
`;
}
createAboutApp() {
return `
<div class="about-content">
<div class="about-header">
<div class="about-avatar">πŸ±β€πŸ’»</div>
<div class="about-info">
<h1>Rafael - Cat Developer</h1>
<p class="about-subtitle">Crafting purr-fessional software with whiskers and code</p>
</div>
</div>
<div class="about-sections">
<div class="about-section">
<h3>🎯 About Me</h3>
<p>Welcome to my digital litter box! I'm a passionate developer who believes that the best code is written with cat-like curiosity and precision. When I'm not debugging, you'll find me contemplating the philosophical implications of yarn balls and infinite loops.</p>
</div>
<div class="about-section">
<h3>πŸ› οΈ Skills</h3>
<div class="skills-grid">
<div class="skill-item">JavaScript</div>
<div class="skill-item">TypeScript</div>
<div class="skill-item">React</div>
<div class="skill-item">Node.js</div>
<div class="skill-item">Python</div>
<div class="skill-item">Cat Psychology</div>
</div>
</div>
<div class="about-section">
<h3>🐾 Philosophy</h3>
<blockquote class="cat-wisdom">
"In coding, as in cat life, the best solutions often come from patient observation,
strategic planning, and the occasional strategic nap."
<cite>- The Cat Developer's Manifesto</cite>
</blockquote>
</div>
</div>
</div>
`;
}
createContactApp() {
return `
<div class="contact-content">
<div class="contact-header">
<div class="contact-icon">πŸ“§</div>
<h1>Get in Touch</h1>
<p>Let's discuss your next purr-fect project!</p>
</div>
<div class="contact-methods">
<div class="contact-method">
<div class="method-icon">πŸ“§</div>
<div class="method-info">
<h3>Email</h3>
<p>hello@catcoder.dev</p>
</div>
</div>
<div class="contact-method">
<div class="method-icon">πŸ’Ό</div>
<div class="method-info">
<h3>LinkedIn</h3>
<p>linkedin.com/in/catdeveloper</p>
</div>
</div>
<div class="contact-method">
<div class="method-icon">🐱</div>
<div class="method-info">
<h3>GitHub</h3>
<p>github.com/catcoder</p>
</div>
</div>
</div>
<div class="contact-form">
<h3>Quick Message</h3>
<form class="cat-form" onsubmit="return CatOSAppManager.handleContactForm(event)">
<div class="form-group">
<label for="contact-name">Name</label>
<input type="text" id="contact-name" name="name" required>
</div>
<div class="form-group">
<label for="contact-email">Email</label>
<input type="email" id="contact-email" name="email" required>
</div>
<div class="form-group">
<label for="contact-message">Message</label>
<textarea id="contact-message" name="message" rows="4" required></textarea>
</div>
<button type="submit" class="submit-button">Send Message 🐾</button>
</form>
</div>
</div>
`;
}
createFileExplorer() {
return `
<div class="file-explorer">
<div class="explorer-toolbar">
<div class="toolbar-section">
<button class="toolbar-btn" title="Back">⬅️</button>
<button class="toolbar-btn" title="Forward">➑️</button>
<button class="toolbar-btn" title="Up">⬆️</button>
</div>
<div class="address-bar">
<span class="path-segment">🏠</span>
<span class="path-separator">/</span>
<span class="path-segment">Users</span>
<span class="path-separator">/</span>
<span class="path-segment">cat</span>
</div>
<div class="toolbar-section">
<button class="toolbar-btn" title="View">πŸ‘οΈ</button>
<button class="toolbar-btn" title="New Folder">πŸ“+</button>
</div>
</div>
<div class="explorer-content">
<div class="file-item directory">
<div class="file-icon">πŸ“</div>
<div class="file-name">Projects</div>
<div class="file-size">--</div>
<div class="file-date">Today</div>
</div>
<div class="file-item directory">
<div class="file-icon">πŸ“</div>
<div class="file-name">Documents</div>
<div class="file-size">--</div>
<div class="file-date">Yesterday</div>
</div>
<div class="file-item file">
<div class="file-icon">πŸ“„</div>
<div class="file-name">resume.pdf</div>
<div class="file-size">2.1 MB</div>
<div class="file-date">Mar 15</div>
</div>
<div class="file-item file">
<div class="file-icon">πŸ–ΌοΈ</div>
<div class="file-name">cat_memes.jpg</div>
<div class="file-size">856 KB</div>
<div class="file-date">Mar 14</div>
</div>
<div class="file-item file">
<div class="file-icon">πŸ’»</div>
<div class="file-name">startup.sh</div>
<div class="file-size">1.2 KB</div>
<div class="file-date">Mar 13</div>
</div>
</div>
</div>
`;
}
handleContactForm(event) {
event.preventDefault();
const formData = new FormData(event.target);
const data = Object.fromEntries(formData.entries());
// Simulate form submission
this.core.showNotification(
'βœ… Message Sent!',
`Thanks ${data.name}! I'll get back to you faster than a cat chasing a laser pointer! 🐱`
);
event.target.reset();
return false;
}
}
// Export for use in main system
window.CatOSAppManager = AppManager;