Some renames

Summary:
Some non-semantic changes. Mostly an earlier rename that was accidentally done only locally rather than across the codebase

Also support `.spec` test extension, which is more idiomatic Jest, since we don't use the `.node` and `.electron` distinction anymore anyway.

Reviewed By: jknoxville

Differential Revision: D22976438

fbshipit-source-id: f3abedb36cbac1e835295177117ccbca492a67a1
This commit is contained in:
Michel Weststrate
2020-08-20 13:31:17 -07:00
committed by Facebook GitHub Bot
parent bce3d48e71
commit 744fe01922
9 changed files with 54 additions and 61 deletions

View File

@@ -19,12 +19,10 @@ import {
} from 'flipper';
import React, {memo} from 'react';
import {FlipperClient, usePlugin, createState, useValue} from 'flipper-plugin';
type Id = number;
import {PluginClient, usePlugin, createState, useValue} from 'flipper-plugin';
type Row = {
id: Id;
id: number;
title: string;
url: string;
};
@@ -33,20 +31,8 @@ type Events = {
newRow: Row;
};
function renderSidebar(row: Row) {
return (
<Panel floating={false} heading={'Extras'}>
<ManagedDataInspector data={row} expandRoot={true} />
</Panel>
);
}
type PersistedState = {
[key: string]: Row;
};
export function plugin(client: FlipperClient<Events, {}>) {
const rows = createState<PersistedState>({}, {persist: 'rows'});
export function plugin(client: PluginClient<Events, {}>) {
const rows = createState<Record<string, Row>>({}, {persist: 'rows'});
const selectedID = createState<string | null>(null, {persist: 'selection'});
client.addMenuEntry(
@@ -90,8 +76,8 @@ export function plugin(client: FlipperClient<Events, {}>) {
export function Component() {
const instance = usePlugin(plugin);
const selectedID = useValue(instance.selectedID);
const rows = useValue(instance.rows);
const selectedID = useValue(instance.selectedID);
return (
<Container>
@@ -110,6 +96,14 @@ export function Component() {
);
}
function renderSidebar(row: Row) {
return (
<Panel floating={false} heading={'Extras'}>
<ManagedDataInspector data={row} expandRoot={true} />
</Panel>
);
}
type CardProps = {
onSelect: (id: number) => void;
selected: boolean;