Moved NavPlugin types into seperate file

Summary: Moved Flow types into their own file. I will be adding more types as part of the auto complete for the navigation bar and this is to keep the code more organized.

Reviewed By: danielbuechele

Differential Revision: D16540279

fbshipit-source-id: d69ac0d05f91e9d92fcda37325c791ddc83a52c9
This commit is contained in:
Benjamin Elo
2019-07-29 03:44:54 -07:00
committed by Facebook Github Bot
parent 84f9a1d8b5
commit 292efb0bb3
8 changed files with 39 additions and 25 deletions

View File

@@ -8,7 +8,7 @@
import NavigationPlugin from '../'; import NavigationPlugin from '../';
import type {PersistedState} from '../'; import type {PersistedState} from '../flow-types';
function constructPersistedStateMock(): PersistedState { function constructPersistedStateMock(): PersistedState {
return { return {

View File

@@ -8,7 +8,7 @@
import {DetailSidebar, FlexCenter, styled, colors} from 'flipper'; import {DetailSidebar, FlexCenter, styled, colors} from 'flipper';
import type {Bookmark} from '../'; import type {Bookmark} from '../flow-types';
type Props = {| type Props = {|
bookmarks: Map<string, Bookmark>, bookmarks: Map<string, Bookmark>,

View File

@@ -9,7 +9,7 @@
import {Button, FlexColumn, Input, Sheet, styled} from 'flipper'; import {Button, FlexColumn, Input, Sheet, styled} from 'flipper';
import {useState} from 'react'; import {useState} from 'react';
import type {Bookmark} from '../'; import type {Bookmark} from '../flow-types';
type Props = {| type Props = {|
uri: ?string, uri: ?string,

View File

@@ -16,7 +16,7 @@ import {
} from 'flipper'; } from 'flipper';
import {IconButton, FavoriteButton} from './'; import {IconButton, FavoriteButton} from './';
import type {Bookmark} from '../'; import type {Bookmark} from '../flow-types';
type Props = {| type Props = {|
onFavorite: (query: string) => void, onFavorite: (query: string) => void,

View File

@@ -9,7 +9,7 @@
import {styled} from 'flipper'; import {styled} from 'flipper';
import {NavigationInfoBox} from './'; import {NavigationInfoBox} from './';
import type {Bookmark, NavigationEvent} from '../'; import type {Bookmark, NavigationEvent} from '../flow-types';
type Props = {| type Props = {|
bookmarks: Map<string, Bookmark>, bookmarks: Map<string, Bookmark>,

View File

@@ -0,0 +1,27 @@
/**
* Copyright 2018-present Facebook.
* 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
*/
export type State = {|
bookmarks: Map<string, Bookmark>,
shouldShowSaveBookmarkDialog: boolean,
saveBookmarkURI: ?string,
|};
export type PersistedState = {|
navigationEvents: Array<NavigationEvent>,
|};
export type NavigationEvent = {|
date: ?Date,
uri: ?string,
|};
export type Bookmark = {|
uri: string,
commonName: string,
|};

View File

@@ -16,25 +16,12 @@ import {
} from './components'; } from './components';
import {readBookmarksFromDB, writeBookmarkToDB} from './util/indexedDB'; import {readBookmarksFromDB, writeBookmarkToDB} from './util/indexedDB';
type State = {| import type {
bookmarks: Map<string, Bookmark>, State,
shouldShowSaveBookmarkDialog: boolean, PersistedState,
saveBookmarkURI: ?string, Bookmark,
|}; NavigationEvent,
} from './flow-types';
export type NavigationEvent = {|
date: ?Date,
uri: ?string,
|};
export type Bookmark = {|
uri: string,
commonName: string,
|};
export type PersistedState = {|
navigationEvents: Array<NavigationEvent>,
|};
export default class extends FlipperPlugin<State, {}, PersistedState> { export default class extends FlipperPlugin<State, {}, PersistedState> {
static title = 'Navigation'; static title = 'Navigation';

View File

@@ -6,7 +6,7 @@
* @flow strict-local * @flow strict-local
*/ */
import type {Bookmark} from '../'; import type {Bookmark} from '../flow-types';
const FLIPPER_NAVIGATION_PLUGIN_DB = 'flipper_navigation_plugin_db'; const FLIPPER_NAVIGATION_PLUGIN_DB = 'flipper_navigation_plugin_db';
const FLIPPER_NAVIGATION_PLUGIN_DB_VERSION = 1; const FLIPPER_NAVIGATION_PLUGIN_DB_VERSION = 1;