Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(site): make TaskPrompt PromptTextarea read-only when submitting#20363

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
johnstcn merged 5 commits intomainfromcj/task-textarea-readonly-submit
Oct 17, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletionssite/src/modules/tasks/TaskPrompt/TaskPrompt.stories.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -103,6 +103,35 @@ export const SubmitDisabledWhenPromptEmpty: Story = {
},
};

export const Submitting: Story = {
decorators: [withGlobalSnackbar],
beforeEach: () => {
spyOn(API.experimental, "createTask").mockImplementation(
() =>
// Never resolve to keep the component in the submitting state for visual testing.
new Promise(() => {}),
);
},
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);

const prompt = await canvas.findByLabelText(/prompt/i);
await userEvent.type(
prompt,
"Lorem ipsum dolor sit amet, consectetur adipiscing elit.{enter}{enter}Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
);

const submitButton = canvas.getByRole("button", { name: /run task/i });
await waitFor(() => expect(submitButton).toBeEnabled());
await userEvent.click(submitButton);
},
parameters: {
chromatic: {
disableSnapshot: true,
},
},
};

export const OnSuccess: Story = {
decorators: [withGlobalSnackbar],
parameters: {
Expand Down
41 changes: 30 additions & 11 deletionssite/src/modules/tasks/TaskPrompt/TaskPrompt.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -259,6 +259,7 @@ const CreateTaskForm: FC<CreateTaskFormProps> = ({ templates, onSuccess }) => {
value={prompt}
onChange={(e) => setPrompt(e.target.value)}
readOnly={isPromptReadOnly}
isSubmitting={createTaskMutation.isPending}
/>
<div className="flex items-center justify-between pt-2">
<div className="flex items-center gap-1">
Expand DownExpand Up@@ -457,17 +458,35 @@ async function createTaskWithLatestTemplateVersion(
});
}

const PromptTextarea: FC<TextareaAutosizeProps> = (props) => {
type PromptTextareaProps = TextareaAutosizeProps & {
isSubmitting?: boolean;
};

const PromptTextarea: FC<PromptTextareaProps> = ({
isSubmitting,
...props
}) => {
return (
<TextareaAutosize
{...props}
required
id="prompt"
name="prompt"
placeholder="Prompt your AI agent to start a task..."
className={`border-0 px-3 py-2 resize-none w-full h-full bg-transparent rounded-lg
outline-none flex min-h-24 text-sm shadow-sm text-content-primary
placeholder:text-content-secondary md:text-sm ${props.readOnly ? "opacity-60 cursor-not-allowed" : ""}`}
/>
<div className="relative">
<TextareaAutosize
{...props}
required
id="prompt"
name="prompt"
placeholder="Prompt your AI agent to start a task..."
className={`border-0 px-3 py-2 resize-none w-full h-full bg-transparent rounded-lg
outline-none flex min-h-24 text-sm shadow-sm text-content-primary
placeholder:text-content-secondary md:text-sm ${props.readOnly || isSubmitting ? "opacity-60 cursor-not-allowed" : ""}`}
/>
{isSubmitting && (
<div className="absolute inset-0 pointer-events-none overflow-hidden">
<div
className={`absolute top-0 w-0.5 h-full
bg-green-400/90 animate-caret-scan rounded-sm
shadow-[-15px_0_15px_rgba(0,255,0,0.9),-30px_0_30px_rgba(0,255,0,0.7),-45px_0_45px_rgba(0,255,0,0.5),-60px_0_60px_rgba(0,255,0,0.3)]`}
/>
</div>
)}
</div>
);
};
8 changes: 8 additions & 0 deletionssite/tailwind.config.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -83,6 +83,14 @@ module.exports = {
"75%": { opacity: 0.3 },
"100%": { opacity: 0.2 },
},
"caret-scan": {
"0%": { left: "0%" },
"100%": { left: "100%" },
},
},
animation: {
loading: "loading 2s ease-in-out infinite alternate",
"caret-scan": "caret-scan 3s ease-in-out infinite",
},
},
},
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp