import contextMenuAccount from '@components/ContextMenu/account' import contextMenuInstance from '@components/ContextMenu/instance' import contextMenuShare from '@components/ContextMenu/share' import contextMenuStatus from '@components/ContextMenu/status' import Icon from '@components/Icon' import { QueryKeyTimeline } from '@utils/queryHooks/timeline' import { StyleConstants } from '@utils/styles/constants' import { useTheme } from '@utils/styles/ThemeManager' import React from 'react' import { useTranslation } from 'react-i18next' import { Pressable, View } from 'react-native' import ContextMenu, { ContextMenuAction } from 'react-native-context-menu-view' import HeaderSharedAccount from './HeaderShared/Account' import HeaderSharedApplication from './HeaderShared/Application' import HeaderSharedCreated from './HeaderShared/Created' import HeaderSharedMuted from './HeaderShared/Muted' import HeaderSharedVisibility from './HeaderShared/Visibility' export interface Props { queryKey?: QueryKeyTimeline status: Mastodon.Status highlighted: boolean } const TimelineHeaderDefault = ({ queryKey, status, highlighted }: Props) => { if (!queryKey) return null const { t } = useTranslation('componentContextMenu') const { colors } = useTheme() const actions: ContextMenuAction[] = [] const shareOnPress = status.visibility !== 'direct' ? contextMenuShare({ actions, type: 'status', url: status.url || status.uri }) : null const statusOnPress = contextMenuStatus({ actions, status, queryKey }) const accountOnPress = contextMenuAccount({ actions, type: 'status', queryKey, id: status.account.id }) const instanceOnPress = contextMenuInstance({ actions, status, queryKey }) return ( {queryKey ? ( { for (const on of [shareOnPress, statusOnPress, accountOnPress, instanceOnPress]) { on && on(index) } }} children={ } style={{ width: '100%', height: '100%', paddingHorizontal: StyleConstants.Font.Size.M }} /> ) : null} ) } export default TimelineHeaderDefault