Skip to content

Commit 39b873e

Browse files
committed
Add yellow active border color to prompt field for empty context warning
- the border on the prompt field should be yellow when we show warning underneath ├── apps │ └── editor │ └── src │ └── views │ └── prompt │ └── frontend │ └── Main │ └── MainView │ └── MainView.tsx └── packages └── ui └── src └── components └── editor ├── chats │ └── Progress │ └── Progress.tsx ├── common │ └── prompts │ ├── PromptField │ │ ├── PromptField.module.scss │ │ ├── PromptField.stories.tsx │ │ ├── PromptField.tsx │ │ ├── hooks │ │ │ ├── use-drag-drop.ts │ │ │ ├── use-dropdown.ts │ │ │ ├── use-ghost-text.ts │ │ │ ├── use-handlers │ │ │ │ ├── handle-copy.ts │ │ │ │ ├── handle-cut.ts │ │ │ │ ├── handle-input-change.ts │ │ │ │ ├── handle-input-click.ts │ │ │ │ ├── handle-key-down.ts │ │ │ │ ├── handle-paste.ts │ │ │ │ ├── handle-submit.ts │ │ │ │ ├── index.ts │ │ │ │ ├── types.ts │ │ │ │ ├── use-handlers.ts │ │ │ │ └── utils.ts │ │ │ └── use-keyboard-shortcuts.ts │ │ └── index.ts │ ├── Template │ │ ├── Template.module.scss │ │ ├── Template.tsx │ │ └── index.ts │ └── shared │ └── symbols │ ├── caret.ts │ ├── get-highlighted-text.tsx │ ├── index.ts │ ├── position-mapping.ts │ ├── prompt-symbols.module.scss │ ├── reconstruct-raw-value.ts │ └── use-symbol-deletion.ts └── prompt ├── ResponsePreview │ └── components │ └── FileItem │ └── FileItem.tsx └── modals ├── OngoingApiCallsModal │ └── OngoingApiCallsModal.tsx └── ProgressModal └── ProgressModal.tsx
1 parent bbf44d2 commit 39b873e

3 files changed

Lines changed: 19 additions & 9 deletions

File tree

‎apps/editor/src/views/prompt/frontend/Main/MainView/MainView.tsx‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -413,13 +413,15 @@ export const MainView: React.FC<Props> = (props) => {
413413
target={props.target}
414414
on_target_change={(target) => props.on_target_change(target)}
415415
active_border_color={
416-
props.target == TARGET.WEB
417-
? props.web_prompt_type == 'edit-files'
418-
? 'blue'
419-
: 'purple'
420-
: props.api_prompt_type == 'edit-files'
421-
? 'blue'
422-
: 'purple'
416+
context_is_empty_warning
417+
? 'yellow'
418+
: props.target == TARGET.WEB
419+
? props.web_prompt_type == 'edit-files'
420+
? 'blue'
421+
: 'purple'
422+
: props.api_prompt_type == 'edit-files'
423+
? 'blue'
424+
: 'purple'
423425
}
424426
on_paste_image={props.on_paste_image}
425427
on_open_image={props.on_open_image}

‎packages/ui/src/components/editor/common/prompts/PromptField/PromptField.module.scss‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@
3131
}
3232
}
3333

34+
&--active-border-yellow {
35+
&:focus-within {
36+
border-color: var(--cwc-yellow-foreground);
37+
}
38+
}
39+
3440
&--selecting {
3541
.keyword {
3642
pointer-events: none;

‎packages/ui/src/components/editor/common/prompts/PromptField/PromptField.tsx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export type PromptFieldProps = {
9191
is_copy_only?: boolean
9292
target: Target
9393
on_target_change: (target: Target) => void
94-
active_border_color?: 'blue' | 'purple'
94+
active_border_color?: 'blue' | 'purple' | 'yellow'
9595
translations: {
9696
voice_input: string
9797
stop_recording: string
@@ -887,7 +887,9 @@ export const PromptField: React.FC<PromptFieldProps> = (props) => {
887887
[styles['container__inner--active-border-blue']]:
888888
props.active_border_color === 'blue',
889889
[styles['container__inner--active-border-purple']]:
890-
props.active_border_color === 'purple'
890+
props.active_border_color === 'purple',
891+
[styles['container__inner--active-border-yellow']]:
892+
props.active_border_color === 'yellow'
891893
})}
892894
onKeyDown={handle_container_key_down}
893895
onClick={() => input_ref.current?.focus()}

0 commit comments

Comments
 (0)