1
0
mirror of https://github.com/tooot-app/app synced 2024-12-21 07:13:15 +01:00

Add new neodb cards

This commit is contained in:
xmflsct 2023-04-18 22:53:50 +02:00
parent 21200a7758
commit 40274ef28c
2 changed files with 52 additions and 22 deletions

View File

@ -1,2 +1,3 @@
toooting愉快此版本包括以下改进和修复
- 新增希腊语
- 新增希腊语
- 新增neodb专辑、播客及剧集卡片

View File

@ -17,20 +17,17 @@ export const CardNeodb: React.FC<Props> = ({ card }) => {
const { colors } = useTheme()
const segments = Linking.parse(card.url).path?.split('/')
if (
!segments ||
!(
segments[0] === 'movie' ||
segments[0] === 'book' ||
(segments[0] === 'tv' && segments[1] !== 'season') ||
segments[0] === 'game'
)
)
if (!segments || !['movie', 'book', 'tv', 'game', 'album', 'podcast'].includes(segments[0]))
return null
const [headingLines, setHeadingLines] = useState(3)
const { data } = useNeodbQuery({ path: `${segments[0]}/${segments[1]}` })
const { data } = useNeodbQuery({
path:
segments[0] === 'tv' && segments[1] === 'season'
? `${segments[0]}${segments[1]}/${segments[2]}`
: `${segments[0]}/${segments[1]}`
})
if (!data) return null
@ -110,17 +107,32 @@ export const CardNeodb: React.FC<Props> = ({ card }) => {
/>
)
case 'tv':
return (
<Content
heading={[data.title, data.orig_title, data.year ? `(${data.year})` : null]}
details={[
data.season_count ? `${data.season_count}` : null,
data.area?.join(' '),
data.genre?.join(' '),
data.director?.join(' ')
]}
/>
)
if (segments[1] === 'season') {
return (
<Content
heading={[data.title, data.orig_title, data.year ? `(${data.year})` : null]}
details={[
data.season_number ? `${data.season_number}` : null,
data.episode_count ? `${data.episode_count}` : null,
data.area?.join(' '),
data.genre?.join(' '),
data.director?.join(' ')
]}
/>
)
} else {
return (
<Content
heading={[data.title, data.orig_title, data.year ? `(${data.year})` : null]}
details={[
data.season_count ? `${data.season_count}` : null,
data.area?.join(' '),
data.genre?.join(' '),
data.director?.join(' ')
]}
/>
)
}
case 'game':
return (
<Content
@ -133,6 +145,23 @@ export const CardNeodb: React.FC<Props> = ({ card }) => {
]}
/>
)
case 'album':
return (
<Content
heading={[data.title]}
details={[
data.artist.join(' '),
data.release_date,
data.duration,
data.genre.join(' '),
data.company.join(' ')
]}
/>
)
case 'podcast':
return (
<Content heading={[data.title]} details={[data.hosts.join(' '), data.genre.join(' ')]} />
)
default:
return null
}