Skip to content

Commit 7df80ee

Browse files
committed
feat: palette commands for profile presets and export (F3 follow-up)
Adds "Browse profile presets" and "Export active profile" to the command palette. Export calls the existing exportProfileToFile directly; presets render the existing PresetsModal from App via a boolean, avoiding a state lift out of ProfilesWorkspace.
1 parent 0a0ff82 commit 7df80ee

4 files changed

Lines changed: 30 additions & 0 deletions

File tree

src/App.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { ConfirmModal } from "./components/ConfirmModal";
2323
import { DebugWorkspace } from "./components/DebugWorkspace";
2424
import { ErrorModal } from "./components/ErrorModal";
2525
import { PortableMigrationDialog } from "./components/PortableMigrationDialog";
26+
import { PresetsModal } from "./components/PresetsModal";
2627
import { OnboardingWizard } from "./components/onboarding/OnboardingWizard";
2728
import { SynapseImportModal } from "./components/SynapseImportModal";
2829
import { Toast, type ToastState } from "./components/Toast";
@@ -48,6 +49,7 @@ import {
4849
restoreConfigFromBackup,
4950
} from "./lib/backend";
5051
import { displayNameForControl, labelForLayer, relativeTime } from "./lib/labels";
52+
import { exportProfileToFile } from "./lib/profile-transfer";
5153
import type { ErrorActionKind } from "./lib/errors";
5254
import type { ParsedSynapseProfiles } from "./lib/synapse-import";
5355
import {
@@ -91,6 +93,7 @@ function App() {
9193
const toastSeqRef = useRef(0);
9294
const [synapseParsed, setSynapseParsed] = useState<ParsedSynapseProfiles | null>(null);
9395
const [settingsDeepLink, setSettingsDeepLink] = useState<SettingsDeepLink | null>(null);
96+
const [presetsOpen, setPresetsOpen] = useState(false);
9497

9598
const showToast = useCallback((message: string, kind?: ToastState["kind"], action?: ToastState["action"]) => {
9699
toastSeqRef.current += 1;
@@ -622,6 +625,19 @@ function App() {
622625
switchWorkspaceMode("settings");
623626
setSettingsDeepLink({ tab: "snippets", nonce: Date.now() });
624627
break;
628+
case "open-presets":
629+
setPresetsOpen(true);
630+
break;
631+
case "export-profile":
632+
if (activeConfig && activeProfile) {
633+
void exportProfileToFile(
634+
activeConfig,
635+
activeProfile.id,
636+
activeProfile.name,
637+
t("settings.exportDialogTitle"),
638+
).catch(() => showToast(t("settings.exportProfileError"), "warning"));
639+
}
640+
break;
625641
}
626642
}
627643

@@ -1056,6 +1072,14 @@ function App() {
10561072
<ShortcutHelp onClose={() => setShortcutHelpOpen(false)} />
10571073
) : null}
10581074

1075+
{presetsOpen ? (
1076+
<PresetsModal
1077+
onCancel={() => setPresetsOpen(false)}
1078+
updateDraft={updateDraft}
1079+
setError={setError}
1080+
/>
1081+
) : null}
1082+
10591083
{commandPaletteOpen ? (
10601084
<CommandPalette
10611085
onClose={() => setCommandPaletteOpen(false)}

src/components/CommandPalette.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ export function CommandPalette({
7171
{ id: "shortcuts", label: t("command.shortcuts"), shortcut: "?" },
7272
{ id: "toggle-runtime", label: t("command.toggleRuntime"), shortcut: "" },
7373
{ id: "open-snippet-library", label: t("command.snippetLibrary"), shortcut: "" },
74+
{ id: "open-presets", label: t("command.presets"), shortcut: "" },
75+
{ id: "export-profile", label: t("command.exportProfile"), shortcut: "" },
7476
],
7577
[t],
7678
);

src/i18n/locales/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,8 @@
642642
"shortcuts": "Help: Keyboard shortcuts",
643643
"toggleRuntime": "Start / stop interception",
644644
"snippetLibrary": "Open the snippet library",
645+
"presets": "Browse profile presets…",
646+
"exportProfile": "Export active profile…",
645647
"placeholder": "Type a command...",
646648
"empty": "Nothing found",
647649
"sectionCommands": "Commands",

src/i18n/locales/ru.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,8 @@
648648
"shortcuts": "Помощь: горячие клавиши",
649649
"toggleRuntime": "Старт / стоп перехвата",
650650
"snippetLibrary": "Открыть библиотеку сниппетов",
651+
"presets": "Открыть пресеты профилей…",
652+
"exportProfile": "Экспортировать активный профиль…",
651653
"placeholder": "Введите команду...",
652654
"empty": "Ничего не найдено",
653655
"sectionCommands": "Команды",

0 commit comments

Comments
 (0)