Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
tingyuan committed Mar 31, 2024
1 parent 5a5fc26 commit c7d532c
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 14 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"devDependencies": {
"@babel/core": "^7.20.0",
"@react-native/eslint-config": "^0.74.0",
"@tingyuan/react-native-tailwindcss": "^0.0.15",
"@tingyuan/react-native-tailwindcss": "^0.0.16",
"@types/he": "^1.2.3",
"@types/react": "~18.2.14",
"@types/spark-md5": "^3.0.4",
Expand Down
4 changes: 3 additions & 1 deletion src/routes/Dynamic/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ export function HeaderLeft(props: { scrollTop: () => void }) {
const userName = dynamicUser?.name || '' // ? dynamicUser.name + level : ''
const sex =
dynamicUser?.sex === '男' ? '♂️' : dynamicUser?.sex === '女' ? '♀️' : ''
const { _followedUpsMap, setCheckLiveTimeStamp } = useStore()
const { _followedUpsMap, setCheckLiveTimeStamp, $blackUps } = useStore()
const followed = dynamicUser?.mid && dynamicUser.mid in _followedUpsMap
const isBlackUp = dynamicUser?.mid && dynamicUser.mid in $blackUps
return (
<View className="flex-row flex-none items-center mr-[110px] left-[-12px]">
{dynamicUser?.face ? (
Expand Down Expand Up @@ -87,6 +88,7 @@ export function HeaderLeft(props: { scrollTop: () => void }) {
className={clsx(
followed && [colors.secondary.text, 'font-bold'],
'text-lg pt-1',
isBlackUp && 'line-through',
)}
adjustsFontSizeToFit
numberOfLines={1}
Expand Down
13 changes: 9 additions & 4 deletions src/routes/Play/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { type RouteProp, useRoute } from '@react-navigation/native'
import { NativeStackScreenProps } from '@react-navigation/native-stack'
import { Icon, Text } from '@rneui/themed'
import clsx from 'clsx'
import * as Clipboard from 'expo-clipboard'
import React from 'react'
import { Linking, View } from 'react-native'
Expand All @@ -19,13 +20,17 @@ export function PlayHeaderTitle() {
const route = useRoute<RouteProp<RootStackParamList, 'Play'>>()
const { data: vi } = useVideoInfo(route.params.bvid)
const { data: fans } = useUserRelation(route.params?.mid || vi?.mid)
const { _followedUpsMap } = useStore()
const followed = route.params?.mid && route.params?.mid in _followedUpsMap

const { _followedUpsMap, $blackUps } = useStore()
const followed = route.params?.mid && route.params.mid in _followedUpsMap
const isBlackUp = route.params?.mid && route.params.mid in $blackUps
return (
<View className="flex-row items-center relative left-[-10px]">
<Text
className={`text-lg font-semibold ${followed ? colors.secondary.text : ''}`}>
className={clsx(
'text-lg font-semibold',
isBlackUp && 'line-through',
followed && colors.secondary.text,
)}>
{route.params?.name || vi?.name}
</Text>
<Text
Expand Down
13 changes: 10 additions & 3 deletions src/routes/SearchUps/UpList.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useNavigation } from '@react-navigation/native'
import { Avatar, Button, Skeleton, Text } from '@rneui/themed'
import { FlashList } from '@shopify/flash-list'
import clsx from 'clsx'
import React from 'react'
import { TouchableOpacity, View } from 'react-native'

Expand All @@ -12,9 +13,10 @@ import { parseNumber } from '@/utils'

function SearchUpItem(props: { up: SearchedUpType }) {
const navigation = useNavigation<NavigationProps['navigation']>()
const { _followedUpsMap, set$followedUps, get$followedUps } = useStore()
const { _followedUpsMap, $blackUps, set$followedUps, get$followedUps } =
useStore()
const isFollowed = props.up.mid in _followedUpsMap

const isBlackUp = props.up.mid in $blackUps
return (
<View className="flex-1 flex-row items-center justify-between px-4 mb-5">
<TouchableOpacity
Expand All @@ -34,7 +36,12 @@ function SearchUpItem(props: { up: SearchedUpType }) {
<Avatar rounded source={{ uri: props.up.face }} size={40} />
<Text
numberOfLines={2}
className={`${colors.primary.text} ${isFollowed ? colors.secondary.text : ''} text-base flex-1`}
className={clsx(
colors.primary.text,
isBlackUp && 'line-through',
isFollowed && colors.secondary.text,
'text-base flex-1',
)}
ellipsizeMode="tail">
{props.up.name}
</Text>
Expand Down
10 changes: 9 additions & 1 deletion src/routes/WebPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from 'react-native'
import { WebView } from 'react-native-webview'

import useMounted from '@/hooks/useMounted'
import useUpdateNavigationOptions from '@/hooks/useUpdateNavigationOptions'

import { UA } from '../../constants'
Expand Down Expand Up @@ -40,7 +41,7 @@ function WebPage({ route }: Props) {
const { url, title } = route.params

const webviewRef = React.useRef<WebView | null>(null)
const { webViewMode } = useStore()
const { webViewMode, setCheckLiveTimeStamp } = useStore()
const isDark = useIsDark()
const [height, setHeight] = React.useState(Dimensions.get('screen').height)
const [isEnabled, setEnabled] = React.useState(true)
Expand All @@ -53,6 +54,13 @@ function WebPage({ route }: Props) {
})
}, []),
)
useMounted(() => {
return () => {
if (url.includes('live.bilibili.com')) {
setCheckLiveTimeStamp(Date.now())
}
}
})
useUpdateNavigationOptions(
React.useMemo(() => {
const headerRight = () => {
Expand Down

0 comments on commit c7d532c

Please sign in to comment.