mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-10-12 04:29:51 +08:00
fix(mcp-server): the shell shows the versions once, in the side panel
This commit is contained in:
@@ -2,7 +2,6 @@ import { Download, History, Moon, Sun } from "lucide-react"
|
|||||||
import { useMemo, useState } from "react"
|
import { useMemo, useState } from "react"
|
||||||
import { CanvasStage } from "@/components/canvas/canvas-stage"
|
import { CanvasStage } from "@/components/canvas/canvas-stage"
|
||||||
import { CompareDialog } from "@/components/canvas/compare-dialog"
|
import { CompareDialog } from "@/components/canvas/compare-dialog"
|
||||||
import { VersionStrip } from "@/components/canvas/version-strip"
|
|
||||||
import { VersionsProvider } from "@/components/canvas/versions-context"
|
import { VersionsProvider } from "@/components/canvas/versions-context"
|
||||||
import { type ExportFormat, SaveDialog } from "@/components/save-dialog"
|
import { type ExportFormat, SaveDialog } from "@/components/save-dialog"
|
||||||
import { AppToaster } from "@/components/workspace/app-toaster"
|
import { AppToaster } from "@/components/workspace/app-toaster"
|
||||||
@@ -22,9 +21,10 @@ const iconButton =
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The MCP preview: the web app's canvas without the chat. A slim bar names
|
* The MCP preview: the web app's canvas without the chat. A slim bar names
|
||||||
* the session and the sync state; the versions strip, the version cards
|
* the session and the sync state; the version cards (from the server's
|
||||||
* (from the server's History), Compare and the export dialog come from the
|
* History), Compare and the export dialog come from the shared canvas
|
||||||
* shared canvas components.
|
* components. The cards sit in a side panel, so the web app's versions strip
|
||||||
|
* above the canvas is left out: it would show the same list twice.
|
||||||
*/
|
*/
|
||||||
export function CanvasShell({ config }: { config: ShellConfig }) {
|
export function CanvasShell({ config }: { config: ShellConfig }) {
|
||||||
const dict = useDictionary()
|
const dict = useDictionary()
|
||||||
@@ -135,16 +135,11 @@ export function CanvasShell({ config }: { config: ShellConfig }) {
|
|||||||
</button>
|
</button>
|
||||||
</header>
|
</header>
|
||||||
<div className="flex min-h-0 flex-1">
|
<div className="flex min-h-0 flex-1">
|
||||||
<div className="flex min-w-0 flex-1 flex-col">
|
<div className="relative min-w-0 flex-1">
|
||||||
{/* With the cards open, one version alone adds
|
<CanvasStage
|
||||||
nothing to its card */}
|
className="inset-0"
|
||||||
<VersionStrip minVersions={showPanel ? 2 : 1} />
|
drawioSource={drawioSource}
|
||||||
<div className="relative flex-1">
|
/>
|
||||||
<CanvasStage
|
|
||||||
className="inset-0"
|
|
||||||
drawioSource={drawioSource}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{showPanel && (
|
{showPanel && (
|
||||||
<VersionsPanel versions={versions.versions} />
|
<VersionsPanel versions={versions.versions} />
|
||||||
|
|||||||
@@ -468,7 +468,6 @@ test("the version cards follow the server's History; undo, redo and restore go t
|
|||||||
await expect(latestCard.getByTestId("version-undo")).toHaveText(
|
await expect(latestCard.getByTestId("version-undo")).toHaveText(
|
||||||
/Undo change/,
|
/Undo change/,
|
||||||
)
|
)
|
||||||
await expect(page.getByTestId("version-thumb")).toHaveCount(3)
|
|
||||||
|
|
||||||
// Undo: the server restores the version before; the card says so
|
// Undo: the server restores the version before; the card says so
|
||||||
await latestCard.getByTestId("version-undo").click()
|
await latestCard.getByTestId("version-undo").click()
|
||||||
|
|||||||
Reference in New Issue
Block a user