Bloks debugger state deeplink from UIDebugger

Summary:
This adds a deeplink into bloks debugger from uidebugger for state events

changelog: UIDebugger - show bloks state & deeplink to bloks debugger

Reviewed By: lblasa

Differential Revision: D51349212

fbshipit-source-id: 6f7ca826228ce11a01fe5eb197f6ce092d2757a9
This commit is contained in:
Luke De Feo
2023-11-17 04:18:41 -08:00
committed by Facebook GitHub Bot
parent e225d9e1c3
commit dd9279bf7a
3 changed files with 47 additions and 0 deletions

View File

@@ -16,6 +16,7 @@ import {
Layout,
styled,
useLocalStorageState,
usePlugin,
} from 'flipper-plugin';
import React, {useState} from 'react';
import {
@@ -33,6 +34,9 @@ import {any} from 'lodash/fp';
import {InspectableColor} from '../../ClientTypes';
import {transformAny} from '../../utils/dataTransform';
import {SearchOutlined} from '@ant-design/icons';
import {plugin} from '../../index';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import {Glyph} from 'flipper';
type ModalData = {
data: unknown;
@@ -433,6 +437,7 @@ function AttributeValue({
name: string;
inspectable: Inspectable;
}) {
const instance = usePlugin(plugin);
switch (inspectable.type) {
case 'boolean':
return (
@@ -551,6 +556,39 @@ function AttributeValue({
</span>
</Button>
);
case 'pluginDeeplink':
return (
<Button
size="small"
onClick={() => {
instance.client.selectPlugin(
inspectable.pluginId,
inspectable.deeplinkPayload,
);
}}
style={{
height: 26,
boxSizing: 'border-box',
alignItems: 'center',
justifyContent: 'center',
}}
type="ghost">
<span
style={{
marginTop: 2,
fontFamily: 'monospace',
color: theme.textColorSecondary,
fontSize: 'small',
}}>
{inspectable.label}
</span>
<Glyph
style={{marginLeft: 8, marginBottom: 2}}
size={12}
name="share-external"
/>
</Button>
);
}
return null;
}