Skip to content

Commit 537020e

Browse files
authored
🤖 feat: improve workspace creation UX with generating state (#842)
Improves the UX when creating a new workspace and an LLM is generating the workspace name. ## Changes - Changed spinner message from 'Creating workspace...' to 'Generating workspace name...' - Show a dimmed, italicized preview of the user's prompt (in quotes) above the spinner - Dim the input section (50% opacity) while generating - Truncate long prompts to 150 chars with ellipsis for clean display _Generated with `mux`_
1 parent 8376423 commit 537020e

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

src/browser/components/ChatInput/CreationCenterContent.tsx

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,35 @@ import React from "react";
33
interface CreationCenterContentProps {
44
projectName: string;
55
isSending: boolean;
6+
inputPreview?: string;
67
}
78

89
/**
910
* Center content displayed during workspace creation
10-
* Shows either a loading spinner or welcome message
11+
* Shows either a loading state with the user's prompt or welcome message
1112
*/
12-
export function CreationCenterContent({ projectName, isSending }: CreationCenterContentProps) {
13+
export function CreationCenterContent(props: CreationCenterContentProps) {
14+
// Truncate long prompts for preview display
15+
const truncatedPreview =
16+
props.inputPreview && props.inputPreview.length > 150
17+
? props.inputPreview.slice(0, 150) + "..."
18+
: props.inputPreview;
19+
1320
return (
1421
<div className="flex flex-1 items-center justify-center">
15-
{isSending ? (
16-
<div className="text-center">
17-
<div className="bg-accent mb-3 inline-block h-8 w-8 animate-spin rounded-full border-4 border-solid border-current border-r-transparent"></div>
18-
<p className="text-muted text-sm">Creating workspace...</p>
22+
{props.isSending ? (
23+
<div className="max-w-xl px-8 text-center">
24+
<div className="bg-accent mb-4 inline-block h-8 w-8 animate-spin rounded-full border-4 border-solid border-current border-r-transparent"></div>
25+
<h2 className="text-foreground mb-2 text-lg font-medium">Creating workspace</h2>
26+
{truncatedPreview && (
27+
<p className="text-muted text-sm leading-relaxed">
28+
Generating name for &ldquo;{truncatedPreview}&rdquo;
29+
</p>
30+
)}
1931
</div>
2032
) : (
2133
<div className="max-w-2xl px-8 text-center">
22-
<h1 className="text-foreground mb-4 text-2xl font-semibold">{projectName}</h1>
34+
<h1 className="text-foreground mb-4 text-2xl font-semibold">{props.projectName}</h1>
2335
<p className="text-muted text-sm leading-relaxed">
2436
Describe what you want to build. A new workspace will be created with an automatically
2537
generated branch name. Configure runtime and model options below.

src/browser/components/ChatInput/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -971,12 +971,16 @@ export const ChatInput: React.FC<ChatInputProps> = (props) => {
971971
<CreationCenterContent
972972
projectName={props.projectName}
973973
isSending={creationState.isSending || isSending}
974+
inputPreview={creationState.isSending || isSending ? input : undefined}
974975
/>
975976
)}
976977

977-
{/* Input section */}
978+
{/* Input section - dim when creating workspace */}
978979
<div
979-
className="bg-separator border-border-light relative flex flex-col gap-1 border-t px-[15px] pt-[5px] pb-[15px]"
980+
className={cn(
981+
"bg-separator border-border-light relative flex flex-col gap-1 border-t px-[15px] pt-[5px] pb-[15px]",
982+
variant === "creation" && (creationState.isSending || isSending) && "opacity-50"
983+
)}
980984
data-component="ChatInputSection"
981985
>
982986
<div className="mx-auto w-full max-w-4xl">

0 commit comments

Comments
 (0)