-
Notifications
You must be signed in to change notification settings - Fork 3.5k
feat: redesign workflow canvas UI w improved UX #3939
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
adithyaakrishna
wants to merge
6
commits into
simstudioai:staging
Choose a base branch
from
adithyaakrishna:feat/ui
base: staging
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
90971fb
chore: fix conflicts
adithyaakrishna a1ee666
chore: fix conflicts
adithyaakrishna 73a7dcf
chore: fix conflicts
adithyaakrishna 476e6aa
chore: remove unnecessary changes
adithyaakrishna 3db31a4
chore: fix review changes
adithyaakrishna e27b506
chore: fix review changes
adithyaakrishna File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
chore: fix conflicts
- Loading branch information
commit a1ee666f4606ae9a301ecb23bc2310655d1a0f2d
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
...sim/app/workspace/[workspaceId]/w/[workflowId]/components/copilot-input/copilot-input.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| 'use client' | ||
|
|
||
| import { memo, useCallback, useRef, useState } from 'react' | ||
| import { ArrowUp, Bot } from 'lucide-react' | ||
| import { Button, Tooltip } from '@/components/emcn' | ||
| import { cn } from '@/lib/core/utils/cn' | ||
| import { usePanelStore } from '@/stores/panel' | ||
|
|
||
| const SEND_BUTTON_BASE = 'h-[28px] w-[28px] rounded-full border-0 p-0 transition-colors' | ||
| const SEND_BUTTON_ACTIVE = | ||
| 'bg-[#383838] hover:bg-[#575757] dark:bg-[#E0E0E0] dark:hover:bg-[#CFCFCF]' | ||
| const SEND_BUTTON_DISABLED = 'bg-[#808080] dark:bg-[#808080]' | ||
|
|
||
| /** | ||
| * Floating copilot input that appears centered on the canvas when the panel | ||
| * is collapsed. Provides a quick entry point to the copilot — on submit, | ||
| * the message is forwarded to the panel store and the copilot tab opens. | ||
| */ | ||
| export const CopilotInput = memo(function CopilotInput() { | ||
| const isPanelOpen = usePanelStore((s) => s.isPanelOpen) | ||
| const setPendingCopilotMessage = usePanelStore((s) => s.setPendingCopilotMessage) | ||
|
|
||
| const [value, setValue] = useState('') | ||
| const inputRef = useRef<HTMLInputElement>(null) | ||
|
|
||
| const canSubmit = value.trim().length > 0 | ||
|
|
||
| const handleSubmit = useCallback(() => { | ||
| const trimmed = value.trim() | ||
| if (!trimmed) return | ||
| setPendingCopilotMessage(trimmed) | ||
| setValue('') | ||
| if (inputRef.current) { | ||
| inputRef.current.value = '' | ||
| } | ||
| }, [value, setPendingCopilotMessage]) | ||
|
|
||
| const handleKeyDown = useCallback( | ||
| (e: React.KeyboardEvent<HTMLInputElement>) => { | ||
| if (e.key === 'Enter') { | ||
| e.preventDefault() | ||
| handleSubmit() | ||
| } | ||
| }, | ||
| [handleSubmit] | ||
| ) | ||
|
|
||
| const handleChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => { | ||
| setValue(e.target.value) | ||
| }, []) | ||
|
|
||
| if (isPanelOpen) return null | ||
|
|
||
| return ( | ||
| <div className='pointer-events-none absolute inset-x-0 bottom-6 z-10 flex justify-center'> | ||
| <div className='pointer-events-auto flex h-[44px] w-full max-w-[520px] items-center gap-2 rounded-xl border border-[var(--border-1)] bg-[var(--white)] px-3 shadow-sm dark:bg-[var(--surface-4)]'> | ||
| <Tooltip.Root> | ||
| <Tooltip.Trigger asChild> | ||
| <div className='flex h-5 w-5 flex-shrink-0 items-center justify-center'> | ||
| <Bot className='h-4 w-4 text-[var(--text-muted)]' /> | ||
| </div> | ||
| </Tooltip.Trigger> | ||
| <Tooltip.Content side='top'>Ask the copilot</Tooltip.Content> | ||
| </Tooltip.Root> | ||
| <input | ||
| ref={inputRef} | ||
| type='text' | ||
| value={value} | ||
| onChange={handleChange} | ||
| onKeyDown={handleKeyDown} | ||
| placeholder='Ask copilot anything...' | ||
| className='h-full min-w-0 flex-1 border-0 bg-transparent text-[14px] text-[var(--text-primary)] outline-none placeholder:text-[var(--text-subtle)] focus-visible:ring-0' | ||
| autoComplete='off' | ||
| autoCorrect='off' | ||
| spellCheck={false} | ||
| /> | ||
| <Button | ||
| variant='ghost' | ||
| onClick={handleSubmit} | ||
| disabled={!canSubmit} | ||
| className={cn( | ||
| SEND_BUTTON_BASE, | ||
| canSubmit ? SEND_BUTTON_ACTIVE : SEND_BUTTON_DISABLED, | ||
| 'flex-shrink-0' | ||
| )} | ||
| aria-label='Send message' | ||
| > | ||
| <ArrowUp | ||
| className='block h-[16px] w-[16px] text-white dark:text-black' | ||
| strokeWidth={2.25} | ||
| /> | ||
| </Button> | ||
| </div> | ||
| </div> | ||
| ) | ||
| }) | ||
1 change: 1 addition & 0 deletions
1
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hover:used instead ofhover-hover:, and hardcoded hex valuesTwo issues on these constants:
SEND_BUTTON_ACTIVEuseshover:bg-[#575757]anddark:hover:bg-[#CFCFCF]. Throughout the rest of the codebase (panel.tsx,workflow-toolbar.tsx,workflow-history.tsx, etc.) the project exclusively uses thehover-hover:media-query variant to avoid hover states activating on touch devices. Usinghover:here is inconsistent and will fire on touch screens.The hex colors (
#383838,#575757,#E0E0E0,#808080) are hardcoded rather than referencing CSS custom properties, breaking the design-token system used everywhere else.Consider replacing with
hover-hover:variants and mapping to the nearest design tokens (e.g.bg-[var(--surface-5)],hover-hover:bg-[var(--surface-6)]).