This repository has no description
0

Configure Feed

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

semble / src / webapp / features / cards / components / urlCardContent / UrlCardContent.tsx
1.4 kB 41 lines
1import { detectUrlPlatform, SupportedPlatform } from '@/lib/utils/link'; 2import { UrlCard } from '@semble/types'; 3import SembleCollectionCardContent from './SembleCollectionCardContent'; 4import LinkCardContent from './LinkCardContent'; 5import BlueskyPost from '@/features/platforms/bluesky/components/blueskyPost/BlueskyPost'; 6import { getPostUriFromUrl } from '@/lib/utils/atproto'; 7import { Suspense } from 'react'; 8import { ErrorBoundary } from 'react-error-boundary'; 9import BlueskyPostSkeleton from '@/features/platforms/bluesky/components/blueskyPost/Skeleton.BlueskyPost'; 10 11interface Props { 12 url: string; 13 cardContent: UrlCard['cardContent']; 14} 15 16export default function UrlCardContent(props: Props) { 17 const platform = detectUrlPlatform(props.url); 18 19 if (platform === SupportedPlatform.SEMBLE_COLLECTION) { 20 return <SembleCollectionCardContent cardContent={props.cardContent} />; 21 } 22 23 if (platform === SupportedPlatform.BLUESKY_POST) { 24 return ( 25 <ErrorBoundary 26 fallback={<LinkCardContent cardContent={props.cardContent} />} 27 > 28 <Suspense fallback={<BlueskyPostSkeleton />}> 29 <BlueskyPost 30 uri={getPostUriFromUrl(props.url)} 31 fallbackCardContent={ 32 <LinkCardContent cardContent={props.cardContent} /> 33 } 34 /> 35 </Suspense> 36 </ErrorBoundary> 37 ); 38 } 39 40 return <LinkCardContent cardContent={props.cardContent} />; 41}