Skip to content

Commit 8255140

Browse files
committed
Add remote workspace port forwarding notice to forwarded ports settings and support inline code rendering in notices
- add notice in chatbots -> remote machines: "In the remote workspace, forward port `55155` to any port you list below". put port number in monospace like in `packages/ui/src/components/editor/settings-view/Item/Item.tsx` - code background in `packages/ui/src/components/editor/settings-view/Notices/Notices.tsx` should follow notice background, e.g. be blue ├── apps │ └── editor │ └── src │ └── views │ └── settings │ └── frontend │ ├── Home │ │ ├── Home.tsx │ │ └── sections │ │ ├── ApiSection.tsx │ │ ├── CliSection.tsx │ │ ├── GeneralSection.tsx │ │ └── WebSection.tsx │ └── i18n │ └── translations │ └── web.ts └── packages ├── shared │ └── src │ └── constants │ └── websocket.ts └── ui └── src ├── components │ └── editor │ └── settings-view │ ├── ForwardedPorts │ │ ├── ForwardedPorts.module.scss │ │ ├── ForwardedPorts.tsx │ │ └── index.ts │ ├── Group │ │ ├── Group.module.scss │ │ └── Group.tsx │ ├── Item │ │ ├── Item.module.scss │ │ └── Item.tsx │ └── Notices │ ├── Notices.module.scss │ └── Notices.tsx └── styles └── foundation └── _colors.scss
1 parent b3e210a commit 8255140

5 files changed

Lines changed: 79 additions & 19 deletions

File tree

‎apps/editor/src/views/settings/frontend/Home/sections/WebSection.tsx‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,16 @@ export const WebSection = forwardRef<HTMLDivElement, Props>((props, ref) => {
367367
add: t('forwarded-ports.add.action'),
368368
delete: t('forwarded-ports.delete')
369369
}}
370+
notice_slot={
371+
<UiNotices
372+
notices={[
373+
{
374+
type: 'info',
375+
message: t('web.remote-machines.notice')
376+
}
377+
]}
378+
/>
379+
}
370380
/>
371381
</div>
372382
<div

‎apps/editor/src/views/settings/frontend/i18n/translations/web.ts‎

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,26 @@ export const translations = {
22
'web.title': {
33
en: 'Web'
44
},
5+
'web.remote-machines.notice': {
6+
en: 'In the remote workspace, forward port `55155` to any port you list below.',
7+
pl: 'W zdalnym obszarze roboczym przekieruj port `55155` na dowolny port z listy poniżej.',
8+
'zh-cn': '在远程工作区中,将端口 `55155` 转发到您在下方列出的任何端口。',
9+
ja: 'リモートワークスペースで、ポート `55155` を以下にリストされている任意のポートに転送します。',
10+
'zh-tw':
11+
'在遠端工作區中,將通訊埠 `55155` 轉送到您在下方列出的任何通訊埠。',
12+
de: 'Leiten Sie im Remote-Arbeitsbereich Port `55155` an einen beliebigen, unten aufgeführten Port weiter.',
13+
es: 'En el espacio de trabajo remoto, reenvíe el puerto `55155` a cualquier puerto que enumere a continuación.',
14+
fr: "Dans l'espace de travail distant, transférez le port `55155` vers n'importe quel port de la liste ci-dessous.",
15+
'pt-br':
16+
'No espaço de trabalho remoto, encaminhe a porta `55155` para qualquer porta listada abaixo.',
17+
ru: 'В удаленном рабочей области перенаправьте порт `55155` на любой порт из списка ниже.',
18+
ko: '원격 작업 공간에서 포트 `55155`를 아래 나열된 포트 중 하나로 전달하십시오.',
19+
it: 'Nello spazio di lavoro remoto, inoltra la porta `55155` a qualsiasi porta elencata di seguito.',
20+
tr: 'Uzak çalışma alanında, `55155` bağlantı noktasını aşağıda listelediğiniz herhangi bir bağlantı noktasına yönlendirin.',
21+
cs: 'Ve vzdáleném pracovním prostoru přesměrujte port `55155` na libovolný port uvedený níže.',
22+
hu: 'A távoli munkaterületen továbbítsa a `55155`-ös portot az alább felsorolt bármelyik portra.',
23+
bg: 'В отдалеченото работно пространство пренасочете порт `55155` към всеки порт, посочен по-долу.'
24+
},
525
'web.remote-machines.title': {
626
en: 'Remote machines',
727
pl: 'Maszyny zdalne',
@@ -57,23 +77,23 @@ export const translations = {
5777
bg: 'Пренасочени портове'
5878
},
5979
'forwarded-ports.add.description': {
60-
en: "List ports CWC's Websockets server port `55155` is forwarded to.",
61-
pl: 'Wypisz porty, na które przekierowany jest port `55155` serwera Websockets CWC.',
62-
'zh-cn': '列出 CWC 的 Websockets 服务器端口 `55155` 转发到的端口。',
63-
ja: 'CWC の Websockets サーバーポート `55155` が転送されるポートのリスト。',
64-
'zh-tw': '列出 CWC 的 Websockets 伺服器埠 `55155` 轉送到的埠。',
65-
de: 'Liste der Ports, an die der Websockets-Server-Port `55155` von CWC weitergeleitet wird.',
66-
es: 'Lista de puertos a los que se reenvía el puerto `55155` del servidor Websockets de CWC.',
67-
fr: 'Liste des ports vers lesquels le port `55155` du serveur Websockets de CWC est transféré.',
80+
en: "List the forwarded ports for the extension's WebSocket server.",
81+
pl: 'Wypisz przekierowane porty dla serwera WebSocket tego rozszerzenia.',
82+
'zh-cn': '列出扩展的 WebSocket 服务器的转发端口。',
83+
ja: '拡張機能の WebSocket サーバーの転送ポートを一覧表示します。',
84+
'zh-tw': '列出擴充功能的 WebSocket 伺服器的轉送埠。',
85+
de: 'Listen Sie die weitergeleiteten Ports für den WebSocket-Server der Erweiterung auf.',
86+
es: 'Enumere los puertos reenviados para el servidor WebSocket de la extensión.',
87+
fr: "Lister les ports transférés pour le serveur WebSocket de l'extension.",
6888
'pt-br':
69-
'Liste as portas para as quais a porta `55155` do servidor Websockets do CWC é encaminhada.',
70-
ru: 'Список портов, на которые перенаправляется порт `55155` сервера Websockets CWC.',
71-
ko: 'CWC의 Websockets 서버 포트 `55155`가 전달되는 포트 목록입니다.',
72-
it: 'Elenca le porte a cui è inoltrata la porta `55155` del server Websockets di CWC.',
73-
tr: "CWC'nin Websockets sunucu bağlantı noktası `55155`'in yönlendirildiği bağlantı noktalarını listeleyin.",
74-
cs: 'Seznam portů, na které je přesměrován port `55155` serveru Websockets CWC.',
75-
hu: 'Azon portok listája, amelyekre a CWC Websockets szerverének `55155`-ös portja továbbítva van.',
76-
bg: 'Списък на портовете, към които е пренасочен порт `55155` на Websockets сървъра на CWC.'
89+
'Liste as portas encaminhadas para o servidor WebSocket da extensão.',
90+
ru: 'Перечислите перенаправленные порты для сервера WebSocket расширения.',
91+
ko: '확장 프로그램의 WebSocket 서버에 대해 전달된 포트를 나열합니다.',
92+
it: "Elenca le porte inoltrate per il server WebSocket dell'estensione.",
93+
tr: 'Uzantının WebSocket sunucusu için yönlendirilen bağlantı noktalarını listeleyin.',
94+
cs: 'Vypsat přesměrované porty pro WebSocket server rozšíření.',
95+
hu: 'Sorolja fel a bővítmény WebSocket szerverének továbbított portjait.',
96+
bg: 'Избройте пренасочените портове за WebSocket сървъра на разширението.'
7797
},
7898
'forwarded-ports.add.placeholder': {
7999
en: 'Port number (e.g. 55156)',

‎packages/ui/src/components/editor/settings-view/ForwardedPorts/ForwardedPorts.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export namespace ForwardedPorts {
2020
forwarded_ports: number[]
2121
on_update: (ports: number[]) => void
2222
translations: Translations
23+
notice_slot?: React.ReactNode
2324
}
2425
}
2526

@@ -44,7 +45,7 @@ export const ForwardedPorts: React.FC<ForwardedPorts.Props> = (props) => {
4445
}
4546

4647
return (
47-
<Group title={props.translations.title}>
48+
<Group title={props.translations.title} notice_slot={props.notice_slot}>
4849
<Item
4950
title={props.translations.item_title}
5051
description={props.translations.item_description}
@@ -84,4 +85,4 @@ export const ForwardedPorts: React.FC<ForwardedPorts.Props> = (props) => {
8485
</Item>
8586
</Group>
8687
)
87-
}
88+
}

‎packages/ui/src/components/editor/settings-view/Notices/Notices.module.scss‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
a {
2020
color: var(--cwc-blue-foreground);
2121
}
22+
23+
.code {
24+
color: var(--cwc-blue-foreground);
25+
background-color: var(--cwc-blue-background);
26+
}
2227
}
2328

2429
&--warning {
@@ -28,6 +33,11 @@
2833
a {
2934
color: var(--cwc-yellow-foreground);
3035
}
36+
37+
.code {
38+
color: var(--cwc-yellow-foreground);
39+
background-color: var(--cwc-yellow-background);
40+
}
3141
}
3242
}
3343

@@ -52,3 +62,10 @@
5262
padding-top: 1px;
5363
}
5464
}
65+
66+
.code {
67+
font-family: var(--vscode-editor-font-family);
68+
padding: 2px 4px;
69+
border-radius: 4px;
70+
font-size: 12px;
71+
}

‎packages/ui/src/components/editor/settings-view/Notices/Notices.tsx‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,19 @@ export const Notices: React.FC<Props> = (props) => {
3636
notice.type === 'info' ? 'codicon-info' : 'codicon-warning'
3737
)}
3838
/>
39-
<span>{notice.message}</span>
39+
<span>
40+
{typeof notice.message === 'string'
41+
? notice.message.split('`').map((part, i) =>
42+
i % 2 === 1 ? (
43+
<code key={i} className={styles.code}>
44+
{part}
45+
</code>
46+
) : (
47+
part
48+
)
49+
)
50+
: notice.message}
51+
</span>
4052
</div>
4153
{notice.slot_right && <div>{notice.slot_right}</div>}
4254
</div>

0 commit comments

Comments
 (0)