mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Switch to a more visually obvious button for the threadgate (#4139)

* Switch to a more visually obvious button for the threadgate

* Move threadgate button into the keyboard-sticky area

* Fix keyboard offset

authored by

Paul Frazee and committed by
GitHub
cb4045d2 6cc040a9

+40 -47
+1
assets/icons/earth_stroke2_corner0_rounded.svg
··· 1 + <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path fill="#000" fill-rule="evenodd" d="M4.4 9.493C4.14 10.28 4 11.124 4 12a8 8 0 1 0 10.899-7.459l-.953 3.81a1 1 0 0 1-.726.727l-3.444.866-.772 1.533a1 1 0 0 1-1.493.35L4.4 9.493Zm.883-1.84L7.756 9.51l.44-.874a1 1 0 0 1 .649-.52l3.306-.832.807-3.227a7.993 7.993 0 0 0-7.676 3.597ZM2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Zm8.43.162a1 1 0 0 1 .77-.29l1.89.121a1 1 0 0 1 .494.168l2.869 1.928a1 1 0 0 1 .336 1.277l-.973 1.946a1 1 0 0 1-.894.553h-2.92a1 1 0 0 1-.831-.445L9.225 14.5a1 1 0 0 1 .126-1.262l1.08-1.076Zm.915 1.913.177-.177 1.171.074 1.914 1.286-.303.607h-1.766l-1.194-1.79Z" clip-rule="evenodd"/></svg>
+4
src/components/icons/Globe.tsx
··· 3 3 export const Globe_Stroke2_Corner0_Rounded = createSinglePathSVG({ 4 4 path: 'M4.062 11h2.961c.103-2.204.545-4.218 1.235-5.77.06-.136.123-.269.188-.399A8.007 8.007 0 0 0 4.062 11ZM12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2Zm0 2c-.227 0-.518.1-.868.432-.354.337-.719.872-1.047 1.61-.561 1.263-.958 2.991-1.06 4.958h5.95c-.102-1.967-.499-3.695-1.06-4.958-.328-.738-.693-1.273-1.047-1.61C12.518 4.099 12.227 4 12 4Zm4.977 7c-.103-2.204-.545-4.218-1.235-5.77a9.78 9.78 0 0 0-.188-.399A8.006 8.006 0 0 1 19.938 11h-2.961Zm-2.003 2H9.026c.101 1.966.498 3.695 1.06 4.958.327.738.692 1.273 1.046 1.61.35.333.641.432.868.432.227 0 .518-.1.868-.432.354-.337.719-.872 1.047-1.61.561-1.263.958-2.991 1.06-4.958Zm.58 6.169c.065-.13.128-.263.188-.399.69-1.552 1.132-3.566 1.235-5.77h2.961a8.006 8.006 0 0 1-4.384 6.169Zm-7.108 0a9.877 9.877 0 0 1-.188-.399c-.69-1.552-1.132-3.566-1.235-5.77H4.062a8.006 8.006 0 0 0 4.384 6.169Z', 5 5 }) 6 + 7 + export const Earth_Stroke2_Corner0_Rounded = createSinglePathSVG({ 8 + path: 'M4.4 9.493C4.14 10.28 4 11.124 4 12a8 8 0 1 0 10.899-7.459l-.953 3.81a1 1 0 0 1-.726.727l-3.444.866-.772 1.533a1 1 0 0 1-1.493.35L4.4 9.493Zm.883-1.84L7.756 9.51l.44-.874a1 1 0 0 1 .649-.52l3.306-.832.807-3.227a7.993 7.993 0 0 0-7.676 3.597ZM2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Zm8.43.162a1 1 0 0 1 .77-.29l1.89.121a1 1 0 0 1 .494.168l2.869 1.928a1 1 0 0 1 .336 1.277l-.973 1.946a1 1 0 0 1-.894.553h-2.92a1 1 0 0 1-.831-.445L9.225 14.5a1 1 0 0 1 .126-1.262l1.08-1.076Zm.915 1.913.177-.177 1.171.074 1.914 1.286-.303.607h-1.766l-1.194-1.79Z', 9 + })
+4 -7
src/view/com/composer/Composer.tsx
··· 380 380 testID="composePostView" 381 381 behavior="padding" 382 382 style={s.flex1} 383 - keyboardVerticalOffset={60}> 383 + keyboardVerticalOffset={replyTo ? 60 : isAndroid ? 120 : 100}> 384 384 <View style={[s.flex1, viewStyles]} aria-modal accessibilityViewIsModal> 385 385 <View style={[styles.topbar, isDesktop && styles.topbarDesktop]}> 386 386 <TouchableOpacity ··· 411 411 onChange={setLabels} 412 412 hasMedia={hasMedia} 413 413 /> 414 - {replyTo ? null : ( 415 - <ThreadgateBtn 416 - threadgate={threadgate} 417 - onChange={setThreadgate} 418 - /> 419 - )} 420 414 {canPost ? ( 421 415 <TouchableOpacity 422 416 testID="composerPublishBtn" ··· 547 541 </KeyboardAvoidingView> 548 542 <KeyboardStickyView 549 543 offset={{closed: isIOS ? -insets.bottom : 0, opened: 0}}> 544 + {replyTo ? null : ( 545 + <ThreadgateBtn threadgate={threadgate} onChange={setThreadgate} /> 546 + )} 550 547 <View style={[pal.border, styles.bottomBar]}> 551 548 <View style={[a.flex_row, a.align_center, a.gap_xs]}> 552 549 <SelectPhotoBtn gallery={gallery} disabled={!canSelectImages} />
+31 -40
src/view/com/composer/threadgate/ThreadgateBtn.tsx
··· 1 1 import React from 'react' 2 - import {TouchableOpacity, StyleSheet, Keyboard} from 'react-native' 3 - import { 4 - FontAwesomeIcon, 5 - FontAwesomeIconStyle, 6 - } from '@fortawesome/react-native-fontawesome' 7 - import {usePalette} from 'lib/hooks/usePalette' 8 - import {useAnalytics} from 'lib/analytics/analytics' 9 - import {HITSLOP_10} from 'lib/constants' 10 - import {useLingui} from '@lingui/react' 2 + import {Keyboard, View} from 'react-native' 11 3 import {msg} from '@lingui/macro' 4 + import {useLingui} from '@lingui/react' 5 + 6 + import {isNative} from '#/platform/detection' 12 7 import {useModalControls} from '#/state/modals' 13 8 import {ThreadgateSetting} from '#/state/queries/threadgate' 14 - import {isNative} from '#/platform/detection' 9 + import {useAnalytics} from 'lib/analytics/analytics' 10 + import {atoms as a} from '#/alf' 11 + import {Button, ButtonIcon, ButtonText} from '#/components/Button' 12 + import {CircleBanSign_Stroke2_Corner0_Rounded as CircleBanSign} from '#/components/icons/CircleBanSign' 13 + import {Earth_Stroke2_Corner0_Rounded as Earth} from '#/components/icons/Globe' 14 + import {Group3_Stroke2_Corner0_Rounded as Group} from '#/components/icons/Group' 15 15 16 16 export function ThreadgateBtn({ 17 17 threadgate, ··· 20 20 threadgate: ThreadgateSetting[] 21 21 onChange: (v: ThreadgateSetting[]) => void 22 22 }) { 23 - const pal = usePalette('default') 24 23 const {track} = useAnalytics() 25 24 const {_} = useLingui() 26 25 const {openModal} = useModalControls() ··· 37 36 }) 38 37 } 39 38 39 + const isEverybody = threadgate.length === 0 40 + const isNobody = !!threadgate.find(gate => gate.type === 'nobody') 41 + const label = isEverybody 42 + ? _(msg`Everybody can reply`) 43 + : isNobody 44 + ? _(msg`Nobody can reply`) 45 + : _(msg`Some people can reply`) 46 + 40 47 return ( 41 - <TouchableOpacity 42 - testID="openReplyGateButton" 43 - onPress={onPress} 44 - style={styles.button} 45 - hitSlop={HITSLOP_10} 46 - accessibilityRole="button" 47 - accessibilityLabel={_(msg`Who can reply`)} 48 - accessibilityHint=""> 49 - <FontAwesomeIcon 50 - icon={['far', 'comments']} 51 - style={pal.link as FontAwesomeIconStyle} 52 - size={24} 53 - /> 54 - {threadgate.length ? ( 55 - <FontAwesomeIcon 56 - icon="check" 57 - size={16} 58 - style={pal.link as FontAwesomeIconStyle} 48 + <View style={[a.flex_row, a.pb_sm, a.px_md]}> 49 + <Button 50 + variant="solid" 51 + color="secondary" 52 + size="small" 53 + testID="openReplyGateButton" 54 + onPress={onPress} 55 + label={label}> 56 + <ButtonIcon 57 + icon={isEverybody ? Earth : isNobody ? CircleBanSign : Group} 59 58 /> 60 - ) : null} 61 - </TouchableOpacity> 59 + <ButtonText>{label}</ButtonText> 60 + </Button> 61 + </View> 62 62 ) 63 63 } 64 - 65 - const styles = StyleSheet.create({ 66 - button: { 67 - flexDirection: 'row', 68 - alignItems: 'center', 69 - paddingHorizontal: 6, 70 - gap: 4, 71 - }, 72 - })