1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00
This commit is contained in:
xmflsct
2023-06-09 23:50:36 +02:00
parent 33709f8fa6
commit 4b2b701cea
4 changed files with 39 additions and 12 deletions

View File

@ -16,18 +16,19 @@ export type Props = {
export const CardNeodb: React.FC<Props> = ({ card }) => {
const { colors } = useTheme()
const segments = Linking.parse(card.url).path?.split('/')
if (!segments || !['movie', 'book', 'tv', 'game', 'album', 'podcast'].includes(segments[0]))
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:
segments[0] === 'tv' && segments[1] === 'season'
? `${segments[0]}${segments[1]}/${segments[2]}`
: `${segments[0]}/${segments[1]}`
})
const { data } = useNeodbQuery({ path })
if (!data) return null
@ -44,7 +45,13 @@ export const CardNeodb: React.FC<Props> = ({ card }) => {
>
{data.cover_image_url ? (
<GracefullyImage
sources={{ default: { uri: data.cover_image_url } }}
sources={{
default: {
uri: data.cover_image_url.startsWith('/')
? `https://neodb.social${data.cover_image_url}`
: data.cover_image_url
}
}}
dimension={{
width: StyleConstants.Font.LineHeight.M * 4,
height: StyleConstants.Font.LineHeight.M * 5
@ -162,6 +169,27 @@ export const CardNeodb: React.FC<Props> = ({ card }) => {
return (
<Content heading={[data.title]} details={[data.hosts.join(' '), data.genre.join(' ')]} />
)
case 'performance':
if (segments[1] === 'production') {
return (
<Content
heading={[data.display_title]}
details={[
data.opening_date,
data.director.join(' '),
data.playwright.join(' '),
data.composer.join(' ')
]}
/>
)
} else {
return (
<Content
heading={[data.title, data.orig_title]}
details={[data.genre.join(' '), data.playwright.join(' '), data.director.join(' ')]}
/>
)
}
default:
return null
}