From aa7400ac0d728ab298f4e05581380ec2d9cbada2 Mon Sep 17 00:00:00 2001 From: "coderabbitai[bot]" <136622811+coderabbitai[bot]@users.noreply.github.com> Date: Mon, 23 Jun 2025 18:31:26 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Add=20docstrings=20to=20`typescr?= =?UTF-8?q?ipt`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Docstrings generation was requested by @yell0wsuit. * https://github.com/learnercraft/ispeakerreact/pull/65#issuecomment-2996580962 The following files were modified: * `src/frontend/components/setting_page/LogSettings.tsx` * `src/frontend/components/setting_page/PronunciationSettings.tsx` --- src/frontend/components/setting_page/LogSettings.tsx | 5 +++++ .../components/setting_page/PronunciationSettings.tsx | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/frontend/components/setting_page/LogSettings.tsx b/src/frontend/components/setting_page/LogSettings.tsx index c6605f5d..0067be03 100644 --- a/src/frontend/components/setting_page/LogSettings.tsx +++ b/src/frontend/components/setting_page/LogSettings.tsx @@ -79,6 +79,11 @@ const LogSettings = () => { useEffect(() => { let isMounted = true; + /** + * Fetches current log settings from the Electron main process and updates component state with the corresponding option values. + * + * Falls back to default values if fetching fails. + */ async function fetchLogSettings() { try { const settings = (await window.electron.ipcRenderer.invoke( diff --git a/src/frontend/components/setting_page/PronunciationSettings.tsx b/src/frontend/components/setting_page/PronunciationSettings.tsx index 25c2818e..aa9d12ff 100644 --- a/src/frontend/components/setting_page/PronunciationSettings.tsx +++ b/src/frontend/components/setting_page/PronunciationSettings.tsx @@ -330,7 +330,12 @@ const PronunciationSettings = () => { const selectedModel = modelOptions.find((opt) => opt.value === modelValue); const selectedModelSize = selectedModel ? selectedModel.size : ""; - // Helper to pick the first defined string value + /** + * Returns the first non-empty string from the provided arguments, or a default failure message if none are found. + * + * @param args - A list of string or undefined values to check + * @returns The first non-empty string, or "Installation failed." if none are provided + */ function pickFirstString(...args: (string | undefined)[]): string { for (const arg of args) { if (typeof arg === "string" && arg.length > 0) return arg;