rearrange some ui (#1123)

* rearrange some ui

* full disable

* move cancel shortcut

* fix bg translation
This commit is contained in:
CJ Pais 2026-03-26 09:16:22 +08:00 committed by GitHub
parent 2b7231e6a9
commit 32687d19e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 18 additions and 51 deletions

View file

@ -50,18 +50,18 @@ export const SECTIONS_CONFIG = {
component: AdvancedSettings,
enabled: () => true,
},
postprocessing: {
labelKey: "sidebar.postProcessing",
icon: Sparkles,
component: PostProcessingSettings,
enabled: (settings) => settings?.post_process_enabled ?? false,
},
history: {
labelKey: "sidebar.history",
icon: History,
component: HistorySettings,
enabled: () => true,
},
postprocessing: {
labelKey: "sidebar.postProcessing",
icon: Sparkles,
component: PostProcessingSettings,
enabled: (settings) => settings?.post_process_enabled ?? false,
},
debug: {
labelKey: "sidebar.debug",
icon: FlaskConical,

View file

@ -49,24 +49,6 @@ export const GlobalShortcutInput: React.FC<GlobalShortcutInputProps> = ({
const handleKeyDown = async (e: KeyboardEvent) => {
if (cleanup) return;
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();
// Get the key with OS-specific naming and normalize it

View file

@ -134,19 +134,8 @@ export const HandyKeysShortcutInput: React.FC<HandyKeysShortcutInputProps> = ({
setupListener();
// Handle escape key to cancel
const handleKeyDown = (e: KeyboardEvent) => {
if (e.key === "Escape") {
e.preventDefault();
cancelRecording();
}
};
window.addEventListener("keydown", handleKeyDown);
return () => {
cleanup = true;
window.removeEventListener("keydown", handleKeyDown);
if (unlistenRef.current) {
unlistenRef.current();
unlistenRef.current = null;

View file

@ -1,6 +1,5 @@
import React from "react";
import { useTranslation } from "react-i18next";
import { type } from "@tauri-apps/plugin-os";
import { WordCorrectionThreshold } from "./WordCorrectionThreshold";
import { LogLevelSelector } from "./LogLevelSelector";
import { PasteDelay } from "./PasteDelay";
@ -9,15 +8,10 @@ import { SettingsGroup } from "../../ui/SettingsGroup";
import { AlwaysOnMicrophone } from "../AlwaysOnMicrophone";
import { SoundPicker } from "../SoundPicker";
import { ClamshellMicrophoneSelector } from "../ClamshellMicrophoneSelector";
import { ShortcutInput } from "../ShortcutInput";
import { UpdateChecksToggle } from "../UpdateChecksToggle";
import { useSettings } from "../../../hooks/useSettings";
export const DebugSettings: React.FC = () => {
const { t } = useTranslation();
const { getSetting } = useSettings();
const pushToTalk = getSetting("push_to_talk");
const isLinux = type() === "linux";
return (
<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} />
<AlwaysOnMicrophone 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>
</div>
);

View file

@ -1,5 +1,6 @@
import React from "react";
import { useTranslation } from "react-i18next";
import { type } from "@tauri-apps/plugin-os";
import { MicrophoneSelector } from "../MicrophoneSelector";
import { ShortcutInput } from "../ShortcutInput";
import { SettingsGroup } from "../../ui/SettingsGroup";
@ -13,12 +14,18 @@ import { ModelSettingsCard } from "./ModelSettingsCard";
export const GeneralSettings: React.FC = () => {
const { t } = useTranslation();
const { audioFeedbackEnabled } = useSettings();
const { audioFeedbackEnabled, getSetting } = useSettings();
const pushToTalk = getSetting("push_to_talk");
const isLinux = type() === "linux";
return (
<div className="max-w-3xl w-full mx-auto space-y-6">
<SettingsGroup title={t("settings.general.title")}>
<ShortcutInput shortcutId="transcribe" 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>
<ModelSettingsCard />
<SettingsGroup title={t("settings.sound.title")}>

View file

@ -547,7 +547,10 @@
"downloading": "Изтегля се... {{progress}}%",
"installing": "Инсталиране...",
"preparing": "Подготовка...",
"checkForUpdates": "Проверка за актуализации"
"checkForUpdates": "Проверка за актуализации",
"portableUpdateTitle": "Необходима е ръчна актуализация",
"portableUpdateMessage": "Преносимите инсталации не могат да бъдат актуализирани автоматично. За актуализация: изтеглете най-новия NSIS инсталатор от GitHub Releases, инсталирайте го в същата папка, след което копирайте папката Data/ (настройки, модели, записи) от старата версия в новата.",
"portableUpdateButton": "Отвори GitHub Releases"
},
"common": {
"loading": "Зареждане...",