-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
392 lines (362 loc) · 19.9 KB
/
Copy pathindex.html
File metadata and controls
392 lines (362 loc) · 19.9 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Aura Affinity • Business Directory & Map</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"/>
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.5.3/dist/MarkerCluster.css" />
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.5.3/dist/MarkerCluster.Default.css" />
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<script src="https://unpkg.com/leaflet.markercluster@1.5.3/dist/leaflet.markercluster.js"></script>
<script src="https://cdn.jsdelivr.net/npm/papaparse@5.4.1/papaparse.min.js"></script>
<style>
:root { --bg:#0e0e10; --panel:#141418; --text:#e6e6ea; --muted:#9aa0a6; --gold:#f7c948; }
* { box-sizing: border-box }
body { margin:0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; background:var(--bg); color:var(--text);}
header { padding:18px 20px 8px; text-align:center; background:#0b0b0d; border-bottom:1px solid #1e1f25; position:sticky; top:0; z-index:5 }
h1{ margin:0; color:var(--gold); letter-spacing:.5px }
.sub{ margin:6px 0 12px; color:var(--muted); font-size:.95rem }
.container { max-width: 1200px; margin: 0 auto; }
#map { height:60vh; width:100%; border-bottom:1px solid #1e1f25; position:relative }
.toolbar { display:flex; justify-content:center; flex-wrap:wrap; gap:10px; padding:12px 16px; background:#0b0b0d; border-bottom:1px solid #1e1f25 }
.toolbar .field { display:flex; align-items:center; gap:8px; background:var(--panel); border:1px solid #23242b; padding:8px 12px; border-radius:12px }
.toolbar label { color:#c7c9ce; font-size:.9rem }
.toolbar input[type="text"], .toolbar select { background:transparent; border:none; color:var(--text); outline:none; font-size:.95rem; appearance:none }
.toolbar select { padding-right:20px; }
.toolbar option { background:var(--panel); color:var(--text); }
.toolbar input::placeholder { color:#7a7f87 }
#directory { display:grid; grid-template-columns:repeat(auto-fill, minmax(300px, 1fr)); gap:16px; padding:16px }
.card { background:var(--panel); border:1px solid #262832; padding:14px; border-radius:16px; transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease; position:relative; display: flex; flex-direction: column; }
.card:hover { transform: translateY(-2px) }
.card .name { font-weight:700; font-size:1.05rem; margin:0 0 6px }
.meta { display:flex; flex-wrap:wrap; gap:8px; align-items:center; color:#c7c9ce; font-size:.9rem; margin-bottom:12px }
.badge { padding:3px 8px; border-radius:999px; font-size:.75rem; border:1px solid rgba(255,255,255,.15) }
.actions { margin-top: auto; display:flex; gap: 15px; align-items:center; flex-wrap:wrap; font-size: 0.9rem; }
.actions a { color:#7dcfff; text-decoration:none; display:inline-flex; align-items:center; gap: 4px; }
.actions a:hover { text-decoration:underline }
.delete { position:absolute; top:10px; right:10px; background:#ef4444; color:#fff; border:none; border-radius:10px; padding:4px 8px; cursor:pointer; font-size:.75rem }
.delete:hover { filter:brightness(1.1) }
.card { box-shadow: 0 0 0px rgba(0,0,0,0); border-color:#262832 }
.card[style*="--glow:"] { box-shadow: 0 0 14px var(--glow); border-color: var(--glow) }
.sticky-actions { position: fixed; right: 16px; bottom: 16px; display:flex; flex-direction:column; gap:10px; z-index: 2000; }
.fab { width:48px; height:48px; border-radius:50%; border:none; color:white; font-size:22px; cursor:pointer; display:flex; align-items:center; justify-content:center; box-shadow:0 6px 16px rgba(0,0,0,0.35); transition:transform .2s, box-shadow .2s }
.fab:hover { transform:translateY(-2px); box-shadow:0 8px 18px rgba(0,0,0,0.45) }
.fab.blue { background:#3b82f6 }
.map-fab { position:absolute; right:15px; bottom:15px; z-index:1000; background:#22c55e }
.adder { background:#0b0b0d; border-top:1px solid #1e1f25; padding:14px 16px }
.adder .row { display:flex; flex-wrap:wrap; gap:10px; justify-content:center }
.adder input, .adder select { background:var(--panel); border:1px solid #23242b; color:var(--text); padding:8px 10px; border-radius:10px }
.adder button { background:#3b82f6; color:#fff; border:none; padding:10px 12px; border-radius:10px; cursor:pointer }
.adder button.secondary { background:#475569 }
</style>
<link rel="icon" type="image/png" sizes="32x32" href="assets/favicon-raster-32.png">
<link rel="icon" type="image/png" sizes="192x192" href="assets/favicon-raster-192.png">
<link rel="apple-touch-icon" sizes="180x180" href="assets/apple-touch-icon-raster-180.png">
</head>
<body>
<header>
<h1>Aura Affinity Map</h1>
<div class="sub">A living directory of businesses carrying the name “Aura” across the world. Verify, connect, and grow the network.</div>
<div id="status-bar" style="font-size: 0.85rem; color: #9aa0a6; margin-top: 10px;">
<span>Last updated: <strong id="last-updated">loading...</strong></span>
<a id="trigger-run" href="https://github.com/auraofintelligence/aura-affinity/actions/workflows/update-map-data.yml" target="_blank" style="margin-left: 15px; color: #3b82f6; text-decoration: none;">
🚀 Trigger New Run
</a>
</div>
</header>
<div id="map" role="region" aria-label="Aura Affinity map">
<button class="fab map-fab" id="recenter" title="Re-center map">🎯</button>
</div>
<div class="toolbar">
<div class="container" id="controls" style="display:flex; justify-content:center; flex-wrap:wrap; gap:10px; align-items:center;">
<div class="field"><label for="q">Search</label><input id="q" type="text" placeholder="Search by name or website…" /></div>
<div class="field"><label for="cat">Category</label>
<select id="cat"><option value="">All</option></select>
</div>
<div class="field"><label for="country">Country</label>
<select id="country"><option value="">All</option></select>
</div>
<div class="field"><label for="verified">Verified</label>
<select id="verified">
<option value="">All</option>
<option value="true">Verified</option>
<option value="false">Unverified</option>
</select>
</div>
<div class="field"><label for="has-info">Has Contact</label>
<select id="has-info">
<option value="">Any</option>
<option value="website">Has Website</option>
<option value="phone">Has Phone</option>
<option value="email">Has Email</option>
<option value="social">Has Social</option>
</select>
</div>
<div class="field"><label for="sort">Sort</label>
<select id="sort">
<option value="name-asc">Name A→Z</option>
<option value="name-desc">Name Z→A</option>
<option value="category">Category A→Z</option>
<option value="country">Country A→Z</option>
<option value="verified">Verified first</option>
</select>
</div>
<div class="counter" style="color: #9aa0a6; font-size: 0.9rem; margin-left: 10px;">
Showing <strong id="tile-counter" style="color: #e6e6ea;">0</strong> results
</div>
</div>
</div>
<div class="container"><div id="directory" aria-live="polite"></div></div>
<div class="adder">
<div class="container">
<div class="row" aria-label="Add new entry">
<input id="new-name" placeholder="Name" />
<input id="new-category" placeholder="Category" />
<input id="new-city" placeholder="City" />
<input id="new-country" placeholder="Country" />
<input id="new-lat" placeholder="Latitude" />
<input id="new-lon" placeholder="Longitude" />
<input id="new-website" placeholder="Website (https://...)" />
<input id="new-email" placeholder="Email" />
<input id="new-phone" placeholder="Phone" />
<input id="new-social" placeholder="Social URL" />
<select id="new-verified">
<option value="false">Unverified</option>
<option value="true">Verified</option>
</select>
<button id="add">+ Add to list</button>
<button id="download" class="secondary">⬇️ Download CSV</button>
</div>
</div>
</div>
<div class="sticky-actions" aria-label="Page navigation helpers">
<button class="fab blue" id="toTop" title="Scroll to top">⬆</button>
<button class="fab blue" id="toBottom" title="Scroll to bottom">⬇</button>
</div>
<script>
const markerColorName = {
'Health & Wellbeing': 'red',
'Creative Industries': 'orange',
'Event Management': 'gold',
'Accommodation': 'blue',
'Cities & Developments': 'green',
'Blockchain': 'violet',
'': 'blue',
};
const ICON_BASE = 'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/';
function buildIcon(colorName){
const c = ['red','orange','gold','green','blue','violet'].includes(colorName)? colorName : 'blue';
return new L.Icon({
iconUrl: ICON_BASE + `marker-icon-2x-${c}.png`,
shadowUrl: ICON_BASE + 'marker-shadow.png',
iconSize:[25,41], iconAnchor:[12,41], popupAnchor:[1,-34], shadowSize:[41,41]
});
}
const map = L.map('map').setView([15, 0], 2);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution:'© OpenStreetMap contributors' }).addTo(map);
const clusterGroup = L.markerClusterGroup();
map.addLayer(clusterGroup);
let raw = [];
let markers = [];
function clearMarkers(){ clusterGroup.clearLayers(); markers = []; }
function addMarker(entry){
const color = markerColorName[entry.category] || 'blue';
const icon = buildIcon(color);
const m = L.marker([+entry.latitude, +entry.longitude], { icon });
const safeUrl = (entry.website||'').startsWith('http') ? entry.website : (entry.website?`https://${entry.website}`:'');
const location = [entry.city, entry.country].filter(Boolean).join(', ');
const safeSocial = (entry.social||'').startsWith('http') ? entry.social : (entry.social?`https://${entry.social}`:'');
m.bindPopup(`
<strong>${entry.name}</strong><br>
<small>${entry.category || '—'}</small><br>
<em>${location || ''}</em>
${safeUrl ? `<br><a href="${safeUrl}" target="_blank">🌐 Website</a>` : ''}
${entry.phone ? `<br>📞 ${entry.phone}` : ''}
${safeSocial ? `<br><a href="${safeSocial}" target="_blank">🔗 Social</a>` : ''}
`);
m.__row = entry;
clusterGroup.addLayer(m);
markers.push(m);
return m;
}
function setOptions(id, values){
const sel = document.getElementById(id);
const chosen = sel.value;
sel.innerHTML = '<option value="">All</option>' + [...values].sort().map(v=>`<option value="${v}">${v}</option>`).join('');
if(values.has(chosen)) sel.value = chosen;
}
function neonFromCategory(cat){
const mapCol = { red:'#ef4444', orange:'#fb923c', gold:'#fbbf24', green:'#22c55e', blue:'#3b82f6', violet:'#a78bfa' };
return mapCol[markerColorName[cat]||'blue']||'#3b82f6';
}
function renderDirectory(rows){
const wrap = document.getElementById('directory');
wrap.innerHTML = rows.map((r,i)=>{
const glow = neonFromCategory(r.category);
const safeUrl = (r.website||'').startsWith('http') ? r.website : (r.website?`https://${r.website}`:'');
const safeSocial = (r.social||'').startsWith('http') ? r.social : (r.social?`https://${r.social}`:'');
const verified = String(r.verified||'').toLowerCase()==='true';
const location = [r.city, r.country].filter(Boolean).join(', ');
return `<article class="card" style="--glow:${glow}">
<button class="delete" data-id="${r.id||''}" title="Delete entry">Delete</button>
<h3 class="name">${r.name || '—'}</h3>
<div class="meta">
<span class="badge" style="border-color:${glow}; color:${glow}">${r.category || 'Other'}</span>
<span class="location-link" style="cursor: pointer;" title="Zoom to city">${location || ''}</span>
${r.business_type ? `<span class="badge" style="background-color: #4b5563;">${r.business_type}</span>` : ''}
<span class="badge" style="color:${verified?'#22c55e':'#eab308'}">${verified?'Verified':'Unverified'}</span>
</div>
${r.description ? `<p style="font-size:0.85rem; color:#c7c9ce; margin:10px 0 0; opacity:0.8;">${r.description.substring(0, 100)}${r.description.length > 100 ? '...' : ''}</p>` : ''}
<div class="actions">
<a href="#" class="map-link" title="Find on map">📍 Map</a>
${safeUrl?`<a href="${safeUrl}" target="_blank" title="Website">🌐 Website</a>`:''}
${r.phone?`<a href="tel:${r.phone}" title="Phone">📞 Phone</a>`:''}
${safeSocial?`<a href="${safeSocial}" target="_blank" title="Social Media">🔗 Social</a>`:''}
</div>
</article>`
}).join('');
const cards = wrap.querySelectorAll('.card');
cards.forEach((card, idx) => {
const rowData = rows[idx];
const marker = markers.find(m => m.__row === rowData);
if (!marker) return;
const mapLink = card.querySelector('.map-link');
if (mapLink) {
mapLink.addEventListener('click', (e) => {
e.preventDefault();
e.stopPropagation();
map.flyTo(marker.getLatLng(), 16, { duration: 0.8 });
marker.openPopup();
document.getElementById('map').scrollIntoView({ behavior: 'smooth' });
});
}
const locationLink = card.querySelector('.location-link');
if (locationLink) {
locationLink.addEventListener('click', (e) => {
e.stopPropagation();
map.flyTo(marker.getLatLng(), 10, { duration: 0.8 });
});
}
});
wrap.querySelectorAll('.delete').forEach((btn, idx)=>{
btn.addEventListener('click', (e)=>{
e.stopPropagation();
const r = rows[idx];
if(confirm(`Delete “${r.name}”?`)){
raw = raw.filter(x=>x!==r);
refreshFilters();
applyFilters();
}
});
});
}
function sortRows(rows){
const mode = document.getElementById('sort').value;
const by = (key) => rows.sort((a,b)=> String(a[key]||'').localeCompare(String(b[key]||'')) );
switch(mode){
case 'name-desc': return by('name').reverse();
case 'category': return by('category');
case 'country': return by('country');
case 'verified': return rows.sort((a,b)=> (String(b.verified).toLowerCase()==='true') - (String(a.verified).toLowerCase()==='true') || String(a.name||'').localeCompare(String(b.name||'')) );
case 'name-asc':
default: return by('name');
}
}
function applyFilters(){
const q = document.getElementById('q').value.trim().toLowerCase();
const cat = document.getElementById('cat').value;
const country = document.getElementById('country').value;
const verified = document.getElementById('verified').value;
const hasInfo = document.getElementById('has-info').value;
let rows = raw.filter(r=>{
if(!r.latitude || !r.longitude) return false;
if(cat && r.category!==cat) return false;
if(country && r.country!==country) return false;
if(verified && String(r.verified).toLowerCase()!==verified) return false;
if(hasInfo && !r[hasInfo]) return false;
if(q && !( (r.name||'').toLowerCase().includes(q) || (r.website||'').toLowerCase().includes(q) )) return false;
return true;
});
document.getElementById('tile-counter').textContent = rows.length;
rows = sortRows(rows);
clearMarkers();
rows.forEach(addMarker);
renderDirectory(rows);
}
function refreshFilters(){
setOptions('cat', new Set(raw.map(r=>r.category).filter(Boolean)));
setOptions('country', new Set(raw.map(r=>r.country).filter(Boolean)));
}
fetch('aura-affinity.csv')
.then(r=>r.text())
.then(text=>{
raw = Papa.parse(text, { header:true, skipEmptyLines:true }).data;
raw = raw.map(d=>({ ...d, id: d.id || String(Date.now()+Math.random()), latitude: parseFloat(d.latitude), longitude: parseFloat(d.longitude) }));
refreshFilters();
applyFilters();
});
document.getElementById('q').addEventListener('input', applyFilters);
document.getElementById('cat').addEventListener('change', applyFilters);
document.getElementById('country').addEventListener('change', applyFilters);
document.getElementById('verified').addEventListener('change', applyFilters);
document.getElementById('sort').addEventListener('change', applyFilters);
document.getElementById('has-info').addEventListener('change', applyFilters);
document.getElementById('toTop').addEventListener('click', ()=> window.scrollTo({ top:0, behavior:'smooth' }));
document.getElementById('toBottom').addEventListener('click', ()=> window.scrollTo({ top:document.body.scrollHeight, behavior:'smooth' }));
document.getElementById('recenter').addEventListener('click', ()=> map.setView([15, 0], 2));
document.getElementById('add').addEventListener('click', ()=>{
const n = id => document.getElementById(id).value.trim();
const entry = {
id: String(Date.now()),
name: n('new-name'), category: n('new-category'), city: n('new-city'), country: n('new-country'),
latitude: parseFloat(n('new-lat')), longitude: parseFloat(n('new-lon')),
website: n('new-website'), email: n('new-email'), phone: n('new-phone'), social: n('new-social'),
verified: n('new-verified')
};
if(!entry.name || isNaN(entry.latitude) || isNaN(entry.longitude)) { alert('Name, latitude and longitude are required.'); return; }
raw.push(entry);
refreshFilters();
applyFilters();
['new-name','new-category','new-city','new-country','new-lat','new-lon','new-website','new-email','new-phone','new-social'].forEach(id=>document.getElementById(id).value='');
document.getElementById('new-verified').value='false';
});
document.getElementById('download').addEventListener('click', ()=>{
const headers = ['place_id','id','name','category','city','country','latitude','longitude','website','email','phone','social','description','verified'];
const toCsvRow = (row) => headers.map(h => {
const val = row[h];
const str = (val !== undefined && val !== null) ? String(val) : '';
return `"${str.replaceAll('"', '""')}"`;
}).join(',');
const csvContent = [headers.join(',')].concat(raw.map(toCsvRow)).join('\n');
const blob = new Blob([csvContent], {type:'text/csv;charset=utf-8;'});
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'aura-affinity.csv';
a.click();
URL.revokeObjectURL(url);
});
</script>
<script>
async function displayLastUpdated() {
try {
const response = await fetch(`last-run.txt?v=${Date.now()}`);
if (!response.ok) throw new Error('Not found');
const lastRunISO = await response.text();
const lastRunDate = new Date(lastRunISO);
const now = new Date();
const diffMillis = now - lastRunDate;
const diffHours = Math.floor(diffMillis / (1000 * 60 * 60));
const diffDays = Math.floor(diffHours / 24);
const remainingHours = diffHours % 24;
const friendlyTime = `${diffDays} days, ${remainingHours} hours ago`;
document.getElementById('last-updated').textContent = friendlyTime;
} catch (error) {
document.getElementById('last-updated').textContent = 'never';
}
}
displayLastUpdated();
</script>
</body>
</html>