mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-28 12:33:55 +03:00
65205f9078
* Replace Action<unknown> with Action<string> In anticipation of Redux 5 type changes * Fix lint errors * Create yellow-steaks-marry.md
44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
import React from 'react';
|
|
import { createDevTools } from '@redux-devtools/core';
|
|
import {
|
|
InspectorMonitor,
|
|
base16Themes,
|
|
Tab,
|
|
} from '@redux-devtools/inspector-monitor';
|
|
import { DockMonitor } from '@redux-devtools/dock-monitor';
|
|
import { useLocation } from 'react-router-dom';
|
|
import getOptions from './getOptions';
|
|
import { TestTab } from '@redux-devtools/inspector-monitor-test-tab';
|
|
import { Action } from 'redux';
|
|
|
|
export const getDevTools = (location: { search: string }) =>
|
|
createDevTools(
|
|
<DockMonitor
|
|
defaultIsVisible
|
|
toggleVisibilityKey="ctrl-h"
|
|
changePositionKey="ctrl-q"
|
|
changeMonitorKey="ctrl-m"
|
|
>
|
|
<InspectorMonitor
|
|
theme={getOptions(location).theme as keyof typeof base16Themes}
|
|
invertTheme={!getOptions(location).dark}
|
|
supportImmutable={getOptions(location).supportImmutable}
|
|
tabs={(defaultTabs) =>
|
|
[
|
|
{
|
|
name: 'Test',
|
|
component: TestTab,
|
|
},
|
|
...defaultTabs,
|
|
] as Tab<unknown, Action<string>>[]
|
|
}
|
|
/>
|
|
</DockMonitor>,
|
|
);
|
|
|
|
export function ConnectedDevTools() {
|
|
const location = useLocation();
|
|
const DevTools = getDevTools(location);
|
|
return <DevTools />;
|
|
}
|