diff --git a/native/components/nux-tips-context.react.js b/native/components/nux-tips-context.react.js --- a/native/components/nux-tips-context.react.js +++ b/native/components/nux-tips-context.react.js @@ -4,20 +4,45 @@ import { values } from 'lib/utils/objects.js'; +import type { NUXTipRouteNames } from '../navigation/route-names.js'; + const nuxTip = Object.freeze({ - MUTED: 'muted', COMMUNITY_DRAWER: 'community_drawer', + MUTED: 'muted', }); -type NUXTip = $Values; +export type NUXTip = $Values; + +type NUXTipParams = { + +nextTip: ?NUXTip, + +tooltipLocation: 'below' | 'above', + +nextRouteName: ?NUXTipRouteNames, +}; + +const nuxTipParams: { [NUXTip]: NUXTipParams } = { + [nuxTip.COMMUNITY_DRAWER]: { + nextTip: nuxTip.MUTED, + tooltipLocation: 'below', + nextRouteName: undefined, //TODO: update to the next screens name + }, + [nuxTip.MUTED]: { + nextTip: undefined, + nextRouteName: undefined, + tooltipLocation: 'below', + }, +}; + +function getNUXTipParams(currentTipKey: NUXTip): NUXTipParams { + return nuxTipParams[currentTipKey]; +} type TipProps = { - +x: ?number, - +y: ?number, - +width: ?number, - +height: ?number, - +pageX: ?number, - +pageY: ?number, + +x: number, + +y: number, + +width: number, + +height: number, + +pageX: number, + +pageY: number, }; export type NUXTipsContextType = { @@ -69,4 +94,4 @@ ); } -export { NUXTipsContext, NUXTipsContextProvider, nuxTip }; +export { NUXTipsContext, NUXTipsContextProvider, nuxTip, getNUXTipParams }; diff --git a/native/navigation/overlay-navigator.react.js b/native/navigation/overlay-navigator.react.js --- a/native/navigation/overlay-navigator.react.js +++ b/native/navigation/overlay-navigator.react.js @@ -39,11 +39,11 @@ import { scrollBlockingModals, TabNavigatorRouteName, - NUXTipsOverlayRouteName, + CommunityDrawerTipRouteName, } from './route-names.js'; import { isMessageTooltipKey } from '../chat/utils.js'; -const newReanimatedRoutes = new Set([NUXTipsOverlayRouteName]); +const newReanimatedRoutes = new Set([CommunityDrawerTipRouteName]); export type OverlayNavigationHelpers = { diff --git a/native/navigation/route-names.js b/native/navigation/route-names.js --- a/native/navigation/route-names.js +++ b/native/navigation/route-names.js @@ -167,7 +167,7 @@ export const TagFarcasterChannelByNameRouteName = 'TagFarcasterChannelByName'; export const ThreadSettingsNotificationsRouteName = 'ThreadSettingsNotifications'; -export const NUXTipsOverlayRouteName = 'NUXTipsOverlay'; +export const CommunityDrawerTipRouteName = 'CommunityDrawerTip'; export type RootParamList = { +LoggedOutModal: void, @@ -197,6 +197,8 @@ +RestoreSIWEBackup: RestoreSIWEBackupParams, }; +export type NUXTipRouteNames = typeof CommunityDrawerTipRouteName; + export type MessageTooltipRouteNames = | typeof RobotextMessageTooltipModalRouteName | typeof MultimediaMessageTooltipModalRouteName @@ -224,7 +226,7 @@ +ThreadAvatarCameraModal: ThreadAvatarCameraModalParams, +VideoPlaybackModal: VideoPlaybackModalParams, +TogglePinModal: TogglePinModalParams, - +NUXTipsOverlay: NUXTipsOverlayParams, + +CommunityDrawerTip: NUXTipsOverlayParams, ...TooltipModalParamList, }; diff --git a/native/tooltip/nux-tips-overlay.react.js b/native/tooltip/nux-tips-overlay.react.js --- a/native/tooltip/nux-tips-overlay.react.js +++ b/native/tooltip/nux-tips-overlay.react.js @@ -14,7 +14,10 @@ import type { AppNavigationProp } from '../navigation/app-navigator.react.js'; import { OverlayContext } from '../navigation/overlay-context.js'; -import type { NavigationRoute } from '../navigation/route-names.js'; +import type { + NavigationRoute, + NUXTipRouteNames, +} from '../navigation/route-names.js'; import { useSelector } from '../redux/redux-utils.js'; import { useStyles } from '../themes/colors.js'; import type { @@ -91,9 +94,9 @@ +tooltipLocation: 'above' | 'below', }; -export type NUXTipsOverlayProps = { - +navigation: AppNavigationProp<'NUXTipsOverlay'>, - +route: NavigationRoute<'NUXTipsOverlay'>, +export type NUXTipsOverlayProps = { + +navigation: AppNavigationProp, + +route: NavigationRoute, }; const margin: number = 20; @@ -111,11 +114,11 @@ }; } -function createNUXTipsOverlay( - ButtonComponent: React.ComponentType, +function createNUXTipsOverlay( + ButtonComponent: React.ComponentType>, tipText: string, -): React.ComponentType { - function NUXTipsOverlay(props: NUXTipsOverlayProps) { +): React.ComponentType> { + function NUXTipsOverlay(props: NUXTipsOverlayProps) { const dimensions = useSelector(state => state.dimensions); const overlayContext = React.useContext(OverlayContext); invariant(overlayContext, 'NUXTipsOverlay should have OverlayContext'); @@ -364,7 +367,7 @@ ); } - function NUXTipsOverlayWrapper(props: NUXTipsOverlayProps) { + function NUXTipsOverlayWrapper(props: NUXTipsOverlayProps) { const overlayContext = React.useContext(OverlayContext); invariant(overlayContext, 'NUXTipsOverlay should have OverlayContext'); @@ -373,7 +376,7 @@ return shouldRenderScreenContent ? : null; } - return React.memo(NUXTipsOverlayWrapper); + return React.memo>(NUXTipsOverlayWrapper); } export { createNUXTipsOverlay };