diff --git a/rulesdocs/refector_rules_and_tracking.md b/rulesdocs/refector_rules_and_tracking.md index e9f9a00a..af1dadd2 100644 --- a/rulesdocs/refector_rules_and_tracking.md +++ b/rulesdocs/refector_rules_and_tracking.md @@ -22,6 +22,9 @@ - Every component must live in its own folder, even when it remains a single-file implementation. - Split large JSX/components and large backing JS files into folderized modules. - Keep modules clear and focused, with title comments. +- Every component/module file should start with a descriptive comment header containing: +- a title line naming the file/module +- a longer purpose/scope description (not a one-liner) - Each component must live entirely inside its own folder; do not leave wrapper/compatibility component files outside that folder. - Remove stale compatibility/leftover code only after usage verification. diff --git a/webui/src/components/AdminPanel/AdminIpLogPanel.jsx b/webui/src/components/AdminPanel/AdminIpLogPanel.jsx index 0c800407..1adbe1a6 100644 --- a/webui/src/components/AdminPanel/AdminIpLogPanel.jsx +++ b/webui/src/components/AdminPanel/AdminIpLogPanel.jsx @@ -1,4 +1,6 @@ -// Admin-only IP log stream panel. +// Admin Ip Log Panel +// Purpose: Defines the Admin Ip Log Panel module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. export default function AdminIpLogPanel({ entries }) { const logs = entries || []; return ( diff --git a/webui/src/components/AdminPanel/AdminPanelContent.jsx b/webui/src/components/AdminPanel/AdminPanelContent.jsx index 840b8ad1..aa784424 100644 --- a/webui/src/components/AdminPanel/AdminPanelContent.jsx +++ b/webui/src/components/AdminPanel/AdminPanelContent.jsx @@ -1,4 +1,6 @@ -// Admin control panel main composition and action handlers. +// Admin Panel Content +// Purpose: Defines the Admin Panel Content module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. import { useEffect, useMemo, useState } from 'react'; import { useSession } from '../../context/SessionContext.jsx'; import RoverRoster from '../RoverRoster/index.jsx'; diff --git a/webui/src/components/AdminPanel/LlmCommentaryPanel.jsx b/webui/src/components/AdminPanel/LlmCommentaryPanel.jsx index 2aa4ccf6..2c95b708 100644 --- a/webui/src/components/AdminPanel/LlmCommentaryPanel.jsx +++ b/webui/src/components/AdminPanel/LlmCommentaryPanel.jsx @@ -1,4 +1,6 @@ -// Admin LLM commentary monitor panel. +// Llm Commentary Panel +// Purpose: Defines the Llm Commentary Panel module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. import { useState } from 'react'; import ChatMessageRow from '../ChatMessageRow/index.jsx'; import { buildLlmLargeIndicatorFromState, buildLlmConversationRowsFromMessages } from './llmHelpers.js'; diff --git a/webui/src/components/AdminPanel/ReplaySnapshotHealth.jsx b/webui/src/components/AdminPanel/ReplaySnapshotHealth.jsx index e3e1a92a..28ee175a 100644 --- a/webui/src/components/AdminPanel/ReplaySnapshotHealth.jsx +++ b/webui/src/components/AdminPanel/ReplaySnapshotHealth.jsx @@ -1,4 +1,6 @@ -// Replay and snapshot health status panel. +// Replay Snapshot Health +// Purpose: Defines the Replay Snapshot Health module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. import { roverNameChromeStyle } from '../../lib/roverColor.js'; export default function ReplaySnapshotHealth({ health, roster = [] }) { diff --git a/webui/src/components/AdminPanel/index.jsx b/webui/src/components/AdminPanel/index.jsx index 9dd7ae69..135d2d74 100644 --- a/webui/src/components/AdminPanel/index.jsx +++ b/webui/src/components/AdminPanel/index.jsx @@ -1,3 +1,6 @@ +// Admin Panel +// Purpose: Defines the Admin Panel module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. import AdminPanelContent from './AdminPanelContent.jsx'; export default AdminPanelContent; diff --git a/webui/src/components/AdminPanel/llmHelpers.js b/webui/src/components/AdminPanel/llmHelpers.js index 3cd0ca47..aa466295 100644 --- a/webui/src/components/AdminPanel/llmHelpers.js +++ b/webui/src/components/AdminPanel/llmHelpers.js @@ -1,4 +1,6 @@ -// LLM commentary monitor formatting helpers. +// llm Helpers +// Purpose: Defines the llm Helpers module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. export function buildLlmLargeIndicatorFromState(state) { const runtime = state?.runtime || {}; const output = state?.output || {}; diff --git a/webui/src/components/AlertFeed/index.jsx b/webui/src/components/AlertFeed/index.jsx index 15eea377..63a17f5d 100644 --- a/webui/src/components/AlertFeed/index.jsx +++ b/webui/src/components/AlertFeed/index.jsx @@ -1,3 +1,6 @@ +// Alert Feed +// Purpose: Defines the Alert Feed module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. import { useEffect, useMemo, useState } from 'react'; import { useSessionActions, useSessionSelector } from '../../context/SessionContext.jsx'; import { useSocket } from '../../context/SocketContext.jsx'; diff --git a/webui/src/components/AuthPanel/index.jsx b/webui/src/components/AuthPanel/index.jsx index 02094a7f..98e5b93e 100644 --- a/webui/src/components/AuthPanel/index.jsx +++ b/webui/src/components/AuthPanel/index.jsx @@ -1,3 +1,6 @@ +// Auth Panel +// Purpose: Defines the Auth Panel module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. import { useState } from 'react'; import { useSessionActions } from '../../context/SessionContext.jsx'; diff --git a/webui/src/components/BatteryBar/index.jsx b/webui/src/components/BatteryBar/index.jsx index 45bb2ea8..fd93e845 100644 --- a/webui/src/components/BatteryBar/index.jsx +++ b/webui/src/components/BatteryBar/index.jsx @@ -1,3 +1,6 @@ +// Battery Bar +// Purpose: Defines the Battery Bar module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. import { WARN_DISPLAY_PERCENT } from '../../lib/battery.js'; const WARN_FLASH_MS = 1600; diff --git a/webui/src/components/ButtonBoxPanel/index.jsx b/webui/src/components/ButtonBoxPanel/index.jsx index 0ba493e1..d4fa117b 100644 --- a/webui/src/components/ButtonBoxPanel/index.jsx +++ b/webui/src/components/ButtonBoxPanel/index.jsx @@ -1,3 +1,6 @@ +// Button Box Panel +// Purpose: Defines the Button Box Panel module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. import { useEffect, useMemo, useRef, useState } from 'react'; import { useSession } from '../../context/SessionContext.jsx'; import { useSocket } from '../../context/SocketContext.jsx'; diff --git a/webui/src/components/ButtonBoxTile/index.jsx b/webui/src/components/ButtonBoxTile/index.jsx index 26a79585..e471f8e2 100644 --- a/webui/src/components/ButtonBoxTile/index.jsx +++ b/webui/src/components/ButtonBoxTile/index.jsx @@ -1,3 +1,6 @@ +// Button Box Tile +// Purpose: Defines the Button Box Tile module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. export default function ButtonBoxTile({ buttonId, count, diff --git a/webui/src/components/CameraTiltControl/index.jsx b/webui/src/components/CameraTiltControl/index.jsx index f5c5498b..0e130545 100644 --- a/webui/src/components/CameraTiltControl/index.jsx +++ b/webui/src/components/CameraTiltControl/index.jsx @@ -1,3 +1,6 @@ +// Camera Tilt Control +// Purpose: Defines the Camera Tilt Control module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. import { useEffect, useRef, useState } from 'react'; function formatDegrees(value) { diff --git a/webui/src/components/ChatMessageRow/index.jsx b/webui/src/components/ChatMessageRow/index.jsx index c0e252f5..7cdbb03a 100644 --- a/webui/src/components/ChatMessageRow/index.jsx +++ b/webui/src/components/ChatMessageRow/index.jsx @@ -1,3 +1,6 @@ +// Chat Message Row +// Purpose: Defines the Chat Message Row module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. import { FaDiscord } from 'react-icons/fa'; import { roverBadgeStyle } from '../../lib/roverColor.js'; diff --git a/webui/src/components/ChatPanel/index.jsx b/webui/src/components/ChatPanel/index.jsx index 3f599030..6f33c21a 100644 --- a/webui/src/components/ChatPanel/index.jsx +++ b/webui/src/components/ChatPanel/index.jsx @@ -1,3 +1,6 @@ +// Chat Panel +// Purpose: Defines the Chat Panel module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. import { useEffect, useMemo, useRef, useState } from 'react'; import { useChat } from '../../context/ChatContext.jsx'; import { useSessionSelector } from '../../context/SessionContext.jsx'; diff --git a/webui/src/components/ChatTypingRow/index.jsx b/webui/src/components/ChatTypingRow/index.jsx index 6c5764a6..6a17022a 100644 --- a/webui/src/components/ChatTypingRow/index.jsx +++ b/webui/src/components/ChatTypingRow/index.jsx @@ -1,3 +1,6 @@ +// Chat Typing Row +// Purpose: Defines the Chat Typing Row module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. import { ChatIdentity, chatRowClass } from '../ChatMessageRow/index.jsx'; export default function ChatTypingRow({ message }) { diff --git a/webui/src/components/CommunityGoalBanner/index.jsx b/webui/src/components/CommunityGoalBanner/index.jsx index dd53fb08..85bf705e 100644 --- a/webui/src/components/CommunityGoalBanner/index.jsx +++ b/webui/src/components/CommunityGoalBanner/index.jsx @@ -1,3 +1,6 @@ +// Community Goal Banner +// Purpose: Defines the Community Goal Banner module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. import { useEffect, useMemo, useRef, useState } from 'react'; import { useSession } from '../../context/SessionContext.jsx'; diff --git a/webui/src/components/DeterrenceChaos/index.jsx b/webui/src/components/DeterrenceChaos/index.jsx index c8ea5b41..c965e7ae 100644 --- a/webui/src/components/DeterrenceChaos/index.jsx +++ b/webui/src/components/DeterrenceChaos/index.jsx @@ -1,3 +1,6 @@ +// Deterrence Chaos +// Purpose: Defines the Deterrence Chaos module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. import { useEffect } from 'react'; import { useSessionSelector } from '../../context/SessionContext.jsx'; diff --git a/webui/src/components/DriveDockAction/index.jsx b/webui/src/components/DriveDockAction/index.jsx index 52f896cc..d1df0df5 100644 --- a/webui/src/components/DriveDockAction/index.jsx +++ b/webui/src/components/DriveDockAction/index.jsx @@ -1,3 +1,6 @@ +// Drive Dock Action +// Purpose: Defines the Drive Dock Action module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. import { useMemo, useState } from 'react'; import { useControlSystem } from '../../controls/index.js'; import { useTelemetryFrame } from '../../context/TelemetryContext.jsx'; diff --git a/webui/src/components/DriverVideoPanel/index.jsx b/webui/src/components/DriverVideoPanel/index.jsx index 2d2ae008..8b0da03b 100644 --- a/webui/src/components/DriverVideoPanel/index.jsx +++ b/webui/src/components/DriverVideoPanel/index.jsx @@ -1,3 +1,6 @@ +// Driver Video Panel +// Purpose: Defines the Driver Video Panel module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. import { useEffect, useMemo, useRef, useState } from 'react'; import { useSessionSelector } from '../../context/SessionContext.jsx'; import { useTelemetryFrame } from '../../context/TelemetryContext.jsx'; diff --git a/webui/src/components/FloatingFullscreenButton/index.jsx b/webui/src/components/FloatingFullscreenButton/index.jsx index fd264bd6..7e504213 100644 --- a/webui/src/components/FloatingFullscreenButton/index.jsx +++ b/webui/src/components/FloatingFullscreenButton/index.jsx @@ -1,3 +1,6 @@ +// Floating Fullscreen Button +// Purpose: Defines the Floating Fullscreen Button module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. export default function FloatingFullscreenButton({ side = 'right', onClick }) { const sideClass = side === 'left' ? 'left-2' : 'right-2'; return ( diff --git a/webui/src/components/FullscreenPrompt/index.jsx b/webui/src/components/FullscreenPrompt/index.jsx index ca8071c7..99999e21 100644 --- a/webui/src/components/FullscreenPrompt/index.jsx +++ b/webui/src/components/FullscreenPrompt/index.jsx @@ -1,3 +1,6 @@ +// Fullscreen Prompt +// Purpose: Defines the Fullscreen Prompt module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. export default function FullscreenPrompt({ visible, mode, onEnterFullscreen, onDismiss }) { if (!visible) return null; const isIOSMode = mode === 'pwa-hint'; diff --git a/webui/src/components/GamepadMappingSettings/GamepadMappingSettingsContent.jsx b/webui/src/components/GamepadMappingSettings/GamepadMappingSettingsContent.jsx index c7702b0a..4d3ee2c5 100644 --- a/webui/src/components/GamepadMappingSettings/GamepadMappingSettingsContent.jsx +++ b/webui/src/components/GamepadMappingSettings/GamepadMappingSettingsContent.jsx @@ -1,3 +1,6 @@ +// Gamepad Mapping Settings Content +// Purpose: Defines the Gamepad Mapping Settings Content module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { useSettingsNamespace } from '../../settings/index.js'; import { GAMEPAD_PROFILE_DEFAULT, GAMEPAD_SETTINGS_DEFAULTS } from '../../settings/namespaces.js'; diff --git a/webui/src/components/GamepadMappingSettings/SliderField.jsx b/webui/src/components/GamepadMappingSettings/SliderField.jsx index f479451c..38ca56e7 100644 --- a/webui/src/components/GamepadMappingSettings/SliderField.jsx +++ b/webui/src/components/GamepadMappingSettings/SliderField.jsx @@ -1,4 +1,6 @@ -// Reusable slider field for gamepad calibration controls. +// Slider Field +// Purpose: Defines the Slider Field module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. import { NUMBER_FORMAT } from './constants.js'; export default function SliderField({ label, description, min, max, step, value, onChange }) { diff --git a/webui/src/components/GamepadMappingSettings/constants.js b/webui/src/components/GamepadMappingSettings/constants.js index 4d3c9c45..ef3bcada 100644 --- a/webui/src/components/GamepadMappingSettings/constants.js +++ b/webui/src/components/GamepadMappingSettings/constants.js @@ -1,4 +1,6 @@ -// Gamepad mapping constants and action catalog. +// constants +// Purpose: Defines the constants module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. export const NUMBER_FORMAT = new Intl.NumberFormat(undefined, { maximumFractionDigits: 2 }); export const ACTIONS = [ diff --git a/webui/src/components/GamepadMappingSettings/helpers.js b/webui/src/components/GamepadMappingSettings/helpers.js index 031e5663..4e162666 100644 --- a/webui/src/components/GamepadMappingSettings/helpers.js +++ b/webui/src/components/GamepadMappingSettings/helpers.js @@ -1,4 +1,6 @@ -// Gamepad mapping helper and capture functions. +// helpers +// Purpose: Defines the helpers module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. import { CAPTURE_AXIS_THRESHOLD, CAPTURE_BUTTON_THRESHOLD, NUMBER_FORMAT } from './constants.js'; export function formatSource(source) { diff --git a/webui/src/components/GamepadMappingSettings/index.jsx b/webui/src/components/GamepadMappingSettings/index.jsx index 17d67c64..9d13118c 100644 --- a/webui/src/components/GamepadMappingSettings/index.jsx +++ b/webui/src/components/GamepadMappingSettings/index.jsx @@ -1,3 +1,6 @@ +// Gamepad Mapping Settings +// Purpose: Defines the Gamepad Mapping Settings module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. import GamepadMappingSettingsContent from './GamepadMappingSettingsContent.jsx'; export default GamepadMappingSettingsContent; diff --git a/webui/src/components/HelpContentView/index.jsx b/webui/src/components/HelpContentView/index.jsx index f003dfff..4ebf62fa 100644 --- a/webui/src/components/HelpContentView/index.jsx +++ b/webui/src/components/HelpContentView/index.jsx @@ -1,3 +1,6 @@ +// Help Content View +// Purpose: Defines the Help Content View module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. import { useMemo } from 'react'; import { formatKeyLabel } from '../../controls/keymapUtils.js'; import { getHelpContent } from '../../help/content.js'; diff --git a/webui/src/components/HelpOverlay/index.jsx b/webui/src/components/HelpOverlay/index.jsx index bb170a5d..693cd5ec 100644 --- a/webui/src/components/HelpOverlay/index.jsx +++ b/webui/src/components/HelpOverlay/index.jsx @@ -1,3 +1,6 @@ +// Help Overlay +// Purpose: Defines the Help Overlay module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. import { useControlSystem } from '../../controls/index.js'; import HelpContentView from '../HelpContentView/index.jsx'; diff --git a/webui/src/components/HelpPanel/index.jsx b/webui/src/components/HelpPanel/index.jsx index 1c47438c..5be08861 100644 --- a/webui/src/components/HelpPanel/index.jsx +++ b/webui/src/components/HelpPanel/index.jsx @@ -1,3 +1,6 @@ +// Help Panel +// Purpose: Defines the Help Panel module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. import { useControlSystem } from '../../controls/index.js'; import HelpContentView from '../HelpContentView/index.jsx'; diff --git a/webui/src/components/HomeAssistantControls/index.jsx b/webui/src/components/HomeAssistantControls/index.jsx index 4f9f5219..26cfafed 100644 --- a/webui/src/components/HomeAssistantControls/index.jsx +++ b/webui/src/components/HomeAssistantControls/index.jsx @@ -1,3 +1,6 @@ +// Home Assistant Controls +// Purpose: Defines the Home Assistant Controls module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. import { useEffect, useMemo, useRef, useState } from 'react'; import { useSessionActions, useSessionSelector } from '../../context/SessionContext.jsx'; import { useControlSystem } from '../../controls/index.js'; diff --git a/webui/src/components/HornControl/index.jsx b/webui/src/components/HornControl/index.jsx index 68dc5588..67b1f4ff 100644 --- a/webui/src/components/HornControl/index.jsx +++ b/webui/src/components/HornControl/index.jsx @@ -1,3 +1,6 @@ +// Horn Control +// Purpose: Defines the Horn Control module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. import { useCallback, useEffect, useMemo, useState } from 'react'; import { useSettingsNamespace } from '../../settings/index.js'; import { HORN_SETTINGS_DEFAULTS } from '../../settings/namespaces.js'; diff --git a/webui/src/components/KeymapSettings/index.jsx b/webui/src/components/KeymapSettings/index.jsx index 73d941d1..653506b9 100644 --- a/webui/src/components/KeymapSettings/index.jsx +++ b/webui/src/components/KeymapSettings/index.jsx @@ -1,3 +1,6 @@ +// Keymap Settings +// Purpose: Defines the Keymap Settings module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. import { useMemo, useState, useEffect, useCallback } from 'react'; import { useControlSystem } from '../../controls/index.js'; import { DEFAULT_KEYMAP } from '../../controls/constants.js'; diff --git a/webui/src/components/LogPanel/index.jsx b/webui/src/components/LogPanel/index.jsx index 5a919f62..bb3ddc31 100644 --- a/webui/src/components/LogPanel/index.jsx +++ b/webui/src/components/LogPanel/index.jsx @@ -1,3 +1,6 @@ +// Log Panel +// Purpose: Defines the Log Panel module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. import { useSessionSelector } from '../../context/SessionContext.jsx'; export default function LogPanel() { diff --git a/webui/src/components/MobileControls/FloatingJoystick.jsx b/webui/src/components/MobileControls/FloatingJoystick.jsx index 0cc207d3..e7a4bf17 100644 --- a/webui/src/components/MobileControls/FloatingJoystick.jsx +++ b/webui/src/components/MobileControls/FloatingJoystick.jsx @@ -1,4 +1,6 @@ -// Floating on-screen joystick used for mobile driving. +// Floating Joystick +// Purpose: Defines the Floating Joystick module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. import { useCallback, useEffect, useRef, useState } from 'react'; import { clampUnit } from '../../controls/controlMath.js'; diff --git a/webui/src/components/MobileControls/MobileAuxButton.jsx b/webui/src/components/MobileControls/MobileAuxButton.jsx index 9ca6528b..b1f42b30 100644 --- a/webui/src/components/MobileControls/MobileAuxButton.jsx +++ b/webui/src/components/MobileControls/MobileAuxButton.jsx @@ -1,4 +1,6 @@ -// Hold-to-run aux motor button for mobile controls. +// Mobile Aux Button +// Purpose: Defines the Mobile Aux Button module and the local helpers/components used in this file. +// Scope: Keeps behavior unchanged while isolating this concern into a clear, single-responsibility unit. export default function MobileAuxButton({ id, label, values, color, disabled, onPress, onRelease }) { return (