Files
pbakaus_impeccable/public/app.js
T
Paul Bakaus 1bdb3ea17a Redesign website with interactive demos and improved layout
- Add interactive before/after demos for all skills (UX Writing, Spatial Design, Motion Design, Typography, Interaction Design, Color & Contrast, Responsive Design)
- Implement tabbed demo navigation for skills with multiple examples
- Refactor app.js into modular JS files (skills.js, commands.js, data.js, skill-demos.js, command-demos.js, demo-toggles.js)
- Add new CSS modules (skill-demos.css, workflow.css, problem-section.css, solution-section.css)
- Redesign commands section with sidebar nav matching skills layout
- Replace large download buttons with compact icon buttons
- Fix gray-on-pink color clashing throughout UI
- Remove frontend-design skill (Anthropic's work, not ours)
- Format skill names properly (e.g., 'UX Writing' not 'ux-writing')
- Remove redundant 'Combines Well With' from skills
- Add 'The Problem' and 'The Solution' sections to homepage
- Various CSS fixes for buttons, backgrounds, and spacing
2025-12-06 12:33:00 -08:00

87 lines
2.3 KiB
JavaScript

// ============================================
// MAIN APP - Entry point and orchestration
// ============================================
import {
renderWorkflowDiagram,
selectCommand,
} from "./js/commands.js";
import { renderSkillsNav, selectSkill } from "./js/skills.js";
// ============================================
// STATE
// ============================================
let allSkills = [];
let allCommands = [];
// ============================================
// INITIALIZATION
// ============================================
async function loadContent() {
try {
const [skillsRes, commandsRes] = await Promise.all([
fetch("/api/skills"),
fetch("/api/commands"),
]);
allSkills = await skillsRes.json();
allCommands = await commandsRes.json();
// Render skills
renderSkillsNav(allSkills, (skill) => selectSkill(skill, allSkills));
// Render commands workflow
renderWorkflowDiagram(allCommands, (cmd) =>
selectCommand(cmd, allCommands),
);
// Select first items by default
if (allSkills.length > 0) selectSkill(allSkills[0], allSkills);
if (allCommands.length > 0) selectCommand(allCommands[0], allCommands);
} catch (error) {
console.error("Failed to load content:", error);
}
}
// ============================================
// UTILITIES
// ============================================
function animateIn() {
const elements = document.querySelectorAll("[data-animate]:not(.animated)");
elements.forEach((el, i) => {
el.style.animationDelay = `${i * 0.05}s`;
el.classList.add("animated");
});
}
// ============================================
// EVENT HANDLERS
// ============================================
// Handle bundle download clicks via event delegation
document.addEventListener("click", (e) => {
const bundleBtn = e.target.closest("[data-bundle]");
if (bundleBtn) {
const { bundle: provider } = bundleBtn.dataset;
window.location.href = `/api/download/bundle/${provider}`;
}
});
// ============================================
// STARTUP
// ============================================
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", loadContent);
} else {
loadContent();
}
window.addEventListener("load", () => {
document.body.classList.add("loaded");
animateIn();
});