bump
This commit is contained in:
parent
1059eeaa9f
commit
70d330ed0b
11 changed files with 2972 additions and 11 deletions
|
|
@ -16,6 +16,7 @@
|
|||
"@sveltejs/adapter-auto": "^1.0.0-next.71",
|
||||
"@sveltejs/adapter-netlify": "^1.0.0-next.76",
|
||||
"@sveltejs/kit": "^1.0.0-next.481",
|
||||
"@types/leaflet": "^1.7.11",
|
||||
"@types/sanitize-html": "^2.6.2",
|
||||
"@typescript-eslint/eslint-plugin": "^5.32.0",
|
||||
"@typescript-eslint/parser": "^5.32.0",
|
||||
|
|
@ -24,6 +25,7 @@
|
|||
"eslint-plugin-svelte3": "^3.2.1",
|
||||
"prettier": "^2.5.1",
|
||||
"prettier-plugin-svelte": "^2.5.0",
|
||||
"sass": "^1.54.9",
|
||||
"svelte": "^3.50.0",
|
||||
"svelte-check": "^2.8.1",
|
||||
"svelte-preprocess": "^4.10.7",
|
||||
|
|
@ -35,6 +37,7 @@
|
|||
"type": "module",
|
||||
"dependencies": {
|
||||
"date-fns": "^2.29.2",
|
||||
"leaflet": "^1.8.0",
|
||||
"mdsvex": "^0.10.5",
|
||||
"mongodb": "^4.8.1",
|
||||
"nanoid": "3.3.4",
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
2784
src/content/wainwrights/wainwrights.json
Normal file
2784
src/content/wainwrights/wainwrights.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,4 +1,4 @@
|
|||
import { json as json$1 } from '@sveltejs/kit';
|
||||
import { json } from '@sveltejs/kit';
|
||||
import allPosts from '../../../content/posts.json';
|
||||
|
||||
export const GET = async ({ url }) => {
|
||||
|
|
@ -17,15 +17,18 @@ export const GET = async ({ url }) => {
|
|||
return 0;
|
||||
});
|
||||
|
||||
return json$1({
|
||||
return json({
|
||||
posts: sortedBlogPosts
|
||||
});
|
||||
} catch (error) {
|
||||
console.error({ error: JSON.stringify(error) });
|
||||
return json$1({
|
||||
return json(
|
||||
{
|
||||
error: 'Could not fetch posts. ' + error
|
||||
}, {
|
||||
},
|
||||
{
|
||||
status: 500
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
20
src/routes/api/wainwrights.json/+server.ts
Normal file
20
src/routes/api/wainwrights.json/+server.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { json } from '@sveltejs/kit';
|
||||
import wainwrights from '../../../content/wainwrights/wainwrights.json';
|
||||
|
||||
export const GET = async ({ url }) => {
|
||||
try {
|
||||
return json({
|
||||
wainwrights
|
||||
});
|
||||
} catch (error) {
|
||||
console.error({ error: JSON.stringify(error) });
|
||||
return json(
|
||||
{
|
||||
error: 'Could not fetch wainwrights' + error
|
||||
},
|
||||
{
|
||||
status: 500
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
10
src/routes/wainwrights/+layout.svelte
Normal file
10
src/routes/wainwrights/+layout.svelte
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<svelte:head>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://unpkg.com/leaflet@1.8.0/dist/leaflet.css"
|
||||
integrity="sha512-hoalWLoI8r4UszCkZ5kL8vayOGVae1oxXe/2A4AO6J9+580uKHDO3JdHb7NzwwzK5xr/Fs0W40kiNHxM9vyTtQ=="
|
||||
crossorigin=""
|
||||
/>
|
||||
</svelte:head>
|
||||
|
||||
<slot />
|
||||
74
src/routes/wainwrights/+page.svelte
Normal file
74
src/routes/wainwrights/+page.svelte
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
<script lang="ts">
|
||||
import type { Map, Marker } from 'leaflet';
|
||||
import { onMount } from 'svelte';
|
||||
import type { PageData } from './$types.js';
|
||||
import type { Wainwright } from './Wainwright.js';
|
||||
import { browser } from '$app/environment';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
$: ({ wainwrights } = data);
|
||||
|
||||
onMount(async () => {
|
||||
const L = await import('leaflet');
|
||||
|
||||
function makeMap(): Map {
|
||||
return new L.Map('map', {
|
||||
center: [54.529149, -3.12411],
|
||||
zoom: 12,
|
||||
layers: [
|
||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution:
|
||||
'Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors'
|
||||
})
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
function makePopup(wainwright: Wainwright): string {
|
||||
return `
|
||||
<div class="wainwright-popup">
|
||||
<b>${wainwright.name}</b> </br>
|
||||
<p>${wainwright.heightMetres}m</p>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
function makeMarkerForWainwright(map: Map, wainwright: Wainwright): Marker {
|
||||
const marker: Marker = L.marker([wainwright.latitude, wainwright.longitude], {
|
||||
alt: wainwright.name,
|
||||
title: wainwright.name
|
||||
});
|
||||
marker.bindPopup(makePopup(wainwright)).openPopup();
|
||||
return marker;
|
||||
}
|
||||
|
||||
const map: Map = makeMap();
|
||||
wainwrights.forEach((wainwright: Wainwright) => {
|
||||
const marker = makeMarkerForWainwright(map, wainwright);
|
||||
marker.addTo(map);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<h1>Wainwrights</h1>
|
||||
|
||||
<p>
|
||||
The Lake District is a National Park in the North West of England. In the mid 20th century, Alfred
|
||||
Wainwright published a series of books describing (illustrated, and with character), two hundred
|
||||
and forteen fells (including four mountains). These have become known as the Wainwrights.
|
||||
</p>
|
||||
|
||||
<div id="map" style="height: 400px;" />
|
||||
|
||||
<style lang="scss">
|
||||
:global .wainwright-popup {
|
||||
text-align: center;
|
||||
|
||||
b,
|
||||
p {
|
||||
font-family: var(--font-family-sans);
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--gray-950);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
15
src/routes/wainwrights/+page.ts
Normal file
15
src/routes/wainwrights/+page.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import type { LoadEvent } from '@sveltejs/kit';
|
||||
import type { Wainwright } from './Wainwright.js';
|
||||
|
||||
export async function load({ fetch }: LoadEvent): Promise<{ wainwrights: Wainwright[] }> {
|
||||
const { wainwrights } = await fetch(`/api/wainwrights.json`)
|
||||
.then((res) => res.json())
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
return { wainwrights: [] };
|
||||
});
|
||||
|
||||
return {
|
||||
wainwrights
|
||||
};
|
||||
}
|
||||
13
src/routes/wainwrights/Wainwright.ts
Normal file
13
src/routes/wainwrights/Wainwright.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
export interface Wainwright {
|
||||
number: number;
|
||||
name: string;
|
||||
classification: string;
|
||||
isWainwright: boolean;
|
||||
heightMetres: number;
|
||||
heightFeet: number;
|
||||
dropMetres: number;
|
||||
colMetres: number;
|
||||
osGridRef: string;
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"extends": "./.svelte-kit/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"moduleResolution": "NodeNext"
|
||||
"moduleResolution": "NodeNext",
|
||||
"resolveJsonModule": true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
35
yarn.lock
35
yarn.lock
|
|
@ -217,11 +217,23 @@
|
|||
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.3.3.tgz#3c90752792660c4b562ad73b3fbd68bf3bc7ae07"
|
||||
integrity sha512-hC7OMnszpxhZPduX+m+nrx+uFoLkWOMiR4oa/AZF3MuSETYTZmFfJAHqZEM8MVlvfG7BEUcgvtwoCTxBp6hm3g==
|
||||
|
||||
"@types/geojson@*":
|
||||
version "7946.0.10"
|
||||
resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.10.tgz#6dfbf5ea17142f7f9a043809f1cd4c448cb68249"
|
||||
integrity sha512-Nmh0K3iWQJzniTuPRcJn5hxXkfB1T1pgB89SBig5PlJQU5yocazeu4jATJlaA0GYFKWMqDdvYemoSnF2pXgLVA==
|
||||
|
||||
"@types/json-schema@^7.0.9":
|
||||
version "7.0.11"
|
||||
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3"
|
||||
integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==
|
||||
|
||||
"@types/leaflet@^1.7.11":
|
||||
version "1.7.11"
|
||||
resolved "https://registry.yarnpkg.com/@types/leaflet/-/leaflet-1.7.11.tgz#48b33b7a15b015bbb1e8950399298a112c3220c8"
|
||||
integrity sha512-VwAYom2pfIAf/pLj1VR5aLltd4tOtHyvfaJlNYCoejzP2nu52PrMi1ehsLRMUS+bgafmIIKBV1cMfKeS+uJ0Vg==
|
||||
dependencies:
|
||||
"@types/geojson" "*"
|
||||
|
||||
"@types/node@*":
|
||||
version "18.7.8"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.7.8.tgz#6bbf2be6fbf9c187a5040d4277d24a06a18957a1"
|
||||
|
|
@ -577,7 +589,7 @@ check-error@^1.0.2:
|
|||
resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82"
|
||||
integrity sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==
|
||||
|
||||
chokidar@^3.4.1:
|
||||
"chokidar@>=3.0.0 <4.0.0", chokidar@^3.4.1:
|
||||
version "3.5.3"
|
||||
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd"
|
||||
integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==
|
||||
|
|
@ -1420,6 +1432,11 @@ ignore@^5.2.0:
|
|||
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a"
|
||||
integrity sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==
|
||||
|
||||
immutable@^4.0.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.1.0.tgz#f795787f0db780183307b9eb2091fcac1f6fafef"
|
||||
integrity sha512-oNkuqVTA8jqG1Q6c+UglTOD1xhC1BtjKI7XkCXRkZHrN5m18/XsnUp8Q89GkQO/z+0WjonSvl0FLhDYftp46nQ==
|
||||
|
||||
import-fresh@^3.0.0, import-fresh@^3.2.1:
|
||||
version "3.3.0"
|
||||
resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b"
|
||||
|
|
@ -1530,6 +1547,11 @@ kleur@^4.1.4, kleur@^4.1.5:
|
|||
resolved "https://registry.yarnpkg.com/kleur/-/kleur-4.1.5.tgz#95106101795f7050c6c650f350c683febddb1780"
|
||||
integrity sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==
|
||||
|
||||
leaflet@^1.8.0:
|
||||
version "1.8.0"
|
||||
resolved "https://registry.yarnpkg.com/leaflet/-/leaflet-1.8.0.tgz#4615db4a22a304e8e692cae9270b983b38a2055e"
|
||||
integrity sha512-gwhMjFCQiYs3x/Sf+d49f10ERXaEFCPr+nVTryhAW8DWbMGqJqt9G4XuIaHmFW08zYvhgdzqXGr8AlW8v8dQkA==
|
||||
|
||||
levn@^0.4.1:
|
||||
version "0.4.1"
|
||||
resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade"
|
||||
|
|
@ -2023,6 +2045,15 @@ saslprep@^1.0.3:
|
|||
dependencies:
|
||||
sparse-bitfield "^3.0.3"
|
||||
|
||||
sass@^1.54.9:
|
||||
version "1.54.9"
|
||||
resolved "https://registry.yarnpkg.com/sass/-/sass-1.54.9.tgz#b05f14ed572869218d1a76961de60cd647221762"
|
||||
integrity sha512-xb1hjASzEH+0L0WI9oFjqhRi51t/gagWnxLiwUNMltA0Ab6jIDkAacgKiGYKM9Jhy109osM7woEEai6SXeJo5Q==
|
||||
dependencies:
|
||||
chokidar ">=3.0.0 <4.0.0"
|
||||
immutable "^4.0.0"
|
||||
source-map-js ">=0.6.2 <2.0.0"
|
||||
|
||||
semver@^6.0.0:
|
||||
version "6.3.0"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
|
||||
|
|
@ -2108,7 +2139,7 @@ sorcery@^0.10.0:
|
|||
sander "^0.5.0"
|
||||
sourcemap-codec "^1.3.0"
|
||||
|
||||
source-map-js@^1.0.2:
|
||||
"source-map-js@>=0.6.2 <2.0.0", source-map-js@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c"
|
||||
integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==
|
||||
|
|
|
|||
Loading…
Reference in a new issue