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,56 +173,64 @@ function DialogContent({
/> />
</View> </View>
<Text style={[a.pt_sm, t.atoms.text_contrast_medium]}> {!noOneCanReply && (
<Trans>Or combine these options:</Trans> <>
</Text> <Text style={[a.pt_sm, t.atoms.text_contrast_medium]}>
<Trans>Or combine these options:</Trans>
</Text>
<View style={[a.gap_sm]}> <View style={[a.gap_sm]}>
<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'})} )
/> }
<Selectable onPress={() => onPressAudience({type: 'mention'})}
label={_(msg`Followed users`)} />
isSelected={ <Selectable
!!threadgateAllowUISettings.find(v => v.type === 'following') label={_(msg`Followed users`)}
} isSelected={
onPress={() => onPressAudience({type: 'following'})} !!threadgateAllowUISettings.find(
/> v => v.type === 'following',
{lists && lists.length > 0 )
? lists.map(list => ( }
<Selectable onPress={() => onPressAudience({type: 'following'})}
key={list.uri} />
label={_(msg`Users in "${list.name}"`)} {lists && lists.length > 0
isSelected={ ? lists.map(list => (
!!threadgateAllowUISettings.find( <Selectable
v => v.type === 'list' && v.list === list.uri, key={list.uri}
) label={_(msg`Users in "${list.name}"`)}
} isSelected={
onPress={() => !!threadgateAllowUISettings.find(
onPressAudience({type: 'list', list: list.uri}) v => v.type === 'list' && v.list === list.uri,
} )
/> }
)) onPress={() =>
: // No loading states to avoid jumps for the common case (no lists) onPressAudience({type: 'list', list: list.uri})
null} }
</View> />
))
: // No loading states to avoid jumps for the common case (no lists)
null}
</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>