({
placeholderAmount,
scrollingProps,
sources,
isLoading,
emptyPlaceholder,
showFollow = true,
showBlock,
}: SourceListProps)
| 33 | } |
| 34 | |
| 35 | export const SourceList = ({ |
| 36 | placeholderAmount, |
| 37 | scrollingProps, |
| 38 | sources, |
| 39 | isLoading, |
| 40 | emptyPlaceholder, |
| 41 | showFollow = true, |
| 42 | showBlock, |
| 43 | }: SourceListProps): ReactElement => { |
| 44 | const feedSettingsEditContext = useFeedSettingsEditContext(); |
| 45 | const feed = feedSettingsEditContext?.feed; |
| 46 | const loader = ( |
| 47 | <SourceListPlaceholder placeholderAmount={placeholderAmount ?? 0} /> |
| 48 | ); |
| 49 | |
| 50 | if (sources?.length) { |
| 51 | return ( |
| 52 | <InfiniteScrolling |
| 53 | {...scrollingProps} |
| 54 | aria-label="source-list" |
| 55 | placeholder={loader} |
| 56 | > |
| 57 | {sources.map((source) => { |
| 58 | const sourceId = source.id ?? source.handle; |
| 59 | const sourceStatus = source.contentPreference?.status; |
| 60 | |
| 61 | return ( |
| 62 | <div |
| 63 | className="relative flex gap-2 px-4 py-3 hover:bg-surface-hover tablet:px-6" |
| 64 | key={sourceId} |
| 65 | > |
| 66 | <Link |
| 67 | href={`${webappUrl}${ |
| 68 | source.type === SourceType.Squad ? 'squads' : 'sources' |
| 69 | }/${source.handle}`} |
| 70 | > |
| 71 | <a |
| 72 | className="absolute inset-0 z-0" |
| 73 | rel={anchorDefaultRel} |
| 74 | target="_blank" |
| 75 | aria-label={`View ${source.handle}`} |
| 76 | /> |
| 77 | </Link> |
| 78 | <ProfilePicture |
| 79 | size={ProfileImageSize.Large} |
| 80 | rounded="full" |
| 81 | className="mt-2" |
| 82 | user={{ |
| 83 | id: sourceId, |
| 84 | image: source.image, |
| 85 | username: source.handle, |
| 86 | }} |
| 87 | nativeLazyLoading |
| 88 | /> |
| 89 | <div className="flex-1"> |
| 90 | <Typography |
| 91 | type={TypographyType.Callout} |
| 92 | bold |
nothing calls this directly
no test coverage detected