your personal website on atproto - mirror
blento.app
1import type { CardDefinition } from '../types';
2import CreateMapCardModal from './CreateMapCardModal.svelte';
3import MapCard from './MapCard.svelte';
4import SidebarItemMapCard from './SidebarItemMapCard.svelte';
5
6export const MapCardDefinition = {
7 type: 'mapLocation',
8 contentComponent: MapCard,
9 sidebarButtonText: 'map',
10 createNew: (item) => {
11 item.w = 4;
12 item.h = 4;
13 item.mobileH = 8;
14 item.mobileW = 8;
15 },
16
17 sidebarComponent: SidebarItemMapCard,
18 creationModalComponent: CreateMapCardModal,
19 allowSetColor: false
20} as CardDefinition & { type: 'mapLocation' };
21
22export function getZoomLevel(type: string | undefined): number {
23 if (
24 ['house', 'building', 'address', 'street', 'road', 'residential', 'highway'].includes(
25 type || ''
26 )
27 ) {
28 return 13;
29 }
30 if (['neighbourhood', 'suburb', 'quarter', 'district', 'postcode'].includes(type || '')) {
31 return 12;
32 }
33 return 1;
34}