Something went wrong. Try again.
Mirror — see github.com/blacksky-algorithms/blacksky.community
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114import {View} from 'react-native'import {Trans, useLingui} from '@lingui/react/macro'
import {atoms as a, useTheme} from '#/alf'import {InlineLinkText} from '#/components/Link'import {Text} from '#/components/Typography'import {type tools} from '#/lexicons'import {ContentBlock} from './ContentBlock'import {useActionedSubjectLabels} from './hooks/useActionedSubjectLabels'
type Detail = tools.ozone.inbox.getActionedSubject.$OutputBodytype Action = tools.ozone.inbox.defs.ActionView
export function AccountActionTimeline({ data, actions,}: { data: Detail actions: Action[]}) { const {t: l} = useLingui() if (!actions.length) return null return ( <ContentBlock header={l`Timeline`}> <View> {actions.map((action, index) => ( <AccountAction key={action.id} data={data} action={action} last={index === actions.length - 1} /> ))} </View> </ContentBlock> )}
function AccountAction({ data, action, last,}: { data: Detail action: Action last: boolean}) { const t = useTheme() const labels = useActionedSubjectLabels({ src: data.src, subject: data.subject, enforcement: data.enforcement, latestAction: action, }) if (!labels) return null return ( <View style={[a.flex_row, a.gap_sm]}> <View style={[a.align_center]}> <View style={[ a.mt_xs, a.rounded_full, last ? { width: 8, height: 8, borderColor: t.palette.primary_500, borderWidth: 2, } : {width: 8, height: 8, backgroundColor: t.palette.contrast_300}, ]} /> {!last && ( <View style={[ a.mt_xs, a.flex_1, a.rounded_full, { width: 2, minHeight: 12, backgroundColor: t.palette.contrast_100, }, ]} /> )} </View> <View style={[a.flex_1, a.gap_2xs, !last && a.pb_md]}> <Text emoji style={[a.text_sm, a.font_medium]}> {labels.subject} </Text> {(action.type === 'labelApplied' || action.type === 'labelRemoved') && labels.summary ? ( <Text emoji style={[a.text_sm]}> {labels.summary} </Text> ) : null} {action.policies?.map(policy => ( <Text key={policy.key} emoji style={[a.text_sm]}> <InlineLinkText to={policy.link} label={policy.displayName}> {policy.displayName} </InlineLinkText> </Text> ))} {action.reversedAt ? ( <Text style={[a.text_sm, t.atoms.text_contrast_medium]}> <Trans>Action reversed</Trans> </Text> ) : null} </View> </View> )}