Hide reply settings if disabled

This commit is contained in:
Eric Bailey
2024-08-09 15:35:21 -05:00
parent e5a678dee8
commit c70f33ebe2
@@ -86,7 +86,10 @@ function DialogContent({
[postgate, onChangePostgate],
)
const doneLabel = _(msg`Save`)
const noOneCanReply = !!threadgateAllowUISettings.find(
v => v.type === 'nobody',
)
return (
<Dialog.ScrollableInner
label={_(msg`Edit post interaction settings`)}
@@ -162,9 +165,7 @@ function DialogContent({
/>
<Selectable
label={_(msg`Nobody`)}
isSelected={
!!threadgateAllowUISettings.find(v => v.type === 'nobody')
}
isSelected={noOneCanReply}
onPress={() =>
onChangeThreadgateAllowUISettings([{type: 'nobody'}])
}
@@ -172,6 +173,8 @@ function DialogContent({
/>
</View>
{!noOneCanReply && (
<>
<Text style={[a.pt_sm, t.atoms.text_contrast_medium]}>
<Trans>Or combine these options:</Trans>
</Text>
@@ -180,14 +183,18 @@ function DialogContent({
<Selectable
label={_(msg`Mentioned users`)}
isSelected={
!!threadgateAllowUISettings.find(v => v.type === 'mention')
!!threadgateAllowUISettings.find(
v => v.type === 'mention',
)
}
onPress={() => onPressAudience({type: 'mention'})}
/>
<Selectable
label={_(msg`Followed users`)}
isSelected={
!!threadgateAllowUISettings.find(v => v.type === 'following')
!!threadgateAllowUISettings.find(
v => v.type === 'following',
)
}
onPress={() => onPressAudience({type: 'following'})}
/>
@@ -209,19 +216,21 @@ function DialogContent({
: // No loading states to avoid jumps for the common case (no lists)
null}
</View>
</>
)}
</View>
</View>
</View>
<Button
label={doneLabel}
label={_(msg`Save`)}
onPress={onSave}
onAccessibilityEscape={control.close}
color="primary"
size="medium"
variant="solid"
style={a.mt_xl}>
<ButtonText>{doneLabel}</ButtonText>
<ButtonText>{_(msg`Save`)}</ButtonText>
{isSaving && <ButtonIcon icon={Loader} position="right" />}
</Button>