From 651c9db5c4b55f0f171c8c1c267cc51570b729db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20B=C3=BCchele?= Date: Fri, 23 Aug 2019 07:17:15 -0700 Subject: [PATCH] seamammals plugin Summary: _typescript_ Reviewed By: passy Differential Revision: D16936889 fbshipit-source-id: 68ec6a14e1ee4517d76816b4156f0eebaca27ab4 --- .../seamammals/{index.js => index.tsx} | 39 +++++++++---------- src/plugins/seamammals/package.json | 2 +- 2 files changed, 20 insertions(+), 21 deletions(-) rename src/plugins/seamammals/{index.js => index.tsx} (86%) diff --git a/src/plugins/seamammals/index.js b/src/plugins/seamammals/index.tsx similarity index 86% rename from src/plugins/seamammals/index.js rename to src/plugins/seamammals/index.tsx index 26dcd49e8..52728e73c 100644 --- a/src/plugins/seamammals/index.js +++ b/src/plugins/seamammals/index.tsx @@ -3,7 +3,6 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * @format - * @flow strict-local */ import { @@ -22,9 +21,9 @@ import React from 'react'; type Id = number; type Row = { - id: Id, - title: string, - url: string, + id: Id; + title: string; + url: string; }; function renderSidebar(row: Row) { @@ -36,33 +35,32 @@ function renderSidebar(row: Row) { } type State = { - selectedID: ?string, + selectedID: string | null; }; type PersistedState = { - [key: string]: Row, + [key: string]: Row; }; export default class SeaMammals extends FlipperPlugin< State, - void, - PersistedState, + any, + PersistedState > { static defaultPersistedState = {}; - static persistedStateReducer = ( + static persistedStateReducer( persistedState: PersistedState, method: string, payload: Row, - ) => { + ) { if (method === 'newRow') { - return { - ...persistedState, + return Object.assign({}, persistedState, { [payload.id]: payload, - }; + }); } return persistedState; - }; + } static Container = styled(FlexRow)({ backgroundColor: colors.macOSTitleBarBackgroundBlur, @@ -100,12 +98,13 @@ export default class SeaMammals extends FlipperPlugin< } } -class Card extends React.Component<{ - ...Row, - onSelect: () => void, - selected: boolean, -}> { - static Container = styled(FlexColumn)(props => ({ +class Card extends React.Component< + { + onSelect: () => void; + selected: boolean; + } & Row +> { + static Container = styled(FlexColumn)((props: {selected?: boolean}) => ({ margin: 10, borderRadius: 5, border: '2px solid black', diff --git a/src/plugins/seamammals/package.json b/src/plugins/seamammals/package.json index d6380299e..1aac0cbb0 100644 --- a/src/plugins/seamammals/package.json +++ b/src/plugins/seamammals/package.json @@ -1,7 +1,7 @@ { "name": "sea-mammals", "version": "1.0.0", - "main": "index.js", + "main": "index.tsx", "license": "MIT", "icon": "apps", "title": "Sea Mammals",