your personal website on atproto - mirror blento.app

Merge pull request #75 from flo-bit/statusphere-fix

statusphere fix #72

authored by

Florian and committed by
GitHub
78d08bfc 42b26090

+14 -15
+8 -11
src/lib/cards/StatusphereCard/EditStatusphereCard.svelte
··· 26 26 } 27 27 }); 28 28 29 + // Use card-specific emoji if set, otherwise fall back to PDS data 30 + let emoji = $derived(item.cardData?.emoji ?? record?.value?.status); 31 + 29 32 let showPopover = $state(false); 30 33 </script> 31 34 32 35 <div class="flex h-full w-full items-center justify-center p-4"> 33 36 <PopoverEmojiPicker 34 37 bind:open={showPopover} 35 - onpicked={(emoji) => { 36 - record ??= { 37 - value: {} 38 - }; 39 - 40 - record.value.status = emoji.unicode; 41 - 38 + onpicked={(picked) => { 42 39 item.cardData.hasUpdate = true; 43 - item.cardData.emoji = emoji.unicode; 40 + item.cardData.emoji = picked.unicode; 44 41 45 42 showPopover = false; 46 43 }} 47 44 > 48 45 {#snippet child({ props })} 49 - {@const animated = emojiToNotoAnimatedWebp(record?.value?.status)} 46 + {@const animated = emojiToNotoAnimatedWebp(emoji)} 50 47 51 48 <button {...props} class="z-20 h-full max-h-40 w-full max-w-40"> 52 49 {#if animated} ··· 55 52 alt="" 56 53 class="hover:bg-base-500/10 h-full max-h-40 w-full max-w-40 rounded-2xl object-contain" 57 54 /> 58 - {:else if record?.value?.status} 55 + {:else if emoji} 59 56 <div class="text-9xl"> 60 - {record.value.status} 57 + {emoji} 61 58 </div> 62 59 {:else} 63 60 <div>Click here to set a status</div>
+5 -3
src/lib/cards/StatusphereCard/StatusphereCard.svelte
··· 9 9 // svelte-ignore state_referenced_locally 10 10 let record = $state(data[item.cardType] as any); 11 11 12 - let animated = $derived(emojiToNotoAnimatedWebp(record?.value?.status)); 12 + // Use card-specific emoji if set, otherwise fall back to PDS data 13 + let emoji = $derived(item.cardData?.emoji ?? record?.value?.status); 14 + let animated = $derived(emojiToNotoAnimatedWebp(emoji)); 13 15 </script> 14 16 15 17 <div class="flex h-full w-full items-center justify-center p-4"> 16 18 {#if animated} 17 19 <img src={animated} alt="" class="h-full max-h-40 w-full object-contain" /> 18 - {:else if record?.value?.status} 20 + {:else if emoji} 19 21 <div class="text-9xl"> 20 - {record?.value?.status} 22 + {emoji} 21 23 </div> 22 24 {:else} 23 25 No status yet
+1 -1
src/lib/cards/StatusphereCard/index.ts
··· 36 36 } 37 37 }); 38 38 delete item.cardData.hasUpdate; 39 - delete item.cardData.emoji; 39 + // Keep item.cardData.emoji so each card can have its own status 40 40 } 41 41 42 42 return item;