Skip to content

Commit 3bf1393

Browse files
committed
fix: rename ui Context tab -> Messages and Raw Trace -> Trace
Also a minor code cleanup to DrawerContentBody Signed-off-by: Nick Mitchell <[email protected]>
1 parent ea8004d commit 3bf1393

File tree

1 file changed

+18
-29
lines changed

1 file changed

+18
-29
lines changed

pdl-live-react/src/view/detail/DrawerContentBody.tsx

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,6 @@ import {
1414
type NonScalarPdlBlock as Model,
1515
} from "../../helpers"
1616

17-
function defBody(_def: string | null, block: Model) {
18-
const value = hasResult(block) ? block.pdl__result : undefined
19-
return (
20-
<Tab eventKey={0} title={<TabTitleText>Value</TabTitleText>}>
21-
{!value ? "Value not found" : <DefContent value={value} />}
22-
</Tab>
23-
)
24-
}
25-
2617
function blockBody(block: Model) {
2718
const tabs = [
2819
<Tab key={0} eventKey={0} title={<TabTitleText>Summary</TabTitleText>}>
@@ -35,7 +26,7 @@ function blockBody(block: Model) {
3526
<SourceTabContent block={block} />
3627
</Suspense>
3728
</Tab>,
38-
<Tab key={2} eventKey={2} title={<TabTitleText>Raw Trace</TabTitleText>}>
29+
<Tab key={2} eventKey={2} title={<TabTitleText>Trace</TabTitleText>}>
3930
<Suspense>
4031
<RawTraceTabContent block={block} />
4132
</Suspense>
@@ -46,7 +37,7 @@ function blockBody(block: Model) {
4637
tabs.splice(
4738
1,
4839
0,
49-
<Tab key={3} eventKey={3} title={<TabTitleText>Context</TabTitleText>}>
40+
<Tab key={3} eventKey={3} title={<TabTitleText>Messages</TabTitleText>}>
5041
<Suspense>
5142
<ContextTabContent block={block} />
5243
</Suspense>
@@ -68,29 +59,27 @@ type Props = {
6859
export default function DrawerContentBody({
6960
id,
7061
value,
71-
def,
7262
objectType,
7363
model,
7464
}: Props) {
65+
if (!model) {
66+
return (
67+
<Suspense fallback={<div />}>
68+
<BlockNotFound pdl__id={id} value={value} />
69+
</Suspense>
70+
)
71+
}
72+
7573
switch (objectType) {
76-
case "def":
77-
if (!model) {
78-
return (
79-
<Suspense>
80-
<BlockNotFound pdl__id={id} value={value} />
81-
</Suspense>
82-
)
83-
}
84-
return defBody(def, model)
74+
case "def": {
75+
const value = hasResult(model) ? model.pdl__result : undefined
76+
return (
77+
<Tab eventKey={0} title={<TabTitleText>Value</TabTitleText>}>
78+
{!value ? "Value not found" : <DefContent value={value} />}
79+
</Tab>
80+
)
81+
}
8582
default:
86-
if (!model) {
87-
return (
88-
<Suspense>
89-
<BlockNotFound pdl__id={id} value={value} />
90-
</Suspense>
91-
)
92-
}
93-
9483
return blockBody(model)
9584
}
9685
}

0 commit comments

Comments
 (0)