Skip to content

Commit 252d55f

Browse files
committed
Proper Context Menus
1 parent 733caeb commit 252d55f

6 files changed

Lines changed: 25 additions & 12 deletions

File tree

languages/de.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"general.close": "Schließen",
1212
"general.retry": "Erneut versuchen",
1313
"general.copy": "Kopieren",
14+
"general.copyAll": "Alles kopieren",
1415
"general.cut": "Ausschneiden",
1516
"general.paste": "Einfügen",
1617
"general.selectAll": "Alles auswählen",

src/main/shared/config/DefaultLanguage.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const ENGLISH_STRINGS = {
99
'general.close': 'Close',
1010
'general.retry': 'Retry',
1111
'general.copy': 'Copy',
12+
'general.copyAll': 'Copy All',
1213
'general.cut': 'Cut',
1314
'general.paste': 'Paste',
1415
'general.selectAll': 'Select All',

src/renderer/components/console/ConsoleTab.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
VscClose,
1212
VscFolderOpened,
1313
VscClearAll,
14+
VscCopy,
1415
} from 'react-icons/vsc';
1516
import { ConsoleLine } from '../../../main/shared/types/Process.types';
1617
import { hasJarConfigured } from '../../../main/shared/types/Profile.types';
@@ -237,10 +238,12 @@ export function ConsoleTab() {
237238
? [
238239
{
239240
label: t('console.copyLine'),
241+
icon: <VscCopy size={12} />,
240242
onClick: () => navigator.clipboard.writeText(lineCtxMenu.text),
241243
},
242244
{
243245
label: t('console.copyAll'),
246+
icon: <VscCopy size={12} />,
244247
onClick: () => navigator.clipboard.writeText(lines.map((l) => l.text).join('\n')),
245248
},
246249
]

src/renderer/components/developer/DevApiExplorer.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { useState, useCallback } from 'react';
22
import { VscCheck, VscCopy, VscPlay, VscEdit, VscCode } from 'react-icons/vsc';
33
import { routeConfig, REST_API_CONFIG } from '../../../main/shared/config/API.config';
44
import { useApp } from '../../AppProvider';
5+
import { useTranslation } from '../../i18n/I18nProvider';
56
import { Button } from '../common/Button';
67
import { ContextMenu, ContextMenuItem } from '../common/ContextMenu';
78
import { RouteDefinition } from '../../..//main/shared/types/RestAPI.types';
@@ -104,6 +105,7 @@ function JsonHighlight({ text }: { text: string }) {
104105

105106
export function DevApiExplorer() {
106107
const { state } = useApp();
108+
const { t } = useTranslation();
107109
const [selected, setSelected] = useState<RouteDefinition | null>(null);
108110
const [pathParams, setPathParams] = useState<Record<string, string>>({});
109111
const [body, setBody] = useState('');
@@ -182,7 +184,7 @@ export function DevApiExplorer() {
182184
y: e.clientY,
183185
items: [
184186
{
185-
label: 'Copy',
187+
label: t('general.copy'),
186188
icon: <VscCopy size={12} />,
187189
disabled: !sel,
188190
onClick: () => navigator.clipboard.writeText(sel),
@@ -198,7 +200,7 @@ export function DevApiExplorer() {
198200
? [
199201
{ type: 'separator' },
200202
{
201-
label: 'Copy all',
203+
label: t('general.copyAll'),
202204
icon: <VscCopy size={12} />,
203205
onClick: () => navigator.clipboard.writeText(response),
204206
},

src/renderer/components/profiles/LogsTab.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,14 +215,14 @@ export function LogsTab() {
215215
onClose={() => setLogCtxMenu(null)}
216216
items={[
217217
{
218-
label: 'Copy',
218+
label: t('general.copy'),
219219
icon: <VscCopy size={12} />,
220220
disabled: !logCtxMenu.sel,
221221
onClick: () => navigator.clipboard.writeText(logCtxMenu.sel),
222222
},
223223
{ type: 'separator' },
224224
{
225-
label: 'Copy all',
225+
label: t('general.copyAll'),
226226
icon: <VscCopy size={12} />,
227227
onClick: () => navigator.clipboard.writeText(logContent),
228228
},

src/renderer/components/profiles/jar/StaticJarPicker.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import { Input } from '../../common/Input';
33
import { FolderBtn } from './FolderBtn';
44
import { useTranslation } from '../../../i18n/I18nProvider';
5+
import { useInputContextMenu } from '../../../hooks/useInputContextMenu';
56

67
interface Props {
78
jarPath: string;
@@ -11,15 +12,20 @@ interface Props {
1112

1213
export function StaticJarPicker({ jarPath, onChange, onPick }: Props) {
1314
const { t } = useTranslation();
15+
const { onContextMenu, contextMenu } = useInputContextMenu();
1416

1517
return (
16-
<Input
17-
label={t('config.jarFile')}
18-
value={jarPath}
19-
onChange={(e) => onChange(e.target.value)}
20-
placeholder={t('config.jarFilePlaceholder')}
21-
hint={t('config.jarFileHint')}
22-
rightElement={<FolderBtn onClick={onPick} />}
23-
/>
18+
<>
19+
<Input
20+
label={t('config.jarFile')}
21+
value={jarPath}
22+
onChange={(e) => onChange(e.target.value)}
23+
onContextMenu={onContextMenu}
24+
placeholder={t('config.jarFilePlaceholder')}
25+
hint={t('config.jarFileHint')}
26+
rightElement={<FolderBtn onClick={onPick} />}
27+
/>
28+
{contextMenu}
29+
</>
2430
);
2531
}

0 commit comments

Comments
 (0)