Skip to content

Commit dd2789e

Browse files
committed
Replace browser extension banner with connection status component and update color variables to yellow
- add missing translations [Fragment] - create component similar to `packages/ui/src/components/editor/prompt/PromptAttachments/PromptAttachments.tsx` but name it 'Browser connection status'. Place below [Fragment]. Should be green with text 'Connected!', or yellow with text 'Install in web browser' - in `packages/ui/src/components/editor/prompt/BrowserConnectionStatus/BrowserConnectionStatus.tsx` add 'install' action shown when not connected, and 'hide' action, shown when connected. style these actions similarly to actions of `packages/ui/src/components/editor/prompt/ResponsePreview/components/FileItem/FileItem.tsx` - handle closing internally, not by prop, reset closed state on disconnect - hanld 'on install' through a quick pick showing 2 appropriate options - on file list, should search in descriptions as well ├── apps │ └── editor │ └── src │ ├── commands │ │ ├── apply-response-command │ │ │ └── utils │ │ │ └── preview │ │ │ ├── index.ts │ │ │ └── vscode-ui.ts │ │ ├── generate-commit-message-commands │ │ │ ├── generate-commit-message-commands.ts │ │ │ ├── index.ts │ │ │ └── utils │ │ │ ├── generate-commit-message-with-api.ts │ │ │ ├── get-commit-message-config.ts │ │ │ └── strip-wrapping-quotes.ts │ │ └── rate-extension-command.ts │ ├── constants │ │ ├── instructions.ts │ │ ├── state-keys.ts │ │ └── values.ts │ ├── features │ │ └── checkpoints │ │ └── actions │ │ ├── create-checkpoint.ts │ │ └── index.ts │ ├── i18n │ │ ├── index.ts │ │ └── translations │ │ ├── commands │ │ │ ├── index.ts │ │ │ ├── install-browser-extension.ts │ │ │ └── rate-extension.ts │ │ └── views │ │ └── shared │ │ └── actions │ │ └── web │ │ └── create.ts │ ├── services │ │ ├── model-providers-manager.ts │ │ └── websocket-manager.ts │ ├── utils │ │ ├── apply-reasoning-effort.ts │ │ ├── ascii-tree │ │ │ ├── ascii-tree.ts │ │ │ └── index.ts │ │ ├── commit-message-details.ts │ │ ├── files-collector.ts │ │ ├── git-repository-utils.ts │ │ ├── normalize-path.ts │ │ ├── prompt-builder.ts │ │ ├── send-llm-message.ts │ │ ├── show-configuration-quick-pick.ts │ │ └── show-no-configurations-warning.ts │ └── views │ └── prompt │ ├── backend │ │ ├── message-handlers │ │ │ ├── handle-at-sign-quick-pick │ │ │ │ └── handle-at-sign-quick-pick.ts │ │ │ ├── handle-hash-sign-quick-pick │ │ │ │ └── handle-hash-sign-quick-pick.ts │ │ │ ├── handle-install-browser-extension.ts │ │ │ ├── handle-pick-tasks-workspace.ts │ │ │ ├── handle-select-edit-format-instructions.ts │ │ │ ├── handle-template-quick-pick.ts │ │ │ └── index.ts │ │ └── prompt-view-provider.ts │ ├── frontend │ │ ├── Main │ │ │ ├── Main.tsx │ │ │ └── MainView │ │ │ └── MainView.tsx │ │ ├── Prompt.tsx │ │ └── hooks │ │ └── use-prompt │ │ └── use-prompt.ts │ └── types │ └── messages.ts └── packages ├── shared │ └── src │ ├── constants │ │ ├── chatbots.ts │ │ └── dictionary.ts │ └── utils │ ├── display-token-count.ts │ └── logger.ts └── ui └── src ├── components │ └── editor │ └── prompt │ ├── BrowserConnectionStatus │ │ ├── BrowserConnectionStatus.module.scss │ │ ├── BrowserConnectionStatus.stories.tsx │ │ ├── BrowserConnectionStatus.tsx │ │ └── index.ts │ ├── BrowserExtensionMessage │ │ ├── BrowserExtensionMessage.module.scss │ │ ├── BrowserExtensionMessage.stories.tsx │ │ ├── BrowserExtensionMessage.tsx │ │ └── index.ts │ ├── PromptAttachments │ │ ├── PromptAttachments.module.scss │ │ ├── PromptAttachments.stories.tsx │ │ ├── PromptAttachments.tsx │ │ └── index.ts │ └── ResponsePreview │ └── components │ └── FileItem │ ├── FileItem.module.scss │ └── FileItem.tsx └── styles └── foundation └── _colors.scss
1 parent 9987a68 commit dd2789e

28 files changed

Lines changed: 364 additions & 62 deletions

File tree

‎apps/editor/src/i18n/translations/commands/index.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { translations as new_file } from './new-file'
1212
import { translations as new_folder } from './new-folder'
1313
import { translations as rename } from './rename'
1414
import { translations as rate_extension } from './rate-extension'
15+
import { translations as install_browser_extension } from './install-browser-extension'
1516
import { translations as select_unstaged_files } from './select-unstaged-files'
1617
import { translations as select_files_of_commit } from './select-files-of-commit'
1718
import { translations as history } from './history'
@@ -36,6 +37,7 @@ export const translations = {
3637
...new_folder,
3738
...rename,
3839
...rate_extension,
40+
...install_browser_extension,
3941
...select_unstaged_files,
4042
...select_files_of_commit,
4143
...history,
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
export const translations = {
2+
'command.install-browser-extension.title': {
3+
en: 'Browser Extension Stores',
4+
pl: 'Sklepy z rozszerzeniami przeglądarki',
5+
'zh-cn': '浏览器扩展商店',
6+
ja: 'ブラウザの拡張機能ストア',
7+
'zh-tw': '瀏覽器擴充功能商店',
8+
de: 'Browser-Erweiterungsstores',
9+
es: 'Tiendas de extensiones del navegador',
10+
fr: 'Boutiques d’extensions du navigateur',
11+
'pt-br': 'Lojas de extensões do navegador',
12+
ru: 'Магазины расширений браузера',
13+
ko: '브라우저 확장 프로그램 스토어',
14+
it: 'Store di estensioni del browser',
15+
tr: 'Tarayıcı Uzantı Mağazaları',
16+
cs: 'Obchody s rozšířeními prohlížeče',
17+
hu: 'Böngésző bővítményboltok',
18+
bg: 'Магазини за разширения на браузъра'
19+
},
20+
'command.install-browser-extension.placeholder': {
21+
en: "Select a browser's extension store",
22+
pl: 'Wybierz sklep z rozszerzeniami przeglądarki',
23+
'zh-cn': '选择浏览器扩展商店',
24+
ja: 'ブラウザの拡張機能ストアを選択',
25+
'zh-tw': '選擇瀏覽器擴充功能商店',
26+
de: 'Browser-Erweiterungsstore auswählen',
27+
es: 'Seleccione la tienda de extensiones del navegador',
28+
fr: 'Sélectionnez la boutique d’extensions du navigateur',
29+
'pt-br': 'Selecione a loja de extensões do navegador',
30+
ru: 'Выберите магазин расширений браузера',
31+
ko: '브라우저 확장 프로그램 스토어 선택',
32+
it: 'Seleziona lo store di estensioni del browser',
33+
tr: 'Tarayıcı uzantı mağazasını seçin',
34+
cs: 'Vyberte obchod s rozšířeními prohlížeče',
35+
hu: 'Válassza ki a böngésző bővítményboltját',
36+
bg: 'Изберете магазин за разширения на браузъра'
37+
}
38+
} as const

‎apps/editor/src/i18n/translations/views/shared/actions/web/create.ts‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,21 @@ export const translations = {
5454
bg: 'Чатботове'
5555
},
5656
'views.shared.actions.web.create.chatbots.placeholder': {
57-
en: 'Choose a chatbot for the new web configuration',
58-
pl: 'Wybierz chatbota dla nowej konfiguracji sieci Web',
59-
'zh-cn': '为新的 Web 配置选择一个聊天机器人',
60-
ja: '新しいWeb構成用のチャットボットを選択',
61-
'zh-tw': '為新的 Web 配置選擇一個聊天機器人',
62-
de: 'Wählen Sie einen Chatbot für die neue Web-Konfiguration',
63-
es: 'Elige un chatbot para la nueva configuración web',
64-
fr: 'Choisissez un chatbot pour la nouvelle configuration web',
65-
'pt-br': 'Escolha um chatbot para a nova configuração web',
66-
ru: 'Выберите чат-бота для новой веб-конфигурации',
67-
ko: '새 웹 구성에 사용할 챗봇 선택',
68-
it: 'Scegli un chatbot per la nuova configurazione web',
69-
tr: 'Yeni web yapılandırması için bir sohbet robotu seçin',
70-
cs: 'Vyberte chatbota pro novou webovou konfiguraci',
71-
hu: 'Válasszon chatbotot az új webes konfigurációhoz',
72-
bg: 'Изберете чатбот за новата уеб конфигурация'
57+
en: 'Choose a chatbot for the new configuration',
58+
pl: 'Wybierz chatbota dla nowej konfiguracji',
59+
'zh-cn': '为新配置选择一个聊天机器人',
60+
ja: '新しい構成用のチャットボットを選択してください',
61+
'zh-tw': '為新設定選擇一個聊天機器人',
62+
de: 'Wählen Sie einen Chatbot für die neue Konfiguration',
63+
es: 'Elige un chatbot para la nueva configuración',
64+
fr: 'Choisissez un chatbot pour la nouvelle configuration',
65+
'pt-br': 'Escolha um chatbot para a nova configuração',
66+
ru: 'Выберите чат-бота для новой конфигурации',
67+
ko: '새 구성에 사용할 챗봇을 선택하세요',
68+
it: 'Scegli un chatbot per la nuova configurazione',
69+
tr: 'Yeni yapılandırma için bir sohbet robotu seçin',
70+
cs: 'Vyberte chatbota pro novou konfiguraci',
71+
hu: 'Válasszon egy chatbotot az új konfigurációhoz',
72+
bg: 'Изберете чатбот за новата конфигурация'
7373
}
7474
} as const

‎apps/editor/src/utils/git-repository-utils.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ export const prepare_staged_changes = async (params: {
362362
}
363363

364364
quick_pick.canSelectMany = true
365+
quick_pick.matchOnDescription = true
365366
quick_pick.title = t('command.generate-commit-message.unstaged-files')
366367
quick_pick.placeholder = t(
367368
'command.generate-commit-message.select-files'
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import * as vscode from 'vscode'
2+
import { t } from '@/i18n'
3+
4+
export const handle_install_browser_extension = async (): Promise<void> => {
5+
const quick_pick = vscode.window.createQuickPick<
6+
vscode.QuickPickItem & { url: string }
7+
>()
8+
quick_pick.title = t('command.install-browser-extension.title')
9+
quick_pick.placeholder = t('command.install-browser-extension.placeholder')
10+
11+
quick_pick.items = [
12+
{
13+
label: 'Chrome Web Store',
14+
description: 'chromewebstore.google.com',
15+
url: 'https://chromewebstore.google.com/detail/autofill-for-code-web-chat/ljookipcanaglfaocjbgdicfbdhhjffp'
16+
},
17+
{
18+
label: 'Firefox Add-ons',
19+
description: 'addons.mozilla.org',
20+
url: 'https://addons.mozilla.org/en-US/firefox/addon/autofill-for-code-web-chat/'
21+
}
22+
]
23+
24+
const close_button = {
25+
iconPath: new vscode.ThemeIcon('close'),
26+
tooltip: t('common.close')
27+
}
28+
29+
quick_pick.buttons = [close_button]
30+
31+
quick_pick.onDidTriggerButton((button) => {
32+
if (button === close_button) {
33+
quick_pick.hide()
34+
}
35+
})
36+
37+
quick_pick.onDidAccept(() => {
38+
const selected = quick_pick.selectedItems[0]
39+
if (selected && selected.url) {
40+
vscode.env.openExternal(vscode.Uri.parse(selected.url))
41+
quick_pick.hide()
42+
}
43+
})
44+
45+
quick_pick.onDidHide(() => {
46+
quick_pick.dispose()
47+
})
48+
49+
quick_pick.show()
50+
}

‎apps/editor/src/views/prompt/backend/message-handlers/index.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,4 @@ export * from './handle-update-last-used-web-configuration'
6767
export * from './handle-request-return-home'
6868
export * from './handle-pick-tasks-workspace'
6969
export * from './handle-preview-prompt'
70+
export * from './handle-install-browser-extension'

‎apps/editor/src/views/prompt/backend/prompt-view-provider.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ import {
8080
handle_update_last_used_web_configuration,
8181
handle_request_return_home,
8282
handle_pick_tasks_workspace,
83-
handle_preview_prompt
83+
handle_preview_prompt,
84+
handle_install_browser_extension
8485
} from './message-handlers'
8586
import { handle_update_api_configuration } from './message-handlers/handle-update-api-configuration'
8687
import { handle_pick_model_provider } from './message-handlers/handle-pick-model-provider'
@@ -863,6 +864,8 @@ export class PromptViewProvider implements vscode.WebviewViewProvider {
863864
await handle_preview_prompt({
864865
prompt_view_provider: this
865866
})
867+
} else if (message.command == 'INSTALL_BROWSER_EXTENSION') {
868+
await handle_install_browser_extension()
866869
}
867870
} catch (error: any) {
868871
Logger.error({

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,12 @@ export const Main: React.FC<Props> = (props) => {
391391
})
392392
}
393393

394+
const handle_install_browser_extension = () => {
395+
post_message(props.vscode, {
396+
command: 'INSTALL_BROWSER_EXTENSION'
397+
})
398+
}
399+
394400
const handle_api_configuration_click = (id: string) => {
395401
const instruction = get_current_instructions()
396402

@@ -539,6 +545,7 @@ export const Main: React.FC<Props> = (props) => {
539545
voice_input_push_to_talk={props.voice_input_push_to_talk}
540546
bottom_spacer_height={props.bottom_spacer_height}
541547
on_preview_prompt={props.on_preview_prompt}
548+
on_install_browser_extension={handle_install_browser_extension}
542549
/>
543550
)
544551
}

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

Lines changed: 15 additions & 8 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 { BrowserExtensionMessage as UiBrowserExtensionMessage } from '@ui/components/editor/prompt/BrowserExtensionMessage'
13+
import { BrowserConnectionStatus as UiBrowserConnectionStatus } from '@ui/components/editor/prompt/BrowserConnectionStatus'
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'
@@ -110,6 +110,7 @@ type Props = {
110110
voice_input_push_to_talk: boolean
111111
bottom_spacer_height?: number
112112
on_preview_prompt: () => void
113+
on_install_browser_extension: () => void
113114
}
114115

115116
const chatbot_to_icon: Record<keyof typeof CHATBOTS, Icon.Variant> = {
@@ -246,6 +247,19 @@ export const MainView: React.FC<Props> = (props) => {
246247
/>
247248
<UiScrollable scroll_to_top_key={props.scroll_reset_key} top_shadow>
248249
<div className={styles.container}>
250+
{props.target == TARGET.WEB && (
251+
<UiBrowserConnectionStatus
252+
is_connected={props.is_connected}
253+
on_install={props.on_install_browser_extension}
254+
translations={{
255+
connected: 'Connected!',
256+
not_connected: 'Not connected',
257+
install: 'Install',
258+
hide: 'Hide'
259+
}}
260+
/>
261+
)}
262+
249263
{props.response_history.length > 0 && (
250264
<UiResponses
251265
response_history={props.response_history}
@@ -379,13 +393,6 @@ export const MainView: React.FC<Props> = (props) => {
379393

380394
<UiSeparator height={6} />
381395

382-
{props.target == TARGET.WEB && !props.is_connected && (
383-
<>
384-
<UiBrowserExtensionMessage />
385-
<UiSeparator height={6} />
386-
</>
387-
)}
388-
389396
{props.target == TARGET.WEB && (
390397
<UiConfigurations
391398
configurations={web_configurations}

‎apps/editor/src/views/prompt/types/messages.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,10 @@ export interface PreviewPromptMessage extends BaseMessage {
516516
command: 'PREVIEW_PROMPT'
517517
}
518518

519+
export interface InstallBrowserExtensionMessage extends BaseMessage {
520+
command: 'INSTALL_BROWSER_EXTENSION'
521+
}
522+
519523
export type FrontendMessage =
520524
| GetInstructionsMessage
521525
| SaveInstructionsMessage
@@ -606,6 +610,7 @@ export type FrontendMessage =
606610
| GetTokenCountMessage
607611
| GetSelectedFilesMessage
608612
| PreviewPromptMessage
613+
| InstallBrowserExtensionMessage
609614

610615
// === FROM BACKEND TO FRONTEND ===
611616
export interface InstructionsMessage extends BaseMessage {

0 commit comments

Comments
 (0)