1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Edited posts can be viewed

This commit is contained in:
Zhiyuan Zheng
2022-04-29 23:57:18 +02:00
parent bceb70e805
commit 95ec76f411
25 changed files with 411 additions and 154 deletions

View File

@ -1,30 +1,43 @@
import Icon from '@components/Icon'
import RelativeTime from '@components/RelativeTime'
import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import React from 'react'
import { StyleSheet, Text } from 'react-native'
import { useTranslation } from 'react-i18next'
import { Text } from 'react-native'
export interface Props {
created_at: Mastodon.Status['created_at'] | number
created_at: Mastodon.Status['created_at']
edited_at?: Mastodon.Status['edited_at']
}
const HeaderSharedCreated = React.memo(
({ created_at }: Props) => {
({ created_at, edited_at }: Props) => {
const { t } = useTranslation('componentTimeline')
const { colors } = useTheme()
return (
<Text style={[styles.created_at, { color: colors.secondary }]}>
<RelativeTime date={created_at} />
</Text>
<>
<Text
style={{ ...StyleConstants.FontStyle.S, color: colors.secondary }}
>
<RelativeTime date={edited_at || created_at} />
</Text>
{edited_at ? (
<Icon
accessibilityLabel={t(
'shared.header.shared.edited.accessibilityLabel'
)}
name='Edit'
size={StyleConstants.Font.Size.S}
color={colors.secondary}
style={{ marginLeft: StyleConstants.Spacing.S }}
/>
) : null}
</>
)
},
() => true
)
const styles = StyleSheet.create({
created_at: {
...StyleConstants.FontStyle.S
}
})
export default HeaderSharedCreated