Skip to content

Commit 0c171a0

Browse files
dev Tab
1 parent 8708562 commit 0c171a0

5 files changed

Lines changed: 42 additions & 6 deletions

File tree

packages/config/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,11 @@
1010
"build": "tsup index.ts --format esm --dts",
1111
"dev": "npm run build -- --watch"
1212
},
13-
"peerDependencies": {
14-
},
1513
"devDependencies": {
14+
"@types/node": "^20.5.7",
1615
"eslint": "^8.48.0",
1716
"eslint-config-custom": "workspace:*",
1817
"tsconfig": "workspace:*",
1918
"typescript": "^5.2.2"
20-
},
21-
"dependencies": {
2219
}
2320
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import * as React from 'react';
2+
import { useAppSelector, selectData, selectEditorState, useAppDispatch, setRowData } from 'state';
3+
import { selectJsonSchema, selectUiSchema } from 'project-state';
4+
5+
export function Print({json={}}: {json: any}) {
6+
const key = Object.keys(json).length === 1 && Object.keys(json)[0]
7+
const data = !key ? json : Object.values(json)[0];
8+
9+
const indentation = ' ';
10+
return <>
11+
<h4>{key}</h4>
12+
<p>
13+
{ JSON.stringify(data, undefined, indentation).split('\n').map(
14+
line => <>{ line.split(indentation).map( token => <span>{token} &nbsp; </span> ) }<br/></>
15+
)
16+
}
17+
</p>
18+
</>
19+
}
20+
21+
export function Debug() {
22+
const schema = useAppSelector(selectJsonSchema);
23+
const uiSchema = useAppSelector(selectUiSchema);
24+
const tableData = useAppSelector(selectData);
25+
26+
return <div>
27+
<Print json={{schema}}/>
28+
<Print json={{uiSchema}}/>
29+
<Print json={{tableData}}/>
30+
</div>
31+
}

packages/example/features/app/Tabs.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Timeline } from 'edit-timeline';
2+
import { Debug } from './Debug';
23

34
import PlaceIcon from '@mui/icons-material/Place';
45
import CalendarMonthIcon from '@mui/icons-material/CalendarMonth';
@@ -21,5 +22,5 @@ export const tabs = [
2122
{icon: <ViewTimelineIcon/>, label: "Gantt", content: notYetImplemented},
2223
{icon: <HubIcon/>, label: "Network", content: notYetImplemented},
2324
{icon: <BarChartIcon/>, label: "Chart", content: notYetImplemented},
24-
config.developerMode && {icon: <LogoDevIcon/>, label: "Dev", content: notYetImplemented}
25+
config.developerMode && {icon: <LogoDevIcon/>, label: "Dev", content: <Debug/>}
2526
].filter(t => t);

packages/example/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"secured-react-redux-yjs": "workspace:*",
2727
"security-state": "workspace:*",
2828
"state": "workspace:*",
29+
"project-state": "workspace:*",
2930
"style": "workspace:*"
3031
},
3132
"devDependencies": {

pnpm-lock.yaml

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)