diff --git a/src/components/Timeline/Shared/Card/Neodb.tsx b/src/components/Timeline/Shared/Card/Neodb.tsx index 69fe2018..0e8c453e 100644 --- a/src/components/Timeline/Shared/Card/Neodb.tsx +++ b/src/components/Timeline/Shared/Card/Neodb.tsx @@ -17,7 +17,15 @@ export const CardNeodb: React.FC = ({ card }) => { const { colors } = useTheme() const segments = Linking.parse(card.url).path?.split('/') - if (!segments || !(segments[0] === 'movie' || segments[0] === 'book' || segments[0] === 'tv')) + if ( + !segments || + !( + segments[0] === 'movie' || + segments[0] === 'book' || + (segments[0] === 'tv' && segments[1] !== 'season') || + segments[0] === 'game' + ) + ) return null const [headingLines, setHeadingLines] = useState(3) @@ -26,121 +34,104 @@ export const CardNeodb: React.FC = ({ card }) => { if (!data) return null - const pressableProps = { - style: { - marginTop: StyleConstants.Spacing.M, - backgroundColor: colors.shimmerDefault, - borderRadius: StyleConstants.BorderRadius, - padding: StyleConstants.Spacing.S, - flexDirection: 'row' as 'row' - }, - onPress: () => openLink(card.url) - } - const contentProps = { style: { flex: 1, gap: StyleConstants.Spacing.S } } - - const itemImage = data.cover_image_url ? ( - ( + - ) : null - const itemHeading = (value: string) => ( - setHeadingLines(nativeEvent.lines.length)} - /> - ) - const itemDetails = (value: string) => ( - + onPress={() => 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 ( - - {itemImage} - - {itemHeading( - [data.title, data.orig_title, data.year ? `(${data.year})` : null] - .filter(d => d) - .join(' ') - )} - - {itemDetails( - [ - data.duration - ? parseInt(data.duration).toString() === data.duration - ? `${data.duration}分钟` - : data.duration - : null, - data.area?.join(' '), - data.genre?.join(' '), - data.director?.join(' ') - ] - .filter(d => d) - .join(' / ') - )} - - + ) case 'book': return ( - - {itemImage} - - {itemHeading(data.title)} - - {itemDetails( - [ - data.author?.join(' '), - data.pages ? `${data.pages}页` : null, - data.language, - data.pub_house - ] - .filter(d => d) - .join(' / ') - )} - - + ) case 'tv': return ( - - {itemImage} - - {itemHeading( - [data.title, data.orig_title, data.year ? `(${data.year})` : null] - .filter(d => d) - .join(' ') - )} - - {itemDetails( - [ - data.season_count ? `共${data.season_count}季` : null, - data.area?.join(' '), - data.genre?.join(' '), - data.director?.join(' ') - ] - .filter(d => d) - .join(' / ') - )} - - + + ) + case 'game': + return ( + ) default: return null diff --git a/src/components/Timeline/Shared/Card/index.tsx b/src/components/Timeline/Shared/Card/index.tsx index da1e393a..5dc3012a 100644 --- a/src/components/Timeline/Shared/Card/index.tsx +++ b/src/components/Timeline/Shared/Card/index.tsx @@ -4,6 +4,7 @@ import openLink from '@components/openLink' import CustomText from '@components/Text' import { useNavigation } from '@react-navigation/native' import { StackNavigationProp } from '@react-navigation/stack' +import { isDevelopment } from '@utils/helpers/checkEnvironment' import { urlMatcher } from '@utils/helpers/urlMatcher' import { TabLocalStackParamList } from '@utils/navigation/navigators' import { useAccountQuery } from '@utils/queryHooks/account' @@ -27,8 +28,9 @@ const TimelineCard: React.FC = () => { const { i18n } = useTranslation() if ( - status.card.url.includes('://neodb.social/') && - i18n.language.toLowerCase().startsWith('zh-hans') + (status.card.url.includes('://neodb.social/') && + i18n.language.toLowerCase().startsWith('zh-hans')) || + isDevelopment ) { return }