rearrange some ui (#1123)
* rearrange some ui * full disable * move cancel shortcut * fix bg translation
This commit is contained in:
parent
2b7231e6a9
commit
32687d19e1
6 changed files with 18 additions and 51 deletions
|
|
@ -50,18 +50,18 @@ export const SECTIONS_CONFIG = {
|
||||||
component: AdvancedSettings,
|
component: AdvancedSettings,
|
||||||
enabled: () => true,
|
enabled: () => true,
|
||||||
},
|
},
|
||||||
postprocessing: {
|
|
||||||
labelKey: "sidebar.postProcessing",
|
|
||||||
icon: Sparkles,
|
|
||||||
component: PostProcessingSettings,
|
|
||||||
enabled: (settings) => settings?.post_process_enabled ?? false,
|
|
||||||
},
|
|
||||||
history: {
|
history: {
|
||||||
labelKey: "sidebar.history",
|
labelKey: "sidebar.history",
|
||||||
icon: History,
|
icon: History,
|
||||||
component: HistorySettings,
|
component: HistorySettings,
|
||||||
enabled: () => true,
|
enabled: () => true,
|
||||||
},
|
},
|
||||||
|
postprocessing: {
|
||||||
|
labelKey: "sidebar.postProcessing",
|
||||||
|
icon: Sparkles,
|
||||||
|
component: PostProcessingSettings,
|
||||||
|
enabled: (settings) => settings?.post_process_enabled ?? false,
|
||||||
|
},
|
||||||
debug: {
|
debug: {
|
||||||
labelKey: "sidebar.debug",
|
labelKey: "sidebar.debug",
|
||||||
icon: FlaskConical,
|
icon: FlaskConical,
|
||||||
|
|
|
||||||
|
|
@ -49,24 +49,6 @@ export const GlobalShortcutInput: React.FC<GlobalShortcutInputProps> = ({
|
||||||
const handleKeyDown = async (e: KeyboardEvent) => {
|
const handleKeyDown = async (e: KeyboardEvent) => {
|
||||||
if (cleanup) return;
|
if (cleanup) return;
|
||||||
if (e.repeat) return; // ignore auto-repeat
|
if (e.repeat) return; // ignore auto-repeat
|
||||||
if (e.key === "Escape") {
|
|
||||||
// Cancel recording and restore original binding
|
|
||||||
if (editingShortcutId && originalBinding) {
|
|
||||||
try {
|
|
||||||
await updateBinding(editingShortcutId, originalBinding);
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Failed to restore original binding:", error);
|
|
||||||
toast.error(t("settings.general.shortcut.errors.restore"));
|
|
||||||
}
|
|
||||||
} else if (editingShortcutId) {
|
|
||||||
await commands.resumeBinding(editingShortcutId).catch(console.error);
|
|
||||||
}
|
|
||||||
setEditingShortcutId(null);
|
|
||||||
setKeyPressed([]);
|
|
||||||
setRecordedKeys([]);
|
|
||||||
setOriginalBinding("");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Get the key with OS-specific naming and normalize it
|
// Get the key with OS-specific naming and normalize it
|
||||||
|
|
|
||||||
|
|
@ -134,19 +134,8 @@ export const HandyKeysShortcutInput: React.FC<HandyKeysShortcutInputProps> = ({
|
||||||
|
|
||||||
setupListener();
|
setupListener();
|
||||||
|
|
||||||
// Handle escape key to cancel
|
|
||||||
const handleKeyDown = (e: KeyboardEvent) => {
|
|
||||||
if (e.key === "Escape") {
|
|
||||||
e.preventDefault();
|
|
||||||
cancelRecording();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
window.addEventListener("keydown", handleKeyDown);
|
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
cleanup = true;
|
cleanup = true;
|
||||||
window.removeEventListener("keydown", handleKeyDown);
|
|
||||||
if (unlistenRef.current) {
|
if (unlistenRef.current) {
|
||||||
unlistenRef.current();
|
unlistenRef.current();
|
||||||
unlistenRef.current = null;
|
unlistenRef.current = null;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { type } from "@tauri-apps/plugin-os";
|
|
||||||
import { WordCorrectionThreshold } from "./WordCorrectionThreshold";
|
import { WordCorrectionThreshold } from "./WordCorrectionThreshold";
|
||||||
import { LogLevelSelector } from "./LogLevelSelector";
|
import { LogLevelSelector } from "./LogLevelSelector";
|
||||||
import { PasteDelay } from "./PasteDelay";
|
import { PasteDelay } from "./PasteDelay";
|
||||||
|
|
@ -9,15 +8,10 @@ import { SettingsGroup } from "../../ui/SettingsGroup";
|
||||||
import { AlwaysOnMicrophone } from "../AlwaysOnMicrophone";
|
import { AlwaysOnMicrophone } from "../AlwaysOnMicrophone";
|
||||||
import { SoundPicker } from "../SoundPicker";
|
import { SoundPicker } from "../SoundPicker";
|
||||||
import { ClamshellMicrophoneSelector } from "../ClamshellMicrophoneSelector";
|
import { ClamshellMicrophoneSelector } from "../ClamshellMicrophoneSelector";
|
||||||
import { ShortcutInput } from "../ShortcutInput";
|
|
||||||
import { UpdateChecksToggle } from "../UpdateChecksToggle";
|
import { UpdateChecksToggle } from "../UpdateChecksToggle";
|
||||||
import { useSettings } from "../../../hooks/useSettings";
|
|
||||||
|
|
||||||
export const DebugSettings: React.FC = () => {
|
export const DebugSettings: React.FC = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { getSetting } = useSettings();
|
|
||||||
const pushToTalk = getSetting("push_to_talk");
|
|
||||||
const isLinux = type() === "linux";
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="max-w-3xl w-full mx-auto space-y-6">
|
<div className="max-w-3xl w-full mx-auto space-y-6">
|
||||||
|
|
@ -33,14 +27,6 @@ export const DebugSettings: React.FC = () => {
|
||||||
<RecordingBuffer descriptionMode="tooltip" grouped={true} />
|
<RecordingBuffer descriptionMode="tooltip" grouped={true} />
|
||||||
<AlwaysOnMicrophone descriptionMode="tooltip" grouped={true} />
|
<AlwaysOnMicrophone descriptionMode="tooltip" grouped={true} />
|
||||||
<ClamshellMicrophoneSelector descriptionMode="tooltip" grouped={true} />
|
<ClamshellMicrophoneSelector descriptionMode="tooltip" grouped={true} />
|
||||||
{/* Cancel shortcut is disabled on Linux due to instability with dynamic shortcut registration */}
|
|
||||||
{!isLinux && (
|
|
||||||
<ShortcutInput
|
|
||||||
shortcutId="cancel"
|
|
||||||
grouped={true}
|
|
||||||
disabled={pushToTalk}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</SettingsGroup>
|
</SettingsGroup>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { type } from "@tauri-apps/plugin-os";
|
||||||
import { MicrophoneSelector } from "../MicrophoneSelector";
|
import { MicrophoneSelector } from "../MicrophoneSelector";
|
||||||
import { ShortcutInput } from "../ShortcutInput";
|
import { ShortcutInput } from "../ShortcutInput";
|
||||||
import { SettingsGroup } from "../../ui/SettingsGroup";
|
import { SettingsGroup } from "../../ui/SettingsGroup";
|
||||||
|
|
@ -13,12 +14,18 @@ import { ModelSettingsCard } from "./ModelSettingsCard";
|
||||||
|
|
||||||
export const GeneralSettings: React.FC = () => {
|
export const GeneralSettings: React.FC = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { audioFeedbackEnabled } = useSettings();
|
const { audioFeedbackEnabled, getSetting } = useSettings();
|
||||||
|
const pushToTalk = getSetting("push_to_talk");
|
||||||
|
const isLinux = type() === "linux";
|
||||||
return (
|
return (
|
||||||
<div className="max-w-3xl w-full mx-auto space-y-6">
|
<div className="max-w-3xl w-full mx-auto space-y-6">
|
||||||
<SettingsGroup title={t("settings.general.title")}>
|
<SettingsGroup title={t("settings.general.title")}>
|
||||||
<ShortcutInput shortcutId="transcribe" grouped={true} />
|
<ShortcutInput shortcutId="transcribe" grouped={true} />
|
||||||
<PushToTalk descriptionMode="tooltip" grouped={true} />
|
<PushToTalk descriptionMode="tooltip" grouped={true} />
|
||||||
|
{/* Cancel shortcut is hidden with push-to-talk (release key cancels) and on Linux (dynamic shortcut instability) */}
|
||||||
|
{!isLinux && !pushToTalk && (
|
||||||
|
<ShortcutInput shortcutId="cancel" grouped={true} />
|
||||||
|
)}
|
||||||
</SettingsGroup>
|
</SettingsGroup>
|
||||||
<ModelSettingsCard />
|
<ModelSettingsCard />
|
||||||
<SettingsGroup title={t("settings.sound.title")}>
|
<SettingsGroup title={t("settings.sound.title")}>
|
||||||
|
|
|
||||||
|
|
@ -547,7 +547,10 @@
|
||||||
"downloading": "Изтегля се... {{progress}}%",
|
"downloading": "Изтегля се... {{progress}}%",
|
||||||
"installing": "Инсталиране...",
|
"installing": "Инсталиране...",
|
||||||
"preparing": "Подготовка...",
|
"preparing": "Подготовка...",
|
||||||
"checkForUpdates": "Проверка за актуализации"
|
"checkForUpdates": "Проверка за актуализации",
|
||||||
|
"portableUpdateTitle": "Необходима е ръчна актуализация",
|
||||||
|
"portableUpdateMessage": "Преносимите инсталации не могат да бъдат актуализирани автоматично. За актуализация: изтеглете най-новия NSIS инсталатор от GitHub Releases, инсталирайте го в същата папка, след което копирайте папката Data/ (настройки, модели, записи) от старата версия в новата.",
|
||||||
|
"portableUpdateButton": "Отвори GitHub Releases"
|
||||||
},
|
},
|
||||||
"common": {
|
"common": {
|
||||||
"loading": "Зареждане...",
|
"loading": "Зареждане...",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue