static site frontend for mapped.at mapped.at
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

Move out test data into data.js

+224 -224
+223
data.js
··· 1 + // ── Test data ───────────────────────────────────────────────────── 2 + // Activity types (at.mapped.test.activityType records) 3 + export function getActivityTypes() { 4 + return { 5 + hiking: { name: 'Hiking', description: 'Walking in natural terrain' }, 6 + running: { name: 'Running', description: 'Running on trails or roads' }, 7 + cycling: { name: 'Cycling', description: 'Riding a bicycle' }, 8 + kayaking: { name: 'Kayaking', description: 'Paddling in water' }, 9 + }; 10 + } 11 + 12 + // Locations (at.mapped.test.location records) 13 + export function getLocations() { 14 + return { 15 + blueRidge: { name: 'Blue Ridge, VA', geo: { type: 'Point', coordinates: [-80.02, 37.17] } }, 16 + alpeHuez: { name: "Alpe d'Huez, FR", geo: { type: 'Point', coordinates: [6.052, 45.073] } }, 17 + torresdelPaine: { name: 'Torres del Paine, Chile', geo: { type: 'Point', coordinates: [-72.95, -51.00] } }, 18 + pugetSound: { name: 'Puget Sound, WA', geo: { type: 'Point', coordinates: [-122.42, 47.65] } }, 19 + shenandoah: { name: 'Shenandoah NP, VA', geo: { type: 'Point', coordinates: [-78.35, 38.53] } }, 20 + dolomites: { name: 'Dolomites, Italy', geo: { type: 'Point', coordinates: [12.31, 46.41] } }, 21 + olympicNP: { name: 'Olympic NP, WA', geo: { type: 'Point', coordinates: [-123.60, 47.80] } }, 22 + }; 23 + } 24 + 25 + // Trails (at.mapped.test.trail records) 26 + export function getTrails() { 27 + const activityTypes = getActivityTypes(); 28 + const locations = getLocations(); 29 + return { 30 + blueRidgeTrail: { 31 + name: 'Blue Ridge Trail', 32 + activityType: activityTypes.hiking, 33 + location: locations.blueRidge, 34 + geo: { 35 + type: 'Feature', 36 + geometry: { 37 + type: 'LineString', 38 + coordinates: [ 39 + [-80.05, 37.15], 40 + [-80.04, 37.16], 41 + [-80.02, 37.17], 42 + [-80.00, 37.18], 43 + [-79.99, 37.19], 44 + ], 45 + }, 46 + }, 47 + }, 48 + alpeHuezRoute: { 49 + name: "Alpe d'Huez Route", 50 + activityType: activityTypes.cycling, 51 + location: locations.alpeHuez, 52 + geo: { 53 + type: 'Feature', 54 + geometry: { 55 + type: 'LineString', 56 + coordinates: [ 57 + [6.027, 45.055], 58 + [6.034, 45.061], 59 + [6.042, 45.067], 60 + [6.051, 45.073], 61 + [6.060, 45.080], 62 + [6.071, 45.091], 63 + ], 64 + }, 65 + }, 66 + }, 67 + pugetSoundRoute: { 68 + name: 'Puget Sound Route', 69 + activityType: activityTypes.kayaking, 70 + location: locations.pugetSound, 71 + geo: { 72 + type: 'Feature', 73 + geometry: { 74 + type: 'LineString', 75 + coordinates: [ 76 + [-122.45, 47.63], 77 + [-122.43, 47.64], 78 + [-122.42, 47.65], 79 + [-122.41, 47.66], 80 + [-122.40, 47.67], 81 + ], 82 + }, 83 + }, 84 + }, 85 + shenandoahTrail: { 86 + name: 'Shenandoah Trail', 87 + activityType: activityTypes.running, 88 + location: locations.shenandoah, 89 + geo: { 90 + type: 'Feature', 91 + geometry: { 92 + type: 'LineString', 93 + coordinates: [ 94 + [-78.38, 38.51], 95 + [-78.36, 38.52], 96 + [-78.35, 38.53], 97 + [-78.34, 38.54], 98 + [-78.32, 38.55], 99 + ], 100 + }, 101 + }, 102 + }, 103 + olympicRoute: { 104 + name: 'Olympic Route', 105 + activityType: activityTypes.hiking, 106 + location: locations.olympicNP, 107 + geo: { 108 + type: 'Feature', 109 + geometry: { 110 + type: 'LineString', 111 + coordinates: [ 112 + [-123.63, 47.78], 113 + [-123.61, 47.79], 114 + [-123.60, 47.80], 115 + [-123.59, 47.81], 116 + [-123.57, 47.82], 117 + ], 118 + }, 119 + }, 120 + }, 121 + }; 122 + } 123 + 124 + // Posts (at.mapped.test.post records) 125 + export function getPosts() { 126 + const activityTypes = getActivityTypes(); 127 + const locations = getLocations(); 128 + const trails = getTrails(); 129 + 130 + return [ 131 + { 132 + id: '1', 133 + uri: 'at://did:plc:samk/at.mapped.test.post/1', 134 + cid: 'bafy1', 135 + author: { name: 'Sam K.', initials: 'SK' }, 136 + title: 'Ridge Trail Summit', 137 + text: 'Perfect morning on the ridge trail. The fog was rolling in just as I reached the summit.', 138 + timestamp: new Date(Date.now() - 5 * 3600 * 1000), 139 + activityType: activityTypes.hiking, 140 + location: locations.blueRidge, 141 + trail: trails.blueRidgeTrail, 142 + stats: { distance: 12.4, duration: 222, elevation: 480 }, 143 + }, 144 + { 145 + id: '2', 146 + uri: 'at://did:plc:alexr/at.mapped.test.post/2', 147 + cid: 'bafy2', 148 + author: { name: 'Alex R.', initials: 'AR' }, 149 + title: 'Alpe d\'Huez Climb', 150 + text: null, 151 + timestamp: new Date(Date.now() - 26 * 3600 * 1000), 152 + activityType: activityTypes.cycling, 153 + location: locations.alpeHuez, 154 + trail: trails.alpeHuezRoute, 155 + stats: { distance: 62.4, duration: 138, elevation: 820 }, 156 + }, 157 + { 158 + id: '3', 159 + uri: 'at://did:plc:maria/at.mapped.test.post/3', 160 + cid: 'bafy3', 161 + author: { name: 'Maria L.', initials: 'ML' }, 162 + title: 'Week 2 in Patagonia', 163 + text: 'Woke up to frost on the tent and an absolutely still lake. The kind of morning that makes you forget what day it is.', 164 + timestamp: new Date(Date.now() - 3 * 24 * 3600 * 1000), 165 + activityType: null, // Travel post (no activity type) 166 + location: locations.torresdelPaine, 167 + trail: null, 168 + stats: null, 169 + }, 170 + { 171 + id: '4', 172 + uri: 'at://did:plc:jordanp/at.mapped.test.post/4', 173 + cid: 'bafy4', 174 + author: { name: 'Jordan P.', initials: 'JP' }, 175 + title: 'Seal Colony Paddle', 176 + text: 'Spotted a seal colony on the eastern shore. Paddled for 3 hours without checking my phone once.', 177 + timestamp: new Date(Date.now() - 2 * 24 * 3600 * 1000), 178 + activityType: activityTypes.kayaking, 179 + location: locations.pugetSound, 180 + trail: trails.pugetSoundRoute, 181 + stats: { distance: 18.2, duration: 185, elevation: 0 }, 182 + }, 183 + { 184 + id: '5', 185 + uri: 'at://did:plc:samk/at.mapped.test.post/5', 186 + cid: 'bafy5', 187 + author: { name: 'Sam K.', initials: 'SK' }, 188 + title: 'Shenandoah Run', 189 + text: null, 190 + timestamp: new Date(Date.now() - 4 * 24 * 3600 * 1000), 191 + activityType: activityTypes.running, 192 + location: locations.shenandoah, 193 + trail: trails.shenandoahTrail, 194 + stats: { distance: 9.2, duration: 52, elevation: 320 }, 195 + }, 196 + { 197 + id: '6', 198 + uri: 'at://did:plc:alexr/at.mapped.test.post/6', 199 + cid: 'bafy6', 200 + author: { name: 'Alex R.', initials: 'AR' }, 201 + title: 'Dolomites Traverse', 202 + text: 'Three passes in two days. My legs are destroyed but the views were worth every metre of climbing.', 203 + timestamp: new Date(Date.now() - 7 * 24 * 3600 * 1000), 204 + activityType: null, // Travel post 205 + location: locations.dolomites, 206 + trail: null, 207 + stats: null, 208 + }, 209 + { 210 + id: '7', 211 + uri: 'at://did:plc:jordanp/at.mapped.test.post/7', 212 + cid: 'bafy7', 213 + author: { name: 'Jordan P.', initials: 'JP' }, 214 + title: 'Olympic Ridge Push', 215 + text: 'Hoh Rainforest to Hurricane Ridge in one push. Absolutely brutal. Would do again.', 216 + timestamp: new Date(Date.now() - 9 * 24 * 3600 * 1000), 217 + activityType: activityTypes.hiking, 218 + location: locations.olympicNP, 219 + trail: trails.olympicRoute, 220 + stats: { distance: 28.7, duration: 555, elevation: 1240 }, 221 + }, 222 + ]; 223 + }
+1 -224
script.js
··· 15 15 XrpcHandleResolver, 16 16 } from '@atcute/identity-resolver'; 17 17 import { getRoute, navigate, onRouteChange } from './router.js'; 18 + import { getLocations, getTrails, getPosts } from './data.js'; 18 19 19 20 // ── ATProto OAuth configuration ─────────────────────────────────── 20 21 configureOAuth({ ··· 34 35 }), 35 36 }), 36 37 }); 37 - 38 - // ── Test data ───────────────────────────────────────────────────── 39 - // Activity types (at.mapped.test.activityType records) 40 - function getActivityTypes() { 41 - return { 42 - hiking: { name: 'Hiking', description: 'Walking in natural terrain' }, 43 - running: { name: 'Running', description: 'Running on trails or roads' }, 44 - cycling: { name: 'Cycling', description: 'Riding a bicycle' }, 45 - kayaking: { name: 'Kayaking', description: 'Paddling in water' }, 46 - }; 47 - } 48 - 49 - // Locations (at.mapped.test.location records) 50 - function getLocations() { 51 - return { 52 - blueRidge: { name: 'Blue Ridge, VA', geo: { type: 'Point', coordinates: [-80.02, 37.17] } }, 53 - alpeHuez: { name: "Alpe d'Huez, FR", geo: { type: 'Point', coordinates: [6.052, 45.073] } }, 54 - torresdelPaine: { name: 'Torres del Paine, Chile', geo: { type: 'Point', coordinates: [-72.95, -51.00] } }, 55 - pugetSound: { name: 'Puget Sound, WA', geo: { type: 'Point', coordinates: [-122.42, 47.65] } }, 56 - shenandoah: { name: 'Shenandoah NP, VA', geo: { type: 'Point', coordinates: [-78.35, 38.53] } }, 57 - dolomites: { name: 'Dolomites, Italy', geo: { type: 'Point', coordinates: [12.31, 46.41] } }, 58 - olympicNP: { name: 'Olympic NP, WA', geo: { type: 'Point', coordinates: [-123.60, 47.80] } }, 59 - }; 60 - } 61 - 62 - // Trails (at.mapped.test.trail records) 63 - function getTrails() { 64 - const activityTypes = getActivityTypes(); 65 - const locations = getLocations(); 66 - return { 67 - blueRidgeTrail: { 68 - name: 'Blue Ridge Trail', 69 - activityType: activityTypes.hiking, 70 - location: locations.blueRidge, 71 - geo: { 72 - type: 'Feature', 73 - geometry: { 74 - type: 'LineString', 75 - coordinates: [ 76 - [-80.05, 37.15], 77 - [-80.04, 37.16], 78 - [-80.02, 37.17], 79 - [-80.00, 37.18], 80 - [-79.99, 37.19], 81 - ], 82 - }, 83 - }, 84 - }, 85 - alpeHuezRoute: { 86 - name: "Alpe d'Huez Route", 87 - activityType: activityTypes.cycling, 88 - location: locations.alpeHuez, 89 - geo: { 90 - type: 'Feature', 91 - geometry: { 92 - type: 'LineString', 93 - coordinates: [ 94 - [6.027, 45.055], 95 - [6.034, 45.061], 96 - [6.042, 45.067], 97 - [6.051, 45.073], 98 - [6.060, 45.080], 99 - [6.071, 45.091], 100 - ], 101 - }, 102 - }, 103 - }, 104 - pugetSoundRoute: { 105 - name: 'Puget Sound Route', 106 - activityType: activityTypes.kayaking, 107 - location: locations.pugetSound, 108 - geo: { 109 - type: 'Feature', 110 - geometry: { 111 - type: 'LineString', 112 - coordinates: [ 113 - [-122.45, 47.63], 114 - [-122.43, 47.64], 115 - [-122.42, 47.65], 116 - [-122.41, 47.66], 117 - [-122.40, 47.67], 118 - ], 119 - }, 120 - }, 121 - }, 122 - shenandoahTrail: { 123 - name: 'Shenandoah Trail', 124 - activityType: activityTypes.running, 125 - location: locations.shenandoah, 126 - geo: { 127 - type: 'Feature', 128 - geometry: { 129 - type: 'LineString', 130 - coordinates: [ 131 - [-78.38, 38.51], 132 - [-78.36, 38.52], 133 - [-78.35, 38.53], 134 - [-78.34, 38.54], 135 - [-78.32, 38.55], 136 - ], 137 - }, 138 - }, 139 - }, 140 - olympicRoute: { 141 - name: 'Olympic Route', 142 - activityType: activityTypes.hiking, 143 - location: locations.olympicNP, 144 - geo: { 145 - type: 'Feature', 146 - geometry: { 147 - type: 'LineString', 148 - coordinates: [ 149 - [-123.63, 47.78], 150 - [-123.61, 47.79], 151 - [-123.60, 47.80], 152 - [-123.59, 47.81], 153 - [-123.57, 47.82], 154 - ], 155 - }, 156 - }, 157 - }, 158 - }; 159 - } 160 - 161 - // Posts (at.mapped.test.post records) 162 - function getPosts() { 163 - const activityTypes = getActivityTypes(); 164 - const locations = getLocations(); 165 - const trails = getTrails(); 166 - 167 - return [ 168 - { 169 - id: '1', 170 - uri: 'at://did:plc:samk/at.mapped.test.post/1', 171 - cid: 'bafy1', 172 - author: { name: 'Sam K.', initials: 'SK' }, 173 - title: 'Ridge Trail Summit', 174 - text: 'Perfect morning on the ridge trail. The fog was rolling in just as I reached the summit.', 175 - timestamp: new Date(Date.now() - 5 * 3600 * 1000), 176 - activityType: activityTypes.hiking, 177 - location: locations.blueRidge, 178 - trail: trails.blueRidgeTrail, 179 - stats: { distance: 12.4, duration: 222, elevation: 480 }, 180 - }, 181 - { 182 - id: '2', 183 - uri: 'at://did:plc:alexr/at.mapped.test.post/2', 184 - cid: 'bafy2', 185 - author: { name: 'Alex R.', initials: 'AR' }, 186 - title: 'Alpe d\'Huez Climb', 187 - text: null, 188 - timestamp: new Date(Date.now() - 26 * 3600 * 1000), 189 - activityType: activityTypes.cycling, 190 - location: locations.alpeHuez, 191 - trail: trails.alpeHuezRoute, 192 - stats: { distance: 62.4, duration: 138, elevation: 820 }, 193 - }, 194 - { 195 - id: '3', 196 - uri: 'at://did:plc:maria/at.mapped.test.post/3', 197 - cid: 'bafy3', 198 - author: { name: 'Maria L.', initials: 'ML' }, 199 - title: 'Week 2 in Patagonia', 200 - text: 'Woke up to frost on the tent and an absolutely still lake. The kind of morning that makes you forget what day it is.', 201 - timestamp: new Date(Date.now() - 3 * 24 * 3600 * 1000), 202 - activityType: null, // Travel post (no activity type) 203 - location: locations.torresdelPaine, 204 - trail: null, 205 - stats: null, 206 - }, 207 - { 208 - id: '4', 209 - uri: 'at://did:plc:jordanp/at.mapped.test.post/4', 210 - cid: 'bafy4', 211 - author: { name: 'Jordan P.', initials: 'JP' }, 212 - title: 'Seal Colony Paddle', 213 - text: 'Spotted a seal colony on the eastern shore. Paddled for 3 hours without checking my phone once.', 214 - timestamp: new Date(Date.now() - 2 * 24 * 3600 * 1000), 215 - activityType: activityTypes.kayaking, 216 - location: locations.pugetSound, 217 - trail: trails.pugetSoundRoute, 218 - stats: { distance: 18.2, duration: 185, elevation: 0 }, 219 - }, 220 - { 221 - id: '5', 222 - uri: 'at://did:plc:samk/at.mapped.test.post/5', 223 - cid: 'bafy5', 224 - author: { name: 'Sam K.', initials: 'SK' }, 225 - title: 'Shenandoah Run', 226 - text: null, 227 - timestamp: new Date(Date.now() - 4 * 24 * 3600 * 1000), 228 - activityType: activityTypes.running, 229 - location: locations.shenandoah, 230 - trail: trails.shenandoahTrail, 231 - stats: { distance: 9.2, duration: 52, elevation: 320 }, 232 - }, 233 - { 234 - id: '6', 235 - uri: 'at://did:plc:alexr/at.mapped.test.post/6', 236 - cid: 'bafy6', 237 - author: { name: 'Alex R.', initials: 'AR' }, 238 - title: 'Dolomites Traverse', 239 - text: 'Three passes in two days. My legs are destroyed but the views were worth every metre of climbing.', 240 - timestamp: new Date(Date.now() - 7 * 24 * 3600 * 1000), 241 - activityType: null, // Travel post 242 - location: locations.dolomites, 243 - trail: null, 244 - stats: null, 245 - }, 246 - { 247 - id: '7', 248 - uri: 'at://did:plc:jordanp/at.mapped.test.post/7', 249 - cid: 'bafy7', 250 - author: { name: 'Jordan P.', initials: 'JP' }, 251 - title: 'Olympic Ridge Push', 252 - text: 'Hoh Rainforest to Hurricane Ridge in one push. Absolutely brutal. Would do again.', 253 - timestamp: new Date(Date.now() - 9 * 24 * 3600 * 1000), 254 - activityType: activityTypes.hiking, 255 - location: locations.olympicNP, 256 - trail: trails.olympicRoute, 257 - stats: { distance: 28.7, duration: 555, elevation: 1240 }, 258 - }, 259 - ]; 260 - } 261 38 262 39 // ── relativeTime helper ─────────────────────────────────────────── 263 40 // Uses Intl.RelativeTimeFormat to produce "5 hours ago", "yesterday", etc.