({
source,
className,
}: SourceStripProps)
| 25 | }; |
| 26 | |
| 27 | export function SourceStrip({ |
| 28 | source, |
| 29 | className, |
| 30 | }: SourceStripProps): ReactElement | null { |
| 31 | const sourceId = source?.id ?? ''; |
| 32 | const sourceName = source?.name ?? ''; |
| 33 | const { showActionBtn } = useShowFollowAction({ |
| 34 | entityId: sourceId, |
| 35 | entityType: ContentPreferenceType.Source, |
| 36 | }); |
| 37 | const { data: contentPreference } = useContentPreferenceStatusQuery({ |
| 38 | id: sourceId, |
| 39 | entity: ContentPreferenceType.Source, |
| 40 | }); |
| 41 | if (!source?.id || !source.name || !source.image || !source.permalink) { |
| 42 | return null; |
| 43 | } |
| 44 | |
| 45 | const sourceHandle = source.handle ? `@${source.handle}` : null; |
| 46 | |
| 47 | return ( |
| 48 | <div className={classNames('flex min-w-0 items-center gap-2', className)}> |
| 49 | <HoverCard |
| 50 | appendTo={globalThis?.document?.body} |
| 51 | side="top" |
| 52 | align="start" |
| 53 | sideOffset={10} |
| 54 | trigger={ |
| 55 | <div className="flex min-w-0 flex-1 items-center gap-3 rounded-10 px-1 py-0.5"> |
| 56 | <Link passHref href={source.permalink} prefetch={false}> |
| 57 | <a |
| 58 | className="shrink-0" |
| 59 | aria-label={`Go to ${source.name}`} |
| 60 | title={source.name} |
| 61 | > |
| 62 | <img |
| 63 | src={source.image} |
| 64 | alt="" |
| 65 | className="size-8 rounded-full" |
| 66 | loading="lazy" |
| 67 | aria-hidden |
| 68 | /> |
| 69 | </a> |
| 70 | </Link> |
| 71 | <div className="flex min-w-0 flex-col"> |
| 72 | <span className="flex min-w-0 items-center gap-1"> |
| 73 | <Link passHref href={source.permalink} prefetch={false}> |
| 74 | <Typography |
| 75 | tag={TypographyTag.Link} |
| 76 | type={TypographyType.Subhead} |
| 77 | color={TypographyColor.Primary} |
| 78 | className="truncate hover:underline focus-visible:underline" |
| 79 | title={source.name} |
| 80 | bold |
| 81 | > |
| 82 | {source.name} |
| 83 | </Typography> |
| 84 | </Link> |
nothing calls this directly
no test coverage detected