/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @format */ import React, {useState} from 'react'; import {plugin} from '../index'; import { Button, Input, Modal, Tooltip, Dropdown, Menu, Typography, TreeSelect, Space, } from 'antd'; import { MoreOutlined, PauseCircleOutlined, PlayCircleOutlined, } from '@ant-design/icons'; import {usePlugin, useValue, Layout} from 'flipper-plugin'; import {FrameworkEventType} from '../types'; export const Controls: React.FC = () => { const instance = usePlugin(plugin); const searchTerm = useValue(instance.uiState.searchTerm); const isPaused = useValue(instance.uiState.isPaused); const frameworkEventMonitoring: Map = useValue( instance.uiState.frameworkEventMonitoring, ); const onSetEventMonitored: ( eventType: FrameworkEventType, monitored: boolean, ) => void = (eventType: FrameworkEventType, monitored: boolean) => { instance.uiState.frameworkEventMonitoring.update((draft) => draft.set(eventType, monitored), ); }; return ( instance.uiState.searchTerm.set(e.target.value)} /> {frameworkEventMonitoring.size > 0 && ( )} ); }; function MoreOptionsMenu({ onSetEventMonitored, frameworkEventTypes, }: { onSetEventMonitored: ( eventType: FrameworkEventType, monitored: boolean, ) => void; frameworkEventTypes: [FrameworkEventType, boolean][]; }) { const [showFrameworkEventsModal, setShowFrameworkEventsModal] = useState(false); const moreOptionsMenu = ( { setShowFrameworkEventsModal(true); }}> Framework event monitoring ); return ( <>