[PWI] Misc (#1977)

* PostDropdownBtn

* Hide reply prompt

* Hide FABs
zio/stable
Eric Bailey 2023-11-22 16:53:11 -06:00 committed by GitHub
parent 08333002cc
commit 95f8bd8ddb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 99 additions and 71 deletions

View File

@ -41,7 +41,7 @@ export function FeedPage({
renderEmptyState: () => JSX.Element renderEmptyState: () => JSX.Element
renderEndOfFeed?: () => JSX.Element renderEndOfFeed?: () => JSX.Element
}) { }) {
const {isSandbox} = useSession() const {isSandbox, hasSession} = useSession()
const pal = usePalette('default') const pal = usePalette('default')
const {_} = useLingui() const {_} = useLingui()
const {isDesktop} = useWebMediaQueries() const {isDesktop} = useWebMediaQueries()
@ -123,24 +123,35 @@ export function FeedPage({
} }
onPress={emitSoftReset} onPress={emitSoftReset}
/> />
<TextLink {hasSession && (
type="title-lg" <TextLink
href="/settings/home-feed" type="title-lg"
style={{fontWeight: 'bold'}} href="/settings/home-feed"
accessibilityLabel={_(msg`Feed Preferences`)} style={{fontWeight: 'bold'}}
accessibilityHint="" accessibilityLabel={_(msg`Feed Preferences`)}
text={ accessibilityHint=""
<FontAwesomeIcon text={
icon="sliders" <FontAwesomeIcon
style={pal.textLight as FontAwesomeIconStyle} icon="sliders"
/> style={pal.textLight as FontAwesomeIconStyle}
} />
/> }
/>
)}
</View> </View>
) )
} }
return <></> return <></>
}, [isDesktop, pal.view, pal.text, pal.textLight, hasNew, _, isSandbox]) }, [
isDesktop,
pal.view,
pal.text,
pal.textLight,
hasNew,
_,
isSandbox,
hasSession,
])
return ( return (
<View testID={testID} style={s.h100pct}> <View testID={testID} style={s.h100pct}>
@ -166,14 +177,17 @@ export function FeedPage({
showIndicator={hasNew} showIndicator={hasNew}
/> />
)} )}
<FAB
testID="composeFAB" {hasSession && (
onPress={onPressCompose} <FAB
icon={<ComposeIcon2 strokeWidth={1.5} size={29} style={s.white} />} testID="composeFAB"
accessibilityRole="button" onPress={onPressCompose}
accessibilityLabel={_(msg`New post`)} icon={<ComposeIcon2 strokeWidth={1.5} size={29} style={s.white} />}
accessibilityHint="" accessibilityRole="button"
/> accessibilityLabel={_(msg`New post`)}
accessibilityHint=""
/>
)}
</View> </View>
) )
} }

View File

@ -38,6 +38,7 @@ import {
UsePreferencesQueryResponse, UsePreferencesQueryResponse,
usePreferencesQuery, usePreferencesQuery,
} from '#/state/queries/preferences' } from '#/state/queries/preferences'
import {useSession} from '#/state/session'
// const MAINTAIN_VISIBLE_CONTENT_POSITION = {minIndexForVisible: 2} TODO // const MAINTAIN_VISIBLE_CONTENT_POSITION = {minIndexForVisible: 2} TODO
@ -130,6 +131,7 @@ function PostThreadLoaded({
onRefresh: () => void onRefresh: () => void
onPressReply: () => void onPressReply: () => void
}) { }) {
const {hasSession} = useSession()
const {_} = useLingui() const {_} = useLingui()
const pal = usePalette('default') const pal = usePalette('default')
const {isTablet, isDesktop} = useWebMediaQueries() const {isTablet, isDesktop} = useWebMediaQueries()
@ -223,7 +225,7 @@ function PostThreadLoaded({
<ActivityIndicator /> <ActivityIndicator />
</View> </View>
) )
} else if (item === REPLY_PROMPT) { } else if (item === REPLY_PROMPT && hasSession) {
return ( return (
<View> <View>
{isDesktop && <ComposePrompt onPressCompose={onPressReply} />} {isDesktop && <ComposePrompt onPressCompose={onPressReply} />}
@ -305,6 +307,7 @@ function PostThreadLoaded({
return null return null
}, },
[ [
hasSession,
isTablet, isTablet,
isDesktop, isDesktop,
onPressReply, onPressReply,

View File

@ -35,7 +35,7 @@ export function PostDropdownBtn({
record: AppBskyFeedPost.Record record: AppBskyFeedPost.Record
style?: StyleProp<ViewStyle> style?: StyleProp<ViewStyle>
}) { }) {
const {currentAccount} = useSession() const {hasSession, currentAccount} = useSession()
const theme = useTheme() const theme = useTheme()
const {_} = useLingui() const {_} = useLingui()
const defaultCtrlColor = theme.palette.default.postCtrl const defaultCtrlColor = theme.palette.default.postCtrl
@ -136,10 +136,10 @@ export function PostDropdownBtn({
web: 'share', web: 'share',
}, },
}, },
{ hasSession && {
label: 'separator', label: 'separator',
}, },
{ hasSession && {
label: isThreadMuted ? _(msg`Unmute thread`) : _(msg`Mute thread`), label: isThreadMuted ? _(msg`Unmute thread`) : _(msg`Mute thread`),
onPress() { onPress() {
onToggleThreadMute() onToggleThreadMute()
@ -153,27 +153,28 @@ export function PostDropdownBtn({
web: 'comment-slash', web: 'comment-slash',
}, },
}, },
{ hasSession && {
label: 'separator', label: 'separator',
}, },
!isAuthor && { !isAuthor &&
label: _(msg`Report post`), hasSession && {
onPress() { label: _(msg`Report post`),
openModal({ onPress() {
name: 'report', openModal({
uri: post.uri, name: 'report',
cid: post.cid, uri: post.uri,
}) cid: post.cid,
}, })
testID: 'postDropdownReportBtn', },
icon: { testID: 'postDropdownReportBtn',
ios: { icon: {
name: 'exclamationmark.triangle', ios: {
name: 'exclamationmark.triangle',
},
android: 'ic_menu_report_image',
web: 'circle-exclamation',
}, },
android: 'ic_menu_report_image',
web: 'circle-exclamation',
}, },
},
isAuthor && { isAuthor && {
label: 'separator', label: 'separator',
}, },

View File

@ -504,14 +504,16 @@ export const FeedsScreen = withAuthRequired(
desktopFixedHeight desktopFixedHeight
/> />
<FAB {hasSession && (
testID="composeFAB" <FAB
onPress={onPressCompose} testID="composeFAB"
icon={<ComposeIcon2 strokeWidth={1.5} size={29} style={s.white} />} onPress={onPressCompose}
accessibilityRole="button" icon={<ComposeIcon2 strokeWidth={1.5} size={29} style={s.white} />}
accessibilityLabel={_(msg`New post`)} accessibilityRole="button"
accessibilityHint="" accessibilityLabel={_(msg`New post`)}
/> accessibilityHint=""
/>
)}
</View> </View>
) )
}, },

View File

@ -131,7 +131,7 @@ function ProfileScreenLoaded({
hideBackButton: boolean hideBackButton: boolean
}) { }) {
const profile = useProfileShadow(profileUnshadowed) const profile = useProfileShadow(profileUnshadowed)
const {currentAccount} = useSession() const {hasSession, currentAccount} = useSession()
const setMinimalShellMode = useSetMinimalShellMode() const setMinimalShellMode = useSetMinimalShellMode()
const {openComposer} = useComposerControls() const {openComposer} = useComposerControls()
const {screen, track} = useAnalytics() const {screen, track} = useAnalytics()
@ -360,14 +360,16 @@ function ProfileScreenLoaded({
) )
: null} : null}
</PagerWithHeader> </PagerWithHeader>
<FAB {hasSession && (
testID="composeFAB" <FAB
onPress={onPressCompose} testID="composeFAB"
icon={<ComposeIcon2 strokeWidth={1.5} size={29} style={s.white} />} onPress={onPressCompose}
accessibilityRole="button" icon={<ComposeIcon2 strokeWidth={1.5} size={29} style={s.white} />}
accessibilityLabel={_(msg`New post`)} accessibilityRole="button"
accessibilityHint="" accessibilityLabel={_(msg`New post`)}
/> accessibilityHint=""
/>
)}
</ScreenHider> </ScreenHider>
) )
} }

View File

@ -423,16 +423,22 @@ export function ProfileFeedScreenInner({
/> />
)} )}
</PagerWithHeader> </PagerWithHeader>
<FAB {hasSession && (
testID="composeFAB" <FAB
onPress={() => openComposer({})} testID="composeFAB"
icon={ onPress={() => openComposer({})}
<ComposeIcon2 strokeWidth={1.5} size={29} style={{color: 'white'}} /> icon={
} <ComposeIcon2
accessibilityRole="button" strokeWidth={1.5}
accessibilityLabel={_(msg`New post`)} size={29}
accessibilityHint="" style={{color: 'white'}}
/> />
}
accessibilityRole="button"
accessibilityLabel={_(msg`New post`)}
accessibilityHint=""
/>
)}
</View> </View>
) )
} }