Skip to content

Commit 6763968

Browse files
committed
[devtools] set up panel ui tab infra
1 parent 5bb1fee commit 6763968

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import type { DevToolsPanelTabType } from '../devtools-panel'
2+
3+
export function DevToolsPanelTab({
4+
activeTab,
5+
}: {
6+
activeTab: DevToolsPanelTabType
7+
}) {
8+
if (activeTab === 'settings') {
9+
return <div>Settings</div>
10+
}
11+
12+
if (activeTab === 'route') {
13+
return <div>Route</div>
14+
}
15+
16+
if (activeTab === 'issues') {
17+
return <div>Issues</div>
18+
}
19+
20+
console.log(
21+
`[Next.js DevTools] Received unknown Panel Tab: "${activeTab}". This is a bug in Next.js DevTools.`
22+
)
23+
return null
24+
}

packages/next/src/next-devtools/dev-overlay/components/devtools-panel/devtools-panel.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type { OverlayDispatch, OverlayState, Corners } from '../../shared'
33
import { useState } from 'react'
44

55
import { DevToolsPanelFooter } from './devtools-panel-footer'
6+
import { DevToolsPanelTab } from './devtools-panel-tab/devtools-panel-tab'
67
import { Dialog, DialogContent, DialogHeader, DialogBody } from '../dialog'
78
import { Overlay, OverlayBackdrop } from '../overlay'
89
import {
@@ -15,6 +16,8 @@ import { INDICATOR_PADDING } from '../devtools-indicator/devtools-indicator'
1516
import { FullScreenIcon } from '../../icons/fullscreen'
1617
import { Cross } from '../../icons/cross'
1718

19+
export type DevToolsPanelTabType = 'issues' | 'route' | 'settings'
20+
1821
function getInitialPosition(): Corners {
1922
if (
2023
typeof localStorage !== 'undefined' &&
@@ -123,7 +126,9 @@ export function DevToolsPanel({
123126
</div>
124127
</div>
125128
</DialogHeader>
126-
<DialogBody></DialogBody>
129+
<DialogBody>
130+
<DevToolsPanelTab activeTab={activeTab} />
131+
</DialogBody>
127132
</DialogContent>
128133
<DevToolsPanelFooter versionInfo={state.versionInfo} />
129134
</Dialog>

0 commit comments

Comments
 (0)