Address remaining PR review feedback for invite friends
- Pin "New Feature" tag color to lightPalette in the announcement NUX so it stays legible against the always-light header illustration in dark mode (APP-2349) - Replace useEffect+eslint-disable with useCallOnce for the invite:nux:presented metric in InviteFriendsAnnouncement - Close the drawer when tapping share-to-invite so the dialog doesn't open over a still-open drawer - Lift the FollowersPromoBanner out of the empty-state early-return in ProfileFollowers so it renders independently of the placeholder/list switch
This commit is contained in:
@@ -3,7 +3,9 @@ import {View} from 'react-native'
|
|||||||
import {Image} from 'expo-image'
|
import {Image} from 'expo-image'
|
||||||
import {Trans, useLingui} from '@lingui/react/macro'
|
import {Trans, useLingui} from '@lingui/react/macro'
|
||||||
|
|
||||||
|
import {useCallOnce} from '#/lib/once'
|
||||||
import {atoms as a, useTheme, web} from '#/alf'
|
import {atoms as a, useTheme, web} from '#/alf'
|
||||||
|
import {themes} from '#/alf/themes'
|
||||||
import {Button, ButtonText} from '#/components/Button'
|
import {Button, ButtonText} from '#/components/Button'
|
||||||
import * as Dialog from '#/components/Dialog'
|
import * as Dialog from '#/components/Dialog'
|
||||||
import {useNuxDialogContext} from '#/components/dialogs/nuxs'
|
import {useNuxDialogContext} from '#/components/dialogs/nuxs'
|
||||||
@@ -28,11 +30,12 @@ export function InviteFriendsAnnouncement() {
|
|||||||
|
|
||||||
Dialog.useAutoOpen(control)
|
Dialog.useAutoOpen(control)
|
||||||
|
|
||||||
useEffect(() => {
|
const firePresented = useCallOnce(() => {
|
||||||
ax.metric('invite:nux:presented', {})
|
ax.metric('invite:nux:presented', {})
|
||||||
// Fire once on mount - the NUX has a single lifecycle per session.
|
})
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
useEffect(() => {
|
||||||
}, [])
|
firePresented()
|
||||||
|
}, [firePresented])
|
||||||
|
|
||||||
const onClose = useCallback(() => {
|
const onClose = useCallback(() => {
|
||||||
nuxDialogs.dismissActiveNux()
|
nuxDialogs.dismissActiveNux()
|
||||||
@@ -87,10 +90,16 @@ export function InviteFriendsAnnouncement() {
|
|||||||
a.align_center,
|
a.align_center,
|
||||||
{top: 0, left: 0, right: 0, paddingTop: IS_WEB ? 24 : 20},
|
{top: 0, left: 0, right: 0, paddingTop: IS_WEB ? 24 : 20},
|
||||||
]}>
|
]}>
|
||||||
|
{/* Pinned to the light palette: the header illustration has a
|
||||||
|
fixed light background, so the tag must stay dark in any
|
||||||
|
theme to remain legible. */}
|
||||||
<View style={[a.flex_row, a.align_center, a.gap_xs]}>
|
<View style={[a.flex_row, a.align_center, a.gap_xs]}>
|
||||||
<SparkleIcon fill={t.palette.primary_800} size="sm" />
|
<SparkleIcon fill={themes.lightPalette.primary_800} size="sm" />
|
||||||
<Text
|
<Text
|
||||||
style={[a.font_semi_bold, {color: t.palette.primary_800}]}>
|
style={[
|
||||||
|
a.font_semi_bold,
|
||||||
|
{color: themes.lightPalette.primary_800},
|
||||||
|
]}>
|
||||||
<Trans>New Feature</Trans>
|
<Trans>New Feature</Trans>
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -184,7 +184,6 @@ export function ProfileFollowers({name}: {name: string}) {
|
|||||||
!isFollowersLoading &&
|
!isFollowersLoading &&
|
||||||
!isError
|
!isError
|
||||||
|
|
||||||
if (followers.length < 1) {
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{showFollowersPromo && (
|
{showFollowersPromo && (
|
||||||
@@ -193,6 +192,7 @@ export function ProfileFollowers({name}: {name: string}) {
|
|||||||
onDismiss={() => setFollowersPromoDismissed(true)}
|
onDismiss={() => setFollowersPromoDismissed(true)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
{followers.length < 1 ? (
|
||||||
<ListMaybePlaceholder
|
<ListMaybePlaceholder
|
||||||
isLoading={isDidLoading || isFollowersLoading}
|
isLoading={isDidLoading || isFollowersLoading}
|
||||||
isError={isError}
|
isError={isError}
|
||||||
@@ -215,11 +215,7 @@ export function ProfileFollowers({name}: {name: string}) {
|
|||||||
onPress: () => navigation.goBack(),
|
onPress: () => navigation.goBack(),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</>
|
) : (
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<List
|
<List
|
||||||
data={followers}
|
data={followers}
|
||||||
renderItem={renderItemWithContext}
|
renderItem={renderItemWithContext}
|
||||||
@@ -242,5 +238,7 @@ export function ProfileFollowers({name}: {name: string}) {
|
|||||||
windowSize={11}
|
windowSize={11}
|
||||||
sideBorders={false}
|
sideBorders={false}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -331,6 +331,7 @@ let DrawerContent = ({}: React.PropsWithoutRef<{}>): React.ReactNode => {
|
|||||||
IS_NATIVE
|
IS_NATIVE
|
||||||
? () => {
|
? () => {
|
||||||
ax.metric('invite:dialog:open', {logContext: 'Drawer'})
|
ax.metric('invite:dialog:open', {logContext: 'Drawer'})
|
||||||
|
setDrawerOpen(false)
|
||||||
inviteFriendsControl.open()
|
inviteFriendsControl.open()
|
||||||
}
|
}
|
||||||
: undefined
|
: undefined
|
||||||
|
|||||||
Reference in New Issue
Block a user