Skip to content

Commit 883feec

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 807479a commit 883feec

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
@@ -16,15 +16,6 @@ import {
1616
type NonScalarPdlBlock as Model,
1717
} from "../../helpers"
1818

19-
function defBody(_def: string | null, block: Model) {
20-
const value = hasResult(block) ? block.pdl__result : undefined
21-
return (
22-
<Tab eventKey={0} title={<TabTitleText>Value</TabTitleText>}>
23-
{!value ? "Value not found" : <DefContent value={value} />}
24-
</Tab>
25-
)
26-
}
27-
2819
function blockBody(block: Model) {
2920
const tabs = [
3021
<Tab key={0} eventKey={0} title={<TabTitleText>Summary</TabTitleText>}>
@@ -37,7 +28,7 @@ function blockBody(block: Model) {
3728
<SourceTabContent block={block} />
3829
</Suspense>
3930
</Tab>,
40-
<Tab key={2} eventKey={2} title={<TabTitleText>Raw Trace</TabTitleText>}>
31+
<Tab key={2} eventKey={2} title={<TabTitleText>Trace</TabTitleText>}>
4132
<Suspense>
4233
<RawTraceTabContent block={block} />
4334
</Suspense>
@@ -48,7 +39,7 @@ function blockBody(block: Model) {
4839
tabs.splice(
4940
1,
5041
0,
51-
<Tab key={3} eventKey={3} title={<TabTitleText>Context</TabTitleText>}>
42+
<Tab key={3} eventKey={3} title={<TabTitleText>Messages</TabTitleText>}>
5243
<Suspense>
5344
<ContextTabContent block={block} />
5445
</Suspense>
@@ -82,29 +73,27 @@ type Props = {
8273
export default function DrawerContentBody({
8374
id,
8475
value,
85-
def,
8676
objectType,
8777
model,
8878
}: Props) {
79+
if (!model) {
80+
return (
81+
<Suspense fallback={<div />}>
82+
<BlockNotFound pdl__id={id} value={value} />
83+
</Suspense>
84+
)
85+
}
86+
8987
switch (objectType) {
90-
case "def":
91-
if (!model) {
92-
return (
93-
<Suspense>
94-
<BlockNotFound pdl__id={id} value={value} />
95-
</Suspense>
96-
)
97-
}
98-
return defBody(def, model)
88+
case "def": {
89+
const value = hasResult(model) ? model.pdl__result : undefined
90+
return (
91+
<Tab eventKey={0} title={<TabTitleText>Value</TabTitleText>}>
92+
{!value ? "Value not found" : <DefContent value={value} />}
93+
</Tab>
94+
)
95+
}
9996
default:
100-
if (!model) {
101-
return (
102-
<Suspense>
103-
<BlockNotFound pdl__id={id} value={value} />
104-
</Suspense>
105-
)
106-
}
107-
10897
return blockBody(model)
10998
}
11099
}

0 commit comments

Comments
 (0)