Atproto AMA app
0
fork

Configure Feed

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

at main 43 lines 1.5 kB view raw
1import { Show } from 'solid-js' 2import { getSourceTypeInfo, formatSourceAttribution, getOriginalPostUrl } from '~/lib/source-integrations' 3import { SOURCE_TYPES, type SourceType } from '~/lib/shared-schemas' 4 5interface SourceAttributionProps { 6 sourceType: string 7 sourceUri?: string | null 8 sourceData?: string | null 9 class?: string 10} 11 12export function SourceAttribution(props: SourceAttributionProps) { 13 const sourceType = () => props.sourceType as SourceType 14 const info = () => getSourceTypeInfo(sourceType()) 15 const attribution = () => formatSourceAttribution(sourceType(), props.sourceUri || undefined) 16 const originalUrl = () => getOriginalPostUrl(sourceType(), props.sourceUri || undefined, props.sourceData || undefined) 17 18 // Don't show attribution for native Askimut content 19 const shouldShow = () => sourceType() !== SOURCE_TYPES.ASKIMUT && attribution() 20 21 return ( 22 <Show when={shouldShow()}> 23 <div class={`source-attribution ${props.class || ''}`}> 24 <span class="source-icon" style={{ color: info().color }}> 25 {info().icon} 26 </span> 27 <Show 28 when={originalUrl()} 29 fallback={<span class="source-text">{attribution()}</span>} 30 > 31 <a 32 href={originalUrl()!} 33 target="_blank" 34 rel="noopener noreferrer" 35 class="source-link" 36 > 37 {attribution()} 38 </a> 39 </Show> 40 </div> 41 </Show> 42 ) 43}