Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: keep Importer Analyze visible during intake (#11056)

Adam Eivy0953096e227a
diff --git a/client/src/pages/Importer.intake.test.jsx b/client/src/pages/Importer.intake.test.jsx
new file mode 100644
index 0000000000..e454f17079
--- /dev/null
+++ b/client/src/pages/Importer.intake.test.jsx
@@ -0,0 +1,51 @@
+import { useState } from 'react';
+import { fireEvent, render, screen, cleanup } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import { afterEach, expect, it, vi } from 'vitest';
+import { IntakeForm } from './Importer';
+
+afterEach(cleanup);
+
+function Intake({ onAnalyze, analyzing = false }) {
+ const [intake, setIntake] = useState({
+ universeName: '', seriesName: '', source: '', contentType: 'novel', targetIssueCount: '',
+ });
+ return <IntakeForm
+ intake={intake} setIntake={setIntake}
+ universeItems={[]} seriesItems={[]}
+ sourceCharLimit={20} analyzing={analyzing}
+ onAnalyze={onAnalyze} onClassify={vi.fn()}
+ providers={[]} llmProvider="" llmModel="" llmModels={[]}
+ onProviderChange={vi.fn()} onModelChange={vi.fn()}
+ />;
+}
+
+// Catches accidental paid calls from Enter and lost validity/busy gates when
+// Analyze moves outside the scrolling intake fields.
+it('requires valid intake and explicit Analyze activation, and gates busy analysis', async () => {
+ const user = userEvent.setup();
+ const onAnalyze = vi.fn();
+ const { rerender } = render(<Intake onAnalyze={onAnalyze} />);
+ const analyze = screen.getByRole('button', { name: 'Analyze', exact: true });
+ expect(analyze.disabled).toBe(true);
+ await user.type(screen.getByLabelText('Universe Name'), 'Test universe');
+ await user.type(screen.getByLabelText('Series Name'), 'Test series');
+ expect(analyze.disabled).toBe(true);
+ await user.type(screen.getByLabelText('Source Text'), 'Test source');
+ expect(analyze.disabled).toBe(false);
+ await user.click(screen.getByLabelText('Series Name'));
+ await user.keyboard('{Enter}');
+ fireEvent.submit(analyze.closest('form'));
+ expect(onAnalyze).not.toHaveBeenCalled();
+ fireEvent.change(screen.getByLabelText('Source Text'), { target: { value: 'x'.repeat(21) } });
+ expect(analyze.disabled).toBe(true);
+ expect(screen.getByText(/Source exceeds/)).toBeTruthy();
+ fireEvent.change(screen.getByLabelText('Source Text'), { target: { value: 'Valid source' } });
+ await user.click(analyze);
+ expect(onAnalyze).toHaveBeenCalledTimes(1);
+ rerender(<Intake onAnalyze={onAnalyze} analyzing />);
+ const busy = screen.getByRole('button', { name: 'Analyzing…' });
+ expect(busy.disabled).toBe(true);
+ await user.click(busy);
+ expect(onAnalyze).toHaveBeenCalledTimes(1);
+});
diff --git a/client/src/pages/Importer.jsx b/client/src/pages/Importer.jsx
index ce909b62e4..08332f1411 100644
--- a/client/src/pages/Importer.jsx
+++ b/client/src/pages/Importer.jsx
@@ -489,8 +489,6 @@ export default function Importer() {
title="Importer"
subtitle="Reverse-engineer a finished story, novel, screenplay, or comic script into the pipeline. The LLM extracts universe canon, the story arc, and a proposed issue split; you review, edit, and commit."
/>
- <div className="flex-1 min-h-0 overflow-auto p-4">
- <div className="space-y-6">
{phase === 'intake' && (
<IntakeForm
@@ -517,6 +515,7 @@ export default function Importer() {
)}
{phase === 'review' && preview && (
+ <div className="flex-1 min-h-0 overflow-auto p-4">
<ReviewPanel
preview={preview}
contentType={intake.contentType}
@@ -546,14 +545,13 @@ export default function Importer() {
onRetryIssues={runRetryIssues}
retryingIssues={retryingIssues}
/>
+ </div>
)}
- </div>
- </div>
</div>
);
}
-function IntakeForm({
+export function IntakeForm({
intake, setIntake,
universeItems, universeSelectedId, seriesItems, seriesSelectedId,
sourceCharLimit, analyzing, analyzeStages, onAnalyze, classifying, onClassify, classifyHint,
@@ -571,7 +569,7 @@ function IntakeForm({
const confirmNewName = () => {};
return (
<form
- className="space-y-4 bg-port-card border border-port-border rounded-lg p-4 sm:p-6"
+ className="flex flex-1 min-h-0 flex-col"
// Swallow default form submission so an accidental Enter in any input
// doesn't trigger Analyze — Analyze fires three heavy-tier LLM calls
// and accidental triggering costs real money. Tab to the button + Space
@@ -579,6 +577,8 @@ function IntakeForm({
// round 6 after this cost trade-off was surfaced.
onSubmit={(e) => e.preventDefault()}
>
+ <div className="flex-1 min-h-0 overflow-y-auto p-4">
+ <div className="space-y-4 bg-port-card border border-port-border rounded-lg p-4 sm:p-6">
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div>
<label htmlFor="importer-universe-name" className="block text-sm font-medium mb-1">
@@ -705,7 +705,9 @@ function IntakeForm({
)}
</div>
- <div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
+ <details>
+ <summary className="cursor-pointer text-sm font-medium">Import options</summary>
+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-4 mt-3">
<div>
<label htmlFor="importer-target-issue-count" className="block text-sm font-medium mb-1">
Target Issue Count (optional)
@@ -740,14 +742,23 @@ function IntakeForm({
</div>
</div>
+ </details>
+
{analyzing && <ImporterProgress stages={analyzeStages} />}
+ </div>
+ </div>
- <div className="flex items-center justify-end gap-2 pt-2">
+ <div className="shrink-0 flex items-center justify-between gap-3 border-t border-port-border bg-port-card px-4 py-3">
+ <p className="min-w-0 text-xs text-port-text-muted break-words">
+ {llmProvider
+ ? <>{providers.find((provider) => provider.id === llmProvider)?.name || llmProvider} · {llmModel || 'Default model'}</>
+ : 'AI: configured stage providers'}
+ </p>
<button
type="button"
onClick={onAnalyze}
disabled={!intakeValid || analyzing}
- className="bg-port-accent hover:bg-port-accent/80 disabled:opacity-50 disabled:cursor-not-allowed text-white px-4 py-2 rounded text-sm font-medium flex items-center gap-2"
+ className="bg-port-accent hover:bg-port-accent/80 disabled:opacity-50 disabled:cursor-not-allowed text-white px-4 py-2 rounded text-sm font-medium flex shrink-0 items-center gap-2"
>
{analyzing ? <Loader2 className="w-4 h-4 animate-spin" /> : <FileInput className="w-4 h-4" />}
{analyzing ? 'Analyzing…' : 'Analyze'}