appview-less bluesky client
24
fork

Configure Feed

Select the types of activity you want to include in your feed.

better handle if image in record doesnt have aspect ratio

dawn 28e88e0e 8658000a

+9 -15
+1 -1
src/components/EmbedMedia.svelte
··· 21 21 isBlob(img.image) ? [{ ...img, image: img.image }] : [] 22 22 )} 23 23 {@const images = _images.map((i): GalleryItem => { 24 - const size = i.aspectRatio ?? { width: 400, height: 300 }; 24 + const size = i.aspectRatio; 25 25 const cid = i.image.ref.$link; 26 26 return { 27 27 ...size,
+8 -14
src/components/PhotoSwipeGallery.svelte
··· 3 3 src: string; 4 4 thumbnail?: { 5 5 src: string; 6 - width: number; 7 - height: number; 6 + width?: number; 7 + height?: number; 8 8 }; 9 - width: number; 10 - height: number; 11 - cropped?: boolean; 9 + width?: number; 10 + height?: number; 12 11 alt?: string; 13 12 } 14 13 export type GalleryData = Array<GalleryItem>; ··· 23 22 24 23 export let images: GalleryData; 25 24 let element: HTMLDivElement; 25 + let imageElements: { [key: number]: HTMLImageElement } = {}; 26 26 27 27 const options = writable<Partial<PreparedPhotoSwipeOptions> | undefined>(undefined); 28 28 $: { ··· 70 70 <!-- eslint-disable svelte/no-navigation-without-resolve --> 71 71 <a 72 72 href={img.src} 73 - data-pswp-width={img.width} 74 - data-pswp-height={img.height} 73 + data-pswp-width={img.width ?? imageElements[i]?.width} 74 + data-pswp-height={img.height ?? imageElements[i]?.height} 75 75 target="_blank" 76 76 class:hidden-in-grid={isHidden} 77 77 class:overlay-container={isOverlay} 78 78 > 79 - <img 80 - src={thumb.src} 81 - title={img.alt ?? ''} 82 - alt={img.alt ?? ''} 83 - width={thumb.width} 84 - height={thumb.height} 85 - /> 79 + <img bind:this={imageElements[i]} src={thumb.src} title={img.alt ?? ''} alt={img.alt ?? ''} /> 86 80 87 81 {#if isOverlay} 88 82 <div class="more-overlay">