diff --git a/packages/ui/src/components/Section.tsx b/packages/ui/src/components/Section.tsx
index 143c825..a5dc482 100644
--- a/packages/ui/src/components/Section.tsx
+++ b/packages/ui/src/components/Section.tsx
@@ -1,36 +1,57 @@
import { ReactNode } from "react";
import {
Badge,
+ Button,
Card,
CardBody,
+ CardHeader,
CardTitle,
Split,
SplitItem,
} from "@patternfly/react-core";
+import { PencilAltIcon } from "@patternfly/react-icons";
export function Section({
title,
count,
id,
children,
+ onEdit,
}: {
title: ReactNode;
count?: number;
id: string;
children: ReactNode;
+ onEdit?: () => void;
}) {
return (
-
-
- {title}
- {count !== undefined && (
-
- {count}
-
- )}
-
-
+
+ {onEdit && (
+ }
+ onClick={onEdit}
+ />
+ )}
+ >
+ ),
+ }}
+ >
+
+
+ {title}
+ {count !== undefined && (
+
+ {count}
+
+ )}
+
+
+
{children}
);
diff --git a/packages/ui/src/documentDesigner/Designer.tsx b/packages/ui/src/documentDesigner/Designer.tsx
index e607874..41a984b 100644
--- a/packages/ui/src/documentDesigner/Designer.tsx
+++ b/packages/ui/src/documentDesigner/Designer.tsx
@@ -9,6 +9,7 @@ import { useMachineSelector } from "./DocumentDesignerMachineContext.ts";
import { DesignerLayout } from "./DesignerLayout.tsx";
import { PathsExplorer } from "./PathsExplorer.tsx";
import { PathsTree } from "./PathsTree.tsx";
+import { OpenApiEditorMachineContext } from "../OpenApiEditor.tsx";
export function Designer() {
const {
@@ -28,6 +29,12 @@ export function Designer() {
editable: context.editable,
};
});
+ const actorRef = OpenApiEditorMachineContext.useActorRef();
+ const onEdit = !editable
+ ? () => {
+ actorRef.send({ type: "SELECT_DOCUMENT_ROOT_DESIGNER" });
+ }
+ : undefined;
return (
}
@@ -43,6 +50,7 @@ export function Designer() {
serversCount={serversCount}
securitySchemeCount={securitySchemeCount}
securityRequirementsCount={securityRequirementsCount}
+ onEdit={onEdit}
/>
);
}
diff --git a/packages/ui/src/documentDesigner/DesignerLayout.tsx b/packages/ui/src/documentDesigner/DesignerLayout.tsx
index ecd62dc..0786030 100644
--- a/packages/ui/src/documentDesigner/DesignerLayout.tsx
+++ b/packages/ui/src/documentDesigner/DesignerLayout.tsx
@@ -19,6 +19,7 @@ export function DesignerLayout({
serversCount,
securitySchemeCount,
securityRequirementsCount,
+ onEdit,
}: {
info?: ReactNode;
paths?: ReactNode;
@@ -33,6 +34,7 @@ export function DesignerLayout({
serversCount?: number;
securitySchemeCount?: number;
securityRequirementsCount?: number;
+ onEdit?: () => void;
}) {
return (
@@ -49,19 +51,24 @@ export function DesignerLayout({
-