Skip to content

Commit 2fb950f

Browse files
committed
Restore browser extension message component and position below web configurations
- restore name and styling of what's now called 'BrowserExtensionNotice' [Commit] ├── apps │ └── editor │ └── src │ ├── commands │ │ ├── code-at-cursor-command │ │ │ └── utils │ │ │ ├── get-code-at-cursor-config.ts │ │ │ └── perform-code-at-cursor.ts │ │ └── generate-commit-message-commands │ │ ├── actions │ │ │ └── run-generate-action.ts │ │ └── utils │ │ └── get-commit-message-config.ts │ ├── features │ │ └── search-files │ │ └── search-modes │ │ └── perform-intelligent-search-mode.ts │ ├── i18n │ │ └── translations │ │ └── common.ts │ ├── utils │ │ ├── ascii-tree │ │ │ ├── ascii-tree.ts │ │ │ ├── index.ts │ │ │ └── utils.ts │ │ └── show-no-configurations-warning.ts │ └── views │ ├── prompt │ │ ├── backend │ │ │ └── message-handlers │ │ │ ├── handle-at-sign-quick-pick │ │ │ │ └── handle-at-sign-quick-pick.ts │ │ │ ├── handle-autofill.ts │ │ │ └── utils │ │ │ └── intelligent-update-utils.ts │ │ └── frontend │ │ ├── Main │ │ │ └── MainView │ │ │ └── MainView.tsx │ │ └── Prompt.tsx │ └── settings │ └── helpers │ └── open-settings.ts └── packages └── ui └── src ├── components │ └── editor │ ├── common │ │ └── TextButton │ │ └── TextButton.tsx │ └── prompt │ └── BrowserExtensionMessage │ ├── BrowserExtensionMessage.module.scss │ ├── BrowserExtensionMessage.stories.tsx │ ├── BrowserExtensionMessage.tsx │ └── index.ts └── styles └── foundation └── _colors.scss
1 parent a90c266 commit 2fb950f

9 files changed

Lines changed: 88 additions & 90 deletions

File tree

‎apps/editor/src/views/prompt/frontend/Main/MainView/MainView.module.scss‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,3 @@
1616
margin: 0 10px;
1717
}
1818
}
19-
20-
.notices {
21-
display: flex;
22-
flex-direction: column;
23-
border-bottom-left-radius: 6px;
24-
border-bottom-right-radius: 6px;
25-
overflow: hidden;
26-
margin: 0 20px;
27-
28-
:global([data-modern-ui='true']) & {
29-
margin: 0 18px;
30-
}
31-
}

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

Lines changed: 62 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { EditFormat } from '@shared/types/edit-format'
1010
import { TARGET, Target } from '@shared/types/mode'
1111
import { ApiPromptType, WebPromptType } from '@shared/types/prompt-types'
1212
import { Scrollable as UiScrollable } from '@ui/components/editor/common/Scrollable'
13-
import { BrowserExtensionNotice as UiBrowserExtensionNotice } from '@ui/components/editor/prompt/BrowserExtensionNotice'
13+
import { BrowserExtensionMessage as UiBrowserExtensionMessage } from '@ui/components/editor/prompt/BrowserExtensionMessage'
1414
import { ApiConfiguration } from '@/views/prompt/types/messages'
1515
import { use_last_choice_tooltip } from './hooks/use-last-choice-tooltip'
1616
import { Header } from './components/Header'
@@ -364,72 +364,70 @@ export const MainView: React.FC<Props> = (props) => {
364364
/>
365365
</div>
366366

367-
<div className={styles['notices']}>
368-
<UiPromptNotice
369-
warning={
370-
context_is_empty_warning
371-
? t('common.context-is-empty')
372-
: undefined
373-
}
374-
token_count={props.selected_files_token_count}
375-
files_count={
376-
context_is_empty_warning
377-
? undefined
378-
: props.selected_files.length
379-
}
380-
translations={{
381-
attaching_files: t('selected-files.attaching-files')
382-
}}
383-
/>
384-
{props.target == TARGET.WEB && !props.is_connected && (
385-
<UiBrowserExtensionNotice />
386-
)}
387-
</div>
367+
<UiPromptNotice
368+
warning={
369+
context_is_empty_warning
370+
? t('common.context-is-empty')
371+
: undefined
372+
}
373+
token_count={props.selected_files_token_count}
374+
files_count={
375+
context_is_empty_warning ? undefined : props.selected_files.length
376+
}
377+
translations={{
378+
attaching_files: t('selected-files.attaching-files')
379+
}}
380+
/>
388381

389382
<UiSeparator height={6} />
390383

391-
{props.target == TARGET.WEB && props.is_connected && (
392-
<UiConfigurations
393-
configurations={web_configurations}
394-
disable_invocation={
395-
context_is_empty_warning || !props.is_connected
396-
}
397-
on_create={(params) => {
398-
props.on_create_web_configuration(params)
399-
}}
400-
on_configuration_click={(id) => {
401-
props.initialize_chats({
402-
web_configuration_name: id,
403-
show_quick_pick: false
404-
})
405-
}}
406-
on_edit={(id) => props.on_web_configuration_edit(id)}
407-
on_reorder={(reordered) => {
408-
const new_web_configurations = reordered.map((c) => {
409-
return props.web_configurations.find(
410-
(p, i) => (p.name ?? `unnamed-${i}`) == c.id
411-
)!
412-
})
413-
props.on_web_configurations_reorder(new_web_configurations)
414-
}}
415-
on_delete={(id) => {
416-
props.on_delete_web_configuration(id)
417-
}}
418-
on_toggle_pinned={(id) => {
419-
props.on_toggle_web_configuration_pinned(id)
420-
}}
421-
selected_configuration_id={props.selected_web_configuration_name}
422-
translations={{
423-
empty: t('configurations.empty'),
424-
add_new: t('action.add-new'),
425-
pin: t('action.pin'),
426-
unpin: t('action.unpin'),
427-
insert: t('action.insert-configuration'),
428-
edit: t('action.edit'),
429-
delete: t('action.delete')
430-
}}
431-
/>
432-
)}
384+
{props.target == TARGET.WEB &&
385+
(props.is_connected ? (
386+
<UiConfigurations
387+
configurations={web_configurations}
388+
disable_invocation={
389+
context_is_empty_warning || !props.is_connected
390+
}
391+
on_create={(params) => {
392+
props.on_create_web_configuration(params)
393+
}}
394+
on_configuration_click={(id) => {
395+
props.initialize_chats({
396+
web_configuration_name: id,
397+
show_quick_pick: false
398+
})
399+
}}
400+
on_edit={(id) => props.on_web_configuration_edit(id)}
401+
on_reorder={(reordered) => {
402+
const new_web_configurations = reordered.map((c) => {
403+
return props.web_configurations.find(
404+
(p, i) => (p.name ?? `unnamed-${i}`) == c.id
405+
)!
406+
})
407+
props.on_web_configurations_reorder(new_web_configurations)
408+
}}
409+
on_delete={(id) => {
410+
props.on_delete_web_configuration(id)
411+
}}
412+
on_toggle_pinned={(id) => {
413+
props.on_toggle_web_configuration_pinned(id)
414+
}}
415+
selected_configuration_id={
416+
props.selected_web_configuration_name
417+
}
418+
translations={{
419+
empty: t('configurations.empty'),
420+
add_new: t('action.add-new'),
421+
pin: t('action.pin'),
422+
unpin: t('action.unpin'),
423+
insert: t('action.insert-configuration'),
424+
edit: t('action.edit'),
425+
delete: t('action.delete')
426+
}}
427+
/>
428+
) : (
429+
<UiBrowserExtensionMessage />
430+
))}
433431

434432
{props.target == TARGET.API && (
435433
<UiConfigurations

packages/ui/src/components/editor/prompt/BrowserExtensionNotice/BrowserExtensionNotice.module.scss renamed to packages/ui/src/components/editor/prompt/BrowserExtensionMessage/BrowserExtensionMessage.module.scss

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@
33
padding: 4px 7px;
44
background: linear-gradient(
55
135deg,
6-
var(--cwc-bg-blue) 0%,
7-
var(--cwc-bg-green) 100%
6+
rgba(255, 0, 221, 0.1) 0%,
7+
rgba(37, 94, 209, 0.1) 100%
88
);
9-
color: var(--cwc-text-color);
9+
color: var(--vscode-inputOption-activeForeground);
10+
border-radius: 6px;
11+
margin: 0 20px;
12+
13+
:global([data-modern-ui='true']) & {
14+
margin: 0 18px;
15+
}
1016
}
1117

1218
.heading {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { BrowserExtensionMessage } from './BrowserExtensionMessage'
2+
3+
export default {
4+
component: BrowserExtensionMessage
5+
}
6+
7+
export const Primary = () => <BrowserExtensionMessage />

packages/ui/src/components/editor/prompt/BrowserExtensionNotice/BrowserExtensionNotice.tsx renamed to packages/ui/src/components/editor/prompt/BrowserExtensionMessage/BrowserExtensionMessage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { use_compacting } from '@shared/hooks/use-compacting'
2-
import styles from './BrowserExtensionNotice.module.scss'
2+
import styles from './BrowserExtensionMessage.module.scss'
33

4-
export const BrowserExtensionNotice: React.FC = () => {
4+
export const BrowserExtensionMessage: React.FC = () => {
55
const { container_ref, compact_step } = use_compacting()
66

77
return (
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './BrowserExtensionMessage'

‎packages/ui/src/components/editor/prompt/BrowserExtensionNotice/BrowserExtensionNotice.stories.tsx‎

Lines changed: 0 additions & 7 deletions
This file was deleted.

‎packages/ui/src/components/editor/prompt/BrowserExtensionNotice/index.ts‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎packages/ui/src/components/editor/prompt/PromptNotice/PromptNotice.module.scss‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
align-items: center;
55
height: var(--height);
66
padding: 0 8px 0 5px;
7+
border-bottom-left-radius: 6px;
8+
border-bottom-right-radius: 6px;
9+
margin: 0 20px;
10+
11+
:global([data-modern-ui='true']) & {
12+
margin: 0 18px;
13+
}
714
}
815

916
.warning {

0 commit comments

Comments
 (0)