import GracefullyImage from '@components/GracefullyImage' import openLink from '@components/openLink' import CustomText from '@components/Text' import { useNeodbQuery } from '@utils/queryHooks/neodb' import { StyleConstants } from '@utils/styles/constants' import { useTheme } from '@utils/styles/ThemeManager' import * as Linking from 'expo-linking' import { useState } from 'react' import { Pressable, View } from 'react-native' import { Rating } from './Rating' export type Props = { card: Mastodon.Card } export const CardNeodb: React.FC = ({ card }) => { const { colors } = useTheme() const path = Linking.parse(card.url).path if (!path) return null const segments = path?.split('/') if ( !segments || !['movie', 'book', 'tv', 'game', 'album', 'podcast', 'performance'].includes(segments[0]) ) return null const [headingLines, setHeadingLines] = useState(3) const { data } = useNeodbQuery({ path }) if (!data) return null const Content = ({ heading, details }: { heading: string[]; details: string[] }) => ( openLink(card.url)} > {data.cover_image_url ? ( ) : null} setHeadingLines(nativeEvent.lines.length)} children={heading.filter(d => d).join(' ')} /> d).join(' / ')} /> ) switch (segments[0]) { case 'movie': return ( ) case 'book': return ( ) case 'tv': if (segments[1] === 'season') { return ( ) } else { return ( ) } case 'game': return ( ) case 'album': return ( ) case 'podcast': return ( ) case 'performance': if (segments[1] === 'production') { return ( ) } else { return ( ) } default: return null } }