Add support for label exp to LabelsOnMeDialog

This commit is contained in:
Eric Bailey
2025-02-13 16:45:27 -06:00
parent 326445d3af
commit 00a9733e7f
+21 -2
View File
@@ -5,6 +5,7 @@ import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react' import {useLingui} from '@lingui/react'
import {useMutation} from '@tanstack/react-query' import {useMutation} from '@tanstack/react-query'
import {useGetTimeAgo} from '#/lib/hooks/useTimeAgo'
import {useLabelSubject} from '#/lib/moderation' import {useLabelSubject} from '#/lib/moderation'
import {useLabelInfo} from '#/lib/moderation/useLabelInfo' import {useLabelInfo} from '#/lib/moderation/useLabelInfo'
import {makeProfileLink} from '#/lib/routes/links' import {makeProfileLink} from '#/lib/routes/links'
@@ -122,6 +123,7 @@ function Label({
const sourceName = labeler const sourceName = labeler
? sanitizeHandle(labeler.creator.handle, '@') ? sanitizeHandle(labeler.creator.handle, '@')
: label.src : label.src
const timeDiff = useGetTimeAgo()
return ( return (
<View <View
style={[ style={[
@@ -163,8 +165,11 @@ function Label({
<Trans>This label was applied by you.</Trans> <Trans>This label was applied by you.</Trans>
</Text> </Text>
) : ( ) : (
<View style={{flexDirection: 'row'}}> <View style={[a.flex_row, a.justify_between, a.gap_xl]}>
<Text style={[t.atoms.text_contrast_medium]}> <Text
style={[a.flex_1, a.leading_snug, t.atoms.text_contrast_medium]}
numberOfLines={1}>
<Text style={[a.leading_snug, t.atoms.text_contrast_medium]}>
<Trans>Source: </Trans>{' '} <Trans>Source: </Trans>{' '}
</Text> </Text>
<InlineLinkText <InlineLinkText
@@ -175,6 +180,20 @@ function Label({
onPress={() => control.close()}> onPress={() => control.close()}>
{sourceName} {sourceName}
</InlineLinkText> </InlineLinkText>
</Text>
{label.exp && (
<View>
<Text
style={[
a.leading_snug,
a.text_sm,
a.italic,
t.atoms.text_contrast_medium,
]}>
<Trans>Expires in {timeDiff(Date.now(), label.exp)}</Trans>
</Text>
</View>
)}
</View> </View>
)} )}
</View> </View>