mirror of
https://github.com/tooot-app/app
synced 2025-04-03 21:21:01 +02:00
Add new neodb cards
This commit is contained in:
parent
21200a7758
commit
40274ef28c
@ -1,2 +1,3 @@
|
|||||||
toooting愉快!此版本包括以下改进和修复:
|
toooting愉快!此版本包括以下改进和修复:
|
||||||
- 新增希腊语
|
- 新增希腊语
|
||||||
|
- 新增neodb专辑、播客及剧集卡片
|
@ -17,20 +17,17 @@ export const CardNeodb: React.FC<Props> = ({ card }) => {
|
|||||||
const { colors } = useTheme()
|
const { colors } = useTheme()
|
||||||
|
|
||||||
const segments = Linking.parse(card.url).path?.split('/')
|
const segments = Linking.parse(card.url).path?.split('/')
|
||||||
if (
|
if (!segments || !['movie', 'book', 'tv', 'game', 'album', 'podcast'].includes(segments[0]))
|
||||||
!segments ||
|
|
||||||
!(
|
|
||||||
segments[0] === 'movie' ||
|
|
||||||
segments[0] === 'book' ||
|
|
||||||
(segments[0] === 'tv' && segments[1] !== 'season') ||
|
|
||||||
segments[0] === 'game'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
return null
|
return null
|
||||||
|
|
||||||
const [headingLines, setHeadingLines] = useState(3)
|
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
|
if (!data) return null
|
||||||
|
|
||||||
@ -110,6 +107,20 @@ export const CardNeodb: React.FC<Props> = ({ card }) => {
|
|||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
case 'tv':
|
case 'tv':
|
||||||
|
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 (
|
return (
|
||||||
<Content
|
<Content
|
||||||
heading={[data.title, data.orig_title, data.year ? `(${data.year})` : null]}
|
heading={[data.title, data.orig_title, data.year ? `(${data.year})` : null]}
|
||||||
@ -121,6 +132,7 @@ export const CardNeodb: React.FC<Props> = ({ card }) => {
|
|||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
}
|
||||||
case 'game':
|
case 'game':
|
||||||
return (
|
return (
|
||||||
<Content
|
<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:
|
default:
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user