From ee6d833d70978346c4eab3543e6d9b362e9c6b87 Mon Sep 17 00:00:00 2001 From: oabrivard Date: Thu, 26 Mar 2026 01:21:45 +0100 Subject: [PATCH] refactor: decompose Settings.tsx into sub-components Extract three self-contained sections from Settings.tsx (1025 lines) into dedicated components under frontend/src/components/settings/: - SettingsBraveSearch: Brave API key lifecycle + use_brave_search toggle - SettingsAdvanced: article_history_days, batch_size, use_llm_for_source_links, search_agent_behavior - SettingsRateLimit: rate limit inputs + effective rate display + reset Co-Authored-By: Claude Opus 4.6 (1M context) --- .../components/settings/SettingsAdvanced.tsx | 143 +++++++ .../settings/SettingsBraveSearch.tsx | 189 +++++++++ .../components/settings/SettingsRateLimit.tsx | 111 ++++++ frontend/src/pages/Settings.tsx | 368 +----------------- 4 files changed, 450 insertions(+), 361 deletions(-) create mode 100644 frontend/src/components/settings/SettingsAdvanced.tsx create mode 100644 frontend/src/components/settings/SettingsBraveSearch.tsx create mode 100644 frontend/src/components/settings/SettingsRateLimit.tsx diff --git a/frontend/src/components/settings/SettingsAdvanced.tsx b/frontend/src/components/settings/SettingsAdvanced.tsx new file mode 100644 index 0000000..bfc9813 --- /dev/null +++ b/frontend/src/components/settings/SettingsAdvanced.tsx @@ -0,0 +1,143 @@ +import { type Component } from 'solid-js'; +import { A } from '@solidjs/router'; +import { useI18n } from '~/i18n'; +import type { UserSettings } from '~/types'; + +interface SettingsAdvancedProps { + settings: () => UserSettings; + setSettings: (updater: (prev: UserSettings) => UserSettings) => void; +} + +/** + * Advanced settings section on the Settings page. + * + * Groups fields that control extraction and pipeline behaviour: + * - `article_history_days` — deduplication window + * - `batch_size` — number of sources processed per LLM batch + * - `use_llm_for_source_links` — whether to use LLM to extract links + * - `search_agent_behavior` — free-text prompt injection for the search agent + */ +const SettingsAdvanced: Component = (props) => { + const { t } = useI18n(); + + return ( + <> + {/* articleHistoryDays + batchSize grid */} +
+
+ +
+ + props.setSettings((prev) => ({ + ...prev, + article_history_days: + parseInt(e.currentTarget.value) || 90, + })) + } + /> +
+ +
+ +
+ +

{t('settings.batchSizeHelp')}

+
+ + props.setSettings((prev) => ({ + ...prev, + batch_size: + parseInt(e.currentTarget.value) || 5, + })) + } + /> +
+
+
+ + {/* Advanced extraction */} +
+

+ {t('settings.advancedExtraction')} +

+
+
+ + props.setSettings((prev) => ({ + ...prev, + use_llm_for_source_links: e.currentTarget.checked, + })) + } + class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded" + /> + +
+
+
+ + {/* Search agent behavior */} +
+ +
+