tangled
alpha
login
or
join now
flo-bit.dev
/
blento
21
fork
atom
your personal website on atproto - mirror
blento.app
21
fork
atom
overview
issues
pulls
pipelines
small fixes
Florian
1 month ago
35838ae2
8db78035
+36
-30
3 changed files
expand all
collapse all
unified
split
src
lib
cards
BaseCard
BaseEditingCard.svelte
MapCard
CreateMapCardModal.svelte
Map.svelte
+1
-1
src/lib/cards/BaseCard/BaseEditingCard.svelte
···
56
56
57
57
const cardDef = $derived(CardDefinitionsByType[item.cardType]);
58
58
59
59
-
const minW = $derived(cardDef.minW ?? (isMobile() ? 4 : 2));
59
59
+
const minW = $derived(cardDef.minW ?? (isMobile() ? 2 : 2));
60
60
const minH = $derived(cardDef.minH ?? (isMobile() ? 2 : 2));
61
61
62
62
const maxW = $derived(cardDef.maxW ?? COLUMNS);
+32
-28
src/lib/cards/MapCard/CreateMapCardModal.svelte
···
28
28
item.cardData.lon = data.lon;
29
29
item.cardData.name = data.display_name?.split(',')[0] || search;
30
30
item.cardData.type = data.class || 'city';
31
31
-
item.cardData.zoom = getZoomLevel(data.class);
31
31
+
item.cardData.zoom = Math.max(getZoomLevel(data.class), getZoomLevel(data.type));
32
32
} else {
33
33
throw new Error('response not ok');
34
34
}
···
43
43
</script>
44
44
45
45
<Modal open={true} closeButton={false}>
46
46
-
<Subheading>Enter a city and country</Subheading>
47
47
-
<Input bind:value={search} />
46
46
+
<form
47
47
+
onsubmit={async () => {
48
48
+
if (await fetchLocation()) oncreate();
49
49
+
}}
50
50
+
class="flex flex-col gap-2"
51
51
+
>
52
52
+
<Subheading>Enter a address or city</Subheading>
53
53
+
<Input bind:value={search} class="mt-4" />
48
54
49
49
-
{#if errorMessage}
50
50
-
<Alert type="error" title="Failed to create map card"><span>{errorMessage}</span></Alert>
51
51
-
{/if}
55
55
+
{#if errorMessage}
56
56
+
<Alert type="error" title="Failed to create map card"><span>{errorMessage}</span></Alert>
57
57
+
{/if}
52
58
53
53
-
<p class="text-xs">
54
54
-
Geocoding by <a
55
55
-
href="https://nominatim.openstreetmap.org/"
56
56
-
class="text-accent-800 dark:text-accent-300"
57
57
-
target="_blank">Nominatim</a
58
58
-
>
59
59
-
/ ©
60
60
-
<a
61
61
-
href="https://www.openstreetmap.org/copyright"
62
62
-
class="text-accent-800 dark:text-accent-300"
63
63
-
target="_blank">OpenStreetMap contributors</a
64
64
-
>
65
65
-
</p>
59
59
+
<p class="text-xs mt-2">
60
60
+
Geocoding by <a
61
61
+
href="https://nominatim.openstreetmap.org/"
62
62
+
class="text-accent-800 dark:text-accent-300"
63
63
+
target="_blank">Nominatim</a
64
64
+
>
65
65
+
/ ©
66
66
+
<a
67
67
+
href="https://www.openstreetmap.org/copyright"
68
68
+
class="text-accent-800 dark:text-accent-300"
69
69
+
target="_blank">OpenStreetMap contributors</a
70
70
+
>
71
71
+
</p>
66
72
67
67
-
<div class="mt-4 flex justify-end gap-2">
68
68
-
<Button onclick={oncancel} variant="ghost">Cancel</Button>
69
69
-
<Button
70
70
-
disabled={isFetchingLocation}
71
71
-
onclick={async () => {
72
72
-
if (await fetchLocation()) oncreate();
73
73
-
}}>{isFetchingLocation ? 'Creating...' : 'Create'}</Button
74
74
-
>
75
75
-
</div>
73
73
+
<div class="mt-4 flex justify-end gap-2">
74
74
+
<Button onclick={oncancel} variant="ghost">Cancel</Button>
75
75
+
<Button type="submit" disabled={isFetchingLocation}
76
76
+
>{isFetchingLocation ? 'Creating...' : 'Create'}</Button
77
77
+
>
78
78
+
</div>
79
79
+
</form>
76
80
</Modal>
+3
-1
src/lib/cards/MapCard/Map.svelte
···
22
22
});
23
23
24
24
onMount(() => {
25
25
-
if (!mapContainer || !env.PUBLIC_MAPBOX_TOKEN) return;
25
25
+
if (!mapContainer || !env.PUBLIC_MAPBOX_TOKEN) {
26
26
+
console.log('no map container or no mapbox token');
27
27
+
}
26
28
27
29
try {
28
30
mapboxgl.accessToken = env.PUBLIC_MAPBOX_TOKEN;