优化评论着位置显示文案

This commit is contained in:
lyswhut 2023-06-08 09:33:05 +08:00
parent 1194d37a2d
commit 8ea63a2784
4 changed files with 6 additions and 2 deletions

View File

@ -89,6 +89,7 @@
"list_update_success": "{name} updated successfully", "list_update_success": "{name} updated successfully",
"load_failed": "Ah, loading failed 😥", "load_failed": "Ah, loading failed 😥",
"loading": "Loading...", "loading": "Loading...",
"location": "From {location}",
"lyric__load_error": "Failed to get lyrics", "lyric__load_error": "Failed to get lyrics",
"move_to": "Move to...", "move_to": "Move to...",
"name": "Name: {name}", "name": "Name: {name}",

View File

@ -89,6 +89,7 @@
"list_update_success": "{name} 更新成功", "list_update_success": "{name} 更新成功",
"load_failed": "啊 加载失败了 😥", "load_failed": "啊 加载失败了 😥",
"loading": "加载中...", "loading": "加载中...",
"location": "来自{location}",
"lyric__load_error": "歌词获取失败", "lyric__load_error": "歌词获取失败",
"move_to": "移动到...", "move_to": "移动到...",
"name": "歌曲名:{name}", "name": "歌曲名:{name}",

View File

@ -9,6 +9,7 @@ import Text from '@/components/common/Text'
import { scaleSizeH, scaleSizeW } from '@/utils/pixelRatio' import { scaleSizeH, scaleSizeW } from '@/utils/pixelRatio'
import ScaledImage from '@/components/common/ScaledImage' import ScaledImage from '@/components/common/ScaledImage'
import { useLayout } from '@/utils/hooks' import { useLayout } from '@/utils/hooks'
import { useI18n } from '@/lang'
// eslint-disable-next-line @typescript-eslint/no-var-requires // eslint-disable-next-line @typescript-eslint/no-var-requires
const defaultUser = require('@/resources/images/defaultUser.jpg') const defaultUser = require('@/resources/images/defaultUser.jpg')
@ -23,6 +24,7 @@ const CommentFloor = memo(({ comment, isLast }: {
const theme = useTheme() const theme = useTheme()
const [isAvatarError, setIsAvatarError] = useState(false) const [isAvatarError, setIsAvatarError] = useState(false)
const { onLayout, width } = useLayout() const { onLayout, width } = useLayout()
const t = useI18n()
const handleAvatarError = useCallback(() => { const handleAvatarError = useCallback(() => {
setIsAvatarError(true) setIsAvatarError(true)
@ -74,7 +76,7 @@ const CommentFloor = memo(({ comment, isLast }: {
</Text> </Text>
<View style={styles.metaInfo}> <View style={styles.metaInfo}>
<Text numberOfLines={1} size={12} color={theme['c-450']}>{comment.timeStr}</Text> <Text numberOfLines={1} size={12} color={theme['c-450']}>{comment.timeStr}</Text>
{ comment.location ? <Text numberOfLines={1} style={styles.location} size={12} color={theme['c-450']}>{comment.location}</Text> : null } { comment.location ? <Text numberOfLines={1} style={styles.location} size={12} color={theme['c-450']}>{t('location', { location: comment.location })}</Text> : null }
</View> </View>
</View> </View>
{likedCount} {likedCount}

View File

@ -244,7 +244,7 @@ export default {
userName: item.Nick ?? '', userName: item.Nick ?? '',
images: item.Pic ? [item.Pic] : [], images: item.Pic ? [item.Pic] : [],
avatar: item.Avatar, avatar: item.Avatar,
location: item.Location ? ('来自' + item.Location) : '', location: item.Location ? item.Location : '',
userId: item.EncryptUin, userId: item.EncryptUin,
likedCount: item.PraiseNum, likedCount: item.PraiseNum,
reply: item.SubComments reply: item.SubComments