2021-02-13 01:26:02 +01:00
|
|
|
import Icon from '@components/Icon'
|
|
|
|
import { useNavigation } from '@react-navigation/native'
|
|
|
|
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-01-30 01:29:15 +01:00
|
|
|
import { Pressable, StyleSheet, 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
|
|
|
}
|
|
|
|
|
2021-02-27 16:33:54 +01:00
|
|
|
const TimelineHeaderDefault = React.memo(
|
|
|
|
({ queryKey, rootQueryKey, status }: Props) => {
|
|
|
|
const navigation = useNavigation()
|
|
|
|
const { theme } = useTheme()
|
2021-01-30 01:29:15 +01:00
|
|
|
|
2021-02-27 16:33:54 +01:00
|
|
|
return (
|
|
|
|
<View style={styles.base}>
|
|
|
|
<View style={styles.accountAndMeta}>
|
|
|
|
<HeaderSharedAccount account={status.account} />
|
|
|
|
<View style={styles.meta}>
|
|
|
|
<HeaderSharedCreated created_at={status.created_at} />
|
|
|
|
<HeaderSharedVisibility visibility={status.visibility} />
|
|
|
|
<HeaderSharedMuted muted={status.muted} />
|
|
|
|
<HeaderSharedApplication application={status.application} />
|
|
|
|
</View>
|
2020-12-13 01:24:25 +01:00
|
|
|
</View>
|
2020-12-03 01:28:56 +01:00
|
|
|
|
2021-02-27 16:33:54 +01:00
|
|
|
{queryKey ? (
|
|
|
|
<Pressable
|
|
|
|
style={styles.action}
|
|
|
|
onPress={() =>
|
|
|
|
navigation.navigate('Screen-Actions', {
|
|
|
|
queryKey,
|
|
|
|
rootQueryKey,
|
|
|
|
status,
|
|
|
|
url: status.url || status.uri,
|
|
|
|
type: 'status'
|
|
|
|
})
|
|
|
|
}
|
|
|
|
children={
|
|
|
|
<Icon
|
|
|
|
name='MoreHorizontal'
|
|
|
|
color={theme.secondary}
|
|
|
|
size={StyleConstants.Font.Size.L}
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
) : null}
|
|
|
|
</View>
|
|
|
|
)
|
|
|
|
},
|
|
|
|
() => true
|
|
|
|
)
|
2020-10-25 01:35:41 +02:00
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
2020-12-12 22:19:18 +01:00
|
|
|
base: {
|
|
|
|
flex: 1,
|
2021-01-03 02:00:26 +01:00
|
|
|
flexDirection: 'row'
|
2020-12-13 01:24:25 +01:00
|
|
|
},
|
2021-01-01 23:10:47 +01:00
|
|
|
accountAndMeta: {
|
2021-01-24 02:25:43 +01:00
|
|
|
flex: 5
|
2020-10-25 01:35:41 +02:00
|
|
|
},
|
|
|
|
meta: {
|
2020-11-23 00:07:32 +01:00
|
|
|
flexDirection: 'row',
|
2020-11-29 18:08:31 +01:00
|
|
|
alignItems: 'center',
|
2020-11-30 00:24:53 +01:00
|
|
|
marginTop: StyleConstants.Spacing.XS,
|
|
|
|
marginBottom: StyleConstants.Spacing.S
|
2020-10-25 01:35:41 +02:00
|
|
|
},
|
|
|
|
created_at: {
|
2020-12-29 00:21:05 +01:00
|
|
|
...StyleConstants.FontStyle.S
|
2021-02-07 00:39:11 +01:00
|
|
|
},
|
|
|
|
action: {
|
|
|
|
flex: 1,
|
|
|
|
flexDirection: 'row',
|
|
|
|
justifyContent: 'center',
|
|
|
|
paddingBottom: StyleConstants.Spacing.S
|
2020-10-25 01:35:41 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2021-02-27 16:33:54 +01:00
|
|
|
export default TimelineHeaderDefault
|