import {View} from 'react-native' import {type AppBskyFeedPost} from '@atproto/api' import {Trans, useLingui} from '@lingui/react/macro' import {getPostEditInfo} from '#/lib/edit-post' import {formatDateWithSystemTime} from '#/lib/strings/systemTime' import {atoms as a, useTheme, web} from '#/alf' import * as Dialog from '#/components/Dialog' import {Text} from '#/components/Typography' /** * The "· Edited" badge next to a post's timestamp. Renders nothing unless the * post was edited; tapping it opens the original-vs-current history. */ export function PostEditedIndicator({ record, size = 'md', }: { record: AppBskyFeedPost.Record size?: 'sm' | 'md' }) { const t = useTheme() const {t: l} = useLingui() const control = Dialog.useDialogControl() const {isEdited, originalText, updatedAt} = getPostEditInfo(record) if (!isEdited) { return null } return ( <> control.open()} style={[ a.pl_xs, size === 'sm' ? a.text_sm : a.text_md, a.leading_tight, t.atoms.text_contrast_medium, web({whiteSpace: 'nowrap', cursor: 'pointer'}), ]}> · Edited ) } function PostEditHistoryDialog({ control, originalText, currentText, createdAt, updatedAt, }: { control: Dialog.DialogControlProps originalText: string | undefined currentText: string createdAt: string updatedAt: string | undefined }) { const {t: l, i18n} = useLingui() return ( Edit history ) } function TimelineEntry({ label, text, isCurrent = false, isLast = false, }: { label: string text: string isCurrent?: boolean isLast?: boolean }) { const t = useTheme() return ( {!isLast && ( )} {label} {text} ) }