mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-25 11:03:57 +03:00
b82de74592
* Use rollup for d3tooltip * Use rollup for map2tree * Set moduleResolution * Use rollup for d3-state-visualizer * Use rollup for react-base16-styling * Use rollup for react-dock * Use rollup for react-json-tree * Use rollup for redux-devtools * Use rollup for redux-devtools-intrument * Use rollup for redux-devtools-chart-monitor * Update export * Use rollup for redux-devtools-dock-monitor * Use rollup for redux-devtools-inspector-monitor * Fix inspector demo * Fix invalid eslint config * Use rollup for inspector-monitor-test-tab * Use rollup for inspector-monitor-trace-tab * Use rollup for redux-devtools-log-monitor * Use rollup for redux-devtools-remote * Use rollup in redux-devtools-rtk-query-monitor * Use rollup for redux-devtools-serialize * Fix redux-devtools examples * Use rollup for redux-devtools-slider-monitor * Fix slider examples * Use rollup for redux-devtools-ui * Use rollup for redux-devtools-utils * Use rollup for redux-devtools-extension * Use rollup for redux-devtools-app * Fix Webpack app build * Fix extension build * Turn on minimization * Update CLI
61 lines
1.6 KiB
TypeScript
61 lines
1.6 KiB
TypeScript
import React from 'react';
|
|
import { connect } from 'react-redux';
|
|
import { createDevTools } from '@redux-devtools/core';
|
|
import { DockMonitor } from '@redux-devtools/dock-monitor';
|
|
import { Location } from 'history';
|
|
import {
|
|
InspectorMonitor,
|
|
base16Themes,
|
|
} from '@redux-devtools/inspector-monitor';
|
|
import getOptions from './getOptions';
|
|
import { DemoAppState } from './reducers';
|
|
|
|
const CustomComponent = () => (
|
|
<div
|
|
style={{
|
|
display: 'flex',
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
width: '100%',
|
|
height: '100%',
|
|
minHeight: '20rem',
|
|
}}
|
|
>
|
|
<div>Custom Tab Content</div>
|
|
</div>
|
|
);
|
|
|
|
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: 'Custom Tab',
|
|
component: CustomComponent,
|
|
},
|
|
...defaultTabs,
|
|
]}
|
|
/>
|
|
</DockMonitor>
|
|
);
|
|
|
|
const UnconnectedDevTools = ({ location }: { location: Location }) => {
|
|
const DevTools = getDevTools(location);
|
|
return <DevTools />;
|
|
};
|
|
|
|
const mapStateToProps = (state: DemoAppState) => ({
|
|
location: state.router.location,
|
|
});
|
|
|
|
export const ConnectedDevTools = connect(mapStateToProps)(UnconnectedDevTools);
|