File size: 3,017 Bytes
abcf568 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | import type { RefObject } from 'react'
import { StudioCommandPanel, type StudioCommandPanelHandle } from '../components/StudioCommandPanel'
import { PlotPreviewPanel } from '../plot/PlotPreviewPanel'
import type { usePlotStudioShell } from './hooks/use-plot-studio-shell'
import { PlotStudioHistoryAside } from './components/PlotStudioHistoryAside'
interface PlotStudioWorkspaceProps {
commandPanelRef: RefObject<StudioCommandPanelHandle | null>
shell: ReturnType<typeof usePlotStudioShell>
onExit: () => void
interruptPlaceholder: string | undefined
}
export function PlotStudioWorkspace({
commandPanelRef,
shell,
onExit,
interruptPlaceholder,
}: PlotStudioWorkspaceProps) {
return (
<>
<main className="relative mb-10 flex min-h-[36vh] flex-1 items-center justify-center md:mb-12 md:min-h-0">
<div className="h-full w-full">
<PlotPreviewPanel
session={shell.studio.session}
works={shell.orderedWorkSummaries}
selectedWorkId={shell.effectiveSelectedWorkId}
work={shell.selected.work}
result={shell.selected.result}
latestRun={shell.studio.latestRun}
tasks={shell.selected.tasks}
requests={shell.studio.pendingPermissions}
replyingPermissionIds={shell.studio.replyingPermissionIds}
latestAssistantText={shell.studio.latestAssistantText}
errorMessage={shell.studio.state.error ?? shell.studio.state.connection.eventError}
onSelectWork={shell.setSelectedWorkId}
onReorderWorks={shell.handleReorderWorks}
onReply={shell.studio.replyPermission}
onSendPreviewToComposer={(attachment) => commandPanelRef.current?.appendPreviewAttachment(attachment)}
variant="pure-minimal-top"
/>
</div>
</main>
<section className="flex shrink-0 min-h-0 flex-col gap-5 md:h-72 md:flex-row md:gap-12 lg:gap-16">
<div className="relative flex min-h-[15rem] min-w-0 flex-1 flex-col md:pl-5 md:pr-5 lg:pl-8 lg:pr-10">
<StudioCommandPanel
ref={commandPanelRef}
session={shell.studio.session}
messages={shell.studio.messages}
latestAssistantText={shell.studio.latestAssistantText}
isBusy={shell.studio.isBusy}
disabled={shell.studio.isBusy || shell.studio.state.connection.snapshotStatus !== 'ready'}
onRun={shell.studio.runCommand}
onExit={onExit}
variant="pure-minimal-bottom"
onEscapePress={shell.handleEscapePress}
inputPlaceholderOverride={interruptPlaceholder}
/>
</div>
<PlotStudioHistoryAside
works={shell.orderedWorkSummaries}
selectedWorkId={shell.effectiveSelectedWorkId}
historyCountLabel={shell.historyCountLabel}
maxHistorySlots={shell.maxHistorySlots}
onSelectWork={shell.setSelectedWorkId}
/>
</section>
</>
)
}
|