Migrated plugins/navigation/index to TypeScript
Summary: Migrated plugins/navigation/index.js to plugins/navigation/index.tsx Reviewed By: passy Differential Revision: D17181195 fbshipit-source-id: da64547ff001cee2be2d728443a3c189785c51f3
This commit is contained in:
committed by
Facebook Github Bot
parent
470c8ca65e
commit
be6a99c8f9
@@ -13,45 +13,39 @@ import {
|
||||
SearchBar,
|
||||
Timeline,
|
||||
RequiredParametersDialog,
|
||||
} from './components/index.tsx';
|
||||
} from './components';
|
||||
import {
|
||||
removeBookmark,
|
||||
readBookmarksFromDB,
|
||||
writeBookmarkToDB,
|
||||
} from './util/indexedDB.tsx';
|
||||
} from './util/indexedDB';
|
||||
import {
|
||||
appMatchPatternsToAutoCompleteProvider,
|
||||
bookmarksToAutoCompleteProvider,
|
||||
DefaultProvider,
|
||||
} from './util/autoCompleteProvider.tsx';
|
||||
import {getAppMatchPatterns} from './util/appMatchPatterns.tsx';
|
||||
import {getRequiredParameters, filterOptionalParameters} from './util/uri.tsx';
|
||||
} from './util/autoCompleteProvider';
|
||||
import {getAppMatchPatterns} from './util/appMatchPatterns';
|
||||
import {getRequiredParameters, filterOptionalParameters} from './util/uri';
|
||||
import {State, PersistedState, Bookmark, NavigationEvent} from './types';
|
||||
import React from 'react';
|
||||
|
||||
import type {
|
||||
State,
|
||||
PersistedState,
|
||||
Bookmark,
|
||||
NavigationEvent,
|
||||
} from './flow-types';
|
||||
|
||||
export default class extends FlipperPlugin<State, {}, PersistedState> {
|
||||
export default class extends FlipperPlugin<State, any, PersistedState> {
|
||||
static title = 'Navigation';
|
||||
static id = 'Navigation';
|
||||
static icon = 'directions';
|
||||
static keyboardActions = ['clear'];
|
||||
|
||||
static defaultPersistedState: PersistedState = {
|
||||
static defaultPersistedState = {
|
||||
navigationEvents: [],
|
||||
bookmarks: new Map<string, Bookmark>(),
|
||||
currentURI: '',
|
||||
bookmarksProvider: new DefaultProvider(),
|
||||
bookmarksProvider: DefaultProvider(),
|
||||
appMatchPatterns: [],
|
||||
appMatchPatternsProvider: new DefaultProvider(),
|
||||
appMatchPatternsProvider: DefaultProvider(),
|
||||
};
|
||||
|
||||
state = {
|
||||
shouldShowSaveBookmarkDialog: false,
|
||||
saveBookmarkURI: null,
|
||||
saveBookmarkURI: null as (string | null),
|
||||
shouldShowURIErrorDialog: false,
|
||||
requiredParameters: [],
|
||||
};
|
||||
@@ -59,8 +53,7 @@ export default class extends FlipperPlugin<State, {}, PersistedState> {
|
||||
static persistedStateReducer = (
|
||||
persistedState: PersistedState,
|
||||
method: string,
|
||||
payload: NavigationEvent,
|
||||
): $Shape<PersistedState> => {
|
||||
) => {
|
||||
switch (method) {
|
||||
default:
|
||||
return {
|
||||
@@ -124,12 +117,6 @@ export default class extends FlipperPlugin<State, {}, PersistedState> {
|
||||
});
|
||||
};
|
||||
|
||||
onKeyboardAction = (action: string) => {
|
||||
if (action === 'clear') {
|
||||
this.props.setPersistedState({navigationEvents: []});
|
||||
}
|
||||
};
|
||||
|
||||
navigateTo = (query: string) => {
|
||||
const filteredQuery = filterOptionalParameters(query);
|
||||
this.props.setPersistedState({currentURI: filteredQuery});
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "flipper-plugin-navigation",
|
||||
"version": "0.0.1",
|
||||
"main": "index.js",
|
||||
"main": "index.tsx",
|
||||
"license": "MIT",
|
||||
"title": "Navigation",
|
||||
"icon": "directions",
|
||||
|
||||
Reference in New Issue
Block a user