adds email notifications

This commit is contained in:
Christian Beutel
2025-01-04 14:24:00 +01:00
parent 72d2bf6062
commit 788690086e
15 changed files with 666 additions and 373 deletions

View File

@@ -140,7 +140,7 @@
const r: GeoJSON[] = [];
trails.forEach((t) => {
if (t.expand.gpx_data) {
if (t.expand?.gpx_data) {
r.push(toGeoJson(t.expand.gpx_data) as GeoJSON);
} else if (t.lat && t.lon) {
r.push({
@@ -165,7 +165,7 @@
if (data[activeTrail] && showElevation) {
epc?.setData(
data[activeTrail]!,
trails.at(activeTrail)!.expand.waypoints,
trails.at(activeTrail)!.expand?.waypoints,
);
epc?.showProfile();
}
@@ -409,7 +409,7 @@
if (data[activeTrail] && showElevation) {
epc?.setData(
data[activeTrail]!,
trails.at(activeTrail)!.expand.waypoints,
trails.at(activeTrail)!.expand?.waypoints,
);
epc?.showProfile();
}
@@ -490,7 +490,7 @@
if (!map) {
return;
}
for (const waypoint of trails[activeTrail]?.expand.waypoints ?? []) {
for (const waypoint of trails[activeTrail]?.expand?.waypoints ?? []) {
const marker = createMarkerFromWaypoint(waypoint, onMarkerDragEnd);
marker.addTo(map);
markers.push(marker);

View File

@@ -7,7 +7,7 @@ const RecordOptionsSchema = z.object({
})
const RecordListOptionsSchema = RecordOptionsSchema.extend({
page: z.number({ coerce: true }).int().positive().optional(),
page: z.number({ coerce: true }).int().nonnegative().optional(),
perPage: z.number({ coerce: true }).int().optional(),
sort: z.string().optional(),
filter: z.string().optional(),

View File

@@ -132,6 +132,15 @@
function handleMapInit() {
if (
$page.url.searchParams.has("lat") &&
$page.url.searchParams.has("lon")
) {
const lat = $page.url.searchParams.get("lat");
const lon = $page.url.searchParams.get("lon");
map.setCenter([parseFloat(lon!), parseFloat(lat!)]);
map.setZoom(14);
console.log("Set map center to: " + lat + " " + lon);
} else if (
$page.url.searchParams.has("tl_lat") &&
$page.url.searchParams.has("tl_lon") &&
$page.url.searchParams.has("br_lat") &&
@@ -148,14 +157,6 @@
],
];
map.fitBounds(boundingBox, { animate: false });
} else if (
$page.url.searchParams.has("lat") &&
$page.url.searchParams.has("lon")
) {
const lat = $page.url.searchParams.get("lat");
const lon = $page.url.searchParams.get("lon");
map.setCenter([parseFloat(lon!), parseFloat(lat!)]);
map.setZoom(14);
} else if (settings && settings.mapFocus == "trails") {
const boundingBox: M.LngLatBoundsLike = [
[maxBoundingBox.min_lon, maxBoundingBox.max_lat],

View File

@@ -17,7 +17,7 @@
text: $_("trail", { values: { n: 2 } }),
value: `/profile/${$page.params.id}/trails`,
},
{ text: $_('statistics'), value: `/profile/${$page.params.id}/stats` },
{ text: $_("statistics"), value: `/profile/${$page.params.id}/stats` },
];
$: activeIndex = profileLinks.findIndex(
@@ -80,14 +80,14 @@
href="/profile/{data.user.id}/users/followers"
>
<p class="font-semibold">{data.followers}</p>
<p>{$_('followers')}</p>
<p>{$_("followers")}</p>
</a>
<a
class:font-bold={$page.url.pathname.endsWith("following")}
href="/profile/{data.user.id}/users/following"
>
<p class="font-semibold">{data.following}</p>
<p>{$_('following')}</p>
<p>{$_("following")}</p>
</a>
</div>
{#if !data.isOwnProfile}
@@ -113,6 +113,12 @@
>
{/each}
</div>
{#if data.isOwnProfile}
<div class="px-6 mb-4 flex flex-col gap-2">
<button class="btn-secondary basis-full">Share profile</button>
<a class="btn-secondary text-center basis-full" href="/settings/profile">{$_("settings")}</a>
</div>
{/if}
</div>
<slot></slot>
</div>

View File

@@ -28,7 +28,7 @@
$_("must-be-at-least-n-characters-long", {
values: { n: 3 },
}),
),
).regex(/^[\w][\w\.]*$/, $_("invalid-username")),
email: z
.string()
.min(1, "required")

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB