Add followed by

https://github.com/tooot-app/app/issues/272
This commit is contained in:
Zhiyuan Zheng 2022-05-08 00:24:15 +02:00
parent 8f8b7b41b9
commit ed531d7371
2 changed files with 14 additions and 0 deletions

View File

@ -281,6 +281,7 @@
"accessibilityLabel": "Actions for user {{user}}", "accessibilityLabel": "Actions for user {{user}}",
"accessibilityHint": "You can mute, block, report or share this user" "accessibilityHint": "You can mute, block, report or share this user"
}, },
"followed_by": " is following you",
"moved": "User moved", "moved": "User moved",
"created_at": "Registered on: {{date}}", "created_at": "Registered on: {{date}}",
"summary": { "summary": {

View File

@ -1,5 +1,6 @@
import Icon from '@components/Icon' import Icon from '@components/Icon'
import CustomText from '@components/Text' import CustomText from '@components/Text'
import { useRelationshipQuery } from '@utils/queryHooks/relationship'
import { import {
getInstanceAccount, getInstanceAccount,
getInstanceUri getInstanceUri
@ -7,6 +8,7 @@ import {
import { StyleConstants } from '@utils/styles/constants' import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager' import { useTheme } from '@utils/styles/ThemeManager'
import React, { useMemo } from 'react' import React, { useMemo } from 'react'
import { useTranslation } from 'react-i18next'
import { View } from 'react-native' import { View } from 'react-native'
import { useSelector } from 'react-redux' import { useSelector } from 'react-redux'
import { PlaceholderLine } from 'rn-placeholder' import { PlaceholderLine } from 'rn-placeholder'
@ -20,6 +22,7 @@ const AccountInformationAccount: React.FC<Props> = ({
account, account,
localInstance localInstance
}) => { }) => {
const { t } = useTranslation('screenTabs')
const { colors } = useTheme() const { colors } = useTheme()
const instanceAccount = useSelector( const instanceAccount = useSelector(
getInstanceAccount, getInstanceAccount,
@ -27,6 +30,11 @@ const AccountInformationAccount: React.FC<Props> = ({
) )
const instanceUri = useSelector(getInstanceUri) const instanceUri = useSelector(getInstanceUri)
const { data: relationship } = useRelationshipQuery({
id: account!.id,
options: { enabled: account !== undefined }
})
const movedContent = useMemo(() => { const movedContent = useMemo(() => {
if (account?.moved) { if (account?.moved) {
return ( return (
@ -65,6 +73,11 @@ const AccountInformationAccount: React.FC<Props> = ({
@{localInstance ? instanceAccount?.acct : account?.acct} @{localInstance ? instanceAccount?.acct : account?.acct}
{localInstance ? `@${instanceUri}` : null} {localInstance ? `@${instanceUri}` : null}
</CustomText> </CustomText>
{relationship?.followed_by ? (
<CustomText fontStyle='M' style={{ color: colors.secondary }}>
{t('shared.account.followed_by')}
</CustomText>
) : null}
{movedContent} {movedContent}
{account?.locked ? ( {account?.locked ? (
<Icon <Icon