Skip to content

Commit 3a890fd

Browse files
committed
Add clickable link to the remote machines notice
- in settings' notice 'In the remote workspace...' text 'forward port' should be a link to https://code.visualstudio.com/docs/debugtest/port-forwarding ├── apps │ └── editor │ └── src │ └── views │ ├── settings │ │ └── frontend │ │ ├── Home │ │ │ └── sections │ │ │ └── WebSection.tsx │ │ └── i18n │ │ ├── translations │ │ │ └── web.ts │ │ └── use-translation.tsx │ └── shared │ └── hooks │ └── use-translation.tsx └── packages └── ui └── src └── components └── editor └── settings-view └── Notices ├── Notices.module.scss └── Notices.tsx
1 parent 5da23dd commit 3a890fd

3 files changed

Lines changed: 75 additions & 32 deletions

File tree

  • apps/editor/src/views/settings/frontend
  • packages/ui/src/components/editor/settings-view/Notices

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

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { Notices as UiNotices } from '@ui/components/editor/settings-view/Notice
1212
import { WebConfiguration } from '@/types/web-configuration'
1313
import { Icon } from '@ui/components/editor/common/Icon'
1414
import { CHATBOTS } from '@shared/constants/chatbots'
15-
import { use_translation } from '../../i18n/use-translation'
15+
import { use_translation, Translation } from '../../i18n/use-translation'
1616
import { NavItem } from '../Home'
1717

1818
type Props = {
@@ -396,7 +396,22 @@ export const WebSection = forwardRef<HTMLDivElement, Props>((props, ref) => {
396396
notices={[
397397
{
398398
type: 'info',
399-
message: t('web.remote-machines.notice')
399+
message: (
400+
<Translation
401+
id="web.remote-machines.notice"
402+
components={{
403+
link: (
404+
<a
405+
href="https://code.visualstudio.com/docs/debugtest/port-forwarding"
406+
target="_blank"
407+
rel="noopener noreferrer"
408+
>
409+
{t('web.remote-machines.notice.link')}
410+
</a>
411+
)
412+
}}
413+
/>
414+
)
400415
}
401416
]}
402417
/>

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

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -129,24 +129,41 @@ export const translations = {
129129
bg: 'Премахване на профил'
130130
},
131131
'web.remote-machines.notice': {
132-
en: 'In the remote workspace, forward port `55155` to any port you list below.',
133-
pl: 'W zdalnym obszarze roboczym przekieruj port `55155` na dowolny port z listy poniżej.',
134-
'zh-cn': '在远程工作区中,将端口 `55155` 转发到您在下方列出的任何端口。',
135-
ja: 'リモートワークスペースで、ポート `55155` を以下にリストされている任意のポートに転送します。',
136-
'zh-tw':
137-
'在遠端工作區中,將通訊埠 `55155` 轉送到您在下方列出的任何通訊埠。',
138-
de: 'Leiten Sie im Remote-Arbeitsbereich Port `55155` an einen beliebigen, unten aufgeführten Port weiter.',
139-
es: 'En el espacio de trabajo remoto, reenvíe el puerto `55155` a cualquier puerto que enumere a continuación.',
140-
fr: "Dans l'espace de travail distant, transférez le port `55155` vers n'importe quel port de la liste ci-dessous.",
132+
en: 'In the remote workspace, {link} `55155` to any port you list below.',
133+
pl: 'W zdalnym obszarze roboczym {link} `55155` na dowolny port z listy poniżej.',
134+
'zh-cn': '在远程工作区中,{link} `55155` 到您在下方列出的任何端口。',
135+
ja: 'リモートワークスペースで、ポート `55155` を以下にリストされている任意のポートに{link}します。',
136+
'zh-tw': '在遠端工作區中,{link} `55155` 到您在下方列出的任何通訊埠。',
137+
de: 'Leiten Sie im Remote-Arbeitsbereich {link} `55155` an einen beliebigen, unten aufgeführten Port weiter.',
138+
es: 'En el espacio de trabajo remoto, {link} `55155` a cualquier puerto que enumere a continuación.',
139+
fr: "Dans l'espace de travail distant, {link} `55155` vers n'importe quel port de la liste ci-dessous.",
141140
'pt-br':
142-
'No espaço de trabalho remoto, encaminhe a porta `55155` para qualquer porta listada abaixo.',
143-
ru: 'В удаленном рабочей области перенаправьте порт `55155` на любой порт из списка ниже.',
144-
ko: '원격 작업 공간에서 포트 `55155`를 아래 나열된 포트 중 하나로 전달하십시오.',
145-
it: 'Nello spazio di lavoro remoto, inoltra la porta `55155` a qualsiasi porta elencata di seguito.',
146-
tr: 'Uzak çalışma alanında, `55155` bağlantı noktasını aşağıda listelediğiniz herhangi bir bağlantı noktasına yönlendirin.',
147-
cs: 'Ve vzdáleném pracovním prostoru přesměrujte port `55155` na libovolný port uvedený níže.',
148-
hu: 'A távoli munkaterületen továbbítsa a `55155`-ös portot az alább felsorolt bármelyik portra.',
149-
bg: 'В отдалеченото работно пространство пренасочете порт `55155` към всеки порт, посочен по-долу.'
141+
'No espaço de trabalho remoto, {link} `55155` para qualquer porta listada abaixo.',
142+
ru: 'В удаленной рабочей области {link} `55155` на любой порт из списка ниже.',
143+
ko: '원격 작업 공간에서 {link} `55155`를 아래 나열된 포트 중 하나로 전달하십시오.',
144+
it: 'Nello spazio di lavoro remoto, {link} `55155` a qualsiasi porta elencata di seguito.',
145+
tr: 'Uzak çalışma alanında, `55155` bağlantı noktasını aşağıda listelediğiniz herhangi bir bağlantı noktasına {link}.',
146+
cs: 'Ve vzdáleném pracovním prostoru {link} `55155` na libovolný port uvedený níže.',
147+
hu: 'A távoli munkaterületen {link} a `55155`-ös portot az alább felsorolt bármelyik portra.',
148+
bg: 'В отдалеченото работно пространство {link} `55155` към всеки порт, посочен по-долу.'
149+
},
150+
'web.remote-machines.notice.link': {
151+
en: 'forward port',
152+
pl: 'przekieruj port',
153+
'zh-cn': '转发端口',
154+
ja: '転送',
155+
'zh-tw': '轉送通訊埠',
156+
de: 'Port',
157+
es: 'reenvíe el puerto',
158+
fr: 'transférez le port',
159+
'pt-br': 'encaminhe a porta',
160+
ru: 'перенаправьте порт',
161+
ko: '포트',
162+
it: 'inoltra la porta',
163+
tr: 'yönlendirin',
164+
cs: 'přesměrujte port',
165+
hu: 'továbbítsa',
166+
bg: 'пренасочете порт'
150167
},
151168
'web.remote-machines.title': {
152169
en: 'Remote machines',

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

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,29 @@ type Props = {
1515
export const Notices: React.FC<Props> = (props) => {
1616
if (!props.notices || props.notices.length === 0) return null
1717

18+
const render_message = (message: React.ReactNode): React.ReactNode => {
19+
if (typeof message === 'string') {
20+
return message.split('`').map((part, i) =>
21+
i % 2 === 1 ? (
22+
<code key={i} className={styles.code}>
23+
{part}
24+
</code>
25+
) : (
26+
part
27+
)
28+
)
29+
}
30+
31+
if (
32+
React.isValidElement<{ children?: React.ReactNode }>(message) &&
33+
message.type === React.Fragment
34+
) {
35+
return React.Children.map(message.props.children, render_message)
36+
}
37+
38+
return message
39+
}
40+
1841
return (
1942
<div className={styles.wrapper}>
2043
{props.notices.map((notice, index) => (
@@ -36,19 +59,7 @@ export const Notices: React.FC<Props> = (props) => {
3659
notice.type === 'info' ? 'codicon-info' : 'codicon-warning'
3760
)}
3861
/>
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>
62+
<span>{render_message(notice.message)}</span>
5263
</div>
5364
{notice.slot_right && <div>{notice.slot_right}</div>}
5465
</div>

0 commit comments

Comments
 (0)