Page MenuHomePhabricator

D13077.id43483.diff
No OneTemporary

D13077.id43483.diff

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<typeof nuxTip>;
+export type NUXTip = $Values<typeof nuxTip>;
+
+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<ParamList: ParamListBase = ParamListBase> =
{
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<Route: NUXTipRouteNames> = {
+ +navigation: AppNavigationProp<Route>,
+ +route: NavigationRoute<Route>,
};
const margin: number = 20;
@@ -111,11 +114,11 @@
};
}
-function createNUXTipsOverlay(
- ButtonComponent: React.ComponentType<NUXTipsOverlayProps>,
+function createNUXTipsOverlay<Route: NUXTipRouteNames>(
+ ButtonComponent: React.ComponentType<NUXTipsOverlayProps<Route>>,
tipText: string,
-): React.ComponentType<NUXTipsOverlayProps> {
- function NUXTipsOverlay(props: NUXTipsOverlayProps) {
+): React.ComponentType<NUXTipsOverlayProps<Route>> {
+ function NUXTipsOverlay(props: NUXTipsOverlayProps<Route>) {
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<Route>) {
const overlayContext = React.useContext(OverlayContext);
invariant(overlayContext, 'NUXTipsOverlay should have OverlayContext');
@@ -373,7 +376,7 @@
return shouldRenderScreenContent ? <NUXTipsOverlay {...props} /> : null;
}
- return React.memo<NUXTipsOverlayProps>(NUXTipsOverlayWrapper);
+ return React.memo<NUXTipsOverlayProps<Route>>(NUXTipsOverlayWrapper);
}
export { createNUXTipsOverlay };

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 25, 6:54 AM (10 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2701870
Default Alt Text
D13077.id43483.diff (5 KB)

Event Timeline