import React from 'react' import { StyleProp, StyleSheet, TouchableOpacity, View, ViewStyle, } from 'react-native' import {ComAtprotoLabelDefs} from '@atproto/api' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {usePalette} from 'lib/hooks/usePalette' import {Link} from '../Link' import {Text} from '../text/Text' import {addStyle} from 'lib/styles' import {useStores} from 'state/index' export function PostHider({ testID, href, isMuted, labels, style, children, }: React.PropsWithChildren<{ testID?: string href: string isMuted: boolean | undefined labels: ComAtprotoLabelDefs.Label[] | undefined style: StyleProp }>) { const store = useStores() const pal = usePalette('default') const [override, setOverride] = React.useState(false) const bg = override ? pal.viewLight : pal.view const labelPref = store.preferences.getLabelPreference(labels) if (labelPref.pref === 'hide') { return <> } if (!isMuted) { // NOTE: any further label enforcement should occur in ContentContainer return ( {children} ) } return ( <> Post from an account you muted. setOverride(v => !v)}> {override ? 'Hide' : 'Show'} post {override && ( {children} )} ) } const styles = StyleSheet.create({ description: { flexDirection: 'row', alignItems: 'center', paddingVertical: 14, paddingHorizontal: 18, borderTopWidth: 1, }, icon: { marginRight: 10, }, showBtn: { marginLeft: 'auto', }, childrenContainer: { paddingHorizontal: 6, paddingBottom: 6, }, child: { borderWidth: 1, borderRadius: 12, }, })