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';
|
2023-12-12 07:02:35 +03:00
|
|
|
import { InspectorMonitor, Tab } from '@redux-devtools/inspector-monitor';
|
|
|
|
import type { Base16ThemeName } 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
|
2023-12-12 07:02:35 +03:00
|
|
|
theme={getOptions(location).theme as Base16ThemeName}
|
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,
|
2023-11-05 00:04:23 +03:00
|
|
|
] as Tab<unknown, Action<string>>[]
|
2020-09-13 07:02:24 +03:00
|
|
|
}
|
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
|
|
|
}
|