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