Hide quote post button if disabled
This commit is contained in:
@@ -255,6 +255,7 @@ let PostCtrls = ({
|
|||||||
onRepost={onRepost}
|
onRepost={onRepost}
|
||||||
onQuote={onQuote}
|
onQuote={onQuote}
|
||||||
big={big}
|
big={big}
|
||||||
|
quotepostDisabled={Boolean(post.viewer?.quotepostDisabled)}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<View style={big ? a.align_center : [a.flex_1, a.align_start]}>
|
<View style={big ? a.align_center : [a.flex_1, a.align_start]}>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ interface Props {
|
|||||||
onRepost: () => void
|
onRepost: () => void
|
||||||
onQuote: () => void
|
onQuote: () => void
|
||||||
big?: boolean
|
big?: boolean
|
||||||
|
quotepostDisabled: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
let RepostButton = ({
|
let RepostButton = ({
|
||||||
@@ -28,6 +29,7 @@ let RepostButton = ({
|
|||||||
onRepost,
|
onRepost,
|
||||||
onQuote,
|
onQuote,
|
||||||
big,
|
big,
|
||||||
|
quotepostDisabled,
|
||||||
}: Props): React.ReactNode => {
|
}: Props): React.ReactNode => {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
@@ -110,24 +112,26 @@ let RepostButton = ({
|
|||||||
: _(msg({message: `Repost`, context: 'action'}))}
|
: _(msg({message: `Repost`, context: 'action'}))}
|
||||||
</Text>
|
</Text>
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
{quotepostDisabled ? null : (
|
||||||
testID="quoteBtn"
|
<Button
|
||||||
style={[a.justify_start, a.px_md]}
|
testID="quoteBtn"
|
||||||
label={_(msg`Quote post`)}
|
style={[a.justify_start, a.px_md]}
|
||||||
onPress={() => {
|
label={_(msg`Quote post`)}
|
||||||
playHaptic()
|
onPress={() => {
|
||||||
dialogControl.close(() => {
|
playHaptic()
|
||||||
onQuote()
|
dialogControl.close(() => {
|
||||||
})
|
onQuote()
|
||||||
}}
|
})
|
||||||
size="large"
|
}}
|
||||||
variant="ghost"
|
size="large"
|
||||||
color="primary">
|
variant="ghost"
|
||||||
<Quote size="lg" fill={t.palette.primary_500} />
|
color="primary">
|
||||||
<Text style={[a.font_bold, a.text_xl]}>
|
<Quote size="lg" fill={t.palette.primary_500} />
|
||||||
{_(msg`Quote post`)}
|
<Text style={[a.font_bold, a.text_xl]}>
|
||||||
</Text>
|
{_(msg`Quote post`)}
|
||||||
</Button>
|
</Text>
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
</View>
|
</View>
|
||||||
<Button
|
<Button
|
||||||
label={_(msg`Cancel quote post`)}
|
label={_(msg`Cancel quote post`)}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ interface Props {
|
|||||||
onRepost: () => void
|
onRepost: () => void
|
||||||
onQuote: () => void
|
onQuote: () => void
|
||||||
big?: boolean
|
big?: boolean
|
||||||
|
quotepostDisabled: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export const RepostButton = ({
|
export const RepostButton = ({
|
||||||
@@ -28,6 +29,7 @@ export const RepostButton = ({
|
|||||||
onRepost,
|
onRepost,
|
||||||
onQuote,
|
onQuote,
|
||||||
big,
|
big,
|
||||||
|
quotepostDisabled,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
@@ -75,13 +77,15 @@ export const RepostButton = ({
|
|||||||
</Menu.ItemText>
|
</Menu.ItemText>
|
||||||
<Menu.ItemIcon icon={Repost} position="right" />
|
<Menu.ItemIcon icon={Repost} position="right" />
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item
|
{quotepostDisabled ? null : (
|
||||||
label={_(msg`Quote post`)}
|
<Menu.Item
|
||||||
testID="repostDropdownQuoteBtn"
|
label={_(msg`Quote post`)}
|
||||||
onPress={onQuote}>
|
testID="repostDropdownQuoteBtn"
|
||||||
<Menu.ItemText>{_(msg`Quote post`)}</Menu.ItemText>
|
onPress={onQuote}>
|
||||||
<Menu.ItemIcon icon={Quote} position="right" />
|
<Menu.ItemText>{_(msg`Quote post`)}</Menu.ItemText>
|
||||||
</Menu.Item>
|
<Menu.ItemIcon icon={Quote} position="right" />
|
||||||
|
</Menu.Item>
|
||||||
|
)}
|
||||||
</Menu.Outer>
|
</Menu.Outer>
|
||||||
</Menu.Root>
|
</Menu.Root>
|
||||||
</EventStopper>
|
</EventStopper>
|
||||||
|
|||||||
Reference in New Issue
Block a user