worldwide todo list: global map (List/Map toggle, clustered category pins, Global strip, pick on map, location_precision, tasks.geojson)
All checks were successful
Deploy production / deploy (push) Successful in 1m13s
All checks were successful
Deploy production / deploy (push) Successful in 1m13s
This commit is contained in:
@@ -60,6 +60,16 @@
|
||||
new: formatValue(k, change[k])
|
||||
}));
|
||||
}
|
||||
/** Coordinates the request proposes (picked on the map or typed), to check before approving. */
|
||||
function proposedPosition(item: Item) {
|
||||
const p = item.payload as Record<string, unknown>;
|
||||
if (item.kind === 'delete' || !('lat' in p || 'lon' in p)) return null;
|
||||
const lat = Number(p.lat ?? item.task?.lat);
|
||||
const lon = Number(p.lon ?? item.task?.lon);
|
||||
return p.lat !== null && p.lon !== null && Number.isFinite(lat) && Number.isFinite(lon)
|
||||
? { lat, lon }
|
||||
: null;
|
||||
}
|
||||
function tweakValues(item: Item) {
|
||||
const base = item.task ? fieldsOf(item.task) : {};
|
||||
return { ...base, ...item.payload } as Record<string, unknown>;
|
||||
@@ -194,6 +204,15 @@
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
{@const pos = proposedPosition(item)}
|
||||
{#if pos}
|
||||
<a
|
||||
class="osm"
|
||||
href="https://www.openstreetmap.org/?mlat={pos.lat}&mlon={pos.lon}#map=15/{pos.lat}/{pos.lon}"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">Check the proposed map position on OpenStreetMap ↗</a
|
||||
>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
<dl class="meta">
|
||||
@@ -573,4 +592,10 @@
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
.osm {
|
||||
display: inline-block;
|
||||
margin-top: 0.4rem;
|
||||
font-size: 0.78rem;
|
||||
color: var(--site-text);
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user