2020-08-10 03:41:59 +03:00
|
|
|
import React from 'react';
|
2020-12-21 17:08:08 +03:00
|
|
|
import { createDevTools } from '@redux-devtools/core';
|
2022-01-10 18:41:53 +03:00
|
|
|
import {
|
|
|
|
InspectorMonitor,
|
2020-09-13 07:02:24 +03:00
|
|
|
base16Themes,
|
|
|
|
Tab,
|
2020-12-21 23:46:28 +03:00
|
|
|
} from '@redux-devtools/inspector-monitor';
|
2022-01-10 18:41:53 +03:00
|
|
|
import { DockMonitor } from '@redux-devtools/dock-monitor';
|
2022-05-16 00:47:09 +03:00
|
|
|
import { useLocation } from 'react-router-dom';
|
2020-08-10 03:41:59 +03:00
|
|
|
import getOptions from './getOptions';
|
2022-01-10 18:41:53 +03:00
|
|
|
import { TestTab } from '@redux-devtools/inspector-monitor-test-tab';
|
2020-09-13 07:02:24 +03:00
|
|
|
import { Action } from 'redux';
|
2020-08-10 03:41:59 +03:00
|
|
|
|
2020-09-13 07:02:24 +03:00
|
|
|
export const getDevTools = (location: { search: string }) =>
|
2020-08-10 03:41:59 +03:00
|
|
|
createDevTools(
|
|
|
|
<DockMonitor
|
|
|
|
defaultIsVisible
|
|
|
|
toggleVisibilityKey="ctrl-h"
|
|
|
|
changePositionKey="ctrl-q"
|
|
|
|
changeMonitorKey="ctrl-m"
|
|
|
|
>
|
2020-09-10 19:37:19 +03:00
|
|
|
<InspectorMonitor
|
2020-09-13 07:02:24 +03:00
|
|
|
theme={getOptions(location).theme as keyof typeof base16Themes}
|
2020-08-10 03:41:59 +03:00
|
|
|
invertTheme={!getOptions(location).dark}
|
|
|
|
supportImmutable={getOptions(location).supportImmutable}
|
2020-09-13 07:02:24 +03:00
|
|
|
tabs={(defaultTabs) =>
|
|
|
|
[
|
|
|
|
{
|
|
|
|
name: 'Test',
|
2022-01-10 18:41:53 +03:00
|
|
|
component: TestTab,
|
2020-09-13 07:02:24 +03:00
|
|
|
},
|
|
|
|
...defaultTabs,
|
|
|
|
] as Tab<unknown, Action<unknown>>[]
|
|
|
|
}
|
2020-08-10 03:41:59 +03:00
|
|
|
/>
|
2023-07-12 21:03:20 +03:00
|
|
|
</DockMonitor>,
|
2020-08-10 03:41:59 +03:00
|
|
|
);
|
|
|
|
|
2022-05-16 00:47:09 +03:00
|
|
|
export function ConnectedDevTools() {
|
|
|
|
const location = useLocation();
|
2020-08-10 03:41:59 +03:00
|
|
|
const DevTools = getDevTools(location);
|
|
|
|
return <DevTools />;
|
2022-05-16 00:47:09 +03:00
|
|
|
}
|