import GracefullyImage from '@components/GracefullyImage' import CustomText from '@components/Text' import openLink from '@components/openLink' import { useNeodbQuery } from '@utils/queryHooks/neodb' import { useTheme } from '@utils/styles/ThemeManager' import { StyleConstants } from '@utils/styles/constants' import * as Linking from 'expo-linking' import { useContext, useState } from 'react' import { Pressable, View } from 'react-native' import StatusContext from '../Context' import { Rating } from './Rating' export const CardNeodb: React.FC = () => { const { status } = useContext(StatusContext) const { colors } = useTheme() const path = Linking.parse(status?.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() const { data } = useNeodbQuery({ path }) if (!data) return null const Content = ({ heading, details }: { heading: string[]; details: string[] }) => ( status?.card?.url && openLink(status.card.url)} > {data.cover_image_url ? ( ) : null} !headingLines && 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 } }