-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
166 lines (137 loc) · 5.82 KB
/
app.js
File metadata and controls
166 lines (137 loc) · 5.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
// HYPERFOCUS ZONE - CONSTELLATION MAP (SYNTAX ERROR FREE)
console.log('🚀 Loading Hyperfocus Zone Constellation...');
// Simple repository data for testing
const testRepositories = [
{
name: "HYPERFOCUSzone-starting-code-",
category: "Core Empire",
description: "The beating heart with Orchestra conductor, Memory Crystals, Dopamine Guardian",
githubUrl: "https://github.com/welshDog/HYPERFOCUSzone-starting-code-",
x: 400, y: 300, size: "large"
},
{
name: "HYPERFOCUS-UNIFIED-EMPIRE",
category: "Core Empire",
description: "Empire-level coordination hub managing the entire constellation",
githubUrl: "https://github.com/welshDog/HYPERFOCUS-UNIFIED-EMPIRE",
x: 300, y: 200, size: "large"
},
{
name: "Hyper-vibe-engine",
category: "Creative",
description: "Turn images into soundtracks. Turn stories into portals",
githubUrl: "https://github.com/welshDog/Hyper-vibe-engine",
x: 500, y: 200, size: "medium"
},
{
name: "My-Social-COMs-Buddy",
category: "Social",
description: "AI to help communicate with dyslexia",
githubUrl: "https://github.com/welshDog/My-Social-COMs-Buddy",
x: 400, y: 400, size: "medium"
}
];
class ConstellationMap {
constructor() {
console.log('🌌 ConstellationMap initializing...');
this.repositories = testRepositories;
this.selectedRepo = null;
this.init();
}
init() {
console.log('🔧 Starting constellation initialization...');
// Verify DOM elements exist
const viewport = document.getElementById('constellationViewport');
if (!viewport) {
console.error('❌ constellationViewport not found!');
return;
}
this.createSVG();
this.drawRepositories();
this.bindEvents();
console.log('✅ Constellation initialized successfully!');
}
createSVG() {
console.log('🎨 Creating SVG...');
const viewport = document.getElementById('constellationViewport');
// Clear viewport
viewport.innerHTML = '';
// Create SVG - SYNTAX ERROR FREE VERSION
this.svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
this.svg.setAttribute('width', '100%');
this.svg.setAttribute('height', '100%');
this.svg.setAttribute('viewBox', '0 0 800 600');
// Create group for stars
this.group = document.createElementNS('http://www.w3.org/2000/svg', 'g');
this.svg.appendChild(this.group);
// Append to viewport
viewport.appendChild(this.svg);
console.log('✅ SVG created without syntax errors');
}
drawRepositories() {
console.log('⭐ Drawing repositories...');
const colors = {
"Core Empire": "#9333ea",
"Creative": "#32b8c6",
"Social": "#ec4899",
"Dev Tools": "#3b82f6"
};
// SYNTAX ERROR FREE forEach - proper arrow function
this.repositories.forEach((repo) => { // ✅ Proper syntax
console.log(`Drawing: ${repo.name}`);
// Create circle
const circle = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
circle.setAttribute('cx', repo.x);
circle.setAttribute('cy', repo.y);
circle.setAttribute('r', repo.size === 'large' ? 18 : 14);
circle.setAttribute('fill', colors[repo.category] || '#666');
circle.setAttribute('stroke', '#fff');
circle.setAttribute('stroke-width', '2');
circle.style.cursor = 'pointer';
// SYNTAX ERROR FREE event handlers
circle.addEventListener('mouseenter', () => { // ✅ Proper syntax
circle.setAttribute('r', repo.size === 'large' ? 22 : 18);
});
circle.addEventListener('mouseleave', () => { // ✅ Proper syntax
circle.setAttribute('r', repo.size === 'large' ? 18 : 14);
});
circle.addEventListener('click', () => { // ✅ Proper syntax
window.open(repo.githubUrl, '_blank');
});
this.group.appendChild(circle);
// Add label
const text = document.createElementNS('http://www.w3.org/2000/svg', 'text');
text.setAttribute('x', repo.x);
text.setAttribute('y', repo.y + 25);
text.setAttribute('text-anchor', 'middle');
text.setAttribute('fill', '#fff');
text.setAttribute('font-size', '12');
text.style.pointerEvents = 'none';
text.textContent = repo.name.length > 15 ?
repo.name.substring(0, 15) + '...' : repo.name;
this.group.appendChild(text);
});
console.log(`✅ Drew ${this.repositories.length} repositories`);
}
bindEvents() {
// Basic search functionality
const searchInput = document.getElementById('searchInput');
if (searchInput) {
searchInput.addEventListener('input', (e) => { // ✅ Proper syntax
console.log('Search:', e.target.value);
// Add search logic here
});
}
}
}
// SYNTAX ERROR FREE initialization
document.addEventListener('DOMContentLoaded', () => { // ✅ Proper syntax
console.log('🌌 DOM loaded, initializing constellation...');
try {
const constellation = new ConstellationMap();
window.constellation = constellation; // For debugging
} catch (error) {
console.error('💥 Error initializing:', error);
}
});
console.log('📁 App.js loaded successfully');