2021-02-13 01:26:02 +01:00
|
|
|
import Icon from '@components/Icon'
|
|
|
|
import { useNavigation } from '@react-navigation/native'
|
2022-04-29 23:57:18 +02:00
|
|
|
import { StackNavigationProp } from '@react-navigation/stack'
|
|
|
|
import { RootStackParamList } from '@utils/navigation/navigators'
|
2021-02-13 01:26:02 +01:00
|
|
|
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
|
2020-12-13 14:04:25 +01:00
|
|
|
import { StyleConstants } from '@utils/styles/constants'
|
2021-02-13 01:26:02 +01:00
|
|
|
import { useTheme } from '@utils/styles/ThemeManager'
|
2021-01-12 00:12:44 +01:00
|
|
|
import React from 'react'
|
2021-04-09 21:43:12 +02:00
|
|
|
import { useTranslation } from 'react-i18next'
|
2022-04-30 21:29:08 +02:00
|
|
|
import { Pressable, View } from 'react-native'
|
2021-01-03 02:00:26 +01:00
|
|
|
import HeaderSharedAccount from './HeaderShared/Account'
|
2021-01-01 23:10:47 +01:00
|
|
|
import HeaderSharedApplication from './HeaderShared/Application'
|
|
|
|
import HeaderSharedCreated from './HeaderShared/Created'
|
2021-01-11 21:36:57 +01:00
|
|
|
import HeaderSharedMuted from './HeaderShared/Muted'
|
2021-02-13 01:26:02 +01:00
|
|
|
import HeaderSharedVisibility from './HeaderShared/Visibility'
|
2020-10-25 01:35:41 +02:00
|
|
|
|
2020-10-31 21:04:46 +01:00
|
|
|
export interface Props {
|
2021-01-07 19:13:09 +01:00
|
|
|
queryKey?: QueryKeyTimeline
|
2021-02-13 01:26:02 +01:00
|
|
|
rootQueryKey?: QueryKeyTimeline
|
2020-12-03 01:28:56 +01:00
|
|
|
status: Mastodon.Status
|
2020-10-31 21:04:46 +01:00
|
|
|
}
|
|
|
|
|
2022-04-30 21:29:08 +02:00
|
|
|
const TimelineHeaderDefault = ({ queryKey, rootQueryKey, status }: Props) => {
|
|
|
|
const { t } = useTranslation('componentTimeline')
|
|
|
|
const navigation = useNavigation<StackNavigationProp<RootStackParamList>>()
|
|
|
|
const { colors } = useTheme()
|
2021-01-30 01:29:15 +01:00
|
|
|
|
2022-04-30 21:29:08 +02:00
|
|
|
return (
|
|
|
|
<View style={{ flex: 1, flexDirection: 'row' }}>
|
|
|
|
<View style={{ flex: 5 }}>
|
|
|
|
<HeaderSharedAccount account={status.account} />
|
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
flexDirection: 'row',
|
|
|
|
alignItems: 'center',
|
|
|
|
marginTop: StyleConstants.Spacing.XS,
|
|
|
|
marginBottom: StyleConstants.Spacing.S
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<HeaderSharedCreated
|
|
|
|
created_at={status.created_at}
|
|
|
|
edited_at={status.edited_at}
|
2021-02-27 16:33:54 +01:00
|
|
|
/>
|
2022-04-30 21:29:08 +02:00
|
|
|
<HeaderSharedVisibility visibility={status.visibility} />
|
|
|
|
<HeaderSharedMuted muted={status.muted} />
|
|
|
|
<HeaderSharedApplication application={status.application} />
|
|
|
|
</View>
|
2021-02-27 16:33:54 +01:00
|
|
|
</View>
|
2020-10-25 01:35:41 +02:00
|
|
|
|
2022-04-30 21:29:08 +02:00
|
|
|
{queryKey ? (
|
|
|
|
<Pressable
|
|
|
|
accessibilityHint={t('shared.header.actions.accessibilityHint')}
|
|
|
|
style={{
|
|
|
|
flex: 1,
|
|
|
|
flexDirection: 'row',
|
|
|
|
justifyContent: 'center',
|
|
|
|
paddingBottom: StyleConstants.Spacing.S
|
|
|
|
}}
|
|
|
|
onPress={() =>
|
|
|
|
navigation.navigate('Screen-Actions', {
|
|
|
|
queryKey,
|
|
|
|
rootQueryKey,
|
|
|
|
status,
|
|
|
|
type: 'status'
|
|
|
|
})
|
|
|
|
}
|
|
|
|
children={
|
|
|
|
<Icon
|
|
|
|
name='MoreHorizontal'
|
|
|
|
color={colors.secondary}
|
|
|
|
size={StyleConstants.Font.Size.L}
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
) : null}
|
|
|
|
</View>
|
|
|
|
)
|
|
|
|
}
|
2020-10-25 01:35:41 +02:00
|
|
|
|
2021-02-27 16:33:54 +01:00
|
|
|
export default TimelineHeaderDefault
|