Update context menu for new ant design api

Summary:
Mostly mechanical change from jsx to object based api. However some changes:

1. Managed to get rid of UIDebugger context menu item. its now possible to listen to when any context menu is clicked

2. The construction code is cleaner. no more mutable arrary and pushing, its just a big spliced literal

3. Had to change how the ide function worked. It is  dynamic and used react query hook to update the number of items. Added a callback to recreate this behaviour.

Reviewed By: aigoncharov

Differential Revision: D48910165

fbshipit-source-id: 9a71f5ecd302e6ff72194f83a13839f78e9b0796
This commit is contained in:
Luke De Feo
2023-09-04 02:19:53 -07:00
committed by Facebook GitHub Bot
parent 32ef1bd565
commit b336ed38fa
6 changed files with 160 additions and 197 deletions

View File

@@ -7,16 +7,21 @@
* @format
*/
import React from 'react';
import {MenuProps} from 'antd';
import {ClientNode} from '../../ClientTypes';
export async function prefetchSourceFileLocation(_: ClientNode) {}
export function IDEContextMenuItems(_: {node: ClientNode}) {
return <></>;
type MenuItems = MenuProps['items'];
export function ideContextMenuItems(
_node: ClientNode,
_onResultsUpdated: () => void,
): MenuItems {
return [];
}
export function BigGrepContextMenuItems(_: {node: ClientNode}) {
return <></>;
export function bigGrepContextMenuItems(_: ClientNode): MenuItems {
return [];
}