Offline-capable geomap, meant for storing location bookmarks
0
fork

Configure Feed

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

fix: refresh map on changes to data

+33 -6
+7
www/components/m-map.ts
··· 61 61 override connectedCallback() { 62 62 super.connectedCallback() 63 63 app.addEventListener(this.#onAppUpdate) 64 + window.addEventListener('pmtiles-updated', this.#onPMTilesUpdated) 64 65 } 65 66 66 67 override updated(changedProperties: Map<string, unknown>): void { ··· 84 85 this.#lastCollectionValues = cv 85 86 this.#renderBookmarkMarkers() 86 87 } 88 + } 89 + 90 + #onPMTilesUpdated = async () => { 91 + await this.#loadCachedDetailTiles(this.#tileManifest) 92 + this.#ensureBookmarkLayersOnTop() 87 93 } 88 94 89 95 override firstUpdated(): void { ··· 601 607 override disconnectedCallback() { 602 608 super.disconnectedCallback() 603 609 app.removeEventListener(this.#onAppUpdate) 610 + window.removeEventListener('pmtiles-updated', this.#onPMTilesUpdated) 604 611 this.#onMoveEnd.clear() 605 612 this.#clearLongPress() 606 613 this.#bookmarkPopup?.remove()
+1
www/routes/settings-downloads.ts
··· 69 69 try { 70 70 await downloadAndSavePMTiles(tile.path, tile.filename) 71 71 this.statuses[tile.id] = 'cached' 72 + window.dispatchEvent(new CustomEvent('pmtiles-updated')) 72 73 } catch (err) { 73 74 this.statuses[tile.id] = 'error' 74 75 this.errors[tile.id] = err instanceof Error
+25 -6
www/routes/settings.ts
··· 8 8 9 9 #onAppUpdate = () => this.requestUpdate() 10 10 #showDeleteConfirm = false 11 + #isImporting = false 11 12 12 13 override connectedCallback() { 13 14 super.connectedCallback() ··· 92 93 .#handleExport}"> 93 94 Export 94 95 </button> 95 - <button class="action" id="settings-import" @click="${this 96 - .#handleImport}"> 97 - Import 96 + <button 97 + class="action" 98 + id="settings-import" 99 + ?disabled="${this.#isImporting}" 100 + @click="${this.#handleImport}" 101 + > 102 + ${this.#isImporting ? 'Importing...' : 'Import'} 98 103 </button> 99 104 </div> 100 105 ··· 157 162 </article> 158 163 </dialog> 159 164 </ui-dialog> 165 + 166 + <ui-dialog ?open="${this.#isImporting}"> 167 + <dialog> 168 + <article class="bm-dialog"> 169 + <h2 class="bm-dialog-title">Importing Data</h2> 170 + <p>Please wait while your data is being imported...</p> 171 + <div style="display:flex;justify-content:center;padding:16px 0"> 172 + <ui-spinner size="lg"></ui-spinner> 173 + </div> 174 + </article> 175 + </dialog> 176 + </ui-dialog> 160 177 ` 161 178 } 162 179 ··· 233 250 } 234 251 235 252 async #handleImport(): Promise<void> { 236 - const btn = this.querySelector<HTMLButtonElement>('#settings-import') 237 - if (btn) btn.disabled = true 253 + this.#isImporting = true 254 + this.requestUpdate() 238 255 const result = await app.importStore() 239 - if (btn) btn.disabled = false 256 + this.#isImporting = false 257 + this.requestUpdate() 240 258 if (result.success) { 241 259 this.#setStatus('Data imported successfully.') 260 + window.dispatchEvent(new CustomEvent('pmtiles-updated')) 242 261 } else { 243 262 this.#setStatus(result.error ?? 'Import failed.', true) 244 263 }