From dcda5741b96dd14f4670f05e8af9881a15685e0d Mon Sep 17 00:00:00 2001 From: Benjamin Elo Date: Mon, 12 Aug 2019 05:49:44 -0700 Subject: [PATCH] Migrated LocationsButton from js to ts Summary: This isn't used anywher at the moment but I plan to add it in once we are finished with TS migration. Migrated this file from LocationsButton.js to LocationsButton.ts Reviewed By: jknoxville Differential Revision: D16730904 fbshipit-source-id: d357785c462b1f5f6017b4c00a2d2467d905b895 --- ...LocationsButton.js => LocationsButton.tsx} | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) rename src/chrome/{LocationsButton.js => LocationsButton.tsx} (67%) diff --git a/src/chrome/LocationsButton.js b/src/chrome/LocationsButton.tsx similarity index 67% rename from src/chrome/LocationsButton.js rename to src/chrome/LocationsButton.tsx index 22fb05594..f9df175fc 100644 --- a/src/chrome/LocationsButton.js +++ b/src/chrome/LocationsButton.tsx @@ -5,25 +5,29 @@ * @format */ -import {Button, Component, styled} from 'flipper'; +import {Button, styled} from 'flipper'; import {connect} from 'react-redux'; +import React, {Component} from 'react'; +import {State} from '../reducers'; -import type BaseDevice from '../devices/BaseDevice.tsx'; +import BaseDevice from '../devices/BaseDevice'; -type OwnProps = {| - locations: Array, - selectedLocation?: string, -|}; +type OwnProps = { + locations: Array; + selectedLocation?: string; +}; -type Props = {| - ...OwnProps, - selectedDevice?: BaseDevice, -|}; +type StateFromProps = { + selectedDevice: BaseDevice | null | undefined; +}; + +type DispatchFromProps = {}; const DropdownButton = styled(Button)({ fontSize: 11, }); +type Props = OwnProps & StateFromProps & DispatchFromProps; class LocationsButton extends Component { goToLocation = (location: string) => { const {selectedDevice} = this.props; @@ -51,7 +55,7 @@ class LocationsButton extends Component { } } -export default connect( +export default connect( ({connections: {selectedDevice}}) => ({ selectedDevice, }),