JavaScript-optional public web frontend for Bluesky anartia.kelinci.net
sveltekit atcute bluesky typescript svelte
9
fork

Configure Feed

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

refactor: deduplicate associated render

mary.my.id 9d6f1940 4e751dad

verified
+10 -12
+10 -12
src/routes/(app)/(profile)/[actor=didOrHandle]/+layout.svelte
··· 50 {#if profile.associated?.feedgens} 51 {@const count = profile.associated.feedgens} 52 53 - <a class="association" href="{base}/{did}/feeds"> 54 - <span class="association-count">{formatCompactNumber(count)}</span> 55 - {count === 1 ? `feed` : `feeds`} 56 - </a> 57 {/if} 58 {#if profile.associated?.lists} 59 {@const count = profile.associated.lists} 60 61 - <a class="association" href="{base}/{did}/lists"> 62 - <span class="association-count">{formatCompactNumber(count)}</span> 63 - {count === 1 ? `list` : `lists`} 64 - </a> 65 {/if} 66 {#if profile.associated?.starterPacks} 67 {@const count = profile.associated.starterPacks} 68 69 - <a class="association" href="{base}/{did}/packs"> 70 - <span class="association-count">{formatCompactNumber(count)}</span> 71 - {count === 1 ? `starter pack` : `starter packs`} 72 - </a> 73 {/if} 74 </div> 75 </div> ··· 79 </div> 80 </div> 81 {/key} 82 83 <style> 84 .profile-layout {
··· 50 {#if profile.associated?.feedgens} 51 {@const count = profile.associated.feedgens} 52 53 + {@render Associated(`${base}/${did}/feeds`, count, `feed`, `feeds`)} 54 {/if} 55 {#if profile.associated?.lists} 56 {@const count = profile.associated.lists} 57 58 + {@render Associated(`${base}/${did}/lists`, count, `list`, `lists`)} 59 {/if} 60 {#if profile.associated?.starterPacks} 61 {@const count = profile.associated.starterPacks} 62 63 + {@render Associated(`${base}/${did}/packs`, count, `starter pack`, `starter packs`)} 64 {/if} 65 </div> 66 </div> ··· 70 </div> 71 </div> 72 {/key} 73 + 74 + {#snippet Associated(href: string, count: number, one: string, many: string)} 75 + <a class="association" {href}> 76 + <span class="association-count">{formatCompactNumber(count)}</span> 77 + {count === 1 ? one : many} 78 + </a> 79 + {/snippet} 80 81 <style> 82 .profile-layout {