your personal website on atproto - mirror blento.app
at mobile-editing 44 lines 1.5 kB view raw
1import type { CardDefinition } from '../types'; 2import CreateMapCardModal from './CreateMapCardModal.svelte'; 3import MapCard from './MapCard.svelte'; 4import MapCardSettings from './MapCardSettings.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 creationModalComponent: CreateMapCardModal, 18 allowSetColor: false, 19 canHaveLabel: true, 20 settingsComponent: MapCardSettings, 21 22 groups: ['Core'], 23 24 name: 'Map', 25 26 icon: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="size-4"> 27 <path stroke-linecap="round" stroke-linejoin="round" d="M9 6.75V15m6-6v8.25m.503 3.498 4.875-2.437c.381-.19.622-.58.622-1.006V4.82c0-.836-.88-1.38-1.628-1.006l-3.869 1.934c-.317.159-.69.159-1.006 0L9.503 3.252a1.125 1.125 0 0 0-1.006 0L3.622 5.689C3.24 5.88 3 6.27 3 6.695V19.18c0 .836.88 1.38 1.628 1.006l3.869-1.934c.317-.159.69-.159 1.006 0l4.994 2.497c.317.158.69.158 1.006 0Z" /> 28</svg> 29` 30} as CardDefinition & { type: 'mapLocation' }; 31 32export function getZoomLevel(type: string | undefined): number { 33 if ( 34 ['house', 'building', 'address', 'street', 'road', 'residential', 'highway'].includes( 35 type || '' 36 ) 37 ) { 38 return 13; 39 } 40 if (['neighbourhood', 'suburb', 'quarter', 'district', 'postcode'].includes(type || '')) { 41 return 12; 42 } 43 return 1; 44}